Module Definition
dashboard | hierarchy | modlist | groups | tests | asserts

Module : spid_dpram
SCORELINECONDTOGGLEFSMBRANCHASSERT
91.67 100.00 75.00 100.00

Source File(s) :
/workspaces/repo/scratch/os_regression_2024_10_02/spi_device_2p-sim-vcs/default/sim-vcs/../src/lowrisc_ip_spi_device_0.1/rtl/spid_dpram.sv

Module self-instances :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
tb.dut.u_spid_dpram 91.67 100.00 75.00 100.00



Module Instance : tb.dut.u_spid_dpram

Instance :
SCORELINECONDTOGGLEFSMBRANCHASSERT
91.67 100.00 75.00 100.00


Instance's subtree :
SCORELINECONDTOGGLEFSMBRANCHASSERT
95.45 100.00 81.82 100.00 100.00


Parent :
SCORELINECONDTOGGLEFSMBRANCHASSERTNAME
92.52 95.20 84.31 97.00 90.62 95.45 dut


Subtrees :
NAMESCORELINECONDTOGGLEFSMBRANCHASSERT
gen_ram2p.u_memory_2p 100.00 100.00 100.00 100.00 100.00


Since this is the module's only instance, the coverage report is the same as for the module.
Line Coverage for Module : spid_dpram
Line No.TotalCoveredPercent
TOTAL2020100.00
CONT_ASSIGN6411100.00
CONT_ASSIGN6511100.00
CONT_ASSIGN7011100.00
CONT_ASSIGN7111100.00
CONT_ASSIGN8311100.00
CONT_ASSIGN8411100.00
CONT_ASSIGN9111100.00
CONT_ASSIGN9211100.00
ALWAYS10377100.00
ALWAYS11833100.00
CONT_ASSIGN16511100.00
CONT_ASSIGN17311100.00

63 sram_addr_t sys2spi_wr_addr; 64 1/1 assign sys2spi_wr_req = (sys_addr_i < Sys2SpiEnd) & sys_req_i & sys_write_i; Tests: T1 T2 T3  65 1/1 assign sys2spi_wr_addr = sys_addr_i - Sys2SpiOffset; Tests: T1 T2 T3  66 67 // SPI reads from only the Sys2Spi memory. 68 logic sys2spi_rd_req; 69 sram_addr_t sys2spi_rd_addr; 70 1/1 assign sys2spi_rd_req = spi_req_i & !spi_write_i; Tests: T1 T2 T3  71 1/1 assign sys2spi_rd_addr = spi_addr_i - Sys2SpiOffset; Tests: T1 T2 T3  72 73 // SPI Wr, SYS Rd is for payload upload 74 localparam sram_addr_t Spi2SysOffset = SramIngressIdx; 75 localparam int unsigned Spi2SysMinDepth = SramPayloadDepth + SramCmdFifoDepth 76 + SramAddrFifoDepth + SramTpmWrFifoDepth; 77 localparam int unsigned Spi2SysAw = $clog2(Spi2SysMinDepth); 78 localparam int unsigned Spi2SysDepth = 1 << Spi2SysAw; 79 80 // SPI writes to only the Spi2Sys memory. 81 logic spi2sys_wr_req; 82 sram_addr_t spi2sys_wr_addr; 83 1/1 assign spi2sys_wr_req = spi_req_i & spi_write_i; Tests: T1 T2 T3  84 1/1 assign spi2sys_wr_addr = spi_addr_i - Spi2SysOffset; Tests: T1 T2 T3  85 86 // SYS reads only read from the Spi2Sys memory. 87 // Allow all reads to complete, so the bus always gets a response, even if 88 // software chooses to read from write-only addresses. 89 logic spi2sys_rd_req; 90 sram_addr_t spi2sys_rd_addr; 91 1/1 assign spi2sys_rd_req = sys_req_i & !sys_write_i; Tests: T1 T2 T3  92 1/1 assign spi2sys_rd_addr = sys_addr_i - Spi2SysOffset; Tests: T1 T2 T3  93 94 // The SPI -> core buffer for the payload uses parity and SW has no way of initializing it since 95 // the write port is in the SPI domain. Since the SPI side writes the payload byte by byte, 96 // we need to guard against partially initialized 32bit words, because these could cause TL-UL 97 // bus errors upon readout. Unfortunately, an initialization circuit that initializes the entire 98 // SRAM on the SPI clock domain is infeasible since that clock is only intermittently available. 99 // Hence, we keep track of uninitialized words using a valid bit array, and upon the first write 100 // to a word, uninitialized bytes are set to zero if the write operation is a sub-word write op. 101 logic [SramDw-1:0] spi_wdata, spi_wmask; 102 logic [Spi2SysDepth-1:0] initialized_words_d, initialized_words_q; 103 1/1 always_comb begin initialized_words_d = initialized_words_q; Tests: T1 T2 T3  104 // By default, we just loop through the data and wmask. 105 1/1 spi_wdata = spi_wdata_i; Tests: T1 T2 T3  106 1/1 spi_wmask = spi_wmask_i; Tests: T1 T2 T3  107 // If the word has not been initialized yet we modify the data and wmask to initialize all bits. 108 1/1 if (spi2sys_wr_req && !initialized_words_q[Spi2SysAw'(spi2sys_wr_addr)]) begin Tests: T1 T2 T3  109 // Mask data at this point already and set all masked bits to 0. 110 1/1 spi_wdata = spi_wdata_i & spi_wmask_i; Tests: T4 T12 T16  111 1/1 spi_wmask = {SramDw{1'b1}}; Tests: T4 T12 T16  112 // Mark this word as initialized 113 1/1 initialized_words_d[Spi2SysAw'(spi2sys_wr_addr)] = 1'b1; Tests: T4 T12 T16  114 end MISSING_ELSE 115 end 116 117 always_ff @(posedge clk_spi_i or negedge rst_spi_ni) begin : p_spi_regs 118 1/1 if (!rst_spi_ni) begin Tests: T1 T2 T3  119 1/1 initialized_words_q <= '0; Tests: T1 T2 T3  120 end else begin 121 1/1 initialized_words_q <= initialized_words_d; Tests: T3 T4 T6  122 end 123 end 124 125 if (SramType == SramType2p) begin : gen_ram2p 126 prim_ram_2p_async_adv #( 127 .Depth (SramDepth), 128 .Width (SramDw), // 32 x 512 --> 2kB 129 .DataBitsPerMask (8), 130 131 .EnableECC (0), 132 .EnableParity (1), 133 .EnableInputPipeline (0), 134 .EnableOutputPipeline(0) 135 ) u_memory_2p ( 136 .clk_a_i (clk_sys_i), 137 .rst_a_ni (rst_sys_ni), 138 139 .clk_b_i (clk_spi_i), 140 .rst_b_ni (rst_spi_ni), 141 142 .a_req_i (sys_req_i), 143 .a_write_i (sys_write_i), 144 .a_addr_i (sys_addr_i), 145 .a_wdata_i (sys_wdata_i), 146 .a_wmask_i (sys_wmask_i), 147 .a_rvalid_o (sys_rvalid_o), 148 .a_rdata_o (sys_rdata_o), 149 .a_rerror_o (sys_rerror_o), 150 151 .b_req_i (spi_req_i), 152 .b_write_i (spi_write_i), 153 .b_addr_i (spi_addr_i), 154 // Use modified wdata and wmask 155 .b_wdata_i (spi_wdata), 156 .b_wmask_i (spi_wmask), 157 .b_rvalid_o (spi_rvalid_o), 158 .b_rdata_o (spi_rdata_o), 159 .b_rerror_o (spi_rerror_o), 160 161 .cfg_i 162 ); 163 164 logic sys2spi_unused; 165 1/1 assign sys2spi_unused = ^{ Tests: T1 T2 T3  166 sys2spi_wr_req, 167 sys2spi_wr_addr, 168 sys2spi_rd_req, 169 sys2spi_rd_addr 170 }; 171 172 logic spi2sys_unused; 173 1/1 assign spi2sys_unused = ^{ Tests: T1 T2 T3 

