1 / 16

Processes in SystemC

Processes in SystemC. Part of HW/SW Codesign of Embedded Systems Course (CE 40-226). Process. Basics Basic unit of execution within SystemC Emulate the behavior of target device Are triggered by clock edges and/or signal expressions Are not hierarchical

verdi
Download Presentation

Processes in SystemC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Processes inSystemC Part of HW/SW Codesign of Embedded Systems Course (CE 40-226) Codesign of Embedded Systems

  2. Process • Basics • Basic unit of execution within SystemC • Emulate the behavior of target device • Are triggered by clock edges and/or signal expressions • Are not hierarchical • No process can directly call another • Processes communicate through signals Codesign of Embedded Systems

  3. ProcessCategories in SystemC • Method process • Thread process • CThread process Codesign of Embedded Systems

  4. Method Process • Is called once, when events occur on its sensitivity list • Cannot suspend execution (i.e. wait) • Returns control to the caller (SystemC Kernel) Codesign of Embedded Systems

  5. rcv frame id Method Example:Packet Receiver void rcv::extract_id() { frame_type frame; frame = xin;if(frame.type==1) id = frame.ida;else id = frame.idb; } #include “frame.h” SC_MODULE(rcv) { sc_in<frame_type> xin;sc_out<int> id; void extract_id(); SC_CTOR(rcv){ SC_METHOD(extract_id); sensitive(xin); }}; Codesign of Embedded Systems

  6. Thread Process • Declaration to SystemC kernel is the same as Method process • Can be suspended and re-activated • wait() system call • Process is re-activated when an event occurs on process SL (Sensitivity List) Codesign of Embedded Systems

  7. Thread Example:Traffic Light Controller SC_MODULE(traff) { sc_in<bool> roadsensor;sc_in<bool> clock; sc_out<bool> NSred;sc_out<bool> NSyellow;sc_out<bool> NSgreen;sc_out<bool> EWred;sc_out<bool> EWyellow;sc_out<bool> EWgreen; void control_lights(); Road Sensor SC_CTOR(traff){ SC_THREAD(control_lights); sensitive<<roadsensor;sensitive_pos<<clock; } }; Codesign of Embedded Systems

  8. Thread Example:Traffic Light Controller (cont’d) void traff::control_lights() { NSred = NSyellow = false; NSgreen = true; EWred = true; EWyellow = EWgreen = false; while (true) { while (roadsensor.delayed() == false)wait(); NSgreen = false; NSyellow = true; NSred = false; for (i=0; i<5; i++)wait(); NSgreen = NSyellow = false; NSred = true; EWgreen = true; EWyellow = EWred = false; for (i= 0; i<50; i++)wait(); NSgreen = NSyellow = false; NSred = true; EWgreen = false; EWyellow = true; EWred = false; for (i=0; i<5; i++) wait(); Codesign of Embedded Systems

  9. The Thread process is the most general one Implementing traff module with Method process requires defining several states Threads are slower than Methods Thread Example:Traffic Light Controller (cont’d) NSgreen = true; NSyellow = NSred = false; EWgreen = EWyellow = false; EWred = true; for (i=0; i<50; i++) wait(); } } Codesign of Embedded Systems

  10. Clocked Thread Process • The same as Thread, but is merely sensitive to edge of one clock • Results in better descriptions to synthesize • One major use: Implicit state machine • Implicit state machine vs. Explicit state machine • Additional waiting mechanisms • wait_until(<signal condition>) system call • Process is re-activated when the condition on the signals hold • timed wait, wait until condition with timeout (SystemC 2.0) Codesign of Embedded Systems

  11. addr 32 newaddr start data 32 data8 ready datardy Clocked Thread Example:Bus Controller SC_MODULE(bus) { sc_in_clk clock; sc_in<bool> newaddr; sc_in<sc_uint<32> > addr; sc_in<bool> ready; sc_out<sc_uint<32> > data; sc_out<bool> start; sc_out<bool> datardy; sc_inout<sc_uint<8> > data8; sc_uint<32> tdata; sc_uint<32> taddr; void xfer(); Bus Cntrlr Mem Cntrlr SC_CTOR(bus) { SC_CTHREAD(xfer, clock.pos()); datardy = true; } }; Codesign of Embedded Systems

  12. Clocked Thread Example:Bus Controller (cont’d) void bus::xfer() { while (true) { wait_until( newaddr.delayed() == true); taddr = addr.read(); datardy = false; data8 = taddr.range(7,0); start = true; wait(); data8 = taddr.range(15,8); start = false; wait(); data8 = taddr.range(23,16); wait(); data8 = taddr.range(31,24); wait(); wait_until(ready.delayed() == true); tdata.range(7,0)=data8; wait(); tdata.range(15,8)=data8; wait(); tdata.range(23,16)=data8; wait(); tdata.range(31,24)=data8; data = tdata; datardy = true; } } Codesign of Embedded Systems

  13. What we learned today • Process in SystemC • Methods • Threads • Clocked Threads Codesign of Embedded Systems

  14. Complementary notes:Assignments • DON’T FORGETSubscribe to ce226list@ce.sharif.edu by sending an email to majordomo@ce.sharif.edu containing subscribe ce226list in the body. • Today is due date for Assignment 4 • Take Assignment 5Due date: Sat. Ordibehesht 8th Codesign of Embedded Systems

  15. Complementary notes:Final Projects • Titles • MP3 Encoder-Decoder • JPEG Encoder-Decoder • TCP/IP Sender-Receiver • ARM7 Processor • TMS32025 DSP • MPEG-2 Encoder • MPEG-2 Decoder • DES/ Tripple-DES/ RSA Encryption-Decryption • Your Suggestion Codesign of Embedded Systems

  16. Complementary notes:Final Projects (cont’d) • Today, choose your final project • First Report • Turn in a 1-2 page document of your references • Deadline: Sat. Ordibehesht 8th • Second Report • Prepare a PowerPoint presentation of algorithm or architecture of your design • Deadline: Sat. Ordibehesht 22nd Codesign of Embedded Systems

More Related