Loading…

Architectural Evaluation and Hardware Trade-off Analysis of L2 Tile Caching Strategies in Systolic Matrix Multipliers

1. Executive Summary

This study evaluates the microarchitectural implementation, simulation performance, and silicon synthesis trade-offs of three distinct L2 tile caching architectures designed for a systolic General Matrix Multiply (GEMM) accelerator. The investigated architectures comprise Direct-Mapped (1-way), 2-Way Set-Associative, and Fully-Associative caching schemes. Each cache instance is positioned between the external system memory (DRAM/Host DMA) and the internal ping-pong double buffers feeding the systolic datapath.

Through deterministic cycle-accurate simulation and logic synthesis targeting a generic CMOS technology mapper with SkyWater 130nm SRAM macro blackboxing, this evaluation quantifies the exact progression of Power, Performance, Area, and Timing (PPAT) across the three associativity models.

The empirical findings confirm that while Direct-Mapped caching incurs minimal logic overhead (1,268 total cells), it suffers from severe conflict thrashing under strided matrix access patterns, resulting in a 21.9% hit rate during conflict stress testing and 61.33 microseconds of total simulation execution time. The Fully-Associative architecture eliminates conflict misses entirely (87.5% conflict hit rate, 59.41 microseconds execution time) but introduces an 80.2% combinational logic area penalty (2,197 total cells) due to wide parallel content-addressable memory (CAM) comparators and global least-recently-used (LRU) addition trees. The 2-Way Set-Associative architecture establishes the microarchitectural sweet spot, doubling the conflict hit rate of the direct-mapped baseline (43.8%) while requiring only 8 additional flip-flops and a moderate 26.3% combinational logic overhead (1,573 total cells).

+-----------------------------------------------------------------------------------+
|                              External System DRAM / Host DMA                      |
+-----------------------------------------------------------------------------------+
          | dma_a_*                                       | dma_b_*
          v                                               v
+-----------------------------------+           +-----------------------------------+
|         L2 Cache (Operand A)      |           |         L2 Cache (Operand B)      |
|  [Direct-Mapped / SA / FA Core]   |           |  [Direct-Mapped / SA / FA Core]   |
|  3x Sky130 SRAM (1024x24-bit)     |           |  3x Sky130 SRAM (1024x24-bit)     |
+-----------------------------------+           +-----------------------------------+
          | pp_wr_*                                       | pp_wr_*
          v                                               v
+-----------------------------------+           +-----------------------------------+
|      Ping-Pong Buffer (Bank A)    |           |      Ping-Pong Buffer (Bank B)    |
|       (SRAM_DEPTH Double Buff)    |           |       (SRAM_DEPTH Double Buff)    |
+-----------------------------------+           +-----------------------------------+
          | a_rd_raw                                      | b_rd_raw
          v                                               v
+-----------------------------------------------------------------------------------+
|                         Systolic Execution Datapath (GEMM Core)                   |
|                                     M x N x K PE Array                            |
+-----------------------------------------------------------------------------------+
          | c_out_w
          v
+-----------------------------------------------------------------------------------+
|                           Output Accumulation Buffer                              |
+-----------------------------------------------------------------------------------+

2. Microarchitectural Implementation

2.1 Unified Memory Subsystem Architecture

The memory subsystem is hierarchically structured to decouple external memory latency from the deterministic execution cycles of the systolic array. The top-level wrapper instantiates two symmetric L2 cache hierarchies: one dedicated to operand A (transposed row-stationary slices) and one dedicated to operand B (column-stationary slices).

Each L2 cache module communicates directly with a dedicated cache controller. The cache controller acts as a master finite state machine (FSM) that intercepts tile requests from the GEMM sequencer, performs tag lookups, orchestrates direct memory access (DMA) transfers upon cache misses, and streams cached words directly into the downstream ping-pong double buffers. The ping-pong buffers operate on a shadow-bank toggle principle, ensuring that while the systolic array actively consumes data from the active buffer bank, the cache controller fills the shadow buffer bank with the subsequent tile.

2.2 SkyWater 130nm SRAM Macro Integration

To ensure physical realism, the data storage arrays within all three cache variants are constructed using real physical memory macros from the SkyWater 130nm process technology (sky130_sram_1kbyte_1rw1r_8x1024_8). Each macro provides 1,024 words of 8-bit storage featuring one read/write port (Port 0) and one dedicated read port (Port 1).

+-------------------------------------------------------------------+
|                Cache Module Data Array Instantiation              |
+-------------------------------------------------------------------+
|  sram_addr (10-bit) = fill_we ? (fill_set*K + fill_addr)          |
|                               : (rd_set*K + rd_addr)              |
|  sram_web           = ~fill_we                                    |
+-------------------------------------------------------------------+
       |                        |                        |
       v                        v                        v
+--------------+        +--------------+        +--------------+
|  u_sram_b2   |        |  u_sram_b1   |        |  u_sram_b0   |
| (Bits 23:16) |        | (Bits 15:8)  |        | (Bits 7:0)   |
| Port 0: 1RW  |        | Port 0: 1RW  |        | Port 0: 1RW  |
| Port 1: Tied |        | Port 1: Tied |        | Port 1: Tied |
+--------------+        +--------------+        +--------------+
       |                        |                        |
       +------------------------+------------------------+
                                |
                                v
                    rd_data (24-bit Bus Output)

