Skip to content

Commit

Permalink
SQUASHME: Address lint failures
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Williams <[email protected]>
  • Loading branch information
a-will committed Jan 19, 2024
1 parent 10fb6c6 commit cc0d7ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 63 deletions.
7 changes: 0 additions & 7 deletions hw/ip/spi_device/lint/spi_device.vlt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

`verilator_config

// The mode_i input is not currently used: we only support FwMode at the moment.
lint_off -rule UNUSED -file "*/rtl/spi_fwmode.sv" -match "Signal is not used: 'mode_i'"

// SRAM error protection is not yet implemented
lint_off -rule UNUSED -file "*/rtl/spi_fwm_rxf_ctrl.sv" -match "Signal is not used: 'sram_error'"
lint_off -rule UNUSED -file "*/rtl/spi_fwm_txf_ctrl.sv" -match "Signal is not used: 'sram_error'"

// Waive a warning caused by the fact that our "abort" register
// matches a C++ common word.
lint_off -rule SYMRSVDWORD -file "*/rtl/spi_device_reg_pkg.sv" -match "Symbol matches C++ common word: 'abort'"
Expand Down
38 changes: 1 addition & 37 deletions hw/ip/spi_device/lint/spi_device.waiver
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,17 @@ waive -rules NOT_READ -location {spi_device.sv} -regexp {Signal.*sram_base_addr.
-comment "Sram base address is given by parameter. Didn't decided if this field is used."
waive -rules NOT_READ -location {spi_device.sv} -regexp {Signal.*[rt]xf_ptr.*' is not read} \
-comment "Only lower bits are used for sram_addr but leaving the register fields flexible"
waive -rules HIER_NET_NOT_READ -location {spi_fwmode.sv} -regexp {[nN]et.*spi_mode.* is not read} \
-comment "FwMode is used. This field is used when EEPROM is implemented"
waive -rules HIER_NET_NOT_READ -location {spi_fwmode.sv} -regexp {[nN]et.*fwm_sram_error.* is not read} \
-comment "SRAM error correction code is not implemented"
waive -rules HIER_NET_NOT_READ NOT_READ -location {spi_device.sv} -regexp {.*fifo_level\..xlvl\.q} \
-comment "RXLevel and TXLevel is used only for pointer width."
waive -rules HIER_NET_NOT_READ -location {spi_device.sv} -regexp {(tl_sram_h2d|tl_i).*a_mask} \
-comment "TL SRAM adapter does not use mask"
waive -rules HIER_NET_NOT_READ NOT_READ -location {spi_device.sv} -regexp {mem_(a|b)_(rerror|addr)} \
-comment "Only portion of Memory address is used depending on SramAw parameter"

waive -rules NOT_READ -location {spi_fwm_rxf_ctrl.sv} -regexp {Signal 'ptr_cmp\[1:0\]' is not read} \
-comment "Only upper bits are used to compare FIFO full condition to avoid partial write"

waive -rules CONST_OUTPUT -location {spi_fwm_txf_ctrl.sv} -regexp {Output 'sram_w.*' is driven} \
-comment "always read operation from TX FIFO CTRL"
waive -rules CONST_OUTPUT -location {spi_fwm_*xf_ctrl.sv} -regexp {Output 'depth.*} \
-comment "Based on the SRAM size 2kB, it cannot hit the case"

waive -rules CONST_FF -location {spi_p2s.sv} \
-regexp {Flip-flop 'tx_state' is driven} \
-comment "Intended behavior"
waive -rules CONST_FF -location {spi_device.sv} -regexp {fwm_rerr_q} \
-comment "Will implement the interrupt later. Waive for now"
waive -rules CONST_FF -location {spi_fwmode.sv} -regexp {'tx_state' is driven by constant one} \
-comment "Intentionally reset to TxIdle and assign TxActive else. For CPHA=1 mode"

waive -rules TWO_STATE_TYPE -location {spi_device.sv} -regexp {'fwm_fifo_e' is of} \
-comment "Intended declaration"
waive -rules TWO_STATE_TYPE -location {spi_device.sv} \
-regexp {'sys_sram_e' is of two state type} \
-comment "Enum int unsigned is used as a index. OK to be two state"
Expand All @@ -74,23 +56,13 @@ waive -rules TWO_STATE_TYPE -location {spid_status.sv} \
-regexp {'status_bit_e' is of two state type} \
-comment "Enum status_bit_e is used as an index. OK to be two state"

waive -rules ONE_BIT_MEM_WIDTH -location {spi_device.sv spi_fwmode.sv} -regexp {Memory 'fwm_sram_.*' has word} \
-comment "Intended implementation to make it consistent with other signals"
waive -rules {ONE_BIT_MEM_WIDTH} -location {spi_device.sv} \
-regexp {Memory 'sub_(sram|p2s)_.*' has word} \
-comment "Intended implemenetation to make it consistent"

waive -rules EXPLICIT_BITLEN -location {spi_*} -regexp {for constant '1'} \
-comment "Parameter subtract is fine"

waive -rules INPUT_NOT_READ -location {spi_fwm_*xf_ctrl.sv} -regexp {Input port 'sram_error' is not read} \
-comment "Sram error protection is not yet implemented"
waive -rules INPUT_NOT_READ -location {spi_fwmode.sv} -regexp {Input port 'mode_i' is not read} \
-comment "Only FwMode is used at this moment"

waive -rules CONST_FF -location {spi_device.sv} -msg {Flip-flop 'fwm_rxerr_q' is driven by constant zero} \
-comment "This is an unimplemented error signal which is currently tied to 0."

# intentional terminal states
waive -rules TERMINAL_STATE -location {spi_cmdparse.sv} -regexp {Terminal state 'St(Status|Jedec|Sfdp|ReadCmd|Upload|Addr4B|WrEn)' is detected}
waive -rules TERMINAL_STATE -location {spi_readcmd.sv} \
Expand Down Expand Up @@ -129,19 +101,11 @@ waive -rules CLOCK_MUX -location {spi_device.sv} \
-comment "ascentlint with prim generic has generated clock starting from a flop"

#### INFO
waive -rules VAR_INDEX -location {spi_fwm_rxf_ctrl.sv} -regexp {'byte_enable\[pos\]'} \
-comment "Flip-flop implemented"
waive -rules VAR_INDEX -location {spi_fwm_rxf_ctrl.sv} -regexp {'sram_[wr]data.*'} \
-comment "Flip-flop implemented"
waive -rules VAR_INDEX -location {spi_fwm_txf_ctrl.sv} -regexp {'fifo_wdata_d.*'} \
-comment "fifo_data_d is latched to fifo_data[7:0]"
waive -rules CASE_INC -location {spi_fwm_*xf_ctrl.sv} -regexp {Case statement tag not} \
-comment "Enum type is used for state machine"

#### NOT used
#### For the convenience of the design, below signals are intentionally unused
waive -rules {NOT_USED NOT_READ} -location {spi_device.sv} \
-regexp {'sub_(sram|p2s)_.*\[1\]' is not (used|read)} \
-regexp {'sub_(sram|p2s)_.*\[0\]' is not (used|read)} \
-comment "CmdParse does not have SRAM intf"

#### Intented Terminal States
Expand Down
8 changes: 1 addition & 7 deletions hw/ip/spi_device/rtl/spi_device.sv
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ module spi_device

import spi_device_pkg::*;

localparam int FifoWidth = $bits(spi_byte_t);
localparam int FifoDepth = 8; // 2 DWords
localparam int SDW = $clog2(SramDw/FifoWidth);
localparam int PtrW = SramAw + 1 + SDW;
localparam int AsFifoDepthW = $clog2(FifoDepth+1);

localparam int unsigned ReadBufferDepth = spi_device_pkg::SramMsgDepth;
localparam int unsigned BufferAw = $clog2(ReadBufferDepth);

Expand Down Expand Up @@ -604,7 +598,7 @@ module spi_device
) u_clk_spi_in_mux (
.clk0_i(clk_spi_in),
.clk1_i(scan_clk_i),
.sel_i(prim_mubi_pkg::mubi4_test_true_strict(scanmode[ClkMuxSel])),
.sel_i(prim_mubi_pkg::mubi4_test_true_strict(scanmode[ClkMuxSel]) | mbist_en_i),
.clk_o(clk_spi_in_muxed)
);

Expand Down
19 changes: 7 additions & 12 deletions hw/ip/spi_device/rtl/spi_device_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,12 @@ package spi_device_pkg;
} io_mode_e;

typedef enum int unsigned {
IoModeFw = 0,
IoModeCmdParse = 1,
IoModeReadCmd = 2,
IoModeStatus = 3,
IoModeJedec = 4,
IoModeUpload = 5,
IoModeEnd = 6 // Indicate of Length
IoModeCmdParse = 0,
IoModeReadCmd = 1,
IoModeStatus = 2,
IoModeJedec = 3,
IoModeUpload = 4,
IoModeEnd = 5 // Indicate of Length
} sub_io_mode_e;

// SPI Line Mode (Mode0 <-> Mode3)
Expand Down Expand Up @@ -484,14 +483,10 @@ package spi_device_pkg;
parameter int unsigned BitCntW = $clog2(BitLength + 1);

// spi device scanmode usage
typedef enum logic [3:0] {
typedef enum logic [2:0] {
ClkInvSel,
CsbRstMuxSel,
TxRstMuxSel,
RxRstMuxSel,
ClkMuxSel,
ClkSramSel,
RstSramSel,
TpmRstSel,
ScanModeUseLast
} scan_mode_e;
Expand Down

0 comments on commit cc0d7ec

Please sign in to comment.