aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2020-03-16 13:58:08 -0400
committerPaul Selkirk <paul@psgd.org>2020-03-16 13:58:08 -0400
commit62495c597ca8b60f733682661afdad9e0d3e0e2d (patch)
tree9f48320d88c6ad75ff91b909b970d289eafab131
parent465cdf0bcbbcd7f18c097beae1e9f85f9da0e04d (diff)
Increase NUM_MULTS to 32.
This required finding and fixing every function that had a baked-in assumption that NUM_MULTS=8.
-rw-r--r--rtl/modexpng_mmm_dual.v30
-rw-r--r--rtl/modexpng_parameters_x8.vh2
-rw-r--r--rtl/modexpng_recombinator_block.v68
3 files changed, 17 insertions, 83 deletions
diff --git a/rtl/modexpng_mmm_dual.v b/rtl/modexpng_mmm_dual.v
index 9346a42..fd39943 100644
--- a/rtl/modexpng_mmm_dual.v
+++ b/rtl/modexpng_mmm_dual.v
@@ -829,18 +829,8 @@ module modexpng_mmm_dual
input [NUM_MULTS_HALF_AUX-1:0] col_index_value;
input [OP_ADDR_W -1:0] narrow_xy_addr_value;
//
- if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value)
- case (narrow_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_mac_mode_z_square = {1'b1, 8'b11111110};
- 3'b001: calc_mac_mode_z_square = {1'b1, 8'b11111101};
- 3'b010: calc_mac_mode_z_square = {1'b1, 8'b11111011};
- 3'b011: calc_mac_mode_z_square = {1'b1, 8'b11110111};
- 3'b100: calc_mac_mode_z_square = {1'b1, 8'b11101111};
- 3'b101: calc_mac_mode_z_square = {1'b1, 8'b11011111};
- 3'b110: calc_mac_mode_z_square = {1'b1, 8'b10111111};
- 3'b111: calc_mac_mode_z_square = {1'b1, 8'b01111111};
- endcase
- else calc_mac_mode_z_square = {1'b1, 8'b11111111};
+ if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) calc_mac_mode_z_square = ~({{NUM_MULTS_AUX-1{1'b0}}, 1'b1} << narrow_xy_addr_value[MAC_INDEX_W-1:0]);
+ else calc_mac_mode_z_square = {NUM_MULTS_AUX{1'b1}};
endfunction
function [NUM_MULTS_AUX -1:0] calc_mac_mode_z_rectangle;
@@ -848,20 +838,8 @@ module modexpng_mmm_dual
input [NUM_MULTS_HALF_AUX -1:0] col_index_value;
input [OP_ADDR_W -1:0] narrow_xy_addr_value;
//
- begin
- if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value)
- case (narrow_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_mac_mode_z_rectangle = {1'b1, 8'b11111110};
- 3'b001: calc_mac_mode_z_rectangle = {1'b1, 8'b11111101};
- 3'b010: calc_mac_mode_z_rectangle = {1'b1, 8'b11111011};
- 3'b011: calc_mac_mode_z_rectangle = {1'b1, 8'b11110111};
- 3'b100: calc_mac_mode_z_rectangle = {1'b1, 8'b11101111};
- 3'b101: calc_mac_mode_z_rectangle = {1'b1, 8'b11011111};
- 3'b110: calc_mac_mode_z_rectangle = {1'b1, 8'b10111111};
- 3'b111: calc_mac_mode_z_rectangle = {1'b1, 8'b01111111};
- endcase
- else calc_mac_mode_z_rectangle = {1'b1, 8'b11111111};
- end
+ if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) calc_mac_mode_z_rectangle = ~({{NUM_MULTS_AUX-1{1'b0}}, 1'b1} << narrow_xy_addr_value[MAC_INDEX_W-1:0]);
+ else calc_mac_mode_z_rectangle = {NUM_MULTS_AUX{1'b1}};
endfunction
always @(posedge clk)
diff --git a/rtl/modexpng_parameters_x8.vh b/rtl/modexpng_parameters_x8.vh
index 2822d0a..f1d6395 100644
--- a/rtl/modexpng_parameters_x8.vh
+++ b/rtl/modexpng_parameters_x8.vh
@@ -31,7 +31,7 @@
//
//======================================================================
-localparam NUM_MULTS = 8;
+localparam NUM_MULTS = 32;
localparam NUM_MULTS_AUX = NUM_MULTS + 1;
localparam NUM_MULTS_HALF = NUM_MULTS / 2;
localparam NUM_MULTS_HALF_AUX = NUM_MULTS_HALF + 1;
diff --git a/rtl/modexpng_recombinator_block.v b/rtl/modexpng_recombinator_block.v
index ba440b0..ccd04ac 100644
--- a/rtl/modexpng_recombinator_block.v
+++ b/rtl/modexpng_recombinator_block.v
@@ -260,28 +260,14 @@ module modexpng_recombinator_block
//
endfunction
- //
- // TODO: This will need some generic replacement defined in modexpng_parameters.vh
- // in case anything different from NUM_MULTS = 8 is used.
- //
function [ NUM_MULTS -1:0] calc_square_triangle_bitmap_lsb;
input [COL_INDEX_W -1:0] col_index_value;
input [COL_INDEX_W -1:0] col_index_last_value;
input [BANK_ADDR_W -1:0] narrow_xy_bank_value;
input [ OP_ADDR_W -1:0] narrow_xy_addr_value;
//
- if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value)
- case (narrow_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_square_triangle_bitmap_lsb = 8'b00000001;
- 3'b001: calc_square_triangle_bitmap_lsb = 8'b00000010;
- 3'b010: calc_square_triangle_bitmap_lsb = 8'b00000100;
- 3'b011: calc_square_triangle_bitmap_lsb = 8'b00001000;
- 3'b100: calc_square_triangle_bitmap_lsb = 8'b00010000;
- 3'b101: calc_square_triangle_bitmap_lsb = 8'b00100000;
- 3'b110: calc_square_triangle_bitmap_lsb = 8'b01000000;
- 3'b111: calc_square_triangle_bitmap_lsb = 8'b10000000;
- endcase
- else calc_square_triangle_bitmap_lsb = 8'b00000000;
+ if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) calc_square_triangle_bitmap_lsb = {{NUM_MULTS-1{1'b0}}, 1'b1} << narrow_xy_addr_value[MAC_INDEX_W-1:0];
+ else calc_square_triangle_bitmap_lsb = {NUM_MULTS{1'b0}};
//
endfunction
@@ -307,18 +293,8 @@ module modexpng_recombinator_block
input [BANK_ADDR_W -1:0] narrow_xy_bank_value;
input [ OP_ADDR_W -1:0] narrow_xy_addr_value;
//
- if ((narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) && (narrow_xy_bank_value != BANK_NARROW_EXT))
- case (narrow_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_rectangle_bitmap_lsb = 8'b00000001;
- 3'b001: calc_rectangle_bitmap_lsb = 8'b00000010;
- 3'b010: calc_rectangle_bitmap_lsb = 8'b00000100;
- 3'b011: calc_rectangle_bitmap_lsb = 8'b00001000;
- 3'b100: calc_rectangle_bitmap_lsb = 8'b00010000;
- 3'b101: calc_rectangle_bitmap_lsb = 8'b00100000;
- 3'b110: calc_rectangle_bitmap_lsb = 8'b01000000;
- 3'b111: calc_rectangle_bitmap_lsb = 8'b10000000;
- endcase
- else calc_rectangle_bitmap_lsb = 8'b00000000;
+ if ((narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) && (narrow_xy_bank_value != BANK_NARROW_EXT)) calc_rectangle_bitmap_lsb = {{NUM_MULTS-1{1'b0}}, 1'b1} << narrow_xy_addr_value[MAC_INDEX_W-1:0];
+ else calc_rectangle_bitmap_lsb = {NUM_MULTS{1'b0}};
//
endfunction
@@ -335,18 +311,8 @@ module modexpng_recombinator_block
input [BANK_ADDR_W -1:0] narrow_xy_bank_value;
input [ OP_ADDR_W -1:0] narrow_xy_addr_value;
//
- if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value)
- case (narrow_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_square_triangle_index_lsb = 3'd0;
- 3'b001: calc_square_triangle_index_lsb = 3'd1;
- 3'b010: calc_square_triangle_index_lsb = 3'd2;
- 3'b011: calc_square_triangle_index_lsb = 3'd3;
- 3'b100: calc_square_triangle_index_lsb = 3'd4;
- 3'b101: calc_square_triangle_index_lsb = 3'd5;
- 3'b110: calc_square_triangle_index_lsb = 3'd6;
- 3'b111: calc_square_triangle_index_lsb = 3'd7;
- endcase
- else calc_square_triangle_index_lsb = 3'dX;
+ if (narrow_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) calc_square_triangle_index_lsb = narrow_xy_addr_value[MAC_INDEX_W-1:0];
+ else calc_square_triangle_index_lsb = {MAC_INDEX_W{1'bX}};
//
endfunction
@@ -372,18 +338,8 @@ module modexpng_recombinator_block
input [BANK_ADDR_W -1:0] slim_bram_xy_bank_value;
input [ OP_ADDR_W -1:0] slim_bram_xy_addr_value;
//
- if ((slim_bram_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) && (slim_bram_xy_bank_value != BANK_NARROW_EXT))
- case (slim_bram_xy_addr_value[MAC_INDEX_W-1:0])
- 3'b000: calc_rectangle_index_lsb = 3'd0;
- 3'b001: calc_rectangle_index_lsb = 3'd1;
- 3'b010: calc_rectangle_index_lsb = 3'd2;
- 3'b011: calc_rectangle_index_lsb = 3'd3;
- 3'b100: calc_rectangle_index_lsb = 3'd4;
- 3'b101: calc_rectangle_index_lsb = 3'd5;
- 3'b110: calc_rectangle_index_lsb = 3'd6;
- 3'b111: calc_rectangle_index_lsb = 3'd7;
- endcase
- else calc_rectangle_index_lsb = 3'dX;
+ if ((slim_bram_xy_addr_value[OP_ADDR_W-1:MAC_INDEX_W] == col_index_value) && (slim_bram_xy_bank_value != BANK_NARROW_EXT)) calc_rectangle_index_lsb = slim_bram_xy_addr_value[MAC_INDEX_W-1:0];
+ else calc_rectangle_index_lsb = {MAC_INDEX_W{1'bX}};
//
endfunction
@@ -445,8 +401,8 @@ module modexpng_recombinator_block
input [ OP_ADDR_W -1:0] narrow_xy_addr_value;
input [ OP_ADDR_W -1:0] index_last_value;
//
- if (narrow_xy_addr_value == index_last_value) calc_square_bitmap_msb = {col_index_value != col_index_last_value, 7'b1111111};
- else calc_square_bitmap_msb = 8'b00000000;
+ if (narrow_xy_addr_value == index_last_value) calc_square_bitmap_msb = {col_index_value != col_index_last_value, {NUM_MULTS-1{1'b1}}};
+ else calc_square_bitmap_msb = {NUM_MULTS{1'b0}};
//
endfunction
@@ -457,8 +413,8 @@ module modexpng_recombinator_block
input [ OP_ADDR_W -1:0] narrow_xy_addr_value;
input [ OP_ADDR_W -1:0] index_last_value;
//
- if ((narrow_xy_addr_value == OP_ADDR_ONE) && (narrow_xy_bank_value == BANK_NARROW_EXT)) calc_rectangle_bitmap_msb = 8'b11111111;
- else calc_rectangle_bitmap_msb = 8'b00000000;
+ if ((narrow_xy_addr_value == OP_ADDR_ONE) && (narrow_xy_bank_value == BANK_NARROW_EXT)) calc_rectangle_bitmap_msb = {NUM_MULTS{1'b1}};
+ else calc_rectangle_bitmap_msb = {NUM_MULTS{1'b0}};
//
endfunction