SlideShare a Scribd company logo
Communication Channels
按一下以編輯母片副標題樣式

林敬倫 , 蘇文鈺
成大資訊
2010/12
Without Channels
•

One can still exchange data among modules.

•

Problems:
–

Data access may not be well scheduled.

–

It is possible that multiple processes try to access but clear order is not set up.

–

Events can be used to set up the order but it is likely that events may be
missed.

–

No handshaking mechanism is embedded.

–

It does not map to HW architecture.

–

And so on….
Using channels
•

•

•

•

For all communication issues, it is recommended to solve the
above problems using channels.
Channel is a SystemC embedded mechanism.
Can be used to map to real HW architecture and
communication protocols.
Two basic types of channels are provided:
–

Primitive

–

Hierarchical
Primitive Channels
•

For “primitive” type, no process, hierarchy,
and so on in order to make the channels fast.

•

Inherit from the base class, sc_prim_channel.

•

Three simple SystemC channels:
–

sc_mutex

–

sc_semaphore

–

sc_fifo
sc_mutex
•

•

•

•

•

Mutex is a program object allowing multiple threads to share a common
resource without colliding.
During elaboration, a mutex is created. Then, any process wants to use
the resource must lock the mutex to prevent others from accessing the
same source. After its access, the process must unlock the mutex to let
others access the resource.
When a process try to access a locked mutex, it is prevented until the
mutex is unlocked.
In SystemC, both blocking and unblocking types are supported.
No signal is available to indicate that a mutex is available. SO, using
trylock may be a method but it may slow down the simulation.
sc_mutex syntax
•

sc_mutex name_of_mutex
–

–

name_of_mutex.trylock();//non-blocking

–

•

name_of_mutex.lock();//blocking

name_of_mutex.unlock();

下圖是一個簡單的 bus based 的範例,其中
有兩個 masters 加上一個 slave 以及一個簡
單的 bus arbiter
Mutex_bus
Arbitration:
Using sc_mutex

master0

master1

slave
Main.cpp
slave slave0("slave0");
bus bus0("bus0");

#include <systemc.h>
#include "master0.h"
#include "master1.h"
#include "slave.h"
#include "bus.h"
int sc_main (int argc , char *argv[])
{
sc_clock clk("clk0", 1 , SC_NS ,
0.5);

master0.clk(clk);
master1.clk(clk);
master0.write_port(bus0);
master1.write_port(bus0);
bus0.write_port(slave0);

master0 master0("master0");
master1 master1("master1");

sc_start(50, SC_NS);
cout << endl << endl;
return 0;
}
Master0.h
#ifndef MASTER0_H
#define MASTER0_H
#include <systemc.h>
#include "bus_if.h"
class master0 : public sc_module
{
public:
// clk
sc_in_clk
clk;

void master0::t1()
{
while(1){
wait();
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(1,32);

// port declaration
sc_port<bus_if,1> write_port;
void t1();
SC_HAS_PROCESS(master0);

master0(sc_module_name
name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}
};

wait(11,SC_NS);
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(5,53);
wait(11,SC_NS);
}
}
#endif // MASTER0_H
Master1.h
#ifndef MASTER1_H
#define MASTER1_H
#include <systemc.h>
#include "bus_if.h"
class master1 : public sc_module
{
public:
// clk
sc_in_clk
clk;

};

master1(sc_module_name name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}

void master1::t1()
{
while(1){

wait();

// port declaration
sc_port<bus_if,1> write_port;

sc_time_stamp().print();
printf("master1 request!n");
write_port->write(3,60);

void t1();

wait(10,SC_NS);

SC_HAS_PROCESS(master1);

sc_time_stamp().print();
printf("master1 request!n");
write_port->write(5,44);
}

wait(10,SC_NS);

}
#endif // MASTER1_H
Bus.h & Bus_if.h
#ifndef BUS_H
#define BUS_H
#include <systemc.h>
#include "bus_if.h"
class bus :public bus_if, public sc_module
{
public:
// port declaration
sc_port<bus_if,1> write_port;

data);

// bus_if function
void write(unsigned addr, int
// constructor
bus(sc_module_name);

private:

// sc_mutex declaration
sc_mutex bus_mutex;

};
#endif // BUS_H

#ifndef BUS_IF_H
#define BUS_IF_H
#include <systemc.h>
class bus_if : public sc_interface
{
// pure virtual function
public:
virtual void write(unsigned addr, int data) = 0;
};
#endif // BUS_IF_H
Bus.cpp
#include "bus.h"
bus::bus(sc_module_name nm) : sc_module(nm)
{
}
void bus::write(unsigned addr, int data)
{
// sc_mutex lock process, wait for unlock
bus_mutex.lock();
write_port->write(addr,data);

}

