Mat Posted June 25, 2019 Report Share Posted June 25, 2019 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. Quote Link to comment Share on other sites More sharing options...
David Black Posted June 25, 2019 Report Share Posted June 25, 2019 Sorry, but this is simply not possible in the convenient manner of Verilog. Reason: SystemC is not about RTL. If you need a few bits, then read all of them and mask off the ones you want. Mat 1 Quote Link to comment Share on other sites More sharing options...
Mat Posted June 25, 2019 Author Report Share Posted June 25, 2019 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); Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted June 26, 2019 Report Share Posted June 26, 2019 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.