To accommodate the maximum word width of the execution datapath (24 bits, representing 3 parallel 8-bit elements for either $M=3$ or $N=3$), three distinct SRAM macros are instantiated in parallel within each cache module. These macros operate as byte lanes (u_sram_b0, u_sram_b1, u_sram_b2) sharing common control signals.

  • Port Utilization Strategy: The design drives Port 0 for both cache line reading and DMA refilling (sram_web = ~fill_we), while Port 1 is permanently tied off (csb1 = 1'b1, addr1 = 10'b0). This matches the sequential nature of the cache controller FSM, where cache inspection and DMA refilling occupy mutually exclusive operational states.
  • Pass-Through Refill Mechanism: A critical optimization implemented in the cache controller FSM is the pass-through refill path during DMA servicing. Upon a cache miss, as words stream from the DMA interface into the cache SRAM write port (fill_we), the controller simultaneously asserts the write enable lines (pp_wr_en) of the ping-pong shadow buffer. This dual-write structure populates the cache line and the execution buffer concurrently, eliminating the $K$-cycle latency penalty that would otherwise occur if the system waited for the cache fill to complete before initiating a secondary buffer read cycle.
  • SRAM Addressing Uniformity: Across all three cache architectures, the physical SRAM addressing logic remains strictly identical. The selection line output (lu_set) from the tag comparison logic consistently represents a flat physical line index (0 to NUM_SETS-1). The SRAM address is computed via multiplication and offset addition (set * TILE_WORDS + word_addr), allowing the cache controller and memory wrapper to remain completely agnostic to the underlying associativity mechanics.

2.3 Direct-Mapped Cache Architecture

The direct-mapped cache module implements a strict 1-to-1 indexing mapping scheme. The physical cache depth is configured to NUM_SETS, where each set contains exactly one cache line holding $K$ words.

+-------------------------------------------------------------------+
|               Direct-Mapped Lookup & Hit Detection                |
+-------------------------------------------------------------------+
|  lu_tag (8-bit: {type_bit, tile_id})                              |
|    |                                                              |
|    +---> [Bits 2:0] ---> lu_set (Direct Index)                    |
|    |                        |                                     |
|    |                        v                                     |
|    |             +--------------------+                           |
|    |             | tag_ram [lu_set]   |                           |
|    |             +--------------------+                           |
|    |                        |                                     |
|    v                        v                                     |
|  +----------------------------+    +-----------------+            |
|  |     8-bit Comparator       |    | valid_r[lu_set] |            |
|  +----------------------------+    +-----------------+            |
|                |                            |                     |
|                +------------+---------------+                     |
|                             |                                     |
|                             v                                     |
|                          (AND Gate) ---> lu_hit                   |
+-------------------------------------------------------------------+
  • Tag and Valid Storage: The tag storage (tag_ram) and line validity flags (valid_r) are modeled as discrete synthesized flip-flops rather than internal memory arrays. Given the compact dimension of the tag directory (8 lines of 8-bit tags), synthesizing registers enables single-cycle combinational tag inspection without incurring macro access penalties.
  • Lookup Mechanics: Upon assertion of lu_valid, the low-order bits of the incoming lookup tag (lu_tag[SET_W-1:0]) are wired directly to the output lu_set. The hit condition (lu_hit) is determined combinationally by verifying that the indexed line is valid (valid_r[lu_set]) and that the stored tag exactly matches the requested tag (tag_ram[lu_set] == lu_tag).
  • Replacement Policy: Because each tile tag maps to exactly one physical set, no replacement tracking logic is required. A cache miss immediately overwrites the existing resident line at lu_set once the DMA fill completion pulse (fill_done) is asserted.

2.4 Set-Associative Cache Architecture

The set-associative cache module implements an $N$-way set-associative structure (N_WAYS = 2). The total physical capacity (NUM_SETS = 8) is divided by N_WAYS to yield the true number of indexing sets (NUM_REAL = 4).

+-------------------------------------------------------------------+
|              2-Way Set-Associative Lookup & Replacement           |
+-------------------------------------------------------------------+
|  lu_tag ---> [Bits 1:0] ---> lu_set_idx (Set Index 0..3)          |
|    |                                                              |
|    +---> [Way 0 Comp: tag_ram[idx*2+0]] --+                       |
|    |                                      |---> any_hit / hit_way |
|    +---> [Way 1 Comp: tag_ram[idx*2+1]] --+                       |
|                                                                   |
|  [Victim Selection Logic]                                         |
|    Priority 1: !valid_r[idx*2+0] ? Way 0                          |
|                !valid_r[idx*2+1] ? Way 1                          |
|    Priority 2: age[idx*2+1] > age[idx*2+0] ? Way 1 : Way 0        |
|                                                                   |
|  lu_set (Flat Index) = any_hit ? (idx*2 + hit_way)                |
|                                : (idx*2 + victim_way)             |
+-------------------------------------------------------------------+
  • Parallel Tag Inspection: The incoming tag provides the set index via its lowest bits (lu_tag[REAL_W-1:0]). The hardware evaluates N_WAYS lines simultaneously within the addressed set. A combinational unrolled loop inspects the valid bits and tag registers for all ways located at lu_set_idx * N_WAYS + hi. If any way demonstrates a match, lu_hit is asserted, and the matching way index is encoded into hit_way.
  • True LRU Replacement Tracking: To govern eviction, each physical cache line maintains a dedicated age register (age). For a 2-way architecture, age requires exactly 1 bit ($clog2(2)). The victim selection logic operates combinationally in a dual-priority structure. Priority 1 scans the ways within the addressed set for the first invalid line (!valid_r). If all ways are valid, Priority 2 inspects the age bits to identify the way holding the maximum age value (victim_way).
  • LRU State Updates: The age registers are updated synchronously on the positive clock edge. Upon a cache hit, the accessed way’s age is reset to 0, while all other ways within the same set whose ages are lower than the accessed way’s prior age are incremented by 1. Upon a cache miss fill completion (fill_done), the newly filled way is promoted to age 0, and the remaining valid ways in the set are incremented.
  • Output Index Flattening: Regardless of whether the lookup results in a hit or a miss, the module computes a flat memory index (lu_set_idx * N_WAYS + selected_way) and drives it onto lu_set, preserving strict modular compatibility with the rest of the memory subsystem.