// sc_mutex unlock
bus_mutex.unlock();
Slave.h
#ifndef SLAVE_H
#define SLAVE_H
#include <systemc.h>
#include "bus_if.h"
class slave : public sc_module , public bus_if
{
public:
void write(unsigned addr, int data);
slave(sc_module_name name)
{
for(int a = 0 ; a<32 ; a++)
{
memory[a] = 0;
}
}

private:
int memory[32];
};
void slave::write(unsigned addr, int data)
{
memory[addr] = data;
wait(2, SC_NS);
sc_time_stamp().print();
printf(" slave get data %d at addr %d !n",data,addr);
}
#endif // SLAVE_H
result
sc_semaphore
•

To have more than one resources to choose from, one can use
semaphore.

•

Mutex here is one special case of semaphore.

•

When a process finishes with a resource, it must post a notice.

•

Syntax: sc_semaphore name_or_semaphore(count)
–

name_of_semaphore.wait(); //blocking

–

name_of_semaphore.trywait(); //non-blocking

–

name_of_semaphore.get_value();// return # of free semaphores

–

name_of_semaphore.post(); //when free a resource
Simple Bus Model
•

一樣是一個簡單的 Bus Model 的範例 , 因為
要求是可以有好幾個 Modules 同時進來 ,
所以可以用 Semaphore 來實現 .

09/12/9
Sem_bus
Arbitration:
Using sc_semaphore

master0

master1

slave

09/12/9
Main.cpp
slave slave0("slave0");
bus bus0("bus0");

#include <systemc.h>
#include "master0.h"
#include "master1.h"
#include "slave.h"
#include "bus.h"

master0.clk(clk);
master1.clk(clk);
master0.write_port(bus0);
master1.write_port(bus0);
bus0.write_port(slave0);

int sc_main (int argc , char *argv[])
{
sc_clock clk("clk0", 1 , SC_NS ,
0.5);

sc_start(50, SC_NS);
cout << endl << endl;
return 0;

master0 master0("master0");
master1 master1("master1");
}
#ifndef MASTER0_H
#define MASTER0_H
#include <systemc.h>
#include "bus_if.h"

Master0.h

class master0 : public sc_module
{
public:
// clk
sc_in_clk
clk;

void master0::t1()
{
while(1){
wait();
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(1,32);

// port declaration
sc_port<bus_if,1> write_port;
void t1();
SC_HAS_PROCESS(master0);
master0(sc_module_name name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}
};

wait(11,SC_NS);
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(5,53);
wait(11,SC_NS);
}
}
#endif // MASTER0_H
Master1.h
#ifndef MASTER1_H
#define MASTER1_H
#include <systemc.h>
#include "bus_if.h"
class master1 : public sc_module
{
public:
// clk
sc_in_clk
clk;

};

master1(sc_module_name name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}

void master1::t1()
{
while(1){

wait();
sc_time_stamp().print();
printf("master1 request!n");
write_port->write(3,60);

// port declaration
sc_port<bus_if,1>
write_port;

wait(10,SC_NS);

void t1();

sc_time_stamp().print();
printf("master1 request!n");
write_port->write(5,44);

SC_HAS_PROCESS(master1);

}

wait(10,SC_NS);

}
#endif // MASTER1_H
Bus.h & Bus_if.h
#ifndef BUS_H
#define BUS_H
#include <systemc.h>
#include "bus_if.h"
class bus :public bus_if, public sc_module
{
public:
// port declaration
sc_port<bus_if,1> write_port;

data);

// bus_if function
void write(unsigned addr, int
// constructor
bus(sc_module_name);

private:

// sc_semaphore declaration
sc_semaphore write_sem;

};
#endif // BUS_H

#ifndef BUS_IF_H
#define BUS_IF_H
#include <systemc.h>
class bus_if : public sc_interface
{
// pure virtual function
public:
virtual void write(unsigned addr, int data) = 0;
};
#endif // BUS_IF_H
Bus.cpp
#include "bus.h"
// write_sem constructor assign count = 1
bus::bus(sc_module_name nm) : sc_module(nm), write_sem(1)
{
}
void bus::write(unsigned addr, int data)
{
// sc_semaphore.wait, count-- (1=>0)
write_sem.wait();
write_port->write(addr,data);

}

// sc_semaphore.post, count++ (0=>1)
write_sem.post();
Slave.h
#ifndef SLAVE_H
#define SLAVE_H
#include <systemc.h>
#include "bus_if.h"
class slave : public sc_module , public bus_if
{
public:
void write(unsigned addr, int data);
slave(sc_module_name name)
{
for(int a = 0 ; a<32 ; a++)
{
memory[a] = 0;
}
}

private:
int memory[32];
};
void slave::write(unsigned addr, int data)
{
memory[addr] = data;
wait(2, SC_NS);
sc_time_stamp().print();
printf(" slave get data %d at addr %d !n",data,addr);
}
#endif // SLAVE_H
result
SC_FIFO
•

