Skip to content

Commit

Permalink
[prim] Add mubix_logic_test_true_strict function
Browse files Browse the repository at this point in the history
- this function is similar to mubix_test_true_strict, but takes a logic
  as input instead of a mubix_t type.

Signed-off-by: Martin Velay <[email protected]>
  • Loading branch information
martin-velay committed Mar 6, 2025
1 parent 31ac30b commit 2ce39b3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 9 deletions.
72 changes: 64 additions & 8 deletions hw/ip/prim/rtl/prim_mubi_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ package prim_mubi_pkg;
return (val ? MuBi4True : MuBi4False);
endfunction : mubi4_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi4_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi4_test_true_strict(mubi4_t val);
return MuBi4True == val;
endfunction : mubi4_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi4_logic_test_true_strict(logic [3:0] val);
return MuBi4True === val;
endfunction : mubi4_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -169,13 +176,20 @@ package prim_mubi_pkg;
return (val ? MuBi8True : MuBi8False);
endfunction : mubi8_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi8_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi8_test_true_strict(mubi8_t val);
return MuBi8True == val;
endfunction : mubi8_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi8_logic_test_true_strict(logic [7:0] val);
return MuBi8True === val;
endfunction : mubi8_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -301,13 +315,20 @@ package prim_mubi_pkg;
return (val ? MuBi12True : MuBi12False);
endfunction : mubi12_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi12_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi12_test_true_strict(mubi12_t val);
return MuBi12True == val;
endfunction : mubi12_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi12_logic_test_true_strict(logic [11:0] val);
return MuBi12True === val;
endfunction : mubi12_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -433,13 +454,20 @@ package prim_mubi_pkg;
return (val ? MuBi16True : MuBi16False);
endfunction : mubi16_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi16_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi16_test_true_strict(mubi16_t val);
return MuBi16True == val;
endfunction : mubi16_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi16_logic_test_true_strict(logic [15:0] val);
return MuBi16True === val;
endfunction : mubi16_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -565,13 +593,20 @@ package prim_mubi_pkg;
return (val ? MuBi20True : MuBi20False);
endfunction : mubi20_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi20_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi20_test_true_strict(mubi20_t val);
return MuBi20True == val;
endfunction : mubi20_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi20_logic_test_true_strict(logic [19:0] val);
return MuBi20True === val;
endfunction : mubi20_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -697,13 +732,20 @@ package prim_mubi_pkg;
return (val ? MuBi24True : MuBi24False);
endfunction : mubi24_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi24_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi24_test_true_strict(mubi24_t val);
return MuBi24True == val;
endfunction : mubi24_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi24_logic_test_true_strict(logic [23:0] val);
return MuBi24True === val;
endfunction : mubi24_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -829,13 +871,20 @@ package prim_mubi_pkg;
return (val ? MuBi28True : MuBi28False);
endfunction : mubi28_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi28_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi28_test_true_strict(mubi28_t val);
return MuBi28True == val;
endfunction : mubi28_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi28_logic_test_true_strict(logic [27:0] val);
return MuBi28True === val;
endfunction : mubi28_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down Expand Up @@ -961,13 +1010,20 @@ package prim_mubi_pkg;
return (val ? MuBi32True : MuBi32False);
endfunction : mubi32_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi32_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi32_test_true_strict(mubi32_t val);
return MuBi32True == val;
endfunction : mubi32_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi32_logic_test_true_strict(logic [31:0] val);
return MuBi32True === val;
endfunction : mubi32_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down
9 changes: 8 additions & 1 deletion util/design/data/prim_mubi_pkg.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ from mubi import prim_mubi
return (val ? MuBi${nbits}True : MuBi${nbits}False);
endfunction : mubi${nbits}_bool_to_mubi

// Test whether the multibit value signals an "enabled" condition.
// Test whether the multibit value of type "mubi${nbits}_t" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi${nbits}_test_true_strict(mubi${nbits}_t val);
return MuBi${nbits}True == val;
endfunction : mubi${nbits}_test_true_strict

// Test whether the multibit value of type "logic vector" signals an "enabled" condition.
// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi${nbits}_logic_test_true_strict(logic [${nbits-1}:0] val);
return MuBi${nbits}True === val;
endfunction : mubi${nbits}_logic_test_true_strict

// Test whether the multibit value signals a "disabled" condition.
// The strict version of this function requires
// the multibit value to equal False.
Expand Down

0 comments on commit 2ce39b3

Please sign in to comment.