The SoC you built is deliberately basic: one manager, one transaction at a time, one clock, no caches, no interrupts taken, no DMA. Every one of those choices kept the design small enough to understand cycle by cycle, and every one of them is something real SoCs do differently. This last article of the section walks through the features a production SoC adds, says where each would attach to cvsoc and which of your blocks it would change, and points to the article in the first half of this tutorial that explains it.
7 min read | Intermediate
What You'll Learn
- Name the features a production SoC adds to a design like
cvsoc - Locate where each feature attaches and which existing blocks it changes
- Connect each feature to the measurements of this section that motivate it
- Plan an extension of your own SoC and how you would test it
Before You Start
This section needs Verilog: see the Verilog Tutorial. This article builds on the whole section, in particular Measuring Your SoC. Each feature below links its article in the first half of the tutorial.
Interrupts Instead of Polling
The largest single cost measured in this section was polling: a third of hello went to reading the UART's STATUS register. With interrupts, the UART would raise a line when its FIFO has room, and the core would do other work, or sleep, until then. That needs three things cvsoc lacks: a core that can take a trap (control and status registers such as mtvec and mie, a way to save the PC and jump to a handler), an interrupt controller that gathers the peripherals' lines and tells the core which one fired, and peripherals that raise a line. The timer already drives timer_irq; it stops at the top level. Polling, Interrupts and DMA, Interrupt Controllers and Traps and Precise Exceptions cover each part.
More Managers: DMA and a Second Core
A DMA engine copies data without the core: the program tells it source, destination and length, and the engine issues the bus transactions itself. copy_sram spent 2,048 accesses on a copy that a DMA engine could do while the core computed. A DMA engine is a second manager, and so is a second core. With more than one manager, the interconnect needs an arbiter that decides who goes first when two managers want the same subordinate, and the subordinates must handle requests from either. Your interconnect would grow a second manager port and an arbitration stage; the SRAM would not change at all. DMA Engines, Arbitration and Quality of Service and Multicore Integration and Coherent Interconnects explain them.
Overlapping Transactions
Your manager port has one transaction in flight; an SRAM access takes 4 cycles, so the core moves at most one word every 4 cycles. AXI allows a manager to issue the next address before the previous data has returned, and a subordinate to accept several requests and answer them in order. With that, the same bus approaches one word per cycle. It changes the manager port (a queue of outstanding requests), the interconnect (it must track several targets) and the core (it must be able to go on before a load returns). Outstanding Transactions and Bursts describes the mechanism.
Caches and External Memory
A 64 KB TCM and 16 KB of SRAM were about 99 percent of the estimated chip area in Synthesizing Your SoC. Programs that need megabytes keep their data in DRAM outside the chip, behind a memory controller, and a cache between the core and the bus keeps the recently used part close. The cache would replace or sit next to the TCM; the memory controller would be another subordinate on the interconnect. DRAM Organization, Memory Controllers and Scheduling and On-Chip SRAM, Scratchpads and System Caches cover them.
Clocks, Resets and Power
cvsoc has one clock and one reset. Real SoCs run their peripherals on a slower clock than the core to save power, which puts a clock-domain crossing between the interconnect and the bridge: signals that pass from one clock to another need synchronizers, or an asynchronous FIFO for data. Resets are released in a planned order, and parts of the chip are switched off when idle. Each of these changes the top level and the boundaries between blocks more than the blocks themselves. Clock Architecture and Clock Domain Crossings, Reset Architecture and Reset Domain Crossings and Power Domains and Power Management explain them.
Quick Check
Q: You add a DMA engine that copies 1,024 words from one SRAM buffer to another while the core runs copy_tcm. Which block of yours must change, and which do not?
Show Answer
The interconnect must change: it needs a second manager port and an arbiter, because the DMA engine and the CPU subsystem can both send transactions at the same time. The SRAM, the bridge and the peripherals do not: they answer transactions without knowing who sent them. The CPU subsystem does not change either; its accesses may now wait a little longer when the DMA engine has the bus.
Verification at the Level of the System
The tests in this section checked each block against its specification and then ran a few programs on the whole. A real SoC adds a structured verification plan for the system: connectivity tests that reach every register from every manager, programs that exercise every interrupt and DMA channel, randomized traffic, and the same C tests run later on an FPGA prototype and on the first chips. Writing and running those C programs on an SoC belongs to the SoC Verification tutorial; SoC-Level Verification Strategy gives the overview.
Where Is This Used?
Open-source SoC platforms show all of these features in readable RTL. Projects such as lowRISC's OpenTitan, the PULP platform's microcontrollers, and many RISC-V development boards' SoCs combine a small core with interrupt controllers, DMA, several bus segments and clock domains, organized the way this article describes. After this section you can read their top levels and find your own blocks in them, larger and with more options, but recognizably the same.
Common Mistakes
Mistake #1: Adding features before measuring
Each feature costs area, verification time and risk. Measuring Your SoC showed that a faster bridge would not shorten hello at all; an interrupt-driven UART would. Measure first, then add what the measurements ask for.
Mistake #2: Treating a new manager as a local change
A second manager looks like one more box on the diagram, but it changes the interconnect, the order in which memory sees accesses, and the assumptions of every program that shares data with it. Plan its arbitration and its tests before writing its RTL.
Your Turn in the Lab
An open extension, not graded. Take your SoC from S16 and add a second GPIO in slot 3: set the bridge's NP to 5, extend the slot parameter, and connect the new block's pins to new top-level ports. Then copy the visible test of S16 into your own project and change it so that it checks the new pins after a store to 0x4000_3000. Before you run it, predict how many cycles that one store takes and which of your blocks you had to change. This is integration work exactly as it is done on real projects: a new block, a new address, a new test.
Summary
cvsocis basic on purpose; production SoCs add interrupts, more managers with arbitration, overlapping transactions, caches and external memory, and several clock and power domains.- Interrupts would remove the polling that cost a third of
hello; a DMA engine would take copies off the core; overlapping transactions would raise bandwidth on the same bus. - Most of these features change the interconnect, the top level and the boundaries between blocks more than the blocks themselves.
- Each feature has an article in the first half of this tutorial; measure before adding, and plan the tests with the feature.