2.5 Fully-Associative Cache Architecture

The fully-associative cache module treats the entire storage capacity (NUM_SETS = 8) as a single unified set containing 8 parallel ways, eliminating index mapping arithmetic entirely.

+-------------------------------------------------------------------+
|               Fully-Associative CAM Matching & LRU                |
+-------------------------------------------------------------------+
|  lu_tag (Broadcast to 8 Parallel Comparators)                     |
|    |---> [Comp 0: tag_ram[0]] ---> hit_vec[0]                     |
|    |---> [Comp 1: tag_ram[1]] ---> hit_vec[1]                     |
|    |---> ...                                                      |
|    +---> [Comp 7: tag_ram[7]] ---> hit_vec[7] ---> any_hit        |
|                                                                   |
|  [Global LRU Victim Selection]                                    |
|    Priority 1: Scan lines 7 down to 0 for first !valid_r          |
|    Priority 2: Wide comparator tree finds max(age[0]..age[7])     |
|                                                                   |
|  lu_set (Flat Index) = any_hit ? hit_way : victim_way             |
+-------------------------------------------------------------------+
  • Parallel CAM Matching: Tag inspection is implemented via a wide combinational vector (hit_vec). Upon lu_valid, lu_tag is broadcast across high-fanout routing nets to 8 individual equality comparators simultaneously. If any line matches and is valid, lu_hit is asserted, and the matching line position is encoded into hit_way.
  • Global LRU Replacement Tracking: Each of the 8 lines requires a 3-bit age register ($clog2(8) = 3). The victim selection logic requires an extensive combinational evaluation tree. The hardware first scans lines 7 down to 0 to locate any invalid entry. If the entire cache is valid, a 3-bit wide comparator tree evaluates all 8 age registers simultaneously to locate the absolute maximum age value, which is then assigned to victim_way.
  • Global Age Updates: On a cache hit, the matching line’s age resets to 0, while all other lines in the entire cache whose ages are lower than the hit line’s previous age are incremented via 3-bit adders. On a fill completion, the filled line resets to 0, and all other lines are unconditionally incremented to maintain absolute global ordering.

2.6 Cache Controller and GEMM FSM Stall Logic

The synchronization between L2 caching and systolic execution is governed by two interacting FSMs: the cache controller FSM and the GEMM execution FSM.

+-------------------------------------------------------------------+
|                     Cache Controller FSM State Flow               |
+-------------------------------------------------------------------+
|                                                                   |
|      +--------+   req_valid   +-----------+                       |
|  --->|  IDLE  |-------------->|  LOOKUP   |                       |
|      +--------+               +-----------+                       |
|          ^                      |       |                         |
|          |         +------------+       +------------+            |
|          |  lu_hit |                          lu_hit | (Miss)     |
|          |         v                                 v            |
|          |   +-------------+                  +-----------+       |
|          |   | HIT_STREAM  |                  | MISS_REQ  |       |
|          |   +-------------+                  +-----------+       |
|          |         | (K words)                       | dma_ack    |
|          |         v                                 v            |
|          |   +-------------+                  +-----------+       |
|          +---|    DONE     |<-----------------| MISS_FILL |       |
|              +-------------+     dma_done     +-----------+       |
|               (load_done=1)                                       |
+-------------------------------------------------------------------+
  • Cache Controller FSM (cache_ctrl):
    • ST_IDLE: The controller rests in standby until req_valid is asserted by the top-level sequencer, at which point it latches the target tag (req_tag) into saved_tag.
    • ST_LOOKUP: Asserts lu_valid to the cache module. The cache responds combinationally within the same cycle with lu_hit and lu_set. lu_set is latched into saved_set. If lu_hit is high, the FSM transitions to ST_HIT_STREAM; otherwise, it transitions to ST_MISS_REQ.
    • ST_HIT_STREAM: Iterates word_cnt from 0 to $K-1$, asserting rd_en to the cache module. Because the SkyWater SRAM macro exhibits a 1-cycle registered read latency, the data appears on rd_data one cycle later. The controller aligns the shadow buffer write enable (pp_wr_en) and address (pp_wr_addr) to match this 1-cycle lag. Upon streaming $K$ words, it transitions to ST_DONE.
    • ST_MISS_REQ: Asserts dma_req and drives dma_tile_id. The FSM stalls in this state until the external memory controller asserts dma_ack.
    • ST_MISS_FILL: Accepts incoming words from the DMA interface (dma_we, dma_addr, dma_data). It routes these signals directly to the cache fill ports (fill_we, fill_set, fill_addr) while simultaneously driving the shadow buffer write ports (pp_wr_en, pp_wr_addr). Upon assertion of dma_done, it pulses fill_done to update the cache tags and transitions to ST_DONE.
    • ST_DONE: Asserts load_done for one cycle and returns to ST_IDLE.
