UCLONG / NetEmulation

Software Simulation and Hardware Synthesis of Electrical and Optical Interconnection Networks
GNU General Public License v3.0
10 stars 6 forks source link

Why is PORT_NO always set to 0 #8

Closed BorisDosen closed 10 years ago

BorisDosen commented 11 years ago

NEMU_PacketSource.sv has a parameter defined called PORT_NO that is set to 0. I don't quite understand why is that the case...

PORT_NO is used as an if statement condition and it is assigned to o_pkt_out.source (this is the code within same file). So it seems as if all of the packets will have the same source - port 0.

I would appreciate your help.

always_comb
     begin
        // Generate packet structure
        if (l_fifo_dout[31+log2('PORTS):32]>=PORT_NO)
            o_pkt_out.dest = l_fifo_dout[31+log2('PORTS):32]+1;
  else
    o_pkt_out.dest = l_fifo_dout[31+log2('PORTS):32];
    l_rd_en = (!i_net_full) && (!l_empty);
    o_pkt_out.source = PORT_NO;
    o_pkt_out.data = l_fifo_dout[31:0];
    o_pkt_out.valid = (!l_empty) && (!i_net_full); 

  // Set input FIFO read enable bit
       l_rd_en = (!l_empty) && (!i_net_full); 

  // Set input fifo full flag
       i_fifo_error = l_full;

end

pmwatts commented 11 years ago

port_no is a parameter of the packet_source module. The definition:

parameter port_no = 0;

sets the default value to 0, but if you instantiate it in the top level code like this:

packet_source #(8) my_pkts (input/output list...

if will take on the value 8. However, if you instantiate it without a value:

packet_source my_pkts (input/output list...

it will take on the default value of 0. In the net_emulation code, the packet source modules are instantiated in a generate loop with each taking on a different value of port_no.

Cheers,

Phil


From: Boris Dosen notifications@github.com Sent: 25 October 2013 15:58 To: DannyNicholls/NetEmulation Cc: Watts, Philip Subject: [NetEmulation] Why is PORT_NO always set to 0 (#8)

NEMU_PacketSource.sv has a parameter defined called PORT_NO that is set to 0. I don't quite understand why is that the case...

PORT_NO is used as an if statement condition and it is assigned to o_pkt_out.source (this is the code within same file). So it seems as if all of the packets will have the same source - port 0.

I would appreciate your help.

always_comb begin // Generate packet structure if (l_fifo_dout[31+log2(PORTS):32]>=PORT_NO) o_pkt_out.dest = l_fifo_dout[31+log2(PORTS):32]+1; else o_pkt_out.dest = l_fifo_dout[31+log2(`PORTS):32]; l_rd_en = (!i_net_full) && (!l_empty); o_pkt_out.source = PORT_NO; o_pkt_out.data = l_fifo_dout[31:0]; o_pkt_out.valid = (!l_empty) && (!i_net_full);

// Set input FIFO read enable bit l_rd_en = (!l_empty) && (!i_net_full);

// Set input fifo full flag i_fifo_error = l_full;

end

Reply to this email directly or view it on GitHubhttps://github.com/DannyNicholls/NetEmulation/issues/8.