Jump to content

Question regarding VHDL -> SystemC conversion


Recommended Posts

Could some SystemC guru please provide some hints to my

problem ? I am trying to translate some old VHDL code into

SystemC, and running into issues.

I have a VHDL entity with 3 input ports and one output ports.

Of the 3 input ports, the data type of 2 is std_logic, which

can be immediately translated to sc_dt::sc_logic. The other

input port and the one output port has data type Boolesn.

I am confused about how to convert VHDL statements

that are executed always, into corresponding SystemC

methods. If I use a SystemC SC_METHOD, they will

always get executed, or alternatively use SC_THREAD

and make the method sensitive to changes in the input

ports. For example, if I have the following VHDL statement :

rstall <= resetn and pcirst when PCIEN else resetn;

(Here, 'resetn' and 'pcirst' are input ports of type std_logic

in VHDL, and PCIEN is a Boolean environment variable)

Any hint, suggestions would be of immense help. Thanks

in advance for your help.

Link to post
Share on other sites

I am sorry I am not able to understand the statement " If I use a SystemC SC_METHOD, they will

always get executed". SC_METHOD will only get executed in case of activity on their senstivity list.

If I have understood your problem correctly then the above statement rstall <= resetn and pcirst when PCIEN else resetn; can be implemented as follows.


sensitive << resetn << pcirst;

void drive_rstall(void)



rstall.write(resetn.read() & pcirst.read());





So the above process will only be executed whenever there is any activity on resetn and pcirst.

Hope it helps.

Although I am not an expert on VHDL to SystemC conversion but there are some commericial tools available from companies like Carbon which can convert your behavioral VHDL/Verilog code to equivalent SystemC code. You may explore them too.

Link to post
Share on other sites

Hello Sir,

I fully agree with your point about SC_METHOD, but why not use a


void test_thread_0()





rstall = PCIEN == '1' ? (rstin.read() & pcirstin.read()) : rstin.read();



And in the constructor:




sensitive << rstin << pcirstin;


Once again, this thread will respond to any changes in either input

port rstin or pcirstin.

So, which is a better way to tackle this issue ?

Link to post
Share on other sites

Hi, a couple of points - firstly if you use SC_THREAD to emulate a VHDL process, the wait() function call should be at the bottom of the thread.

Regarding SC_METHOD vs SC_THREAD, in this case there is no different behaviour. SC_METHODs may simulate faster due to few context switches to the kernel, so I would prefer an SC_METHOD.



Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...