Jump to content

vijay.franklin

Members
  • Content count

    4
  • Joined

  • Last visited

About vijay.franklin

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location
    Munich, Germany
  1. Take one clock cycle for each thread

    For a pipeline, that is cycle accurate, you would need a reference to clock somewhere. Your implementation might work, but I am not sure what it actually implements / represents ! You could do an event based synchronization. And the below code assumes an ideal pipeline. (ie) there is no interprocess dependencies / bubbles and hence no pipeline stalls. If there is a pipeline stall & also during the initial pipeline fill, a suitable synchronization is to be used. sc_event do_decode_ev; sc_event do_evaladdr_ev; sc_event do_fetchop_ev; sc_event do_execute_ev; sc_event do_store_ev; SC_THREAD(Fetch); sensitive << clock.pos(); SC_THREAD(Decode); sensitive << do_decode_ev; SC_THREAD(Evaluate); sensitive << do_evaladdr_ev; SC_THREAD(FetchOperands); sensitive << do_fetchop_ev; SC_THREAD(Excute); sensitive << do_execute_ev; SC_THREAD(Store); sensitive << do_store_ev; void Fetch() { while(1){ wait(); //! will do a fetch every cycle. //! do the fetch and trigger decode in next delta do_decode_ev.notify(SC_ZERO_TIME); } } void Decode() { while(1){ wait(); //! waits for do_decode_ev <-- IMP --> decode the fetch done in previous cycle | not the one done in this cycle | In first cycle there is no operand, so wait till operand is there. //! notify the next process in pipeline do_evaladdr_ev.notify(SC_ZERO_TIME); } } void Evaluate() { while(1){ wait(); //! waits for do_execute_ev <-- evaluate for inputs from previous cycle //! notify the next process in pipeline do_execute_ev.notify(SC_ZERO_TIME); } } void FetchOperands() { while(1){ wait(); //! waits for do_fetchop_ev //! notify the next process in pipeline do_execute_ev.notify(SC_ZERO_TIME); } } //! etc
  2. peq_with_cb_and_phase - has a call back attached. (ie) When the time has expired, a call back function is triggered. You can then process the transaction in the call back function. The call back function also gives the phase. say, the current call back has a phase AR_READY --> you can then do the processing of the state machine for AR_READY. From the LRM: "Transactions emerge in different ways from the two PEQ variants. In the case of peq_with_get, the method get_event returns an event that is notified whenever a transaction is ready to be retrieved. The method get_next_transaction should be called repeatedly to retrieve any available transactions one at a time. In the case of peq_with_cb_and_phase, a callback method is registered as a constructor argument, and that method is called as each transaction emerges. This particular PEQ carries both a transaction object and a phase object with each notification, and both are passed as arguments to the callback method." For example on how this is to be used - you can refer; https://www.doulos.com/knowhow/systemc/tlm2/tlm_2_0_1/#anchor6
  3. Getting started

    Not free - http://www.synopsys.com/Prototyping/ArchitectureDesign/Pages/platform-architect.aspx
  4. Systemc time based arbiter

    You would need a clock port that is hooked up to a clock generator -- which would enable the actual progression of simulation of time. Now, when you add in that, I would model the algorithm somewhere along the lines of In pseudo code: --- would never compile //! resources SC_METHOD --> hook_method_1 (sensitive to char_in1); SC_METHOD --> hook_method_2 (sensitive to char_in2); SC_THREAD ---> process_queue SC_METHOD --> process_method (sensitive to process_event) queue <char_data> //!processes hook_method_1 (){ queue.push_back(char_in1) //! always enter data in the last position notify process_event ( clean this with atomic signalling to avoid multiple unwanted triggers) } hook_method_2 () { wait for delta cycle //! in case char_in1, 2 changes in same clock, give more priority to char_in1 queue.push_back(char_in2) notify process_event ( clean this with atomic signalling to avoid multiple unwanted triggers) } process_method(){ wait for process event schedule all elements in queue by notifying "float in sc_out event" with appropriate delays between bus transitions. ie, if there are two requests in queue and you want the data to be valid for two cycles and other for three cycles, notify the "float in sc_out event" with appropriate delays. } process_queue(){ while(1){ wait(for "float in sc_out event") while(there are elements in queue ){ * get top most char from queue * put the data from queue into the sc_out * delete the data from queue //! as already sent out } } }
×