Good for architecture modeling

•

Suitable for data flow modeling too.

•

Simple to implement.

•

Default sc_fifo depth is 16, with its data type specified.

•

The data type of sc_fifo can be complex structure.

•

It can be used to buffer data between two processing units,
data packets in communication networks, and so on.
Bus Wrapper
•

接續上面的 Bus Model, 接到 Bus 的 Module
有一個 Wrapper, Wrapper 上有一個 FIFO 來
當 buffer, 這樣就可以運用 sc_fifo 來當練習
了.
FIFO_bus
Arbitration:
Using wrapper(sc_fifo)

master0

master1

wrapper

slave
Main.cpp
#include <systemc.h>
#include "master0.h"
#include "master1.h"
#include "wrapper.h"
#include "slave.h"
#include "bus.h"

wrapper wrapper0("wrapper0");
slave slave0("slave0");
bus bus0("bus0");

int sc_main (int argc , char *argv[])
{
sc_clock clk0("clk0", 1 , SC_NS ,
0.5);

master0.write_port(wrapper0);
master1.write_port(wrapper0);
wrapper0.write_port(bus0);
bus0.write_port(slave0);

master0
master0("master0");
master1
master1("master1");

sc_start(50, SC_NS);
cout << endl << endl;
return 0;

master0.clk(clk0);
master1.clk(clk0);
wrapper0.clk(clk0);

}
#ifndef MASTER0_H
#define MASTER0_H
#include <systemc.h>
#include "bus_if.h"

Master0.h

class master0 : public sc_module
{
public:
// clk
sc_in_clk
clk;

void master0::t1()
{
while(1){
wait();
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(1,32);

// port declaration
sc_port<bus_if,1> write_port;
void t1();
SC_HAS_PROCESS(master0);
master0(sc_module_name name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}
};

wait(11,SC_NS);
sc_time_stamp().print();
printf("master0 request!n");
write_port->write(5,53);
wait(11,SC_NS);
}
}
#endif // MASTER0_H
Master1.h
#ifndef MASTER1_H
#define MASTER1_H
#include <systemc.h>
#include "bus_if.h"
class master1 : public sc_module
{
public:
// clk
sc_in_clk
clk;

master1(sc_module_name name)
{
SC_THREAD(t1);
sensitive << clk.pos();
}

};
void master1::t1()
{
while(1){
wait();
sc_time_stamp().print();
printf("master1 request!n");
write_port->write(3,60);

// port declaration
sc_port<bus_if,1>
write_port;

wait(10,SC_NS);

void t1();

sc_time_stamp().print();
printf("master1 request!n");
write_port->write(5,44);

SC_HAS_PROCESS(master1);

wait(10,SC_NS);
}
}
#endif // MASTER1_H
Wrapper.h
SC_HAS_PROCESS(wrapper);

#ifndef WRAPPER_H
#define WRAPPER_H
#include <systemc.h>
#include "bus_if.h"
class wrapper : public sc_module , public bus_if
{
public:
// clk
sc_in_clk
clk;
// port declaration
sc_port<bus_if,1>

wrapper(sc_module_name name)
{
sc_fifo<unsigned> addr_fifo(10);
sc_fifo<int>
data_fifo(10);
SC_THREAD(t1);
sensitive << clk.pos();
}
private:
sc_fifo<unsigned> addr_fifo;
sc_fifo<int>
data_fifo;

write_port;

void t1();
void write(unsigned addr, int data);

};

unsigned addr_temp;
int data_temp;
Wrapper.h(cont’)
void wrapper::t1()
{
while(1)
{

}

}

wait();
sc_time_stamp().print();
printf(" wrapper request!n");
addr_temp = addr_fifo.read();
data_temp = data_fifo.read();
write_port->write(addr_temp,data_temp);
sc_time_stamp().print();
printf(" wrapper write %d in %d n",data_temp,addr_temp);

void wrapper::write(unsigned addr, int data)
{
sc_time_stamp().print();
printf(" fifo.write data = %d ; addr = %d n",data,addr);
addr_fifo.write(addr);
data_fifo.write(data);
}
#endif // WRAPPER_H
Bus.h & Bus_if.h
#ifndef BUS_H
#define BUS_H
#include <systemc.h>
#include "bus_if.h"

#ifndef BUS_IF_H
#define BUS_IF_H
#include <systemc.h>

class bus :public bus_if, public sc_module
{
public:
// port declaration
sc_port<bus_if,1> write_port;

class bus_if : public sc_interface
{
// pure virtual function
public:
virtual void write(unsigned addr, int data) = 0;
};

data);

