Jump to content

veeresh k

Members
  • Content Count

    19
  • Joined

  • Last visited

About veeresh k

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi david, Thanx for taking out your time n helping beginner guys like me. I will be going though the link and let u know if any problem arises. Thank you once again david and maehne u too. Regards, Veeresh K
  2. Hi maehne, Thanx for the reply and the mentions. ?
  3. Hey everyone, As of now , i am reffering textbook "SYSTEM C-FROM THE GROUND UP". I am finding that textbook very helpful and wanted to go through the solutions of example problems given in that book. If am able to figure out my approach is right or wrong ,then it would be very helpful in getting much proficient with system c. Can anyone,please tell me where can i find them? I am not able to find solutions on the link provided in the textbook. Thanx in advance. Regards, Veeresh K
  4. Hey everyone, As of now , i am reffering textbook "SYSTEM C-FROM THE GROUND UP". I wanted to have the solutions of example problems given in that book. Can anyone,please tell me where can i find them? I am not able to find solutions on the link provided in the textbook. Thanx in advance. Regards, Veeresh K
  5. veeresh k

    SystemC basic tutorial and examples

    Hey ajinkya, Even i am new to system c,and trying to learn much more about it The examples which u have mentioned such as counters,registers can be found in A SYSTEM C PRIMER by J.BHASKER. I had tried few examples from that book,so go for it. If u find any other textbooks or links or any other thing which will be helpful for learning system c,then please do share. Regards, Veeresh .K
  6. veeresh k

    beginner problems on fifo waveform

    Hi eyck, Thanx fo d rply. ? Is it possible to copy the read and write values in temporary variables and trace that signal.? I had tried this way but it was not possible,so needed suggestions for alternatives.
  7. Hi , I am trying to trace out the wave for the input and the output. I have tried for different ways,but not getting the desired results. One of the way was,i created 2 same signals with diff. name in testbench file and tried to trace ,but i was not successful in doing so. Any suggestions to do? Thank you. ? Ps:- I have attached the code through which m trying to trace.Plz,help me out with this.I have modified the code according to the errors,So thats the reason for using namespace sc::core while declaring fifo tracing input.I am posting full code along with the errors. /////////ERRORS///////////////////////////////////// testbench.cpp: In function 'int sc_main(int, char**)':testbench.cpp:16:18: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_in<int>&)'testbench.cpp:17:19: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_out<int>&)'testbench.cpp:21:29: error: no matching function for call to 'sc_trace(sc_core::sc_trace_file*&, sc_core::sc_fifo_in<int>&, const char [6])' ////////////////////CODE///////////////////////////// #ifndef EXAMPLE_H #define EXAMPLE_H using namespace sc_dt; typedef sc_int<32> sc_int32; SC_MODULE(example) sc_fifo<sc_int32> fifo; //producer thread void producer_thread(); //consumer thread void consumer_thread(); SC_CTOR(example) : fifo(2) { SC_THREAD(producer_thread); SC_THREAD(consumer_thread); }; }; #endif ///////////////////////////////////////// #include <systemc.h> #include "example.h" using namespace sc_dt; void example::producer_thread() { int unsigned number_of_accesses = 4; for (int i = 0; i < number_of_accesses; i++) { sc_int32 value(i); cout << "[" << sc_time_stamp() << "] writing to FIFO value: " << value << ", free: " << fifo.num_free() << endl; fifo.write(value); cout << "[" << sc_time_stamp() << "] wrote to FIFO value: " << value << endl; wait(1, SC_NS); } } //consumer thread void example::consumer_thread() { sc_int<32> value(0); for (;;) { wait(4, SC_NS); fifo.read(value); cout << "[" << sc_time_stamp() << "] read from FIFO value: " << value << endl; } } ////////////////////////////////////////////////MAIN.CPP//////////////////// #include "systemc.h" #include "example.h" using namespace sc_dt; int sc_main(int, char* []) { sc_core::sc_fifo_out<int> output1; sc_core::sc_fifo_in<int> input1; //create the instance of the example example eg1("example_inst"); eg1.fifo(input1); eg1.fifo(output1); sc_trace_file*tf=sc_create_vcd_trace_file("fi"); sc_trace(tf,input1,"input"); sc_trace(tf,output1,"output"); sc_start(); if(not sc_end_of_simulation_invoked()) { sc_stop; } sc_close_vcd_trace_file(tf); return 0; }
  8. veeresh k

    fifo waveform tracing

    Hey maehne, Sorry for the incomplete post.Actually it was a follow up question which i had previously asked,so thats the reason for posting it up in this way. I am posting full code along with the errors. /////////ERRORS///////////////////////////////////// testbench.cpp: In function 'int sc_main(int, char**)':testbench.cpp:16:18: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_in<int>&)'testbench.cpp:17:19: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_out<int>&)'testbench.cpp:21:29: error: no matching function for call to 'sc_trace(sc_core::sc_trace_file*&, sc_core::sc_fifo_in<int>&, const char [6])' ////////////////////CODE///////////////////////////// #ifndef EXAMPLE_H #define EXAMPLE_H using namespace sc_dt; typedef sc_int<32> sc_int32; SC_MODULE(example) sc_fifo<sc_int32> fifo; //producer thread void producer_thread(); //consumer thread void consumer_thread(); SC_CTOR(example) : fifo(2) { SC_THREAD(producer_thread); SC_THREAD(consumer_thread); }; }; #endif ///////////////////////////////////////// #include <systemc.h> #include "example.h" using namespace sc_dt; void example::producer_thread() { int unsigned number_of_accesses = 4; for (int i = 0; i < number_of_accesses; i++) { sc_int32 value(i); cout << "[" << sc_time_stamp() << "] writing to FIFO value: " << value << ", free: " << fifo.num_free() << endl; fifo.write(value); cout << "[" << sc_time_stamp() << "] wrote to FIFO value: " << value << endl; wait(1, SC_NS); } } //consumer thread void example::consumer_thread() { sc_int<32> value(0); for (;;) { wait(4, SC_NS); fifo.read(value); cout << "[" << sc_time_stamp() << "] read from FIFO value: " << value << endl; } } ////////////////////////////////////////////////MAIN.CPP//////////////////// #include "systemc.h" #include "example.h" using namespace sc_dt; int sc_main(int, char* []) { sc_core::sc_fifo_out<int> output1; sc_core::sc_fifo_in<int> input1; //create the instance of the example example eg1("example_inst"); eg1.fifo(input1); eg1.fifo(output1); sc_trace_file*tf=sc_create_vcd_trace_file("fi"); sc_trace(tf,input1,"input"); sc_trace(tf,output1,"output"); sc_start(); if(not sc_end_of_simulation_invoked()) { sc_stop; } sc_close_vcd_trace_file(tf); return 0; }
  9. veeresh k

    fifo waveform tracing

    Hey everyone, I am trying to trace out the wave for the input and the output. I have tried for different ways,but not getting the desired results. One of the way was,i created 2 same signals with diff. name in testbench file and tried to trace ,but i was not successful in doing so. Any suggestions to do? Thank you. ? Ps:- I have attached the code through which m trying to trace.Plz,help me out with this.I have modified the code according to the errors,So thats the reason for using namespace sc::core while declaring fifo tracing input. ///////////////////////////////////////////// using namespace sc_dt; int sc_main(int, char* []) { sc_core::sc_fifo_out<int> output1; sc_core::sc_fifo_in<int> input1; //create the instance of the example example eg1("example_inst"); eg1.fifo(input1); eg1.fifo(output1); sc_trace_file*tf=sc_create_vcd_trace_file("fi"); sc_trace(tf,input1,"input"); sc_trace(tf,output1,"output"); sc_start(); if(not sc_end_of_simulation_invoked()) { sc_stop; } sc_close_vcd_trace_file(tf); return 0; }
  10. veeresh k

    fifo example

    Hey ameya, Thanks for taking out your time n helping me out by modifying code. ? By seeing the developed code of yours,i can understand now that they had clearly mentioned the error while i was executing,but i dint get it. And one more thing,I am trying to trace out the wave for the input and the output. I have tried for different ways,but not getting the desired results. One of the way was,i created 2 same signals with diff. name in testbench file and tried to trace ,but i was not successful in doing so. Any suggestions to do? Thank you.:-)
  11. veeresh k

    fifo example

    Hi. I have taken this example from a book and tried to execute it,But i got few errors. I have compared this code with std 2011 and made changes according to that like using namspace sc_core . I am not able to find a right solution for this one. Can someone plese help me out with this.I have posted the code below along with the error,check it out. Thank you. //error////////// In file included from testbench.cpp:6:0:head1.h: In member function 'void www::woperation()':head1.h:16:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_out_if<int> >' has no member named 'write'In file included from testbench.cpp:7:0:head2.h: In member function 'void rrr::roperation()':head2.h:17:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_in_if<int> >' has no member named 'read'  ////////code///// #include<systemc.h> #include"Head1.h" #include"Head2.h" int sc_main(int argc, char* argv[]) { sc_fifo<int> fifo(10); writer w("writer"); reader r("reader"); w.out(fifo); r.in(fifo); sc_start(-1); return 0; } //header1 #include<systemc.h> SC_MODULE(reader) { sc_port<sc_fifo_in_if<int> > in; void roperation() { int val; while (true) { wait(10, SC_NS) for (int i = 0; i <= 15; i++) { in.read(val); cout << val << endl; } } cout << "Availaible : " << in.num availaible() << endl; } SC_CTOR(writer) { SC_THREAD(woperation); } }; //header2 #include<systemc.h> SC_MODULE(writer) { sc_port<sc_fifo_out_if<int> > out; void woperation() { int val = 0; while (true) { wait(10, SC_NS); for (int i = 0; i <= 20; i++) { out.write(val++); } } } SC_CTOR(writer) { SC_THREAD(woperation); } };
  12. veeresh k

    basic fifo example error

    Hi. I am tring to execute a example from a book,but am getting error of this kind : In file included from testbench.cpp:6:0:head1.h: In member function 'void www::woperation()':head1.h:16:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_out_if<int> >' has no member named 'write'In file included from testbench.cpp:7:0:head2.h: In member function 'void rrr::roperation()':head2.h:17:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_in_if<int> >' has no member named 'read' below is the code: #include<systemc.h> #include"Head1.h" #include"Head2.h" int sc_main(int argc, char* argv[]) { sc_fifo<int> fifo(10); writer w("writer"); reader r("reader"); w.out(fifo); r.in(fifo); sc_start(-1); return 0; } //header1 #include<systemc.h> SC_MODULE(reader) { sc_port<sc_fifo_in_if<int> > in; void roperation() { int val; while (true) { wait(10, SC_NS) for (int i = 0; i <= 15; i++) { in.read(val); cout << val << endl; } } cout << "Availaible : " << in.num availaible() << endl; } SC_CTOR(writer) { SC_THREAD(woperation); } }; //header2 #include<systemc.h> SC_MODULE(writer) { sc_port<sc_fifo_out_if<int> > out; void woperation() { int val = 0; while (true) { wait(10, SC_NS); for (int i = 0; i <= 20; i++) { out.write(val++); } } } SC_CTOR(writer) { SC_THREAD(woperation); } };
  13. veeresh k

    clock generation in system c

    Ok Eyck. Thanx for d reply . ? It wont be clear untill n unless,i do more n more examples on my own. To certain extent, u guys made me clear of few topics. Thank you once again.
  14. veeresh k

    clock generation in system c

    Hey ameya, Thanx for the reply. ? I have gone through documentation,but am not getting it completely. By seeing the suggested api documentation from u,i am assuming that we will have a time period of 1ps along with 0.5 dutycycle by default and we are changing a bit of start value of clock by using sc_start(1,SC_NS) .We just got to declare it and mention it in trace file n we will get the waveform,ryt? As u can see in below waveform,i know the reason for reset and enable changes,but the clock waveform reason i dint get. N how can i change the clock waveform.Is it done by this sc_clock testclk("testclk",2,SC_NS,0.5,1,SC_NS). Note:-In test clock i am just randomly taking the no. .
  15. veeresh k

    clock generation in system c

    Hi, I have came across this counter example from other website. Can u please tell me ,where have we intitialised the main clock. I know the default time period is 1ps,but i am not getting the start of the clock is from which point. I am not knowing the reason for its generation in waveform viewer. Thank you. Below is the code: #include "systemc.h" #include "design.cpp" int sc_main (int argc, char* argv[]) { sc_signal<bool> clock; sc_signal<bool> reset; sc_signal<bool> enable; sc_signal<sc_uint<4> > counter_out; int i = 0; // Connect the DUT first_counter counter("COUNTER"); counter.clock(clock); counter.reset(reset); counter.enable(enable); counter.counter_out(counter_out); sc_start(1, SC_NS); // Open VCD file sc_trace_file *wf = sc_create_vcd_trace_file("counter"); // Dump the desired signals sc_trace(wf, clock, "clock"); sc_trace(wf, reset, "reset"); sc_trace(wf, enable, "enable"); sc_trace(wf, counter_out, "count"); // Initialize all variables reset = 0; // initial value of reset enable = 0; // initial value of enable for (i=0;i<5;i++) { clock = 0; sc_start(1, SC_NS); clock = 1; sc_start(1, SC_NS); } reset = 1; // Assert the reset cout << "@" << sc_time_stamp() <<" Asserting reset\n" << endl; for (i=0;i<10;i++) { clock = 0; sc_start(1, SC_NS); clock = 1; sc_start(1, SC_NS); } reset = 0; // De-assert the reset cout << "@" << sc_time_stamp() <<" De-Asserting reset\n" << endl; for (i=0;i<5;i++) { clock = 0; sc_start(1, SC_NS); clock = 1; sc_start(1, SC_NS); } cout << "@" << sc_time_stamp() <<" Asserting Enable\n" << endl; enable = 1; // Assert enable for (i=0;i<20;i++) { clock = 0; sc_start(1, SC_NS); clock = 1; sc_start(1, SC_NS); } cout << "@" << sc_time_stamp() <<" De-Asserting Enable\n" << endl; enable = 0; // De-assert enable cout << "@" << sc_time_stamp() <<" Terminating simulation\n" << endl; sc_close_vcd_trace_file(wf); return 0;// Terminate simulation }
×