Jump to content

reading part of input port


Mat

Recommended Posts

I have recently started using SystemC for my project. I would appreciate if someone could help me with following problem.

 

How can I select part of input port in SystemC? In Verilog it can be done easily by choosing the required bits, e.g.,

inputPort[3:1]

 How can I do this in Systemc? I have defined an input port as follows 

sc_in < sc_int<5> > inputPort;

What is the syntax to read bits e.g., [1:3] from inputPort like I did in Verilog? I tried few  syntax like inputPort.read({1:3}) but no success.

  

 

 

 

Link to comment
Share on other sites

10 hours ago, Mat said:

I managed to do this by defining the input port as sc_bv, i.e., 


sc_in<sc_bv<5>> inputPort; 

Then, using  ".range()" I can select part of  the port I need :


inputPort.read().range(0:2);

 

Well,  sc_int also support range access,  so you could do the same in original code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...