Search the Community

Showing results for tags 'channels ports update wait'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Accellera Systems Initiative
    • Information
    • Announcements
    • In the News
  • SystemC
    • SystemC Language
    • SystemC AMS (Analog/Mixed-Signal)
    • SystemC TLM (Transaction-level Modeling)
    • SystemC Synthesizable Subset v1.4 Public Review
    • SystemC Verification (UVM-SystemC, SCV)
  • UVM (Universal Verification Methodology)
    • UVM 1.2 Public Review
    • Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • Simulator Specific Issues
    • UVM Commercial Announcements
  • Portable Stimulus
    • Portable Stimulus Discussion
    • IP-XACT Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • OCP (Open Core Protocol)
  • UCIS (Unified Coverage Interoperability Standard)
  • Commercial Announcements
    • Announcements


  • SystemC
  • UVM
  • UCIS
  • IEEE 1735/IP Encryption


  • Community Calendar

Found 1 result

  1. Hello everybody, While working on a systemC project, I discovered that probably I have some confused ideas about signals and ports. Let's say I have something like this: //cell.hpp SC_MODULE(Cell) { sc_in<sc_uint<16> > datain; sc_in<sc_uint<1> > addr_en; sc_in<sc_uint<1> > enable; sc_out<sc_uint<16> > dataout; SC_CTOR(Cell) { SC_THREAD(memory_cell); sensitive << enable << datain << addr_en; } private: void memory_cell(); }; //cell.cpp void Cell::memory_cell() { unsigned short data_cell=11; while(true) { //wait for some input wait(); if (enable->read()==1 && addr_en->read()==1) { data_cell=datain->read(); } else { if(enable->read()==0 && addr_en->read()==1) { dataout->write(data_cell); } } } } //test.cpp SC_MODULE(TestBench) { sc_signal<sc_uint<1> > address_en_s; sc_signal<sc_uint<16> > datain_s; sc_signal<sc_uint<1> > enable_s; sc_signal<sc_uint<16> > dataout_s; Cell cella; SC_CTOR(TestBench) : cella("cella") { // Binding cella.addr_en(address_en_s); cella.datain(datain_s); cella.enable(enable_s); cella.dataout(dataout_s); SC_THREAD(stimulus_thread); } private: void stimulus_thread() { //write a value: datain_s.write(81); address_en_s.write(1); enable_s.write(1); wait(SC_ZERO_TIME); //read what we have written: enable_s.write(0); address_en_s.write(1); wait(SC_ZERO_TIME); cout << "Output value: " << << endl; //let's cycle the memory again: address_en_s.write(0); wait(SC_ZERO_TIME); cout << "Output value: " << << endl; } }; I've tried running this modules and I've noticed something weird (at least, weird for me): when the stimulus writes a value (81), after the wait(SC_ZERO_TIME) the memory thread finds its datain, enable and address_enable values already updated. This is what I expected to happen. The same happens when the stimulus changes the enable_es value, in order to run another cycle in the memory thread and copy the datacell value into the memory cell dataout port. What I don't understand is why after the memory module writes into its dataout port and goes again to the wait() statement at the beginning of the while loop, the stimulus module still has the old value on its dataout_s channel (0), and not the new value(81), which has just been copied by the memory module. Then, if I run another cycle of the memory loop (for example changing some values on the stimulus channels), the dataout channel finnally updates. In other words, it looks like that if I write into the stimulus channels and then switch to the memory thread, the memory finds the values updated. But if the memory thread writes into its ports, and then i switch to the stimulus thread, the thread still sees the old values on its channels (binded to the memory ports). I don't know if I am clear, and I am sure that maybe this is a naive question, but i am a newbie with systemC and I need to understand this thing.