[prim_secded] Use _i/_o suffix for port names
The SECDED primitives did use `in` and `out` as port names, which isn't
matching our style guide, which mandates the use of `_i` and `_o`
suffixes. Change the definition and all instantiations to use `data_i`
and `data_o` instead.
The motivation to change this wasn't so much me being
style-guide-pedantic, but more the fact that `in` is a keyword in Python
and I couldn't easily use cocotb to write to the signal for a one-off
testbench.
(We do have a circular dependency between Ibex and the OpenTitan
repository in this regard, making it necessary to temporarily patch the
vendored-in Ibex. I'll remove that once this patch lands.)
Signed-off-by: Philipp Wagner <phw@lowrisc.org>
diff --git a/util/design/secded_gen.py b/util/design/secded_gen.py
index 0178f2e..98ec4b6 100755
--- a/util/design/secded_gen.py
+++ b/util/design/secded_gen.py
@@ -106,20 +106,20 @@
module_name = "prim_secded%s_%d_%d" % (suffix, n, k)
outstr = '''
- function automatic logic [{}:0] {}_enc (logic [{}:0] in);
- logic [{}:0] out;
-{} return out;
+ function automatic logic [{}:0] {}_enc (logic [{}:0] data_i);
+ logic [{}:0] data_o;
+{} return data_o;
endfunction
- function automatic {} {}_dec (logic [{}:0] in);
- logic [{}:0] d_o;
+ function automatic {} {}_dec (logic [{}:0] data_i);
+ logic [{}:0] data_o;
logic [{}:0] syndrome_o;
logic [1:0] err_o;
{} dec;
{}
- dec.data = d_o;
+ dec.data = data_o;
dec.syndrome = syndrome_o;
dec.err = err_o;
return dec;
@@ -132,8 +132,8 @@
def print_enc(n, k, m, codes):
- outstr = " out = {}'(in);\n".format(n)
- format_str = " out[{}] = ^(out & " + str(n) + "'h{:0" + str(
+ outstr = " data_o = {}'(data_i);\n".format(n)
+ format_str = " data_o[{}] = ^(data_o & " + str(n) + "'h{:0" + str(
(n + 3) // 4) + "X});\n"
# Print parity computation
for j, mask in enumerate(calc_bitmasks(k, m, codes, False)):
@@ -158,7 +158,7 @@
outstr += "\n"
outstr += " {}// Syndrome calculation\n".format(
preamble if print_type == "function" else "")
- format_str = " {}".format(preamble) + "syndrome_o[{}] = ^(in & " \
+ format_str = " {}".format(preamble) + "syndrome_o[{}] = ^(data_i & " \
+ str(n) + "'h{:0" + str((n + 3) // 4) + "X});\n"
# Print syndrome computation
@@ -168,7 +168,7 @@
outstr += " {}// Corrected output calculation\n".format(
preamble if print_type == "function" else "")
for i in range(k):
- outstr += " {}".format(preamble) + "d_o[%d] = (syndrome_o == %d'h%x) ^ in[%d];\n" % (
+ outstr += " {}".format(preamble) + "data_o[%d] = (syndrome_o == %d'h%x) ^ data_i[%d];\n" % (
i, m, calc_syndrome(codes[i]), i)
outstr += "\n"
outstr += " {}// err_o calc. bit0: single error, bit1: double error\n".format(
@@ -414,8 +414,8 @@
outstr = '''{}// SECDED encoder generated by util/design/secded_gen.py
module {}_enc (
- input [{}:0] in,
- output logic [{}:0] out
+ input [{}:0] data_i,
+ output logic [{}:0] data_o
);
always_comb begin : p_encode
@@ -431,8 +431,8 @@
outstr = '''{}// SECDED decoder generated by util/design/secded_gen.py
module {}_dec (
- input [{}:0] in,
- output logic [{}:0] d_o,
+ input [{}:0] data_i,
+ output logic [{}:0] data_o,
output logic [{}:0] syndrome_o,
output logic [1:0] err_o
);
@@ -453,8 +453,8 @@
module {}_fpv (
input clk_i,
input rst_ni,
- input [{}:0] in,
- output logic [{}:0] d_o,
+ input [{}:0] data_i,
+ output logic [{}:0] data_o,
output logic [{}:0] syndrome_o,
output logic [1:0] err_o,
input [{}:0] error_inject_i
@@ -463,13 +463,13 @@
logic [{}:0] data_enc;
{}_enc {}_enc (
- .in,
- .out(data_enc)
+ .data_i,
+ .data_o(data_enc)
);
{}_dec {}_dec (
- .in(data_enc ^ error_inject_i),
- .d_o,
+ .data_i(data_enc ^ error_inject_i),
+ .data_o,
.syndrome_o,
.err_o
);
@@ -485,8 +485,8 @@
module {}_assert_fpv (
input clk_i,
input rst_ni,
- input [{}:0] in,
- input [{}:0] d_o,
+ input [{}:0] data_i,
+ input [{}:0] data_o,
input [{}:0] syndrome_o,
input [1:0] err_o,
input [{}:0] error_inject_i
@@ -495,7 +495,7 @@
// Inject a maximum of two errors simultaneously.
`ASSUME_FPV(MaxTwoErrors_M, $countones(error_inject_i) <= 2)
// This bounds the input data state space to make sure the solver converges.
- `ASSUME_FPV(DataLimit_M, $onehot0(in) || $onehot0(~in))
+ `ASSUME_FPV(DataLimit_M, $onehot0(data_i) || $onehot0(~data_i))
// Single bit error detection
`ASSERT(SingleErrorDetect_A, $countones(error_inject_i) == 1 |-> err_o[0])
`ASSERT(SingleErrorDetectReverse_A, err_o[0] |-> $countones(error_inject_i) == 1)
@@ -503,7 +503,7 @@
`ASSERT(DoubleErrorDetect_A, $countones(error_inject_i) == 2 |-> err_o[1])
`ASSERT(DoubleErrorDetectReverse_A, err_o[1] |-> $countones(error_inject_i) == 2)
// Single bit error correction (implicitly tests the syndrome output)
- `ASSERT(SingleErrorCorrect_A, $countones(error_inject_i) < 2 |-> in == d_o)
+ `ASSERT(SingleErrorCorrect_A, $countones(error_inject_i) < 2 |-> in == data_o)
// Basic syndrome check
`ASSERT(SyndromeCheck_A, |syndrome_o |-> $countones(error_inject_i) > 0)
`ASSERT(SyndromeCheckReverse_A, $countones(error_inject_i) > 0 |-> |syndrome_o)
@@ -522,8 +522,8 @@
{}_assert_fpv {}_assert_fpv (
.clk_i,
.rst_ni,
- .in,
- .d_o,
+ .data_i,
+ .data_o,
.syndrome_o,
.err_o,
.error_inject_i