+-------------------------------------------------------------------+
|               GEMM Execution Sequencer FSM State Flow             |
+-------------------------------------------------------------------+
|                                                                   |
|   +--------+  start   +-----------+          +------------+       |
| ->|  IDLE  |--------->| CACHE_REQ |--------->| CACHE_WAIT |       |
|   +--------+          +-----------+          +------------+       |
|       ^                                             |             |
|       |                           loads_ready (a&b) |             |
|       |                                             v             |
|   +-----------+                              +------------+       |
|   | WRITEBACK |                              | FLIP_INIT  |       |
|   +-----------+                              +------------+       |
|       ^                                             |             |
|       |                                             v             |
|   +-----------+       +---------------+      +------------+       |
|   |  CAPTURE  |<------| CAPTURE_WAIT  |<-----|  PRELOAD   |       |
|   +-----------+       +---------------+      +------------+       |
|                               ^                     |             |
|                               |     k_cnt == K-1    v             |
|                               +----------------+ RUNNING  |       |
|                                              +------------+       |
+-------------------------------------------------------------------+
  • GEMM Execution FSM (gemm_ctrl_cached): The execution FSM coordinates the macro-level tile processing loops. Upon leaving ST_IDLE, it enters ST_CACHE_REQ to pulse req_valid to both A and B cache controllers. It immediately transitions to ST_CACHE_WAIT, where it actively halts the systolic array execution pipeline until both a_load_done and b_load_done are observed.

    This explicit stall mechanism directly exposes the performance impact of cache misses. On a cache hit, ST_CACHE_WAIT resolves rapidly as the cache streams data in $K$ cycles. On a miss, ST_CACHE_WAIT stalls for the entire duration of the DMA latency plus the fill time. Once the loads complete, the FSM transitions through ST_FLIP_INIT (toggling the active ping-pong bank), ST_PRELOAD (flushing systolic registers), ST_RUNNING (pulsing valid_in for $K$ cycles to compute the matrix multiplication), ST_CAPTURE_WAIT (waiting for systolic accumulation settling), ST_CAPTURE (writing results to the output buffer), and ST_WRITEBACK (signaling tile completion and incrementing tile indices).


3. Simulation Setup and Performance Evaluation

3.1 Verification Setup and Workload Modeling

The simulation environment is constructed using Verilog testbenches compiled and executed via Icarus Verilog (iverilog / vvp). The verification suite evaluates three separate top-level wrapper configurations (sim_dm, sim_sa, sim_fa) operating on identical array parameters ($M=3, N=3, K=3$, SRAM_DEPTH=8, TAG_WIDTH=8).

To isolate the microarchitectural behavior of the memory subsystem, the external DMA interface is modeled as a deterministic data generator where the content of any word is derived mathematically from its tile tag and word index ((tag*10 + k*M + i) % 128). This eliminates external memory nondeterminism, ensuring that all timing variations are strictly attributable to internal FSM stalls and cache hit/miss transitions.

The testbench orchestrates seven discrete verification phases (T1 through T7). To expose the exact operational bounds of the three associativity models, the testbench instantiates a primary DUT (dut) with NUM_TILES=4 (CACHE_SETS=4) for baseline verification, and a secondary high-stress DUT (dut8) with NUM_TILES=8 (CACHE_SETS=8) featuring a custom conflict tag workload (CUSTOM_TAGS=1). The custom conflict workload overrides the sequential tile counter to request an intentional collision sequence of eight tags: 0, 8, 16, 24, 1, 9, 2, 3.

+-------------------------------------------------------------------+
|               Custom Conflict Workload Tag Mapping                |
+-------------------------------------------------------------------+
| Requested Tag Sequence: [0, 8, 16, 24, 1, 9, 2, 3]                |
|                                                                   |
| Direct-Mapped (8 Sets, 1 Way):                                    |
|   Tags {0, 8, 16, 24} ---> Set 0 (100% Thrashing, 4 Misses)       |
|   Tags {1, 9}         ---> Set 1 (100% Thrashing, 2 Misses)       |
|   Tags {2}, {3}       ---> Sets 2, 3 (Stable Hits, 2 Hits)        |
|   Result: 2 Hits / 6 Misses per pass (21.9% T7 Hit Rate)          |
|                                                                   |
| 2-Way Set-Associative (4 Sets, 2 Ways):                           |
|   Tags {0, 8, 16, 24} ---> Set 0 (4 Tags > 2 Ways -> 4 Misses)    |
|   Tags {1, 9}         ---> Set 1 (Fits in Way 0 & 1 -> 2 Hits)    |
|   Tags {2}, {3}       ---> Sets 2, 3 (Fits in Way 0 -> 2 Hits)    |
|   Result: 4 Hits / 4 Misses per pass (43.8% T7 Hit Rate)          |
|                                                                   |
| Fully-Associative (1 Set, 8 Ways):                                |
|   All 8 distinct tags fit into 8 parallel CAM ways.               |
|   Result: 8 Hits / 0 Misses per pass (87.5% T7 Hit Rate)          |
+-------------------------------------------------------------------+

