/*
|
/*
|
Asynchronous SDM NoC
|
Asynchronous SDM NoC
|
(C)2011 Wei Song
|
(C)2011 Wei Song
|
Advanced Processor Technologies Group
|
Advanced Processor Technologies Group
|
Computer Science, the Univ. of Manchester, UK
|
Computer Science, the Univ. of Manchester, UK
|
|
|
Authors:
|
Authors:
|
Wei Song wsong83@gmail.com
|
Wei Song wsong83@gmail.com
|
|
|
License: LGPL 3.0 or later
|
License: LGPL 3.0 or later
|
|
|
An IM of a buffered Clos for SDM-Clos routers
|
An IM of a buffered Clos for SDM-Clos routers
|
*** SystemVerilog is used ***
|
*** SystemVerilog is used ***
|
|
|
History:
|
History:
|
07/07/2011 Initial version. <wsong83@gmail.com>
|
07/07/2011 Initial version. <wsong83@gmail.com>
|
|
|
*/
|
*/
|
|
|
// the router structure definitions
|
// the router structure definitions
|
`include "define.v"
|
`include "define.v"
|
|
|
module im (/*AUTOARG*/
|
module im (/*AUTOARG*/
|
// Outputs
|
// Outputs
|
do0, do1, do2, do3, deco, dia, do4,
|
do0, do1, do2, do3, deco, dia, do4,
|
// Inputs
|
// Inputs
|
di0, di1, di2, di3, deci, di4, doa, doa4
|
di0, di1, di2, di3, deci, di4, doa,
|
`ifndef ENABLE_CRRD
|
`ifndef ENABLE_CRRD
|
, cms
|
cms,
|
`endif
|
`endif
|
, rst_n
|
rst_n
|
);
|
);
|
|
|
parameter MN = 2; // the number of CMs
|
parameter MN = 2; // the number of CMs
|
parameter NN = 2; // the number of IPs in one IM
|
parameter NN = 2; // the number of IPs in one IM
|
parameter DW = 8; // the data width of a single IP
|
parameter DW = 8; // the data width of a single IP
|
parameter SN = 2; // the number of possible output directions
|
parameter SN = 2; // the number of possible output directions
|
parameter SCN = DW/2; // the number of sub-channels in one IP
|
parameter SCN = DW/2; // the number of sub-channels in one IP
|
|
|
input [NN-1:0][SCN-1:0] di0, di1, di2, di3; // data input
|
input [NN-1:0][SCN-1:0] di0, di1, di2, di3; // data input
|
input [NN-1:0][SN-1:0] deci; // decoded dir input
|
input [NN-1:0][SN-1:0] deci; // decoded dir input
|
output [MN-1:0][SCN-1:0] do0, do1, do2, do3; // data output
|
output [MN-1:0][SCN-1:0] do0, do1, do2, do3; // data output
|
output [MN-1:0][SN-1:0] deco; // decoded dir output
|
output [MN-1:0][SN-1:0] deco; // decoded dir output
|
|
|
// eof bits and ack lines
|
// eof bits and ack lines
|
`ifdef ENABLE_CHANNEL_SLICING
|
`ifdef ENABLE_CHANNEL_SLICING
|
input [NN-1:0][SCN-1:0] di4; // data input
|
input [NN-1:0][SCN-1:0] di4; // data input
|
output [NN-1:0][SCN-1:0] dia; // input ack
|
output [NN-1:0][SCN-1:0] dia; // input ack
|
output [MN-1:0][SCN-1:0] do4; // data output
|
output [MN-1:0][SCN-1:0] do4; // data output
|
input [MN-1:0][SCN-1:0] doa, doa4; // output ack
|
input [MN-1:0][SCN-1:0] doa; // output ack
|
`else
|
`else
|
input [NN-1:0] di4; // data input
|
input [NN-1:0] di4; // data input
|
output [NN-1:0] dia; // input ack
|
output [NN-1:0] dia; // input ack
|
output [MN-1:0] do4; // data output
|
output [MN-1:0] do4; // data output
|
input [MN-1:0] doa, doa4; // output ack
|
input [MN-1:0] doa; // output ack
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
|
|
`ifndef ENABLE_CRRD
|
`ifndef ENABLE_CRRD
|
input [MN-1:0][SN-1:0] cms; // the states from CMs
|
input [MN-1:0][SN-1:0] cms; // the states from CMs
|
`endif
|
`endif
|
|
|
input rst_n; // global active low reset
|
input rst_n; // global active low reset
|
|
|
wire [MN-1:0][NN-1:0] cfg; // the configuration for the IM
|
wire [MN-1:0][NN-1:0] cfg; // the configuration for the IM
|
wire [MN-1:0][SCN-1:0] imo0, imo1, imo2, imo3; // the IM output data
|
wire [MN-1:0][SCN-1:0] imo0, imo1, imo2, imo3; // the IM output data
|
wire [MN-1:0][SN-1:0] imodec; // the IM output dec
|
wire [MN-1:0][SN-1:0] imodec; // the IM output dec
|
`ifdef ENABLE_CHANNEL_SLICING
|
`ifdef ENABLE_CHANNEL_SLICING
|
wire [MN-1:0][SCN-1:0] imo4; // IM output data
|
wire [MN-1:0][SCN-1:0] imo4; // IM output data
|
wire [MN-1:0][SCN-1:0] imoa, imoa4; // IM output ack
|
wire [MN-1:0][SCN-1:0] imoa, imoa4; // IM output ack
|
wire [MN-1:0][SCN-1:0] eofan, doan, deca; // stage control acks
|
wire [MN-1:0][SCN-1:0] eofan, doan, deca; // stage control acks
|
`else
|
`else
|
wire [MN-1:0] imo4; // IM data output
|
wire [MN-1:0] imo4; // IM data output
|
wire [MN-1:0] imoa, imoa4; // IM output ack
|
wire [MN-1:0] imoa, imoa4; // IM output ack
|
wire [MN-1:0] eofan, doan, deca; // stage control acks
|
wire [MN-1:0] eofan, doan, deca; // stage control acks
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
wire [MN-1:0] decan;
|
wire [MN-1:0] decan;
|
|
|
genvar i, j;
|
genvar i, j;
|
|
|
// the data crossbar
|
// the data crossbar
|
dcb #(.NN(NN), .MN(MN), .DW(DW))
|
dcb #(.NN(NN), .MN(MN), .DW(DW))
|
IMDCB (
|
IMDCB (
|
.o0 ( imo0 ),
|
.o0 ( imo0 ),
|
.o1 ( imo1 ),
|
.o1 ( imo1 ),
|
.o2 ( imo2 ),
|
.o2 ( imo2 ),
|
.o3 ( imo3 ),
|
.o3 ( imo3 ),
|
.o4 ( imo4 ),
|
.o4 ( imo4 ),
|
.ia ( dia ),
|
.ia ( dia ),
|
.i0 ( di0 ),
|
.i0 ( di0 ),
|
.i1 ( di1 ),
|
.i1 ( di1 ),
|
.i2 ( di2 ),
|
.i2 ( di2 ),
|
.i3 ( di3 ),
|
.i3 ( di3 ),
|
.i4 ( di4 ),
|
.i4 ( di4 ),
|
.oa ( imoa ),
|
.oa ( imoa ),
|
.oa4 ( imoa4 ),
|
.oa4 ( imoa4 ),
|
.cfg ( cfg )
|
.cfg ( cfg )
|
);
|
);
|
|
|
// the crossbar for decoded direction
|
// the crossbar for decoded direction
|
cb #(.NN(NN), .MN(MN), .DW(SN))
|
cb #(.NN(NN), .MN(MN), .DW(SN))
|
IMDECCB (
|
IMDECCB (
|
.data_in ( deci ),
|
.data_in ( deci ),
|
.data_out ( imodec ),
|
.data_out ( imodec ),
|
.cfg ( cfg )
|
.cfg ( cfg )
|
);
|
);
|
|
|
// the IM dispatcher
|
// the IM dispatcher
|
im_alloc #(.VCN(NN), .CMN(MN), .SN(SN))
|
im_alloc #(.VCN(NN), .CMN(MN), .SN(SN))
|
IMD (
|
IMD (
|
.IMr ( deci ),
|
.IMr ( deci ),
|
.IMa ( ),
|
.IMa ( ),
|
`ifndef ENABLE_CRRD
|
`ifndef ENABLE_CRRD
|
.CMs ( cms ),
|
.CMs ( cms ),
|
`endif
|
`endif
|
.cfg ( cfg ),
|
.cfg ( cfg ),
|
.rst_n ( rst_n )
|
.rst_n ( rst_n )
|
);
|
);
|
|
|
// the buffer stage for data
|
// the buffer stage for data
|
generate
|
generate
|
for(i=0; i<MN; i++) begin: OPD
|
for(i=0; i<MN; i++) begin: OPD
|
`ifdef ENABLE_CHANNEL_SLICING
|
`ifdef ENABLE_CHANNEL_SLICING
|
for(j=0; j<SCN; j++) begin:SC
|
for(j=0; j<SCN; j++) begin:SC
|
pipe4 #(.DW(2))
|
pipe4 #(.DW(2))
|
P (
|
P (
|
.o0 ( do0[i][j] ),
|
.o0 ( do0[i][j] ),
|
.o1 ( do1[i][j] ),
|
.o1 ( do1[i][j] ),
|
.o2 ( do2[i][j] ),
|
.o2 ( do2[i][j] ),
|
.o3 ( do3[i][j] ),
|
.o3 ( do3[i][j] ),
|
.ia ( imoa[i][j] ),
|
.ia ( imoa[i][j] ),
|
.i0 ( imo0[i][j] ),
|
.i0 ( imo0[i][j] ),
|
.i1 ( imo1[i][j] ),
|
.i1 ( imo1[i][j] ),
|
.i2 ( imo2[i][j] ),
|
.i2 ( imo2[i][j] ),
|
.i3 ( imo3[i][j] ),
|
.i3 ( imo3[i][j] ),
|
.oa ( doan[i][j] )
|
.oa ( doan[i][j] )
|
);
|
);
|
|
|
pipen #(.DW(1))
|
pipen #(.DW(1))
|
PEoF (
|
PEoF (
|
.d_in_a ( ),
|
.d_in_a ( ),
|
.d_out ( do4[i][j] ),
|
.d_out ( do4[i][j] ),
|
.d_in ( imo4[i][j] ),
|
.d_in ( imo4[i][j] ),
|
.d_out_a ( eofan[i][j] ),
|
.d_out_a ( eofan[i][j] ),
|
);
|
);
|
|
|
ppc PCTL (
|
ppc PCTL (
|
.deca ( deca[i][j] ),
|
.deca ( deca[i][j] ),
|
.dia ( imoa4[i][j] ),
|
.dia ( imoa4[i][j] ),
|
.eof ( do4[i][j] ),
|
.eof ( do4[i][j] ),
|
.doa ( doa[i][j] ),
|
.doa ( doa[i][j] ),
|
.dec ( |deco[i] )
|
.dec ( |deco[i] )
|
);
|
);
|
|
|
assign doan[i][j] = (~doa[i][j])&rst_n;
|
assign doan[i][j] = (~doa[i][j])&rst_n;
|
assign eofan[i][j] = (~deca[i][j])&rst_n;
|
assign eofan[i][j] = (~deca[i][j])&rst_n;
|
end // block: SC
|
end // block: SC
|
|
|
assign decan[i] = (~&deca[i])&rst_n;
|
assign decan[i] = (~&deca[i])&rst_n;
|
|
|
`else // !`ifdef ENABLE_CHANNEL_SLICING
|
`else // !`ifdef ENABLE_CHANNEL_SLICING
|
pipe4 #(.DW(DW))
|
pipe4 #(.DW(DW))
|
P (
|
P (
|
.o0 ( do0[i] ),
|
.o0 ( do0[i] ),
|
.o1 ( do1[i] ),
|
.o1 ( do1[i] ),
|
.o2 ( do2[i] ),
|
.o2 ( do2[i] ),
|
.o3 ( do3[i] ),
|
.o3 ( do3[i] ),
|
.ia ( imoa[i] ),
|
.ia ( imoa[i] ),
|
.i0 ( imo0[i] ),
|
.i0 ( imo0[i] ),
|
.i1 ( imo1[i] ),
|
.i1 ( imo1[i] ),
|
.i2 ( imo2[i] ),
|
.i2 ( imo2[i] ),
|
.i3 ( imo3[i] ),
|
.i3 ( imo3[i] ),
|
.oa ( doan[i] )
|
.oa ( doan[i] )
|
);
|
);
|
|
|
pipen #(.DW(1))
|
pipen #(.DW(1))
|
PEoF (
|
PEoF (
|
.d_in_a ( ),
|
.d_in_a ( ),
|
.d_out ( do4[i] ),
|
.d_out ( do4[i] ),
|
.d_in ( imo4[i] ),
|
.d_in ( imo4[i] ),
|
.d_out_a ( eofan[i] )
|
.d_out_a ( eofan[i] )
|
);
|
);
|
|
|
ppc PCTL (
|
ppc PCTL (
|
.deca ( deca[i] ),
|
.deca ( deca[i] ),
|
.dia ( imoa4[i] ),
|
.dia ( imoa4[i] ),
|
.eof ( do4[i] ),
|
.eof ( do4[i] ),
|
.doa ( doa[i] ),
|
.doa ( doa[i] ),
|
.dec ( |deco[i] )
|
.dec ( |deco[i] )
|
);
|
);
|
|
|
assign doan[i] = (~doa[i])&rst_n;
|
assign doan[i] = (~doa[i])&rst_n;
|
assign eofan[i] = (~deca[i])&rst_n;
|
assign eofan[i] = (~deca[i])&rst_n;
|
|
|
assign decan[i] = (~deca[i])&rst_n;
|
assign decan[i] = (~deca[i])&rst_n;
|
|
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
`endif // !`ifdef ENABLE_CHANNEL_SLICING
|
|
|
pipen #(.DW(SN))
|
pipen #(.DW(SN))
|
PDEC (
|
PDEC (
|
.d_in_a ( ),
|
.d_in_a ( ),
|
.d_out ( deco[i] ),
|
.d_out ( deco[i] ),
|
.d_in ( imodec[i] ),
|
.d_in ( imodec[i] ),
|
.d_out_a ( decan[i] )
|
.d_out_a ( decan[i] )
|
);
|
);
|
end // block: OPD
|
end // block: OPD
|
endgenerate
|
endgenerate
|
|
|
endmodule // im
|
endmodule // im
|
|
|