Line 35... |
Line 35... |
** PROPOGATE_LIMITED = (WRRA_CONFIG_INDEX==1 );
|
** PROPOGATE_LIMITED = (WRRA_CONFIG_INDEX==1 );
|
** PROPOGATE_NEQ1 = (WRRA_CONFIG_INDEX==2 );
|
** PROPOGATE_NEQ1 = (WRRA_CONFIG_INDEX==2 );
|
** PROPOGATE_NEQ2 = (WRRA_CONFIG_INDEX==3 );
|
** PROPOGATE_NEQ2 = (WRRA_CONFIG_INDEX==3 );
|
*****************************************************************/
|
*****************************************************************/
|
|
|
|
`include "pronoc_def.v"
|
|
|
module wrra #(
|
module wrra #(
|
parameter ARBITER_WIDTH = 8,
|
parameter ARBITER_WIDTH = 8,
|
parameter WEIGHTw = 4, // maximum weight size in bits
|
parameter WEIGHTw = 4, // maximum weight size in bits
|
parameter EXT_P_EN = 1
|
parameter EXT_P_EN = 1
|
|
|
Line 217... |
Line 219... |
input [WEIGHTw-1 : 0] weight_i;
|
input [WEIGHTw-1 : 0] weight_i;
|
input reset,clk,decr,load_i;
|
input reset,clk,decr,load_i;
|
output out;
|
output out;
|
wire [WEIGHTw-1 : 0] weight;
|
wire [WEIGHTw-1 : 0] weight;
|
|
|
reg [WEIGHTw-1 : 0] counter,counter_next;
|
reg [WEIGHTw-1 : 0] counter_next;
|
|
wire [WEIGHTw-1 : 0] counter;
|
wire couner_zero, load;
|
wire couner_zero, load;
|
|
|
assign couner_zero = counter == {WEIGHTw{1'b0}};
|
assign couner_zero = counter == {WEIGHTw{1'b0}};
|
assign load = (counter > weight_i) | load_i;
|
assign load = (counter > weight_i) | load_i;
|
assign out = couner_zero;
|
assign out = couner_zero;
|
Line 231... |
Line 234... |
if(load) counter_next = weight- 1'b1 ;
|
if(load) counter_next = weight- 1'b1 ;
|
if(decr) counter_next = (couner_zero)? weight-1'b1 : counter - 1'b1; // if the couner has zero value then the load is active not decrese
|
if(decr) counter_next = (couner_zero)? weight-1'b1 : counter - 1'b1; // if the couner has zero value then the load is active not decrese
|
|
|
end
|
end
|
|
|
|
pronoc_register #(.W(WEIGHTw)) reg2 (.in(counter_next ), .out(counter), .reset(reset), .clk(clk));
|
`ifdef SYNC_RESET_MODE
|
|
always @ (posedge clk )begin
|
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if (reset)begin
|
|
counter<= {WEIGHTw{1'b0}};
|
|
end else begin
|
|
counter <= counter_next;
|
|
end //else
|
|
end //always
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endmodule
|
endmodule
|
Line 276... |
Line 266... |
input [WEIGHTw-1 : 0] weight_i;
|
input [WEIGHTw-1 : 0] weight_i;
|
input reset,clk,decr,load_i;
|
input reset,clk,decr,load_i;
|
output out;
|
output out;
|
wire [WEIGHTw-1 : 0] weight;
|
wire [WEIGHTw-1 : 0] weight;
|
|
|
reg [WEIGHTw-1 : 0] counter,counter_next;
|
reg [WEIGHTw-1 : 0] counter_next;
|
|
wire [WEIGHTw-1 : 0] counter;
|
wire couner_zero, load;
|
wire couner_zero, load;
|
|
|
assign couner_zero = counter == {WEIGHTw{1'b0}};
|
assign couner_zero = counter == {WEIGHTw{1'b0}};
|
assign load = (counter > weight_i) | load_i;
|
assign load = (counter > weight_i) | load_i;
|
assign out = couner_zero;
|
assign out = couner_zero;
|
Line 290... |
Line 281... |
if(load) counter_next = weight- 1'b1 ;
|
if(load) counter_next = weight- 1'b1 ;
|
if(decr && !couner_zero) counter_next = counter - 1'b1; // if the couner has zero value then the load is active not decrese
|
if(decr && !couner_zero) counter_next = counter - 1'b1; // if the couner has zero value then the load is active not decrese
|
|
|
end
|
end
|
|
|
|
pronoc_register #(.W(WEIGHTw)) reg2 (.in(counter_next ), .out(counter), .reset(reset), .clk(clk));
|
`ifdef SYNC_RESET_MODE
|
|
always @ (posedge clk )begin
|
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if (reset)begin
|
|
counter<= {WEIGHTw{1'b0}};
|
|
end else begin
|
|
counter <= counter_next;
|
|
end //else
|
|
end //always
|
|
|
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
Line 413... |
Line 392... |
oport_weight[i]= {W{1'b0}};
|
oport_weight[i]= {W{1'b0}};
|
end
|
end
|
assign oports_weight [(i+1)*W-1 : i*W] = {W{1'b0}};
|
assign oports_weight [(i+1)*W-1 : i*W] = {W{1'b0}};
|
end else begin :else1
|
end else begin :else1
|
|
|
`ifdef SYNC_RESET_MODE
|
|
always @ (posedge clk )begin
|
always @ (`pronoc_clk_reset_edge )begin
|
`else
|
if(`pronoc_reset) begin
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
oport_weight_counter[i]<=INIT_WEIGHT;
|
oport_weight_counter[i]<=INIT_WEIGHT;
|
end else begin
|
end else begin
|
if (weight_dcrease_en && counter_is_reset) oport_weight_counter[i]<= INIT_WEIGHT;
|
if (weight_dcrease_en && counter_is_reset) oport_weight_counter[i]<= INIT_WEIGHT;
|
else if (weight_dcrease_en && dest_port[i] && oport_weight_counter[i] != {W{1'b1}} )oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
else if (weight_dcrease_en && dest_port[i] && oport_weight_counter[i] != {W{1'b1}} )oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
end
|
end
|
end //always
|
end //always
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
oport_weight[i]<={W{1'b0}};
|
oport_weight[i]<={W{1'b0}};
|
end else begin
|
end else begin
|
if (weight_dcrease_en && counter_is_reset) oport_weight[i]<= oport_weight_counter[i]; //capture oweight counters
|
if (weight_dcrease_en && counter_is_reset) oport_weight[i]<= oport_weight_counter[i]; //capture oweight counters
|
end
|
end
|
end //always
|
end //always
|
Line 466... |
Line 438... |
oport_weight[i]<= {W{1'b0}};
|
oport_weight[i]<= {W{1'b0}};
|
end
|
end
|
assign oports_weight [(i+1)*W-1 : i*W] = {W{1'b0}};
|
assign oports_weight [(i+1)*W-1 : i*W] = {W{1'b0}};
|
end else begin :else1
|
end else begin :else1
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
oport_weight_counter[i]<= INIT_WEIGHT;
|
oport_weight_counter[i]<= INIT_WEIGHT;
|
end else begin
|
end else begin
|
if (weight_dcrease_en && counter_is_reset) oport_weight_counter[i]<= INIT_WEIGHT;
|
if (weight_dcrease_en && counter_is_reset) oport_weight_counter[i]<= INIT_WEIGHT;
|
else if (weight_dcrease_en && dest_port[i] && oport_weight_counter[i] <MAX_WEIGHT )oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
else if (weight_dcrease_en && dest_port[i] && oport_weight_counter[i] <MAX_WEIGHT )oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
end
|
end
|
end //always
|
end //always
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
oport_weight[i]<={W{1'b0}};
|
oport_weight[i]<={W{1'b0}};
|
end else begin
|
end else begin
|
if(oport_weight[i]>iport_weight) oport_weight[i]<=iport_weight;// weight counter should always be smaller than iport weight
|
if(oport_weight[i]>iport_weight) oport_weight[i]<=iport_weight;// weight counter should always be smaller than iport weight
|
else if (weight_dcrease_en)begin
|
else if (weight_dcrease_en)begin
|
if( counter_is_reset ) begin
|
if( counter_is_reset ) begin
|
oport_weight[i]<= (oport_weight_counter[i]>0)? oport_weight_counter[i]: 1;
|
oport_weight[i]<= (oport_weight_counter[i]>0)? oport_weight_counter[i]: 1;
|
end//counter_reset
|
end//counter_reset
|
else begin
|
else begin
|
if (oport_weight_counter[i]>0 && oport_weight[i] < oport_weight_counter[i]) oport_weight[i]<= oport_weight_counter[i];
|
if (oport_weight_counter[i]>0 && oport_weight[i] < oport_weight_counter[i]) oport_weight[i]<= oport_weight_counter[i];
|
|
|
|
|
end
|
end
|
end//weight_dcr
|
end//weight_dcr
|
|
|
end//else reset
|
end//else reset
|
end //always
|
end //always
|
|
|
assign oports_weight [(i+1)*W-1 : i*W] = oport_weight[i];
|
assign oports_weight [(i+1)*W-1 : i*W] = oport_weight[i];
|
end //else
|
end //else
|
|
|
|
|
|
|
end //for
|
end //for
|
|
|
|
|
end
|
end
|
|
|
|
|
|
|
|
|
Line 877... |
Line 836... |
assign tail_flit_is_sent = (flit_out_wr_all & flit_out_is_tail);
|
assign tail_flit_is_sent = (flit_out_wr_all & flit_out_is_tail);
|
assign any_tail_is_sent = | tail_flit_is_sent;
|
assign any_tail_is_sent = | tail_flit_is_sent;
|
for (i=0; i<P; i=i+1) begin : lp
|
for (i=0; i<P; i=i+1) begin : lp
|
assign flit_out_is_tail[i] = flit_out_all[(i+1)*Fw-2];
|
assign flit_out_is_tail[i] = flit_out_all[(i+1)*Fw-2];
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
oport_weight_counter[i]<=INIT_WEIGHT;
|
oport_weight_counter[i]<=INIT_WEIGHT;
|
end else begin
|
end else begin
|
if (any_tail_is_sent && capture_o_weights) oport_weight_counter[i]<= INIT_WEIGHT;
|
if (any_tail_is_sent && capture_o_weights) oport_weight_counter[i]<= INIT_WEIGHT;
|
else if (any_tail_is_sent && tail_flit_is_sent[i] && oport_weight_counter[i] != {W{1'b1}})oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
else if (any_tail_is_sent && tail_flit_is_sent[i] && oport_weight_counter[i] != {W{1'b1}})oport_weight_counter[i]<= oport_weight_counter[i] +1'b1;
|
end
|
end
|
end //always
|
end //always
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
limited_oport_weight[i]<={W{1'b0}};
|
limited_oport_weight[i]<={W{1'b0}};
|
end else begin
|
end else begin
|
if (any_tail_is_sent && capture_o_weights) limited_oport_weight[i]<= oport_weight_counter[i]; //capture oweight counters
|
if (any_tail_is_sent && capture_o_weights) limited_oport_weight[i]<= oport_weight_counter[i]; //capture oweight counters
|
end
|
end
|
end //always
|
end //always
|
|
|
assign limited_oports_weight [(i+1)*W-1 : i*W] = limited_oport_weight[i];
|
assign limited_oports_weight [(i+1)*W-1 : i*W] = limited_oport_weight[i];
|
|
|
|
|
end
|
end
|
//all input wights summation
|
//all input wights summation
|
Line 1074... |
Line 1026... |
always @ (*) begin
|
always @ (*) begin
|
contention= contention_out;
|
contention= contention_out;
|
end
|
end
|
|
|
end else if(ADD_PIPREG_AFTER_CROSSBAR==1)begin : add_reg
|
end else if(ADD_PIPREG_AFTER_CROSSBAR==1)begin : add_reg
|
`ifdef SYNC_RESET_MODE
|
|
always @ (posedge clk )begin
|
always @ (`pronoc_clk_reset_edge )begin
|
`else
|
if(`pronoc_reset) begin
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
contention<={W{1'b0}};
|
contention<={W{1'b0}};
|
end else begin
|
end else begin
|
contention<= contention_in;
|
contention<= contention_in;
|
end
|
end
|
end
|
end//always
|
|
|
|
|
end else begin : no_reg
|
end else begin : no_reg
|
always @ (*) begin
|
always @ (*) begin
|
contention= contention_in;
|
contention= contention_in;
|
end
|
end
|
end
|
end
|
Line 1151... |
Line 1102... |
end
|
end
|
end
|
end
|
end
|
end
|
|
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
counter = {WEIGHTw{1'b0}};
|
counter = {WEIGHTw{1'b0}};
|
weight_out = {WEIGHTw{1'b0}};
|
weight_out = {WEIGHTw{1'b0}};
|
end else begin
|
end else begin
|
counter = counter_next;
|
counter = counter_next;
|
weight_out = weight_out_next;
|
weight_out = weight_out_next;
|
end
|
end
|
end
|
end//always
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|