Jump to content

Question regarding VHDL -> SystemC conversion


dakupoto

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 comment
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.

SC_METHOD(drive_rstall);

sensitive << resetn << pcirst;

void drive_rstall(void)

{

if(PCIEN){

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

}else{

rstall.write(resetn.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 comment
Share on other sites

Hello Sir,

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

SC_THREAD as:

void test_thread_0()

{

while(1)

{

wait();

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

}

}

And in the constructor:

SC_CTOR(test)

{

SC_THREAD(test_thread_0);

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 comment
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.

regards

Alan

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...