// bus_if function
void write(unsigned addr, int
// constructor
bus(sc_module_name);

#endif // BUS_H

#endif // BUS_IF_H
Bus.cpp
#include "bus.h"
bus::bus(sc_module_name nm) : sc_module(nm), write_sem(1)
{
}
void bus::write(unsigned addr, int data)
{
write_port->write(addr,data);
}
Slave.h
#ifndef SLAVE_H
#define SLAVE_H

private:
int memory[32];
};

#include <systemc.h>
#include "bus_if.h"

class slave : public sc_module , public bus_if
{
public:

void write(unsigned addr, int data);

09/12/9

void slave::write(unsigned addr, int data)
{
memory[addr] = data;
wait(2, SC_NS);
}
#endif // SLAVE_H
result

09/12/9
The use of Signals
•

•

•

•

When modeling signal on something like electronic
wire,
When concurrent executions of modules are
required and execution orders of modules are
important,
When using wait() and notify() cosumes too much
time,
When using FIFO consuming too much resources,
SystemC Simulation Kernel Work
Flow
Signal Channel
•

Signal channels use the update phase as a point of synchronization.

•

Each such channel has to store the current value and the new value.

•

•

•

•

The incoming value is stored into the new position instead of the current
position.
When in update phase (Kernel calls update_request()), the current value
is updated with the new value. Therefore, contention is resolved.
All these are done within a delta cycle.
If one writes to a channel and reads the channel within the same delta
cycle, one will find the result is not the value just been written.
sc_signal
•

•

•

When using write(), the evaluate-update is performed, too.
That is, it calls sc_prim_channle:: request_update() and
sc_signal::update().
sc_signal behaves like VHDL’ signal and Verilog’s reg. By the
way.
Only one process can write to a sc_signal in order to avoid
race condition.
sc_signal <datatype> name_of_signal;
name_of_signal.write(new_value);
name_of_signal.read(name_of_var);
sensitive << name_of_signal.default_event();
wait(name_of_signal.default_event);
………

09/12/9
SIGNAL_BUS
Bus 說明

m0

m1
enable1

addr

addr

data

data
enable0

CLK

enable_m
select

multiplexer
addr

used

data

s0

enable_s

arbiter
Signal Bus File

main.cpp
master0.h
master1.h
slave.h
arbiter.h
multiplexer.h
main.cpp
master0.h
master1.h
slave.h
arbiter.h
multiplexer.h
Channel 2010

More Related Content

What's hot

Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomization
Nirav Desai
 
UVM TUTORIAL;
UVM TUTORIAL;UVM TUTORIAL;
UVM TUTORIAL;
Azad Mishra
 
Verification flow and_planning_vlsi_design
Verification flow and_planning_vlsi_designVerification flow and_planning_vlsi_design
Verification flow and_planning_vlsi_design
Usha Mehta
 
Static_Time_Analysis.pptx
Static_Time_Analysis.pptxStatic_Time_Analysis.pptx
Static_Time_Analysis.pptx
Ahmed Abdelazeem
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
Rakeshkumar Sachdev
 
Complete ASIC design flow - VLSI UNIVERSE
Complete ASIC design flow - VLSI UNIVERSEComplete ASIC design flow - VLSI UNIVERSE
Complete ASIC design flow - VLSI UNIVERSE
VLSIUNIVERSE
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
kumar gavanurmath
 
Verification strategies
Verification strategiesVerification strategies
Verification strategies
Vinchipsytm Vlsitraining
 
Spyglass dft
Spyglass dftSpyglass dft
Spyglass dft
kumar gavanurmath
 
Dft (design for testability)
Dft (design for testability)Dft (design for testability)
Dft (design for testability)
shaik sharief
 
Basics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesBasics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow Devices
Arrow Devices
 
Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in Linux
Tushar B Kute
 
Lec13
Lec13Lec13
verilog code
verilog codeverilog code
verilog code
Mantra VLSI
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfacesSession 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
Nirav Desai
 
DRCs.pptx
DRCs.pptxDRCs.pptx
DRCs.pptx
ssuserd05d591
 
04~chapter 02 dft.ppt
04~chapter 02 dft.ppt04~chapter 02 dft.ppt
04~chapter 02 dft.ppt
SandipSolanki10
 
The IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standardThe IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standard
Jose Manuel Martins Ferreira
 
Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)
Usha Mehta
 

What's hot (20)

Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomization
 
UVM TUTORIAL;
UVM TUTORIAL;UVM TUTORIAL;
UVM TUTORIAL;
 
Verification flow and_planning_vlsi_design
Verification flow and_planning_vlsi_designVerification flow and_planning_vlsi_design
Verification flow and_planning_vlsi_design
 
Static_Time_Analysis.pptx
Static_Time_Analysis.pptxStatic_Time_Analysis.pptx
Static_Time_Analysis.pptx
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
 
