Jump to content

Search the Community

Showing results for tags 'method'.

  • 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 Verification (UVM-SystemC, SCV, CRAVE, FC4SC)
    • SystemC CCI (Configuration, Control & Inspection)
    • SystemC Datatypes
  • UVM (Universal Verification Methodology)
    • UVM (IEEE 1800.2) - Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • UVM Simulator Specific Issues
    • UVM Commercial Announcements
    • UVM (Pre-IEEE) Methodology and BCL Forum
  • Portable Stimulus
    • Portable Stimulus Discussion
    • Portable Stimulus 2.0 Public Review Feedback
  • IP Security
    • SA-EDI Standard Discussion
    • IP Security Assurance Whitepaper Discussion
    • IP-XACT Discussion
  • SystemRDL
    • SystemRDL Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • Commercial Announcements
    • Announcements


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL












Found 2 results

  1. I'm implementing a network simulator where modules send flits (packets of information) to other modules. They can only do so if there is available space in a buffer to hold a flit. Credits are used to control when a module can send a flit to another module. Basically credits in a given module correspond to the number of available positions in the input buffer of the next module. I am having some issues related to the order of method execution. I know SystemC does not specify a predefined order in which methods are executed. But, I somehow need to enforce a given order (even if it is in an indirect way). Therefore, I would really appreciate if I could get some directions on how to actually accomplish it with SystemC. An example intermediate module receives flits in the request input port: void receive() { auto& flit = req_in.read(); LOG_M(boost::format("Received %1%") % flit.to_str()); buffer_.push_back(flit); process_buffer_event_.notify(clk); } One cycle after receiving a flit, it is necessary to process the flit buffer: void process_buffer() { if (buffer_.empty()) return; if (credits_ == 0) { LOG_M("No credits!!!"); return; } auto& flit = buffer_.front(); LOG_M(boost::format("Sending %1%") % flit.to_str()); req_out.write(flit); credits_--; // consumes a credit buffer_.erase(begin(buffer_)); if (!buffer_.empty()) process_buffer_event_.notify(clk); } Finally, the method receiving credits back from the next module is defined as: void receive_credits() { auto credits = cr_rcv.read(); credits_ += credits; LOG_M(boost::format("%1% credits received (total=%2%)") % credits % credits_); process_buffer_event_.notify(SC_ZERO_TIME); } The problem with this approach is that at a given time the previous module in the network might send a flit while the next module returns a credit. This would happen at delta cycle 0. Then at delta cycle 1, both receive() and receive_credits() would execute. That would trigger an execution of process_buffer() at delta cycle 2. If the buffer was originally empty, process_buffer() would proceed to send the flit that arrived at delta cycle 1. But, that flit just arrived in this very same cycle, so it should not be eligible for sending it until next cycle. If I could guarantee that receive_credits() always executes before receive(), I could rewrite that function like this: void receive_credits() { auto credits = cr_rcv.read(); credits_ += credits; LOG_M(boost::format("%1% credits received (total=%2%)") % credits % credits_); if (!buffer_.empty()) process_buffer_event_.notify(SC_ZERO_TIME); } That would guarantee that a flit is not sent too early. But as far as I know, there is no way to specify the order of methods' execution. What would be the most SystemC-like approach to solve this issue? A fully functional example can be found here (http://pastebin.com/Ma6Hxq31).
  2. I'm developing a performance simulator for a hardware unit. The hardware runs at 1GHz and therefore I define a clock cycle as: sc_time clk(1, SC_NS) In a specific module requests arrive to the input port, triggering a method that places them into a request buffer. At some point requests that are ready for processing are moved out from the request buffer and placed into another buffer. The overall design would look like: void Receive() { auto x = input.read(); buffer_.push_back(x); process_buffer_event_.notify(clk); } void ProcessBuffer() { for (auto it = begin(buffer_); it != end(buffer_); ++it) { if (process_entry(*it)) { // returns true if a request was successfully moved to the second buffer buffer_.erase(it); break; // only one request can be processed per cycle } } if (!buffer_.empty()) process_buffer_event_.notify(clk); } So, ProcessBuffer will trigger either when a new request arrives or when a request is processed and there are still requests in the buffer. However, there is another case when ProcessBuffer should trigger. In the module there are some resources that can be either in use or idle. Whenever a resource becomes idle, ProcessBuffer must immediately trigger (without waiting until the next cycle): void ReleaseResources() { bool any_released = false; for (auto& r : resources_) any_released = r->try_to_release() || any_released; if (any_released) process_buffer_event_.notify(SC_ZERO_TIME); } However, because of this piece of code, ProcessBuffer now may trigger twice in a given cycle (in the same nanosecond). I suspect it is related to using SC_ZERO_TIME, but I'm not really sure. This creates an issue since now two requests might be moved into the second buffer. I suppose I could guard against executing ProcessBuffer twice by doing something like: void ProcessBuffer() { if (sc_time_stamp() == last_time_processed) return; last_time_processed = sc_time_stamp(); for (auto it = begin(buffer_); it != end(buffer_); ++it) { if (process_entry(*it)) { buffer_.erase(it); break; // only one request can be processed per cycle } } if (!buffer_.empty()) process_buffer_event_.notify(clk); } But I was just wondering whether there is some mechanism in SystemC to properly prevent a method from triggering more than once.
  • Create New...