From b4c2a456b80246dff652d5498111bc76ee6340a7 Mon Sep 17 00:00:00 2001 From: dalance Date: Wed, 7 Aug 2024 19:10:50 +0900 Subject: [PATCH] Enable naming lint --- Veryl.toml | 21 +++++++++++++++++++++ src/lfsr/lfsr_galois.veryl | 22 +++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Veryl.toml b/Veryl.toml index 72be2f6..a53b6c7 100644 --- a/Veryl.toml +++ b/Veryl.toml @@ -10,6 +10,27 @@ repository = "https://github.com/veryl-lang/std" target = {type = "directory", path = "target/src"} exclude_std = true +[lint.naming] +case_enum = "snake" +case_function = "snake" +case_instance = "snake" +case_interface = "snake" +case_modport = "snake" +case_module = "snake" +case_package = "snake" +case_parameter = "screaming_snake" +case_port_inout = "snake" +case_port_input = "snake" +case_port_modport = "snake" +case_port_output = "snake" +case_reg = "snake" +case_struct = "snake" +case_union = "snake" +case_var = "snake" +case_wire = "snake" +prefix_port_input = "i" +prefix_port_output = "o" + [doc] path = "target/doc" diff --git a/src/lfsr/lfsr_galois.veryl b/src/lfsr/lfsr_galois.veryl index 21d7292..e49c86b 100644 --- a/src/lfsr/lfsr_galois.veryl +++ b/src/lfsr/lfsr_galois.veryl @@ -1,10 +1,10 @@ pub module lfsr_galois #( /// Size of the LFSR in bits - param SIZE : u32 = 64 , - local tapvec: type = logic, + param SIZE : u32 = 64 , + local TAPVEC_T: type = logic, /// Bit-vector representing the taps of the LFSR. /// Default values provided for `SIZE` in range [2, 64] - param TAPVEC: tapvec = case SIZE { + param TAPVEC: TAPVEC_T = case SIZE { 2 : 2'h3, 3 : 3'h5, 4 : 4'h9, @@ -88,18 +88,18 @@ pub module lfsr_galois #( assign val_next[SIZE - 1] = o_val[0]; for i in 0..(SIZE - 1) :g_taps { - local k: u32 = SIZE - 2 - i; - if TAPVEC[k] :g_tap { - assign val_next[k] = if i_set { - i_setval[k] + local K: u32 = SIZE - 2 - i; + if TAPVEC[K] :g_tap { + assign val_next[K] = if i_set { + i_setval[K] } else { - o_val[k + 1] ^ o_val[0] + o_val[K + 1] ^ o_val[0] }; } else :g_notap { - assign val_next[k] = if i_set { - i_setval[k] + assign val_next[K] = if i_set { + i_setval[K] } else { - o_val[k + 1] + o_val[K + 1] }; } }