Complete ASIC design flow - VLSI UNIVERSE
Complete ASIC design flow - VLSI UNIVERSEComplete ASIC design flow - VLSI UNIVERSE
Complete ASIC design flow - VLSI UNIVERSE
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
Verification strategies
Verification strategiesVerification strategies
Verification strategies
 
Spyglass dft
Spyglass dftSpyglass dft
Spyglass dft
 
Dft (design for testability)
Dft (design for testability)Dft (design for testability)
Dft (design for testability)
 
Basics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesBasics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow Devices
 
Signal Handling in Linux
Signal Handling in LinuxSignal Handling in Linux
Signal Handling in Linux
 
Lec13
Lec13Lec13
Lec13
 
verilog code
verilog codeverilog code
verilog code
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfacesSession 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
 
DRCs.pptx
DRCs.pptxDRCs.pptx
DRCs.pptx
 
04~chapter 02 dft.ppt
04~chapter 02 dft.ppt04~chapter 02 dft.ppt
04~chapter 02 dft.ppt
 
The IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standardThe IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standard
 
Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)
 

Viewers also liked

Esl basics
Esl basicsEsl basics
Esl basics
敬倫 林
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin
敬倫 林
 
C++ process new
C++ process newC++ process new
C++ process new
敬倫 林
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
敬倫 林
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
敬倫 林
 
Transaction level modeling an overview
Transaction level modeling an overviewTransaction level modeling an overview
Transaction level modeling an overview
fagunp
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
chiportal
 
MixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLiveMixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLive
Robert O. Peruzzi, PhD, PE, DFE
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
Srinivasan Venkataramanan
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification Process
DVClub
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
Robert O. Peruzzi, PhD, PE, DFE
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
Amiq Consulting
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
Parth Pandya
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register Package
DVClub
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
Amiq Consulting
 
stack
stackstack
stack
Raj Sarode
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Rabindranath Tagore University, Bhopal
 
Queue
QueueQueue
Queue
Raj Sarode
 
Tree
TreeTree
Queue
QueueQueue

Viewers also liked (20)

Esl basics
Esl basicsEsl basics
Esl basics
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin
 
C++ process new
C++ process newC++ process new
C++ process new
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
 
Transaction level modeling an overview
Transaction level modeling an overviewTransaction level modeling an overview
Transaction level modeling an overview
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
MixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLiveMixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLive
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification Process
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register Package
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
 
stack
stackstack
stack
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
 
Queue
QueueQueue
Queue
 
Tree
TreeTree
Tree
 
Queue
QueueQueue
Queue
 

Similar to Channel 2010

Help Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdfHelp Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdf
mohdjakirfb
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Tanel Poder
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)
Flor Ian
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
艾鍗科技
 
A whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizerA whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizer
Nikita Popov
 
IOT Firmware: Best Pratices
IOT Firmware:  Best PraticesIOT Firmware:  Best Pratices
IOT Firmware: Best Pratices
farmckon
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
Jens Siebert
 
Lab
LabLab
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
Hao-Ran Liu
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
HSA Foundation
 
Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++
Yandex
 
Bluespec @waseda
Bluespec @wasedaBluespec @waseda
Bluespec @waseda
Takefumi MIYOSHI
 
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
David Walker
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in R
armstrtw
 
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex LauDoing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Ceph Community
 
unit5 uc.pptx
unit5 uc.pptxunit5 uc.pptx
unit5 uc.pptx
KandavelEee
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
CODE BLUE
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded Programming
Sri Prasanna
 