Cond Coverage for Module : spid_dpram
TotalCoveredPercent
Conditions161275.00
Logical161275.00
Non-Logical00
Event00

 LINE       64
 EXPRESSION ((sys_addr_i < Sys2SpiEnd) & sys_req_i & sys_write_i)
             ------------1------------   ----2----   -----3-----
-1--2--3-StatusTests
011Not Covered
101Not Covered
110Not Covered
111CoveredT4,T5,T6

 LINE       70
 EXPRESSION (spi_req_i & ((!spi_write_i)))
             ----1----   --------2-------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT4,T12,T16
11CoveredT4,T6,T12

 LINE       83
 EXPRESSION (spi_req_i & spi_write_i)
             ----1----   -----2-----
-1--2-StatusTests
01Not Covered
10CoveredT4,T6,T12
11CoveredT4,T12,T16

 LINE       91
 EXPRESSION (sys_req_i & ((!sys_write_i)))
             ----1----   --------2-------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT4,T5,T6
11CoveredT4,T5,T10

 LINE       108
 EXPRESSION (spi2sys_wr_req && ((!initialized_words_q[7'(spi2sys_wr_addr)])))
             -------1------    ----------------------2----------------------
-1--2-StatusTests
01CoveredT1,T2,T3
10CoveredT4,T12,T16
11CoveredT4,T12,T16

Branch Coverage for Module : spid_dpram
Line No.TotalCoveredPercent
Branches 4 4 100.00
IF 108 2 2 100.00
IF 118 2 2 100.00


108 if (spi2sys_wr_req && !initialized_words_q[Spi2SysAw'(spi2sys_wr_addr)]) begin -1- 109 // Mask data at this point already and set all masked bits to 0. 110 spi_wdata = spi_wdata_i & spi_wmask_i; ==> 111 spi_wmask = {SramDw{1'b1}}; 112 // Mark this word as initialized 113 initialized_words_d[Spi2SysAw'(spi2sys_wr_addr)] = 1'b1; 114 end MISSING_ELSE ==>

Branches:
-1-StatusTests
1 Covered T4,T12,T16
0 Covered T1,T2,T3


118 if (!rst_spi_ni) begin -1- 119 initialized_words_q <= '0; ==> 120 end else begin 121 initialized_words_q <= initialized_words_d; ==>

Branches:
-1-StatusTests
1 Covered T1,T2,T3
0 Covered T3,T4,T6

0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%