3.2 Detailed Test Phase Analysis

T1: Cold Miss Latency Verification

Test T1 initiates a single tile request (tag=0) immediately following a hard system reset. Because the cache directory is entirely invalid, both A and B caches register a cold miss (hits=0, miss=1). The testbench measures the exact cycle delta from start assertion to c_out_valid.

  • Empirical Latency: 27 cycles across all three architectures.
  • Cycle Accounting Breakdown: The 27 cycles are rigorously accounted for by the underlying hardware parameters: 3 cycles of external DMA_LATENCY + 3 cycles of word refilling ($K=3$) + 7 cycles of systolic datapath flush delay (DONE_DELAY = K + (M-1) + (N-1)) + 14 cycles of collective FSM transition overhead (spanning request propagation, synchronization waiting, active bank flipping, preloading, and capture delays).

T2: True Cache Hit Latency Verification

Test T2 immediately requests the identical tile (tag=0) without asserting reset, preserving the valid bits and tag registers established during T1.

  • Empirical Latency: 23 cycles across all three architectures.
  • Verification Takeaway: Both A and B cache hit counters increment (+1 hits, +0 misses). By achieving a cache hit, the cache controller transitions directly from ST_LOOKUP to ST_HIT_STREAM, bypassing ST_MISS_REQ and ST_MISS_FILL. This entirely eliminates the external DMA_LATENCY stall and handshake overhead, yielding a deterministic savings of exactly 4 cycles (27 - 23 = 4).

T3: Sequential Tile Cold Fill and Replay

Test T3 executes a sequential 4-tile workload (tags 0, 1, 2, 3) on the primary DUT (CACHE_SETS=4).

  • Pass 1 (Cold Fills): Completes in 103 cycles, registering 4 compulsory misses (+0 hits, +4 misses). The output validation cycles occur at intervals reflecting the DMA stall penalty ([232, 256, 282, 306]).
  • Pass 2 (Warm Replay): Completes in 87 cycles, registering 4 consecutive hits (+4 hits, +0 misses). Output validation occurs at tighter intervals ([332, 354, 374, 396]). Because the working set size (4 tiles) exactly matches the cache capacity (4 sets), all three architectures successfully maintain the working set without eviction.

T4: Real Eviction and Associativity Bounds

Test T4 evaluates the secondary DUT (dut8) configured with NUM_TILES=8 and CACHE_SETS=8, activating the custom conflict tag workload (0, 8, 16, 24, 1, 9, 2, 3). Pass 1 executes the initial cold fill, requiring 203 cycles and logging 8 compulsory misses. Pass 2 replays the identical sequence, exposing the precise architectural boundaries of the three associativity models:

  • Direct-Mapped (sim_dm): Replay completes in 195 cycles, logging +2 hits, +6 misses. Direct-Mapped indexing calculates set placement via tag % 8. Tags 0, 8, 16, 24 all map to Set 0, constantly overwriting each other and causing 4 consecutive misses. Tags 1 and 9 both map to Set 1, overwriting each other and causing 2 misses. Only Tag 2 (Set 2) and Tag 3 (Set 3) survive to register hits.
  • 2-Way Set-Associative (sim_sa): Replay completes in 187 cycles, logging +4 hits, +4 misses. With 4 sets of 2 ways, indexing operates via tag % 4. Set 0 receives 4 competing tags (0, 8, 16, 24), exceeding the 2-way capacity and resulting in 4 misses. However, Set 1 receives exactly 2 tags (1, 9), which map cleanly into Way 0 and Way 1. Set 2 (Tag 2) and Set 3 (Tag 3) map into Way 0 of their respective sets. The architecture successfully preserves 4 hits, saving 8 cycles of stall over Direct-Mapped (195 - 187 = 8).
  • Fully-Associative (sim_fa): Replay completes in 171 cycles, logging +8 hits, +0 misses. Because the 8 distinct tags are absorbed into 8 fully-associative CAM slots, zero evictions occur. The FSM streams all tiles at peak speed, saving 24 cycles over Direct-Mapped (195 - 171 = 24).

T5: DMA Stall Breakdown

Test T5 resets the primary DUT and performs a precise single-tile cold miss followed by a warm hit, verifying that the internal hardware latency tracking logic perfectly matches the cycle formulas established in T1 and T2 (27 cycles cold, 23 cycles warm).

T6: Warm Cache High Hit-Rate Stress

Test T6 evaluates performance stability under extended operational loops without intermediate resets.

  • T6a (8 Passes x 4 Tiles): Pass 1 incurs 4 cold misses (103 cycles); Passes 2 through 8 achieve pure hits (87 cycles each). Total metrics reach 28 hits, 4 misses (87.5% hit rate).
  • T6b (16 Passes x 4 Tiles Warm): Operating on the warmed cache from T6a, the system executes 16 consecutive passes of 4 tiles without a single stall. Total metrics reach 64 hits, 0 misses (100.0% hit rate).
  • T6c (Cold Reset + 16 Passes x 4 Tiles): Following a hard reset, Pass 1 incurs 4 cold misses; Passes 2 through 16 achieve pure hits. Total metrics reach 60 hits, 4 misses (93.8% hit rate).