(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks
David Horvath
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
Rodrigo Almeida
 

Similar to Channel 2010 (20)

Help Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdfHelp Needed!UNIX Shell and History Feature This project consists.pdf
Help Needed!UNIX Shell and History Feature This project consists.pdf
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
A whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizerA whirlwind tour of the LLVM optimizer
A whirlwind tour of the LLVM optimizer
 
IOT Firmware: Best Pratices
IOT Firmware:  Best PraticesIOT Firmware:  Best Pratices
IOT Firmware: Best Pratices
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
 
Lab
LabLab
Lab
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
 
Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++
 
Bluespec @waseda
Bluespec @wasedaBluespec @waseda
Bluespec @waseda
 
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
The Effect of Hierarchical Memory on the Design of Parallel Algorithms and th...
 
Distributed Computing Patterns in R
Distributed Computing Patterns in RDistributed Computing Patterns in R
Distributed Computing Patterns in R
 
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex LauDoing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
 
unit5 uc.pptx
unit5 uc.pptxunit5 uc.pptx
unit5 uc.pptx
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded Programming
 
(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
 

Recently uploaded

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 

Recently uploaded (20)

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 

Channel 2010

  • 2. Without Channels • One can still exchange data among modules. • Problems: – Data access may not be well scheduled. – It is possible that multiple processes try to access but clear order is not set up. – Events can be used to set up the order but it is likely that events may be missed. – No handshaking mechanism is embedded. – It does not map to HW architecture. – And so on….
  • 3. Using channels • • • • For all communication issues, it is recommended to solve the above problems using channels. Channel is a SystemC embedded mechanism. Can be used to map to real HW architecture and communication protocols. Two basic types of channels are provided: – Primitive – Hierarchical
  • 4. Primitive Channels • For “primitive” type, no process, hierarchy, and so on in order to make the channels fast. • Inherit from the base class, sc_prim_channel. • Three simple SystemC channels: – sc_mutex – sc_semaphore – sc_fifo
  • 5. sc_mutex • • • • • Mutex is a program object allowing multiple threads to share a common resource without colliding. During elaboration, a mutex is created. Then, any process wants to use the resource must lock the mutex to prevent others from accessing the same source. After its access, the process must unlock the mutex to let others access the resource. When a process try to access a locked mutex, it is prevented until the mutex is unlocked. In SystemC, both blocking and unblocking types are supported. No signal is available to indicate that a mutex is available. SO, using trylock may be a method but it may slow down the simulation.
  • 8. Main.cpp slave slave0("slave0"); bus bus0("bus0"); #include <systemc.h> #include "master0.h" #include "master1.h" #include "slave.h" #include "bus.h" int sc_main (int argc , char *argv[]) { sc_clock clk("clk0", 1 , SC_NS , 0.5); master0.clk(clk); master1.clk(clk); master0.write_port(bus0); master1.write_port(bus0); bus0.write_port(slave0); master0 master0("master0"); master1 master1("master1"); sc_start(50, SC_NS); cout << endl << endl; return 0; }
  • 9. Master0.h #ifndef MASTER0_H #define MASTER0_H #include <systemc.h> #include "bus_if.h" class master0 : public sc_module { public: // clk sc_in_clk clk; void master0::t1() { while(1){ wait(); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(1,32); // port declaration sc_port<bus_if,1> write_port; void t1(); SC_HAS_PROCESS(master0); master0(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } }; wait(11,SC_NS); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(5,53); wait(11,SC_NS); } } #endif // MASTER0_H
  • 10. Master1.h #ifndef MASTER1_H #define MASTER1_H #include <systemc.h> #include "bus_if.h" class master1 : public sc_module { public: // clk sc_in_clk clk; }; master1(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } void master1::t1() { while(1){ wait(); // port declaration sc_port<bus_if,1> write_port; sc_time_stamp().print(); printf("master1 request!n"); write_port->write(3,60); void t1(); wait(10,SC_NS); SC_HAS_PROCESS(master1); sc_time_stamp().print(); printf("master1 request!n"); write_port->write(5,44); } wait(10,SC_NS); } #endif // MASTER1_H
  • 11. Bus.h & Bus_if.h #ifndef BUS_H #define BUS_H #include <systemc.h> #include "bus_if.h" class bus :public bus_if, public sc_module { public: // port declaration sc_port<bus_if,1> write_port; data); // bus_if function void write(unsigned addr, int // constructor bus(sc_module_name); private: // sc_mutex declaration sc_mutex bus_mutex; }; #endif // BUS_H #ifndef BUS_IF_H #define BUS_IF_H #include <systemc.h> class bus_if : public sc_interface { // pure virtual function public: virtual void write(unsigned addr, int data) = 0; }; #endif // BUS_IF_H
  • 12. Bus.cpp #include "bus.h" bus::bus(sc_module_name nm) : sc_module(nm) { } void bus::write(unsigned addr, int data) { // sc_mutex lock process, wait for unlock bus_mutex.lock(); write_port->write(addr,data); } // sc_mutex unlock bus_mutex.unlock();
  • 13. Slave.h #ifndef SLAVE_H #define SLAVE_H #include <systemc.h> #include "bus_if.h" class slave : public sc_module , public bus_if { public: void write(unsigned addr, int data); slave(sc_module_name name) { for(int a = 0 ; a<32 ; a++) { memory[a] = 0; } } private: int memory[32]; }; void slave::write(unsigned addr, int data) { memory[addr] = data; wait(2, SC_NS); sc_time_stamp().print(); printf(" slave get data %d at addr %d !n",data,addr); } #endif // SLAVE_H
  • 15. sc_semaphore • To have more than one resources to choose from, one can use semaphore. • Mutex here is one special case of semaphore. • When a process finishes with a resource, it must post a notice. • Syntax: sc_semaphore name_or_semaphore(count) – name_of_semaphore.wait(); //blocking – name_of_semaphore.trywait(); //non-blocking – name_of_semaphore.get_value();// return # of free semaphores – name_of_semaphore.post(); //when free a resource
  • 16. Simple Bus Model • 一樣是一個簡單的 Bus Model 的範例 , 因為 要求是可以有好幾個 Modules 同時進來 , 所以可以用 Semaphore 來實現 . 09/12/9
  • 18. Main.cpp slave slave0("slave0"); bus bus0("bus0"); #include <systemc.h> #include "master0.h" #include "master1.h" #include "slave.h" #include "bus.h" master0.clk(clk); master1.clk(clk); master0.write_port(bus0); master1.write_port(bus0); bus0.write_port(slave0); int sc_main (int argc , char *argv[]) { sc_clock clk("clk0", 1 , SC_NS , 0.5); sc_start(50, SC_NS); cout << endl << endl; return 0; master0 master0("master0"); master1 master1("master1"); }
  • 19. #ifndef MASTER0_H #define MASTER0_H #include <systemc.h> #include "bus_if.h" Master0.h class master0 : public sc_module { public: // clk sc_in_clk clk; void master0::t1() { while(1){ wait(); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(1,32); // port declaration sc_port<bus_if,1> write_port; void t1(); SC_HAS_PROCESS(master0); master0(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } }; wait(11,SC_NS); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(5,53); wait(11,SC_NS); } } #endif // MASTER0_H
  • 20. Master1.h #ifndef MASTER1_H #define MASTER1_H #include <systemc.h> #include "bus_if.h" class master1 : public sc_module { public: // clk sc_in_clk clk; }; master1(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } void master1::t1() { while(1){ wait(); sc_time_stamp().print(); printf("master1 request!n"); write_port->write(3,60); // port declaration sc_port<bus_if,1> write_port; wait(10,SC_NS); void t1(); sc_time_stamp().print(); printf("master1 request!n"); write_port->write(5,44); SC_HAS_PROCESS(master1); } wait(10,SC_NS); } #endif // MASTER1_H
  • 21. Bus.h & Bus_if.h #ifndef BUS_H #define BUS_H #include <systemc.h> #include "bus_if.h" class bus :public bus_if, public sc_module { public: // port declaration sc_port<bus_if,1> write_port; data); // bus_if function void write(unsigned addr, int // constructor bus(sc_module_name); private: // sc_semaphore declaration sc_semaphore write_sem; }; #endif // BUS_H #ifndef BUS_IF_H #define BUS_IF_H #include <systemc.h> class bus_if : public sc_interface { // pure virtual function public: virtual void write(unsigned addr, int data) = 0; }; #endif // BUS_IF_H
  • 22. Bus.cpp #include "bus.h" // write_sem constructor assign count = 1 bus::bus(sc_module_name nm) : sc_module(nm), write_sem(1) { } void bus::write(unsigned addr, int data) { // sc_semaphore.wait, count-- (1=>0) write_sem.wait(); write_port->write(addr,data); } // sc_semaphore.post, count++ (0=>1) write_sem.post();
  • 23. Slave.h #ifndef SLAVE_H #define SLAVE_H #include <systemc.h> #include "bus_if.h" class slave : public sc_module , public bus_if { public: void write(unsigned addr, int data); slave(sc_module_name name) { for(int a = 0 ; a<32 ; a++) { memory[a] = 0; } } private: int memory[32]; }; void slave::write(unsigned addr, int data) { memory[addr] = data; wait(2, SC_NS); sc_time_stamp().print(); printf(" slave get data %d at addr %d !n",data,addr); } #endif // SLAVE_H
  • 25. SC_FIFO • Good for architecture modeling • Suitable for data flow modeling too. • Simple to implement. • Default sc_fifo depth is 16, with its data type specified. • The data type of sc_fifo can be complex structure. • It can be used to buffer data between two processing units, data packets in communication networks, and so on.
  • 26. Bus Wrapper • 接續上面的 Bus Model, 接到 Bus 的 Module 有一個 Wrapper, Wrapper 上有一個 FIFO 來 當 buffer, 這樣就可以運用 sc_fifo 來當練習 了.
  • 28. Main.cpp #include <systemc.h> #include "master0.h" #include "master1.h" #include "wrapper.h" #include "slave.h" #include "bus.h" wrapper wrapper0("wrapper0"); slave slave0("slave0"); bus bus0("bus0"); int sc_main (int argc , char *argv[]) { sc_clock clk0("clk0", 1 , SC_NS , 0.5); master0.write_port(wrapper0); master1.write_port(wrapper0); wrapper0.write_port(bus0); bus0.write_port(slave0); master0 master0("master0"); master1 master1("master1"); sc_start(50, SC_NS); cout << endl << endl; return 0; master0.clk(clk0); master1.clk(clk0); wrapper0.clk(clk0); }
  • 29. #ifndef MASTER0_H #define MASTER0_H #include <systemc.h> #include "bus_if.h" Master0.h class master0 : public sc_module { public: // clk sc_in_clk clk; void master0::t1() { while(1){ wait(); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(1,32); // port declaration sc_port<bus_if,1> write_port; void t1(); SC_HAS_PROCESS(master0); master0(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } }; wait(11,SC_NS); sc_time_stamp().print(); printf("master0 request!n"); write_port->write(5,53); wait(11,SC_NS); } } #endif // MASTER0_H
  • 30. Master1.h #ifndef MASTER1_H #define MASTER1_H #include <systemc.h> #include "bus_if.h" class master1 : public sc_module { public: // clk sc_in_clk clk; master1(sc_module_name name) { SC_THREAD(t1); sensitive << clk.pos(); } }; void master1::t1() { while(1){ wait(); sc_time_stamp().print(); printf("master1 request!n"); write_port->write(3,60); // port declaration sc_port<bus_if,1> write_port; wait(10,SC_NS); void t1(); sc_time_stamp().print(); printf("master1 request!n"); write_port->write(5,44); SC_HAS_PROCESS(master1); wait(10,SC_NS); } } #endif // MASTER1_H
  • 31. Wrapper.h SC_HAS_PROCESS(wrapper); #ifndef WRAPPER_H #define WRAPPER_H #include <systemc.h> #include "bus_if.h" class wrapper : public sc_module , public bus_if { public: // clk sc_in_clk clk; // port declaration sc_port<bus_if,1> wrapper(sc_module_name name) { sc_fifo<unsigned> addr_fifo(10); sc_fifo<int> data_fifo(10); SC_THREAD(t1); sensitive << clk.pos(); } private: sc_fifo<unsigned> addr_fifo; sc_fifo<int> data_fifo; write_port; void t1(); void write(unsigned addr, int data); }; unsigned addr_temp; int data_temp;
  • 32. Wrapper.h(cont’) void wrapper::t1() { while(1) { } } wait(); sc_time_stamp().print(); printf(" wrapper request!n"); addr_temp = addr_fifo.read(); data_temp = data_fifo.read(); write_port->write(addr_temp,data_temp); sc_time_stamp().print(); printf(" wrapper write %d in %d n",data_temp,addr_temp); void wrapper::write(unsigned addr, int data) { sc_time_stamp().print(); printf(" fifo.write data = %d ; addr = %d n",data,addr); addr_fifo.write(addr); data_fifo.write(data); } #endif // WRAPPER_H
  • 33. Bus.h & Bus_if.h #ifndef BUS_H #define BUS_H #include <systemc.h> #include "bus_if.h" #ifndef BUS_IF_H #define BUS_IF_H #include <systemc.h> class bus :public bus_if, public sc_module { public: // port declaration sc_port<bus_if,1> write_port; class bus_if : public sc_interface { // pure virtual function public: virtual void write(unsigned addr, int data) = 0; }; data); // bus_if function void write(unsigned addr, int // constructor bus(sc_module_name); #endif // BUS_H #endif // BUS_IF_H
  • 34. Bus.cpp #include "bus.h" bus::bus(sc_module_name nm) : sc_module(nm), write_sem(1) { } void bus::write(unsigned addr, int data) { write_port->write(addr,data); }
  • 35. Slave.h #ifndef SLAVE_H #define SLAVE_H private: int memory[32]; }; #include <systemc.h> #include "bus_if.h" class slave : public sc_module , public bus_if { public: void write(unsigned addr, int data); 09/12/9 void slave::write(unsigned addr, int data) { memory[addr] = data; wait(2, SC_NS); } #endif // SLAVE_H
  • 37. The use of Signals • • • • When modeling signal on something like electronic wire, When concurrent executions of modules are required and execution orders of modules are important, When using wait() and notify() cosumes too much time, When using FIFO consuming too much resources,
  • 39. Signal Channel • Signal channels use the update phase as a point of synchronization. • Each such channel has to store the current value and the new value. • • • • The incoming value is stored into the new position instead of the current position. When in update phase (Kernel calls update_request()), the current value is updated with the new value. Therefore, contention is resolved. All these are done within a delta cycle. If one writes to a channel and reads the channel within the same delta cycle, one will find the result is not the value just been written.
  • 40. sc_signal • • • When using write(), the evaluate-update is performed, too. That is, it calls sc_prim_channle:: request_update() and sc_signal::update(). sc_signal behaves like VHDL’ signal and Verilog’s reg. By the way. Only one process can write to a sc_signal in order to avoid race condition. sc_signal <datatype> name_of_signal; name_of_signal.write(new_value); name_of_signal.read(name_of_var); sensitive << name_of_signal.default_event(); wait(name_of_signal.default_event); ……… 09/12/9