Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Architecture Metrics Reference
  • Workload Taxonomy for Architects
  • Architecture Glossary
  • Computer Architecture Cheatsheet
  • Pipeline Fundamentals14
  • Memory Hierarchy15
  • NoC and Interconnect Architecture6
  • Coherency and Memory Ordering9
  • Performance Analysis9
  • Accelerator Architectures6
    • Accelerators for the Architect
      • When an Accelerator Pays Off
      • Dataflow Patterns as Reuse Contracts
      • Systolic Execution and Utilization Cliffs
      • Locality, Scratchpads and Tile Sizing
      • DMA and Double Buffering
      • Integration, Launch Cost and Signoff
  • SoC Architecture Tradeoffs9
  • Architecture Interview Prep14
Loading lesson

‹Accelerators for the Architect
  1. Topics
  2. Computer Architecture
  3. Accelerator Architectures
  4. Accelerators for the Architect
  5. DMA and Double Buffering

Computer Architecture · All levels

DMA and Double Buffering

DMA transfers overlapped with compute by double buffering, proved by a runnable model.

On this page

    Overlap by design

    Double buffering fills one tile while the array consumes the other. Steady state costs the slower side per tile, not the sum.

    With 8-cycle fills and 8-cycle computes over 2 tiles, overlap finishes in 26 cycles against 34 sequential, hiding one full fill.

    Diagram
    sequential: 8 + 1 + 8 + 8 + 1 + 8 = 34 cycles (fills, 1-cycle starts, computes)
    overlapped: 8 + 1 + 8 + 1 + 8 = 26 cycles (first fill, starts, overlapped middle, last compute)
    saved = 34 - 26 = 8 cycles = one hidden fill

    Sizing with Little's law

    Buffer depth must cover throughput times latency. One beat per cycle against 8 cycles of latency needs at least 8 entries.

    Refill time follows from tile bytes over bandwidth. A 16 KiB tile at 32 GB/s needs 16384 / 32e9 = 512 ns, or 512 cycles at 1 GHz.

    Term

    Value

    Tile bytes

    16384 B

    Bandwidth

    32 GB/s

    Refill time

    512 ns

    Refill cycles at 1 GHz

    512

    Testbench

    The model below is a two-buffer tile store with a DMA fill port and a summing compute port. The testbench overlaps the second fill with the first compute and checks both sums plus the 26-cycle span.

    dblbuf_sum.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    module dblbuf_sum #(
      parameter int N = 8
    ) (
      input  logic        clk,
      input  logic        rst_n,
      input  logic        fill_wen,
      input  logic        fill_sel,
      input  logic [7:0]  fill_addr,
      input  logic [7:0]  fill_data,
      input  logic        comp_start,
      input  logic        comp_sel,
      output logic        comp_done,
      output logic [15:0] comp_sum
    );
      logic [7:0] buf_a [N];
      logic [7:0] buf_b [N];
      int idx;
      logic [15:0] acc;
      logic busy;
      always_ff @(posedge clk or negedge rst_n) begin
        if (!rst_n) begin
          comp_done <= 1'b0; comp_sum <= 16'd0;
          acc <= 16'd0; idx <= 0; busy <= 1'b0;
        end else begin
          comp_done <= 1'b0;
          if (fill_wen) begin
            if (!fill_sel) buf_a[fill_addr] <= fill_data;
            else buf_b[fill_addr] <= fill_data;
          end
          if (comp_start) begin
            busy <= 1'b1; acc <= 16'd0; idx <= 0;
          end else if (busy) begin
            if (idx == N - 1) begin
              busy <= 1'b0;
              comp_done <= 1'b1;
              if (!comp_sel) comp_sum <= acc + buf_a[idx];
              else comp_sum <= acc + buf_b[idx];
            end else begin
              if (!comp_sel) acc <= acc + buf_a[idx];
              else acc <= acc + buf_b[idx];
              idx <= idx + 1;
            end
          end
        end
      end
    endmodule
    

    Common mistakes

    Common pitfall

    Sizing one tile policy for every kernel repeats the legacy anti-pattern. Tile geometry follows the phase, not the datasheet.

    Interview

    Likely probes: overlap math and refill budgets.

    • Steady state pays the max of transfer and compute per tile.

    • Depth covers throughput times latency; refill is bytes over bandwidth.

    • Spill turns resident compute back into transfer-bound waiting.

    Check yourself Fill and compute each take 8 cycles per tile. What is the steady-state cost per tile?

    8 cycles. Overlap hides the shorter side behind the longer one.

    Check yourself The second fill cannot overlap compute. What breaks first?

    The schedule. Total time returns to the sequential sum, and the array idles during fills.

    Related topics

    • Valid/Ready Handshake

    • Memory bandwidth and latency

    Previous

    62 / 86

    Next: Integration, Launch Cost and Signoff

    Up next

    Up nextIntegration, Launch Cost and Signoff

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • When an Accelerator Pays Off
    • Dataflow Patterns as Reuse Contracts
    • Systolic Execution and Utilization Cliffs