RTL Problems / Level 3 · On-Chip Protocols
What You Will Learn
By solving APB Slave — APB Transactions, you will acquire core industry skills:
- Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
- Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
- Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
- Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.
Problem Statement & Requirements
Implement an AMBA APB (Advanced Peripheral Bus) slave containing two 32-bit read/write registers at byte offsets 0x00 and 0x04. (Simplified educational implementation).
Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.
Prerequisites: AMBA bus specifications, memory-mapped I/O, synchronous register maps.
Port List & Interface Timing
The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:
| Name | Dir | Width | Description |
|---|---|---|---|
pclk | input | 1 | APB bus clock |
preset_n | input | 1 | Active-low APB reset |
paddr | input | 4 | APB address bus |
psel | input | 1 | APB slave select |
penable | input | 1 | APB enable (strobe) |
pwrite | input | 1 | 1 = Write transfer, 0 = Read transfer |
pwdata | input | 32 | APB write data bus |
prdata | output | 32 | APB read data bus |
pready | output | 1 | Slave ready signal |
Timing Constraints & Synthesizable RTL Rules
Timing Contract: Writes commit on `posedge pclk` when `psel && penable && pwrite && pready`. Read data is valid during the ACCESS phase.
Synthesis Constraints: Zero wait-state implementation: `pready` is permanently 1'b1. Word-aligned addresses: 0x00 and 0x04.
Architectural Deep Dive & Implementation Walkthrough
Common RTL Designer Pitfalls
['Committing writes during the SETUP phase (`penable=0`), which violates the AMBA APB protocol specification.', 'Omitting the active-low reset check, causing registers to power up in unknown (`X`) states.']
Silicon & Hardware Engineering Notes
This is a simplified educational APB implementation (no PSTRB byte enables or PSLVERR errors). Real SoC peripherals include byte strobes to support 8-bit and 16-bit register writes.
Starter RTL Code
module top_module(
input pclk,
input preset_n,
input [3:0] paddr,
input psel,
input penable,
input pwrite,
input [31:0] pwdata,
output reg [31:0] prdata,
output pready
);
// APB Slave containing Reg0 (offset 0x0) and Reg1 (offset 0x4)
endmodule
Verified Reference Solution
🔒 Reveal Verified Reference RTL Solution
module top_module(
input pclk,
input preset_n,
input [3:0] paddr,
input psel,
input penable,
input pwrite,
input [31:0] pwdata,
output reg [31:0] prdata,
output pready
);
reg [31:0] reg0;
reg [31:0] reg1;
assign pready = 1'b1; // zero wait-state response
// Write phase
always @(posedge pclk or negedge preset_n) begin
if (!preset_n) begin
reg0 <= 32'h0;
reg1 <= 32'h0;
end else if (psel && penable && pwrite) begin
case (paddr[3:0])
4'h0: reg0 <= pwdata;
4'h4: reg1 <= pwdata;
endcase
end
end
// Read phase
always @(*) begin
if (psel && !pwrite) begin
case (paddr[3:0])
4'h0: prdata = reg0;
4'h4: prdata = reg1;
default: prdata = 32'h0;
endcase
end else begin
prdata = 32'h0;
end
end
endmodule
Related RTL Problems in Level 3
- Synchronous RAM — Memory Read/Write — Design a 16-word by 8-bit synchronous RAM (16x8) with synchronous write and synchronous read.
- Single-Port RAM with Write Enable — Memory Control — Implement a 32-word x 8-bit single-port synchronous RAM with read-first (read-during-write) behavior.
- Synchronous FIFO — FIFO Architecture — Design an 8-entry by 8-bit synchronous First-In First-Out (FIFO) buffer with write enable (wr_en), read enable (rd_en), full, and empty flags.
Connected EcrioniX Learning Resources
Accelerate your VLSI engineering knowledge with these curated learning materials:
Progress through step-by-step verified modules from fundamentals to advanced silicon design.
Benchmark your hardware knowledge across 10 semiconductor domains and receive study roadmaps.
Explore foundational circuit theory, waveform timing, and physical hardware implementation.
Frequently Asked Questions
What does APB Slave — APB Transactions require?
Implement an AMBA APB (Advanced Peripheral Bus) slave containing two 32-bit read/write registers at byte offsets 0x00 and 0x04. (Simplified educational implementation). Implement it as Verilog module top_module matching the listed ports.
Is this design combinational or sequential?
Tags: memory, fifo, protocols, apb, uart, hard, amba-apb. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.
How is my solution graded?
A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.
How does this challenge help with semiconductor interviews?
Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of APB Slave — APB Transactions to assess real-world synthesizability and race-condition awareness.