1 / 7

Chapter 4 : Simulation and Debugging

Chapter 4 : Simulation and Debugging. Original Monitor Module Problem. Text are hard to read Undesired changes In file: c:tempsystemc-2.0.1srcsystemckernelsc_object.cpp:217 At time 0 s::(a, b, carry): 000 (sum, carry_out): 00 At time 5 ns::(a, b, carry): 100 (sum, carry_out): 00

chuck
Download Presentation

Chapter 4 : Simulation and Debugging

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. Chapter 4 : Simulation and Debugging

  2. Original Monitor Module Problem • Text are hard to read • Undesired changes In file: c:\temp\systemc-2.0.1\src\systemc\kernel\sc_object.cpp:217 At time 0 s::(a, b, carry): 000 (sum, carry_out): 00 At time 5 ns::(a, b, carry): 100 (sum, carry_out): 00 At time 5 ns::(a, b, carry): 100 (sum, carry_out): 10

  3. Replace with Trace orignal modified … … sc_trace_file *tf = sc_create_vcd_trace_file(“dump"); sc_trace(tf, a, "a"); sc_trace(tf, b, "b"); sc_trace(tf, carry, "carry"); sc_trace(tf, sum, "sum"); sc_trace(tf, co, "cout"); sc_start(100, SC_NS); sc_close_vcd_trace_file(tf); return 0; } int sc_main(int argc, char* argv[]) { sc_signal<booL> t_a, t_b, t_cin, t_sum, t_cout; full_adder f1(“Fulladder”); //connect using positional association f1 << t_a << t_b << t_cin << t_sum << t_cout; pattern_gen pg_ptr = new pattern_gen(“Genartion”); //connection using named association pg_ptr->d_a(t_a); pg_ptr->d_b(t_b); (*pg_ptr->d_cin(t_cin); monitor mol(“Monitor”); mo1 << t_a << t_b << t_cin << t_sum << t_cout; sc_start(100, SC_NS); return 0; }

  4. Control Functions • sc_clock : generate a clock signal • sc_trace : trace information into a file in the specified • sc_start : Run simulation for specified time • sc_stop : stop simulation • sc_time_stamp : get current simulation time with time units • sc_simulation_time : Get current simulation time without time units • sc_time : set simulation time resolution • sc_set_time_resolution : Specify a time value

  5. Control Functions (cont.) • sc_clock • Sc_clock rclk(“rclk”, 10, SC_NS); • Sc_clock mclk(“mclk”, 10, SC_NS, 0.2, 5, SC_NS, false) • sc_trace • Three format • VCD (Value Change Dump) • WIF (Waveform Interchange Format) • ISDB (Integrated Signal Data Base) • Related function • sc_create_xxx_trace_file(filename); • sc_close_xxx_trace_file(filename); • sc_trace(tfile, signal_name, “signal_name”);

  6. Control Functions (cont.) • sc_start • sc_start(100, SC_NS); • sc_start(-1); • sc_stop • Stop simulation. Can be used in any process

  7. Control Functions (cont.) • sc_set_time_resolution • sc_set_time_resolution(100, SC_PS); • sc_time sc_time t1(100, SC_NS); sc_time t2(20, SC_PS); sc_start(t1); sc_start(t2);

More Related