T7: Custom Conflict Workload Evaluation

Test T7 executes 8 consecutive passes of the custom conflict workload (0, 8, 16, 24, 1, 9, 2, 3) on dut8, representing 64 total tile lookups. Pass 0 incurs 8 compulsory cold misses across all variants. Passes 1 through 7 exhibit the steady-state conflict behavior governed by the underlying associativity:

+-------------------------------------------------------------------+
|               T7 Custom Conflict Workload Hit Rates               |
+-------------------------------------------------------------------+
|                                                                   |
|   100% +                                                          |
|        |                                              87.5%       |
|    80% |                                            +-------+     |
|        |                                            |       |     |
|    60% |                                            |       |     |
|        |                              43.8%         |       |     |
|    40% |                            +-------+       |       |     |
|        |              21.9%         |       |       |       |     |
|    20% |            +-------+       |       |       |       |     |
|        |            |       |       |       |       |       |     |
|     0% +------------+-------+-------+-------+-------+-------+---> |
|                   Direct-Mapped   Set-Assoc (2W)   Fully-Assoc    |
+-------------------------------------------------------------------+
  • Direct-Mapped (sim_dm): Each of the 7 warm passes yields 2 hits and 6 conflict misses. Total T7 performance concludes at 14 hits, 50 misses, resulting in a 21.9% hit rate.
  • 2-Way Set-Associative (sim_sa): Each warm pass yields 4 hits and 4 conflict misses. Total T7 performance concludes at 28 hits, 36 misses, resulting in a 43.8% hit rate.
  • Fully-Associative (sim_fa): Each warm pass yields 8 hits and 0 misses. Total T7 performance concludes at 56 hits, 8 misses (the initial cold fills), resulting in an 87.5% hit rate.

3.3 Lifetime Performance Summary

By accumulating every hardware transaction across all test phases (T1 through T7, spanning both dut and dut8), the verification suite provides an uncompromised global view of architectural efficiency:

Architectural Variant Lifetime Hits Lifetime Misses Global Hit Rate Total Sim Execution Time Latency Reduction vs. DM
Direct-Mapped (sim_dm) 177 84 67.8% 61,326 ns (61.33 µs) Baseline
Set-Associative (sim_sa) 193 68 73.9% 60,686 ns (60.69 µs) 640 ns (640,000 ps)
Fully-Associative (sim_fa) 225 36 86.2% 59,406 ns (59.41 µs) 1,920 ns (1,920,000 ps)

The empirical latency savings directly correlate with the reduction in FSM stall cycles. By avoiding 48 cache misses over the simulation lifecycle, the Fully-Associative architecture reduces total accelerator execution time by 1,920 nanoseconds. The 2-Way Set-Associative architecture successfully avoids 16 misses, achieving a 640-nanosecond execution reduction.

3.4 3C Miss Classification

The 3C model categorizes memory subsystem failures into Compulsory (cold start), Capacity (working set exceeding total lines), and Conflict (indexing collisions). Analyzing the lifetime miss totals isolates the exact microarchitectural failure modes:

+-------------------------------------------------------------------+
|               3C Cache Miss Classification Breakdown              |
+-------------------------------------------------------------------+
|                                                                   |
|   100 +                                                           |
|       |     84 Total                                              |
|    80 |    +--------+          68 Total                           |
|       |    |   48   |         +--------+                          |
|    60 |    |Conflict|         |   32   |          36 Total        |
|       |    | Misses |         |Conflict|         +--------+       |
|    40 |    +--------+         +--------+         |   0    |       |
|       |    |   36   |         |   36   |         +--------+       |
|    20 |    | Compul |         | Compul |         |   36   |       |
|       |    | Misses |         | Misses |         | Compul |       |
|     0 +----+--------+---------+--------+---------+--------+--->   |
|              Direct-Mapped    Set-Assoc (2W)    Fully-Assoc       |
+-------------------------------------------------------------------+
  • Compulsory Misses: Exactly 36 misses occur across all three architectures. These represent the absolute first access to any tile during cold starts across T1 (1), T3 (4), T4 (8), T5 (1), T6a (4), T6c (4), and T7 (14 across resets). Compulsory misses are independent of associativity.
  • Capacity Misses: Because the maximum working set evaluated in any test phase is 8 tiles (dut8), and all cache architectures possess exactly 8 physical lines (CACHE_SETS=8), zero true capacity misses occur during steady-state warm replay.
  • Conflict Misses: Subtracting the 36 compulsory misses from the lifetime totals isolates the exact volume of conflict thrashing:
    • Direct-Mapped: 84 - 36 = 48 Conflict Misses.
    • Set-Associative: 68 - 36 = 32 Conflict Misses. The 2-way structure successfully eliminates 16 conflict misses from the baseline.
    • Fully-Associative: 36 - 36 = 0 Conflict Misses. The fully-associative structure eliminates all 48 conflict misses.

4. Hardware Synthesis and Silicon Trade-off Analysis

4.1 Synthesis Methodology

To evaluate physical silicon complexity, the three Verilog cache modules were synthesized using Yosys. The synthesis script targeted a generic CMOS gate library (cmos2), applying exhaustive combinatorial optimization (opt; proc; flatten; techmap).

