Jump to content

SYSTEMC sensitivity


Recommended Posts

Hello All , 

 I am a beginner in SystemC with Hardware verification background (sv/uvm). I coded a simple synchronous design (sensitive_pos (clk)) and ran the simulation using questasim10.2 . Sadly In waveform the behavior looked as a combination logic rather than a sequential one.

 

Whether its the problem of simulator or systemc ? .Also what will be the best simulator for SystemC.

 

Thanks in advance,

Kavinkumar  (MTS , AtriaLogic). 

Link to comment
Share on other sites

It's almost definitely a problem with your code. Questa definitely works. As does the Proof of Concept simulator you can download for free from Accellera.

 

The best simulator depends on your criteria. The lowest cost simulator is the free download - but of course you don't get nice integrated debugging and waveform viewing.

If you want a better debugging environment, then you're better off using Questa, or Incisive, or VCS, or Riviera: but it will cost you.

 

regards

Alan

 

P.S. sensitive_pos is deprecated, you should use sensitive << clk.pos()

Link to comment
Share on other sites

#include "systemc.h"
SC_MODULE (singleport_ram)
{
    sc_in<bool>        clk;
    sc_in<bool>        rd;
    sc_in<bool>        wr;
    sc_in<sc_uint< 9> >     wr_address;
    sc_in<sc_uint< 9> >     rd_address;
    sc_in<sc_uint<32> >     data_in;
    sc_out<sc_uint<32> >    data_out;
    sc_out<bool>        vld;



    sc_lv <32> mem [512];


    void mem_wr ();
    void mem_rd ();

    SC_CTOR (singleport_ram)
         {
        SC_METHOD (mem_wr);
            sensitive << clk.pos();

        SC_METHOD (mem_rd);
            sensitive << clk.pos();
        }
};

void singleport_ram :: mem_rd ()
    {
    
    if (rd.read())
        {
        data_out.write (mem [rd_address.read()]);
        vld.write( 1);
        }
    else
        {
        vld.write( 0);
        }
    }


void singleport_ram :: mem_wr ()
    {
    
    if (wr.read())
        {
        mem [wr_address.read()]    = data_in;
        }
    };

 

Alan can you point where i could have gone wrong?

Thanks

kavin






 

Link to comment
Share on other sites

That looks good to me. What is wrong with the waveforms?

One issue that can catch you out is the time resolution of the simulator, the speed of your clock, and the time resolution of the waveforms. I guess if you're using Questa, you're using the built-in waveform tracing (not using your own vcd trace file).

Questa will probably default to a resolution of either 1ns or 1ps.

 

So I would check the clock frequency in your testbench to make sure it is sensible (much bigger than 1ns, say 10ns)

 

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