Jump to content
Mat

reading part of input port

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.

  

 

 

 

Share this post


Link to post
Share on other sites

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);

 

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×