To prevent the physical memory macros from obscuring the synthesized logic area, the SkyWater 130nm SRAM instances (sky130_sram_1kbyte_1rw1r_8x1024_8) were treated as blackboxes. Consequently, the resulting cell statistics reflect only the physical area and register count consumed by the tag directories, valid flags, hit evaluation comparators, multiplexers, and LRU replacement tracking logic.

+-------------------------------------------------------------------+
|               Yosys Logic Synthesis Cell Stat Summary             |
+-------------------------------------------------------------------+
|                                                                   |
|   2500 +                                                          |
|        |                                              2197        |
|   2000 |                                            +-------+     |
|        |                              1573          | 2036  |     |
|   1500 |                            +-------+       | Logic |     |
|        |              1268          | 1428  |       | Gates |     |
|   1000 |            +-------+       | Logic |       |       |     |
|        |            | 1131  |       | Gates |       +-------+     |
|    500 |            | Logic |       +-------+       | 161 FF|     |
|        |            | Gates |       | 145 FF|       +-------+     |
|      0 +------------+-------+-------+-------+-------+-------+---> |
|                   Direct-Mapped   Set-Assoc (2W)   Fully-Assoc    |
+-------------------------------------------------------------------+

4.2 Detailed Gate and Register Breakdown

The Yosys synthesis reports (stat) provide the exact structural decomposition of the three modules:

Structural Component Direct-Mapped (tile_cache_dm) Set-Associative (tile_cache_sa) Fully-Associative (tile_cache_fa) Architectural Origin of Logic Cells
SRAM Blackboxes 3 3 3 Instantiated 1024x8-bit memory macros (24-bit bus).
$_DFF_PP0_ 72 76 84 Primary sequential storage flip-flops.
$_DFF_PP1_ 0 4 12 Preset sequential storage flip-flops.
$_DFF_P_ 65 65 65 Standard sequential flip-flops (Counters/State).
Total Flip-Flops 137 FFs 145 FFs 161 FFs Total synthesized discrete register count.
$_NAND_ 523 663 944 Synthesized NAND logic gates.
$_NOR_ 388 537 736 Synthesized NOR logic gates.
$_NOT_ 217 225 353 Synthesized Inverter logic gates.
Total Logic Gates 1,128 Gates 1,425 Gates 2,033 Gates Combinational gate count (Comparators & LRU trees).
Total Cell Count 1,268 Cells 1,573 Cells 2,197 Cells Total combined standard cell footprint.
Combinational Overhead Baseline +26.3% +80.2% Percentage increase in combinational logic gates over DM.

4.3 Microarchitectural PPAT Trade-off Analysis

The integration of simulation performance logs and synthesis gate counts enables a highly rigorous trade-off analysis across Power, Performance, Area, and Timing (PPAT).

+-------------------------------------------------------------------+
|               Microarchitectural PPAT Trade-off Matrix            |
+-------------------------------------------------------------------+
|                                                                   |
|     [Direct-Mapped]           [Set-Associative]      [Fully-Assoc]|
|  +--------------------+     +--------------------+  +------------+|
|  | Area: Lowest       |     | Area: Moderate     |  | Area: High ||
|  | Timing: Fastest    |     | Timing: Fast       |  | Timing:Slow||
|  | Power: Lowest      |     | Power: Moderate    |  | Power: High||
|  | Perform: Thrashing |     | Perform: Balanced  |  | Perform:Max||
|  +--------------------+     +--------------------+  +------------+|
|            |                          |                    |      |
|            +--------------------------+--------------------+      |
|                                       |                           |
|                                       v                           |
|                    The Sweet Spot: 2-Way Set-Associative          |
+-------------------------------------------------------------------+

1. Performance (Hit Rate and Stall Reduction)

  • Direct-Mapped: Exhibits severe performance degradation under strided matrix access patterns. The direct indexing calculation (tag % NUM_SETS) creates artificial bottlenecks where distinct tiles collide on the same set index, resulting in a 21.9% conflict hit rate and 48 conflict misses. This forces the GEMM execution FSM to stall repeatedly for 27-cycle DMA fetch penalties.
  • Fully-Associative: Achieves absolute peak performance. By utilizing parallel CAM matching, it absorbs the active working set entirely, achieving an 87.5% conflict hit rate (limited only by compulsory cold misses) and zero conflict misses, reducing total simulation execution time by 1,920 nanoseconds.
  • Set-Associative: Delivers highly balanced intermediate performance. By providing two ways per set, it successfully separates colliding tags in Set 1, doubling the conflict hit rate to 43.8%, eliminating 16 conflict misses, and saving 640 nanoseconds of total execution time.

2. Area (Silicon Real Estate and Gate Density)

  • Direct-Mapped: Establishes the baseline logic footprint (1,268 total cells). The 137 flip-flops directly reflect the minimum structural requirement: 64 FFs for hit/miss accumulation counters + 64 FFs for tag storage (8 lines $\times$ 8 bits) + 8 FFs for valid flags + 1 FF for read enable registration (64 + 64 + 8 + 1 = 137). Combinational logic is minimal (1,128 gates) because lu_set is wired directly from lu_tag[2:0].
  • Set-Associative: Introduces a highly efficient area trade-off (1,573 total cells). It adds exactly 8 flip-flops (145 - 137 = 8), representing exactly one 1-bit age register per cache line (8 lines × 1 bit = 8 FFs). Combinational gate count increases by 26.3% (+297 gates) to accommodate the dual 8-bit comparators required to inspect Way 0 and Way 1 in parallel, alongside the 1-bit LRU toggle logic.
  • Fully-Associative: Imposes a severe logic area penalty (2,197 total cells). It adds 24 flip-flops over the baseline (161 - 137 = 24), representing a 3-bit age register per line (8 lines × 3 bits = 24 FFs) to track global LRU. More critically, combinational logic expands by 80.2% (+905 gates). This massive expansion is required to synthesize eight parallel 8-bit equality comparators (CAM matching) and the extensive 3-bit adder and comparator priority trees required to identify and update the global LRU victim.

