From 0cb7fb14f8ae722ec072677f457bcb4e7003d8ec Mon Sep 17 00:00:00 2001 From: Stefan Mach Date: Wed, 12 Jun 2019 17:21:48 +0200 Subject: [PATCH 1/3] :space_invader: Don't cares no longer tied to X by default The value can now be set by changing `fpnew_pkg::DONT_CARE`, default is `'1`. --- docs/CHANGELOG.md | 4 +++- src/fpnew_cast_multi.sv | 26 +++++++++++++------------- src/fpnew_fma.sv | 12 ++++++------ src/fpnew_fma_multi.sv | 32 ++++++++++++++++---------------- src/fpnew_i2fcast.sv | 2 +- src/fpnew_noncomp.sv | 14 +++++++------- src/fpnew_opgroup_block.sv | 4 ++-- src/fpnew_pkg.sv | 5 +++++ src/fpnew_rounding.sv | 4 ++-- 9 files changed, 55 insertions(+), 48 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 143961cb..4e3f6029 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,8 +12,10 @@ Versions of the IP in the same major relase are "pin-compatible" with each other ### Added ### Changed -### Fixed +- Don't care logic value can be changed from the package now +### Fixed +- Don't care values are assigned `'1` instead of `'X` by default ## [0.5.5] - 2019-06-02 diff --git a/src/fpnew_cast_multi.sv b/src/fpnew_cast_multi.sv index 59ed94c2..dae8bd51 100644 --- a/src/fpnew_cast_multi.sv +++ b/src/fpnew_cast_multi.sv @@ -199,11 +199,11 @@ module fpnew_cast_multi #( // Compensation for the difference in mantissa widths used for leading-zero count assign fmt_shift_compensation[fmt] = signed'(INT_MAN_WIDTH - 1 - MAN_BITS); end else begin : inactive_format - assign info_q[fmt] = 'X; // propagate don't care (format disabled) - assign fmt_sign[fmt] = 'x; // propagate don't care (format disabled) - assign fmt_exponent[fmt] = 'X; // propagate don't care (format disabled) - assign fmt_mantissa[fmt] = 'X; // propagate don't care (format disabled) - assign fmt_shift_compensation[fmt] = 'X; // propagate don't care (format disabled) + assign info_q[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled + assign fmt_sign[fmt] = fpnew_pkg::DONT_CARE; // format disabled + assign fmt_exponent[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled + assign fmt_mantissa[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled + assign fmt_shift_compensation[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled end end @@ -219,7 +219,7 @@ module fpnew_cast_multi #( ifmt_input_val[ifmt][INT_WIDTH-1:0] = operands_q[INT_WIDTH-1:0]; end end else begin : inactive_format - assign ifmt_input_val[ifmt] = 'X; // don't care about disabled formats + assign ifmt_input_val[ifmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled end end @@ -492,7 +492,7 @@ module fpnew_cast_multi #( fmt_pre_round_abs[fmt] = {final_exp[EXP_BITS-1:0], final_mant[MAN_BITS-1:0]}; // 0-extend end end else begin : inactive_format - assign fmt_pre_round_abs[fmt] = 'X; + assign fmt_pre_round_abs[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -508,7 +508,7 @@ module fpnew_cast_multi #( ifmt_pre_round_abs[ifmt][INT_WIDTH-1:0] = final_int[INT_WIDTH-1:0]; end end else begin : inactive_format - assign ifmt_pre_round_abs[ifmt] = 'X; + assign ifmt_pre_round_abs[ifmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -550,9 +550,9 @@ module fpnew_cast_multi #( : {rounded_sign, rounded_abs[EXP_BITS+MAN_BITS-1:0]}; end end else begin : inactive_format - assign fmt_uf_after_round[fmt] = 'X; - assign fmt_of_after_round[fmt] = 'X; - assign fmt_result[fmt] = 'X; + assign fmt_uf_after_round[fmt] = fpnew_pkg::DONT_CARE; + assign fmt_of_after_round[fmt] = fpnew_pkg::DONT_CARE; + assign fmt_result[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -596,7 +596,7 @@ module fpnew_cast_multi #( fmt_special_result[fmt][FP_WIDTH-1:0] = special_res; end end else begin : inactive_format - assign fmt_special_result[fmt] = 'X; + assign fmt_special_result[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -642,7 +642,7 @@ module fpnew_cast_multi #( ifmt_special_result[ifmt][INT_WIDTH-1:0] = special_res; end end else begin : inactive_format - assign ifmt_special_result[ifmt] = 'X; + assign ifmt_special_result[ifmt] = '{default: fpnew_pkg::DONT_CARE}; end end diff --git a/src/fpnew_fma.sv b/src/fpnew_fma.sv index 934da213..256d7f36 100644 --- a/src/fpnew_fma.sv +++ b/src/fpnew_fma.sv @@ -199,12 +199,12 @@ module fpnew_fma #( info_c = '{is_zero: 1'b1, is_boxed: 1'b1, default: 1'b0}; //zero, boxed value. end default: begin // propagate don't cares - operand_a = 'X; - operand_b = 'X; - operand_c = 'X; - info_a = 'X; - info_b = 'X; - info_c = 'X; + operand_a = '{default: fpnew_pkg::DONT_CARE}; + operand_b = '{default: fpnew_pkg::DONT_CARE}; + operand_c = '{default: fpnew_pkg::DONT_CARE}; + info_a = '{default: fpnew_pkg::DONT_CARE}; + info_b = '{default: fpnew_pkg::DONT_CARE}; + info_c = '{default: fpnew_pkg::DONT_CARE}; end endcase end diff --git a/src/fpnew_fma_multi.sv b/src/fpnew_fma_multi.sv index 63370d0a..26817f4a 100644 --- a/src/fpnew_fma_multi.sv +++ b/src/fpnew_fma_multi.sv @@ -194,10 +194,10 @@ module fpnew_fma_multi #( (SUPER_MAN_BITS - MAN_BITS); // move to left of mantissa end end else begin : inactive_format - assign info_q[fmt] = 'X; // propagate don't care (format disabled) - assign fmt_sign[fmt] = 'x; // propagate don't care (format disabled) - assign fmt_exponent[fmt] = 'X; // propagate don't care (format disabled) - assign fmt_mantissa[fmt] = 'X; // propagate don't care (format disabled) + assign info_q[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled + assign fmt_sign[fmt] = fpnew_pkg::DONT_CARE; // format disabled + assign fmt_exponent[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled + assign fmt_mantissa[fmt] = '{default: fpnew_pkg::DONT_CARE}; // format disabled end end @@ -241,12 +241,12 @@ module fpnew_fma_multi #( info_c = '{is_zero: 1'b1, is_boxed: 1'b1, default: 1'b0}; //zero, boxed value. end default: begin // propagate don't cares - operand_a = 'X; - operand_b = 'X; - operand_c = 'X; - info_a = 'X; - info_b = 'X; - info_c = 'X; + operand_a = '{default: fpnew_pkg::DONT_CARE}; + operand_b = '{default: fpnew_pkg::DONT_CARE}; + operand_c = '{default: fpnew_pkg::DONT_CARE}; + info_a = '{default: fpnew_pkg::DONT_CARE}; + info_b = '{default: fpnew_pkg::DONT_CARE}; + info_c = '{default: fpnew_pkg::DONT_CARE}; end endcase end @@ -332,7 +332,7 @@ module fpnew_fma_multi #( fmt_special_result[fmt][FP_WIDTH-1:0] = special_res; end end else begin : inactive_format - assign fmt_special_result[fmt] = 'X; + assign fmt_special_result[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -689,8 +689,8 @@ module fpnew_fma_multi #( assign fmt_round_sticky_bits[fmt][0] = sticky_after_norm | of_before_round; end end else begin : inactive_format - assign fmt_pre_round_abs[fmt] = 'X; - assign fmt_round_sticky_bits[fmt] = 'X; + assign fmt_pre_round_abs[fmt] = '{default: fpnew_pkg::DONT_CARE}; + assign fmt_round_sticky_bits[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end @@ -734,9 +734,9 @@ module fpnew_fma_multi #( fmt_result[fmt][FP_WIDTH-1:0] = {rounded_sign, rounded_abs[EXP_BITS+MAN_BITS-1:0]}; end end else begin : inactive_format - assign fmt_uf_after_round[fmt] = 'X; - assign fmt_of_after_round[fmt] = 'X; - assign fmt_result[fmt] = 'X; + assign fmt_uf_after_round[fmt] = fpnew_pkg::DONT_CARE; + assign fmt_of_after_round[fmt] = fpnew_pkg::DONT_CARE; + assign fmt_result[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end diff --git a/src/fpnew_i2fcast.sv b/src/fpnew_i2fcast.sv index 6a7cda8a..56176cdd 100644 --- a/src/fpnew_i2fcast.sv +++ b/src/fpnew_i2fcast.sv @@ -94,7 +94,7 @@ module fpnew_i2fcast #( .clk_i, .rst_ni, .operands_i, - .is_boxed_i ( 'X ), // unused + .is_boxed_i ( '{default: fpnew_pkg::DONT_CARE} ), // unused .rnd_mode_i, .op_i ( fpnew_pkg::FMADD ), // unused .op_mod_i, diff --git a/src/fpnew_noncomp.sv b/src/fpnew_noncomp.sv index bdfebf8c..af23b8c8 100644 --- a/src/fpnew_noncomp.sv +++ b/src/fpnew_noncomp.sv @@ -187,7 +187,7 @@ module fpnew_noncomp #( fpnew_pkg::RTZ: sgnj_result.sign = ~sign_b; // SGNJN fpnew_pkg::RDN: sgnj_result.sign = sign_a ^ sign_b; // SGNJX fpnew_pkg::RUP: sgnj_result = operand_a; // passthrough - default: sgnj_result = 'X; // propagate X + default: sgnj_result = '{default: fpnew_pkg::DONT_CARE}; // don't care endcase end @@ -223,7 +223,7 @@ module fpnew_noncomp #( unique case (rnd_mode_q) fpnew_pkg::RNE: minmax_result = operand_a_smaller ? operand_a : operand_b; // MIN fpnew_pkg::RTZ: minmax_result = operand_a_smaller ? operand_b : operand_a; // MAX - default: minmax_result = 'X; // propagate X + default: minmax_result = '{default: fpnew_pkg::DONT_CARE}; // don't care endcase end end @@ -262,7 +262,7 @@ module fpnew_noncomp #( if (any_operand_nan) cmp_result = op_mod_q; // NaNs are valid, always campare as not equal else cmp_result = operands_equal ^ op_mod_q; end - default: cmp_result = 'X; // propagate X + default: cmp_result = '{default: fpnew_pkg::DONT_CARE}; // don't care endcase end end @@ -323,14 +323,14 @@ module fpnew_noncomp #( extension_bit_d = cmp_extension_bit; end fpnew_pkg::CLASSIFY: begin - result_d = 'X; // unused + result_d = '{default: fpnew_pkg::DONT_CARE}; // unused status_d = class_status; extension_bit_d = class_extension_bit; end default: begin - result_d = 'X; // propaagate X - status_d = 'X; // propaagate X - extension_bit_d = 'X; // propaagate X + result_d = '{default: fpnew_pkg::DONT_CARE}; // dont care + status_d = '{default: fpnew_pkg::DONT_CARE}; // dont care + extension_bit_d = fpnew_pkg::DONT_CARE; // dont care end endcase end diff --git a/src/fpnew_opgroup_block.sv b/src/fpnew_opgroup_block.sv index 03fcc78a..d5f71a69 100644 --- a/src/fpnew_opgroup_block.sv +++ b/src/fpnew_opgroup_block.sv @@ -128,7 +128,7 @@ module fpnew_opgroup_block #( assign fmt_out_valid[fmt] = 1'b0; // don't emit values assign fmt_busy[fmt] = 1'b0; // never busy // Outputs are don't care - assign fmt_outputs[fmt] = 'X; + assign fmt_outputs[fmt] = '{default: fpnew_pkg::DONT_CARE}; // Tie off disabled formats end else if (!FpFmtMask[fmt] || (FmtUnitTypes[fmt] == fpnew_pkg::DISABLED)) begin : disable_fmt @@ -136,7 +136,7 @@ module fpnew_opgroup_block #( assign fmt_out_valid[fmt] = 1'b0; // don't emit values assign fmt_busy[fmt] = 1'b0; // never busy // Outputs are don't care - assign fmt_outputs[fmt] = 'X; + assign fmt_outputs[fmt] = '{default: fpnew_pkg::DONT_CARE}; end end diff --git a/src/fpnew_pkg.sv b/src/fpnew_pkg.sv index ab3da7c1..7d68acfe 100644 --- a/src/fpnew_pkg.sv +++ b/src/fpnew_pkg.sv @@ -270,6 +270,11 @@ package fpnew_pkg; PipeConfig: AFTER }; + // ----------------------- + // Synthesis optimization + // ----------------------- + localparam logic DONT_CARE = 1'b1; // the value to assign as don't care + // ------------------------- // General helper functions // ------------------------- diff --git a/src/fpnew_rounding.sv b/src/fpnew_rounding.sv index b4ba62f6..60f63bb7 100644 --- a/src/fpnew_rounding.sv +++ b/src/fpnew_rounding.sv @@ -47,13 +47,13 @@ module fpnew_rounding #( 2'b01: round_up = 1'b0; // < ulp/2 away, round down 2'b10: round_up = abs_value_i[0]; // = ulp/2 away, round towards even result 2'b11: round_up = 1'b1; // > ulp/2 away, round up - default: round_up = 1'bx; // propagate X + default: round_up = fpnew_pkg::DONT_CARE; endcase fpnew_pkg::RTZ: round_up = 1'b0; // always round down fpnew_pkg::RDN: round_up = (| round_sticky_bits_i) ? sign_i : 1'b0; // to 0 if +, away if - fpnew_pkg::RUP: round_up = (| round_sticky_bits_i) ? ~sign_i : 1'b0; // to 0 if -, away if + fpnew_pkg::RMM: round_up = round_sticky_bits_i[1]; // round down if < ulp/2 away, else up - default: round_up = 1'bx; // propagate x + default: round_up = fpnew_pkg::DONT_CARE; // propagate x endcase end From 300098c14a1dc92f64155c6729601eebb05276cc Mon Sep 17 00:00:00 2001 From: Stefan Mach Date: Wed, 12 Jun 2019 17:24:53 +0200 Subject: [PATCH 2/3] :books: Bump version to 0.5.6 --- docs/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4e3f6029..0ee8b59e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,12 +11,19 @@ Versions of the IP in the same major relase are "pin-compatible" with each other ## [Unreleased] ### Added +### Changed +### Fixed + + +## [0.5.6] - 2019-06-12 + ### Changed - Don't care logic value can be changed from the package now ### Fixed - Don't care values are assigned `'1` instead of `'X` by default + ## [0.5.5] - 2019-06-02 ### Fixed From 4ead3e8b1525236dc6c41d9dac9016203b3a5e87 Mon Sep 17 00:00:00 2001 From: Stefan Mach Date: Wed, 12 Jun 2019 17:29:24 +0200 Subject: [PATCH 3/3] :zap: Switch default pipeline config to BEFORE --- docs/CHANGELOG.md | 1 + src/fpnew_pkg.sv | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0ee8b59e..ddd51fca 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -19,6 +19,7 @@ Versions of the IP in the same major relase are "pin-compatible" with each other ### Changed - Don't care logic value can be changed from the package now +- Default pipeline config in the package is now `BEFORE` ### Fixed - Don't care values are assigned `'1` instead of `'X` by default diff --git a/src/fpnew_pkg.sv b/src/fpnew_pkg.sv index 7d68acfe..3d1152c3 100644 --- a/src/fpnew_pkg.sv +++ b/src/fpnew_pkg.sv @@ -258,7 +258,7 @@ package fpnew_pkg; '{default: MERGED}, // DIVSQRT '{default: PARALLEL}, // NONCOMP '{default: MERGED}}, // CONV - PipeConfig: AFTER + PipeConfig: BEFORE }; localparam fpu_implementation_t DEFAULT_SNITCH = '{ @@ -267,7 +267,7 @@ package fpnew_pkg; '{default: DISABLED}, // DIVSQRT '{default: PARALLEL}, // NONCOMP '{default: MERGED}}, // CONV - PipeConfig: AFTER + PipeConfig: BEFORE }; // -----------------------