Questions tagged [systemc]

C++ library used for system-level modeling of hardware designs. Used by engineers in making architectural decisions, modeling performance and enabling software/firmware development concurrently with traditional hardware development.

Wiki

SystemC is a collection C++ classes and macros which provide an event-driven simulation interface in C++. These facilities enable a designer to simulate concurrent processes, each described using plain C++ syntax. SystemC processes can communicate in a simulated real-time environment, using signals of all the datatypes offered by C++, some additional ones offered by the SystemC library, as well as user defined. In certain respects, SystemC deliberately mimics the hardware description languages VHDL (tag ) and Verilog (tag ), but is more aptly described as a system-level modelling language.

SystemC is standardized as IEEE 1666-2011 (available as a free download). SystemC-AMS is standardized as IEEE 1666-2011.1 (also available as a free download).

Example

#include "systemc.h"
 
SC_MODULE(adder)          // module (class) declaration
{
  sc_in<int> a, b;        // ports
  sc_out<int> sum;
 
  void do_add()           // process
  {
    sum.write(a.read() + b.read()); //or just sum = a + b
  }
 
  SC_CTOR(adder)          // constructor
  {
    SC_METHOD(do_add);    // register do_add to kernel
    sensitive << a << b;  // sensitivity list of do_add
  }
};

Tag usage

The tag can be used for programming related problems in system level modelling and other related fields. Please avoid theoretical and "refer-a-book"-type questions on stackoverflow.

Read more

279 questions
4
votes
4 answers

How to get sc_module_name of the current running module

When I create an instance if sc_module I give it a string as a module name (sc_module_name). How can I get the name of the module that is currently running?
yonigo
  • 987
  • 1
  • 15
  • 30
4
votes
1 answer

OpenCV in SystemC

I have been using both OpenCV and SystemC for several applications with great satisfaction. Now, I have this application where I need to display images with OpenCV in a SystemC simulation environment. For some reason however, both packages seem to…
4
votes
1 answer

SystemVerilog fork/join w/ "run()" type functions and SystemC

I am trying to port a SystemVerilog model of a memory controller to SystemC and am wondering what is the best way to translate run()-type functions (i.e. with forever loops that do continuous processing) spawned with fork and join to SystemC. These…
Rich
  • 1,165
  • 1
  • 15
  • 29
3
votes
2 answers

Difference between sc_port and sc_export

Can someone clearly and intuitively explain what is the difference between an sc_port and an sc_export in SystemC? When does one use a port, and when an export? I've been reading portions of the manual but I still fail to grasp the main conceptual…
PieterNuyts
  • 496
  • 5
  • 20
3
votes
3 answers

SystemC: passing events between modules

In SystemC, what is the syntax to use events as module input/outputs. I have a worker module and I want to send it an event to preempt what it's currently doing from a scheduler module. sc_port preempt_event; I'm declaring an…
Joe
  • 151
  • 1
  • 5
3
votes
1 answer

async_request_update() example in SystemC

I could not find a complete example code of async_request_update(). Can anyone please post a simple example.
Zeeshan Hayat
  • 401
  • 6
  • 13
3
votes
1 answer

How to connect two modules by systemC tlm_fifo?

I am still a novice for writing systemC-TLM. Now, I want to connect two modules by tlm_fifoFF. I am searching examples for a long time on net. But no use. Please help to give some ideas or examples how to achieve this. This is my…
潘俊瑋
  • 33
  • 3
3
votes
1 answer

How can I derive a SystemC class from another SystemC class?

Is it possible to define a SC class as a derivative of another SC class? For example, a simple D-Flipflop (latch) implementation will have d and clk inputs and a q output. I want to define an Enabled-Latch on top of that class adding the en input…
ysap
  • 7,723
  • 7
  • 59
  • 122
3
votes
3 answers

How to initialize a systemc port name which is an array?

I wanted to initialize a port name. The port is an array and my code does not work. SC_MODULE(example) { sc_clock clk; sc_signal mysignals[2]; public: SC_CTOR(example) :clk("clk"), mysignals[0]("mysignals[0]"), // won't work …
e19293001
  • 2,783
  • 9
  • 42
  • 54
3
votes
2 answers

Use volatile data with methods not overloaded for volatile data

I'm a bit at the end of my knowledge. I have three processes communicating via a shared memory segment. Concurrent access is handled via correct locking (to avoid getting misunderstood here), so I'm pretty sure I'm using the volatile keyword in the…
3
votes
4 answers

while(a==b); vs while(a==b) {;}

Is there a difference between the following pieces of code: while (a==b); while (a==b) {;} Does it make an impact on compiler or execution time? Background for this questions: Currently the FW uses code 1, where a or b is actually a global…
subtle85
  • 57
  • 3
3
votes
0 answers

Porting SystemVerilog style clock division and driving to SystemC

I am porting a System Verilog model to SystemC and I am not sure of the best way to model this phase locked loop clock driving scheme. It seems to me in SV driving the clock is a bit of a manual process where SystemC provides a way for the kernel to…
Rich
  • 1,165
  • 1
  • 15
  • 29
3
votes
3 answers

How to implement a multi-dimensional associative array in C++?

I am porting some SystemVerilog to SystemC/C++ and am having trouble with a multidimensional associative array. Consider the declaration of this array in SV. // assume typ_one, typ_two, typ_three are struct or enum types typ_one…
Rich
  • 1,165
  • 1
  • 15
  • 29
3
votes
3 answers

Safely cast/convert SystemC struct of bit/logic vectors to a single bit/logic vectors

I am porting from code from SystemVerilog to SystemC. SV is easily able to interpret packed structs of bits/logic as a single bit/logic vector. For example: typedef struct logic { logic [31:0] blk1; //63:32 logic [4:0] blk2; //31:27 logic…
Rich
  • 1,165
  • 1
  • 15
  • 29
2
votes
5 answers

Compiling SystemC library in Mingw32

I have been trying to compile systemC library in Mingw32 and I am getting an error when I run the "configure" command which says that the architecture is not supported. Anyone out there solved this problem?
R.B
  • 31
  • 1
  • 2
1
2
3
18 19