SystemC Modules Part II

Print

Module Ports
Module Ports pass data to and from the processes of a module to the external world as in Verilog and VHDL. You declare a port direction as inout, or inout. You also declare the data type of the port as any C++ data type,

SystemC data type, or user defined type.
Types of Ports

Here :

Example Module Ports
  1 #include "systemc.h"

  2

  3 SC_MODULE (first_counter) {

  4   sc_in_clk     clock ;      // Clock input of the design

  5   sc_in<bool>   reset ;      // active high, synchronous Reset input

  6   sc_in<bool>   enable;      // Active high enable signal for counter

  7   sc_out<sc_uint<4> > counter_out; // 4 bit vector output of the counter

  8

  9   // Rest of body

 10 }
Module Signals

Ports are used for communicating outside the module. For communicating within a SystemC module we use signals. Signals are like wires in Verilog. Signals can be of any legal data types.
Signal are also used for connecting two modules ports in parent module. Lets say we have two child modules A and B, this two modules are used in parent module C, then wires are used for connecting ports of module A and B with each other.
Syntax :

 sc_signal type variable;

Here :

Example Module Signal

 1 #include "systemc.h"

 2

 3 SC_MODULE (counter) {

 4   sc_signal <bool>        reset ;     

 5   sc_signal <bool>        enable;     

 6   sc_signal <sc_uint<4> > counter_out;

 7

 8   // Rest of body

 9 }

 Bạn Có Đam Mê Với Vi Mạch hay Nhúng      -     Bạn Muốn Trau Dồi Thêm Kĩ Năng

Mong Muốn Có Thêm Cơ Hội Trong Công Việc

Và Trở Thành Một Người Có Giá Trị Hơn

Bạn Chưa Biết Phương Thức Nào Nhanh Chóng Để Đạt Được Chúng

Hãy Để Chúng Tôi Hỗ Trợ Cho Bạn. SEMICON  

Last Updated ( Tuesday, 29 March 2022 00:47 )