3. Timing (Critical Path Depth and Maximum Frequency $F_{max}$)

  • Direct-Mapped: Possesses the shortest topological logic depth. The lookup path consists of a direct wire routing lu_tag[2:0] to lu_set, followed by a single 8-bit equality comparison against tag_ram[lu_set] and an AND gate with valid_r. This architecture achieves the highest theoretical clock frequency ($F_{max}$) during place-and-route.
  • Set-Associative: Introduces a minor timing penalty. The critical path requires indexing into the set, performing two 8-bit tag comparisons in parallel, evaluating a 2-to-1 multiplexer to select the matching way, and executing a small 1-bit age comparison to identify the victim way. Because N_WAYS is small (2), the multiplexing and comparison logic levels remain shallow, preserving wide timing margins.
  • Fully-Associative: Possesses the longest combinational critical path in the entire memory subsystem. Upon every lu_valid assertion, the hardware must execute eight 8-bit comparisons simultaneously. Furthermore, the victim selection logic (always @(*)) must evaluate an 8-input priority encoding tree to check for invalid lines, and if all are valid, propagate signals through a 3-bit wide comparator tree to locate the absolute maximum age value among all 8 lines. As cache capacity scales upward, this global comparator tree quickly becomes the primary timing bottleneck of the accelerator chip.

4. Power (Dynamic Switching and Leakage)

  • Direct-Mapped: Consumes minimal dynamic and leakage power. Only one tag register (tag_ram[lu_set]) is accessed per lookup cycle, and lu_tag is routed to only a single comparator. Register toggling is strictly limited to the active set during DMA refilling.
  • Set-Associative: Imposes a modest power increase. On each lookup, two tag registers are read and compared in parallel. During an LRU update, clock enables fire only for the age registers located within the specific indexed set (2 flip-flops), keeping clock tree and register switching power highly constrained.
  • Fully-Associative: Consumes substantial dynamic power. On every single lookup cycle, lu_tag must be broadcast across high-fanout routing nets to eight separate comparators simultaneously, causing continuous combinational switching. Furthermore, during a global LRU update (posedge clk), nearly every single age register in the entire cache activates its clock enable to increment (age[li] <= age[li] + 1), driving up clock tree power and sequential switching activity across all 24 age flip-flops.

5. Conclusion

This evaluation establishes a rigorous microarchitectural comparison across L2 caching strategies for systolic GEMM accelerators. The synthesis and simulation metrics confirm that while Direct-Mapped caching achieves the lowest silicon area (1,268 cells) and fastest combinational timing, its vulnerability to indexing collisions makes it highly inefficient for strided matrix workloads, resulting in a 21.9% conflict hit rate and high FSM stall overhead (61.33 microseconds execution time).

Conversely, Fully-Associative caching eliminates conflict misses entirely (87.5% hit rate, 59.41 microseconds execution time) but introduces an 80.2% combinational logic penalty (2,197 cells) alongside severe timing depth and dynamic power penalties due to parallel CAM broadcasting and global LRU addition trees.

The 2-Way Set-Associative architecture represents the optimal microarchitectural sweet spot. It provides robust conflict-miss absorption (doubling the conflict hit rate to 43.8% and saving 640 nanoseconds of execution time) while adding only 8 flip-flops and a modest 26.3% combinational gate overhead (1,573 cells). For systolic accelerator ASICs requiring balanced area, high clock frequency, and dependable memory throughput, the 2-way set-associative cache is the definitive architectural recommendation.

===================================================================================
                       FINAL ARCHITECTURAL TRADE-OFF SUMMARY
===================================================================================
Metric                  Direct-Mapped        2-Way Set-Assoc      Fully-Associative
-----------------------------------------------------------------------------------
T7 Conflict Hit Rate    21.9% (14H / 50M)    43.8% (28H / 36M)    87.5% (56H / 8M)
Lifetime Global HR      67.8%                73.9%                86.2%
3C Conflict Misses      48 Misses            32 Misses            0 Misses
Sim Execution Time      61.33 µs             60.69 µs             59.41 µs
-----------------------------------------------------------------------------------
Synthesized FFs         137 FFs              145 FFs (+8)         161 FFs (+24)
Logic Gates             1,128 Gates          1,425 Gates          2,033 Gates
Total Cell Count        1,268 Cells          1,573 Cells          2,197 Cells
Combinational Overhead  Baseline             +26.3%               +80.2%
-----------------------------------------------------------------------------------
Critical Path / Fmax    Fastest (Mux 8:1)    Fast (Dual Comp)     Slowest (CAM Tree)
Dynamic Power           Lowest               Moderate             Highest (Broadcast)
Architectural Verdict   High Thrashing       Optimal Sweet Spot   Area/Timing Heavy
===================================================================================