Jump to content

akb20

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. The problem with your suggested solution is that it is not giving the correct latency value of the pipeline which is my only target. Note that I already know the latency (in terms of number of clock cycle) of the pipeline which is same as the number of stages. I also understood that FIFO is better way to do handshaking but the FIFO is not delaying in any pipeline stage. So there is no correct latency value. I think that only wait() can pause the simulation but it is only possible in SC_THREAD or SC_CTHREAD and not possible in SC_METHOD. Currently, if I change the SC_METHOD to SC_CTHREAD, it is not giving correct result. I don't know why because just changing SC_METHOD to SC_CTHREAD without changing the code should not make the simulation to fail.
  2. I want to thank you for your reply. I could not understand your first solution. 1) Why do I need to put the txProcess at the first position? 2) What do you mean by controlling the order of calling? Actually, I am trying to implement two stages and want to see the latency difference compared to only one stage. I think the latency should increase. But currently there is no change of latency whether one or two stages. I thought that if I create two separate methods for two stages, it will take two clock cycles. But it is not true. Kindly suggest me how I can implement two stages and see the impact on latency.
  3. I have a design.h and design.cpp as given below. I am trying to have two stages in the design. I notice that the latency is same when I had only once stage. I don't understand why the number of clock cycles required by data to pass the design can remain same if I have two stages instead of one. I think that the two stages are not correctly done. //Design.h file #include <systemc.h> #include "Buffer.h" using namespace std; SC_MODULE(Design) { sc_in_clk clock; sc_in <bool> reset; sc_in <Flit> flit_rx[DIRECTIONS + 2]; sc_out <Flit> flit_tx[DIRECTIONS + 2]; BufferBank buffer[DIRECTIONS + 2]; BufferBank intermediate_buffer[DIRECTIONS + 2]; void process(); void rxProcess(); void second_stage_process(); void intermediateProcess(); void txProcess(); SC_CTOR(Design) { SC_METHOD(process); sensitive << reset; sensitive << clock.pos(); SC_METHOD(second_stage_process); sensitive << reset; sensitive << clock.pos(); } }; The design.cpp is as follows. #include "Design.h" void Design::process() { rxProcess(); } void Design::second_stage_process() { txProcess(); intermediateProcess(); } void Design::rxProcess() { if (!reset.read()) { for (int i = 0; i < DIRECTIONS + 2; i++) { Flit received_flit = flit_rx[i].read(); int vc = received_flit.vc_id; if (!buffer[i][vc].IsFull()) { // Store the incoming flit in the circular buffer buffer[i][vc].Push(received_flit); } } } } void Design::intermediateProcess() { if (!reset.read()) { for (int i = 0; i < DIRECTIONS + 2; i++) { for (int vc = 0;vc < GlobalParams::n_virtual_channels; vc++) { if ((!buffer[i][vc].IsEmpty()) && (!intermediate_buffer[i][vc].IsFull())) { // Store the incoming flit in the circular buffer intermediate_buffer[i][vc].Push(buffer[i][vc].Front()); buffer[i][vc].Pop(); } } } } } void Design::txProcess() { if (!reset.read()) { for (int j = 0; j < DIRECTIONS + 2; j++) { int i = (start_from_port + j) % (DIRECTIONS + 2); for (int k = 0;k < GlobalParams::n_virtual_channels; k++) { int vc = (start_from_vc[i]+k)%(GlobalParams::n_virtual_channels); if (!intermediate_buffer[i][vc].IsEmpty()) { Flit flit = intermediate_buffer[i][vc].Front(); //some operations with flit } } } for (int i = 0; i < DIRECTIONS + 2; i++) { if (!intermediate_buffer[i][vc].IsEmpty()) { Flit flit = intermediate_buffer[i][vc].Front(); //some operations to get the value of o flit_tx[o].write(flit); intermediate_buffer[i][vc].Pop(); } } } } Please tell me what I am doing wrong. I want to create a second stage and that is why I am saving data from buffer to intermediate_buffer and use that buffer in txProcess. But this is not increasing the latency of the data propagation (from input receiver to output transmitter) which means the second stage is actually not getting created.
×
×
  • Create New...