File: README

package info (click to toggle)
systemc 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,768 kB
  • sloc: cpp: 181,958; sh: 4,925; asm: 2,700; perl: 1,980; ansic: 1,931; makefile: 1,761; fortran: 492; python: 482; awk: 157; csh: 50
file content (42 lines) | stat: -rw-r--r-- 2,041 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

This is a simple test for async suspend:

 	 Each 'node' consists of a SystemC thread, and a std::thread component.
 	
 	 The std::thread gets transactions from a queue (or creates new ones), and 'sends'
 	 them by poting them to a 'mailbox' (txn), and then signalling SystemC using
 	 an async_events (sendIt). It then uses a 'semaphore' (txnSent) to wait till
 	 the txn is sent, before sending another one.
 	 The std::thread has it's own notion of 'time' (myTime)
 	
 	 Meanwhile, the SystemC thread recieves the async event (sendIt), in a
 	 SC_THREAD (sendTxns). This must be a thread, so that 'wait' can be called.
 	 The txn's are sent to a 'random' other node, where they are processed by a
 	 b_transport which calls wait().
 	 Once done, sendTxns releases the semaphore allowing the std::thread to continue.
 	
 	 In order to maintain syncronisation, the SystemC thread can do 2 things:
 	  1. If the 'nodes' local time (myTime) is ahead of SystemC, the std::thread
 	  semaphore is released by notifying a method at the appropriate myTime.
 	  2. Else SystemC is requested to suspend (waiting for the node to catch up).
 	
 	 The b_transport call is protected as 'unsuspendable', to ensure that all
 	 b_transport calls can complete.

         In each node is a systemc thred which simply wait(..)s a
         random amount of time, this 'drives' SystemC time forward.
         
Configuration:
        Set the amount of time you want to run in async_suspend.c
        
        In node.h, set the relatives speeds of the SystemC wait, the nodes
        internal (myTime), and the b_transport time.
        
        If you have python installed, you may try using the MatPlot
        library, enable this in collector.h - this will generate a
        .png picture of the resulting run in 'output.png'
        
To run and generate a graphical output, build with "WITHMATPLOT":
e.g.
g++ -DWITHMATPLOT --std=c++11 async_suspend.cpp -I ../../../src/ -I /usr/include/python3.6m/ -L../../../build/src/ -lsystemc -lpython3.6m -lpthread