Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by afzalmd

  1. No. time values are greater than time resolution.
  2. Hi Alan, I was missing that wait() statement, which was outside of while loop. Now my program is working fine and I am getting desired results (which I can check by printing time values). tINT etc are defined values of time. Thanks to phillip as well.
  3. Hi Philip, Here I come across a small program to check the functionality. It uses only reset input to check the functionality(actual program uses other inputs also). Even if I use with SC_METHOD and use next_trigger, again it gives wrong results. dut.h class init:public sc_module{ public: sc_in<bool> clk; sc_in<bool> reset; sc_out<bool> rst_o; void conv(); init(sc_module_name name):sc_module(name){ SC_THREAD(conv); sensitive<<clk; } ~init(){ } private: SC_HAS_PROCESS(init); }; dut.cpp void init::conv(){ sc_time Tint; sc_time Tact; sc_time Tstab; sc_time diff; Tint = sc_time(tINT, SC_PS); //it should be in micro seconds (us) Tact = sc_time(tACT, SC_FS); //in nano seconds(ns) Tstab = sc_time(tSTAB, SC_NS); //in micro seconds(us) diff=Tint-Tact; while(true){ if(!reset.read()){ wait(diff); //after diff, DCKE should be zero rst_o.write(true); wait(Tact); //after tACT (or initialization time), reset should be true rst_o.write(false); wait(Tstab); //after tSTAB; rst_o.write(true); } else{ rst_o.write(reset.read()); //for normal operation } } wait(); // wait for the next clock edge (required!) } For testbench, I am giving stimuli as follow: class testbench:public sc_module{ public: sc_in<bool> clk; sc_out<bool> rst; void stim(); testbench(sc_module_name name):sc_module(name){ SC_THREAD(stim); sensitive<<clk; } ~testbench(){ } void stim(){ rst.write(false); wait(50, SC_NS); rst.write(true); wait(50,SC_NS); rst.write(false); wait(50, SC_NS); rst.write(true); } private: SC_HAS_PROCESS(testbench); }; All modules are attached in the top module and that module is instantiated in main file. main.cpp int sc_main (int argc, char* argv[]){ //default time values sc_set_default_time_unit(1,SC_PS); sc_set_time_resolution(1,SC_FS); top tp("tp"); cout<<"Simulation Started\n"; sc_start(200, SC_NS); sc_stop(); return 0; } I hope now it will be clear to find out the problem or something which I am missing.
  4. The output of my program says this ... What might be the exact problem.. !! I am unable to tracethat particular port. SystemC 2.2.0 --- Sep 25 2012 13:13:03 Copyright © 1996-2006 by all Contributors ALL RIGHTS RESERVED As it is clear from the info message, you have to use sc_sensitive<<a.pos(); . sc_sensitive_pos is supported in previous versions. All systemC ports should be binded. SystemC does not support floating ports. Either you can bind that port another port or with a dummy signal. In this case port 3 in m1 module is not bounded. Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about IEEE 1666 deprecated features by placing this method call as the first statement in your sc_main() function: sc_report_handler::set_actions("/IEEE_Std_1666/deprecated", SC_DO_NOTHING);
  5. Hi Phillip, What does this mean? How does a waveform "appear"? How do you generate your clock events? How do you start the simulation? How/when do you stop it? I mean, I can't see trace file on gtkwave because when I click on that file, it doesn't dispaly result. At this point I don't know the reason. But when I don't use while loop, it appears fine. This is very hard to parse. What is the "first instance"? How do you "check manually"? Debugger? printf? I mean, for the first stimuli. I give different values at input, including "reset" and after 50ns I give some other values. Just like simple testbench. For first stimuli values, the above code behaves in the way as it should be. But after 50ns and so on, there is no increment in time. For example: if I print a statement in else statement, it will appear with time stamp of 50ns (which is true in my case), but for rest of the simulation, this time is not changing and it seems that at every rising edge of the clock, this statement is appearing again and again with the same value of time. How can the control flow "remain" in the else part? What is the clock frequency? It looks like you want to model a synchronous design, where you check the reset signal at every rising clock edge. I would expect to see an advance of the timestamp according to the clock frequency. Well, I am using clock signal of 4ns. Yes it is a synchronous design and I need to check different input values at rising edge of clock. In my program. I am giving same input clock to testbench (which gives stimuli to DUT) and DUT as well. Wild guess: Did you include the last line in the loop I posted above? I.e. do you have a wait() for static sensitivity on the input clock after your condition? Yes, I used that function and also defined some time for wait statement (just to check if works or not). But each time it gives similar result.
  6. Hi Phillip, I tried to implement in this way . First problem I got, I can't display the result on a waveform. it does not appear. When I check manually, system still remains in the first instance of module. For example: if input reset stimuli is changing after every 50ns, then say, system will check for reset and it finds reset to be LOW, until 50ns. Then after 50ns it enters in the "else" statement and remains there. I tried to print the time_stamp and it does not change the value of time after 50ns.
  7. Hi, In my module, if input reset signal is LOW, then module should produce a defined delay and after that it should make the output reset signal to HIGH (which will be given to other modules). In vice versa it should write the input reset to the output reset signal as it is. Stimulis are given in the testbench file, changing after every 50ns. In this case, module works fine for the first time, but when after some time input reset goes again to LOW, it is not working and does not produce any delay (process is not called after that). Can you described what is wrong in this code or something missing? Code is given: //init.h class init:public sc_module{ public: sc_in<bool> ck_t_i; sc_in<bool> reset_i; sc_in<sc_lv<CKE_C> > dcke_i; sc_out<bool> reset_o; sc_out<sc_lv<CKE_C> > dcke_o; void conv(); init(sc_module_name name):sc_module(name){ SC_THREAD(conv); sensitive<<ck_t_i.pos(); } private: SC_HAS_PROCESS(init); }; //init.cpp void init::conv(){ sc_time Tint; sc_time Tact; sc_time Tstab; sc_time diff; Tint = sc_time(tINT, SC_PS); //8000 Tact = sc_time(tACT, SC_FS); //8ntCK and tCK is 4ns Tstab = sc_time(tSTAB, SC_NS); //5 diff=Tint-Tact; if(!reset_i.read()){ wait(diff); //after diff, DCKE should be zero dcke_o.write("00"); wait(Tact); //after tACT (or initialization time), reset should be true reset_o.write(true); wait(Tstab); //after tSTAB dcke_o.write("11"); } else{ reset_o.write(reset_i.read()); //for normal operation } } In attached waveform, d_rst is input reset and q_rst is output reset.
  • Create New...