How Hundreds of IP Blocks Are Integrated
A chip of two hundred blocks is built by many teams. Every cut between two teams is a hand-off, and what crosses a hand-off is a promise. Follow one promise from a release day down to a clock edge.
You Will Be Able To
- Cut a chip into subsystems, and name what the teams on both sides of a cut must agree on.
- Say why the top level is generated from descriptions, and what a generated file cannot prove.
- Predict the work completed in a window, and compare the prediction with the circuit.
- Lesson
- S10.12
- Time
- 27 min
- Runs on
- Your browser
- Check
- 5 questions
The I/O team ships a new work queue on Friday. Every register stays at its address, and every test of the team passes.
On Monday the firmware of the compute team misses its deadline. Nothing it reads is wrong, but something it was promised is gone.
Before You Start
You need From Microcontroller to Application Processor: the large chip ap_phone and what grows with it.
You need The Memory Map and Address Decode and Aliases: a base address, a size, and the select line of a block.
You need Finding the Bottleneck and Sizing Buffers: a queue, its depth and its service.
| Question | |
|---|---|
| 1 | Why is a large chip cut into subsystems, and what must be agreed at each cut? |
| 2 | Why is the top level generated, and not typed? |
| 3 | All generated files agree with each other. What does that not prove? |
| 4 | A promise about speed says "three tickets". What else must it say? |
| 5 | The consumer takes a ticket every 2 ticks. What does the lab print last? |
The Idea: A Promise Across a Hand-Off
The small chip of this track had about twenty blocks, and one person could hold it in mind. The exercise chip of this module has two hundred. No team can design and test all of them together.
So the chip is cut. A group of blocks that one team builds, tests and ships as a unit is called a subsystem. Each has its own version and its own release day. The compute team can keep last month's I/O release while the I/O team works on the next one.
Every cut is a hand-off, and a hand-off works only if both sides agree on what crosses it. That agreement is a promise. It has two parts.
The first part is about places: which address a block has, which wire goes where, which interrupt number it uses. With two hundred blocks nobody types that by hand. Each team writes it once, in a file that tools can read, and a program writes the top level from those files.
The second part is about time: how much work a block gets done, and by when. No address map says that. It is written as a count in a window. A model predicts it before the circuit exists, and the circuit is then checked against it.
Friday's queue kept the first part of its promise and broke the second. The rest of this page follows it down to the clock edge where that shows.
New Words
| Word | Meaning |
|---|---|
| IP block | A finished design of one block, made to be used in many chips. IP is short for intellectual property. |
| Subsystem of a chip | A group of blocks that one team builds, tests and ships as a unit. Subsystem for short. |
| Hand-off between teams | The passing of work from one team to another, or from one tool to the next. Hand-off for short. |
| Release of a subsystem | One version of a subsystem that its team has tested and given out. Release for short. |
| Pinned release | A release that the chip build names by its exact version, so that everybody uses the same one. |
| Interface description | A file that tools can read. It lists the ports, registers, addresses and interrupts of a block. |
| Top-level generator | A program that reads the interface descriptions and writes the wiring between the blocks. Generator for short. |
| Performance model | A small program that predicts how much work a design gets done in a given time. Model for short on this page. |
| Workload | The work that is offered to a design in a test: what arrives, and when. |
| Counting window | The stretch of time over which a result is counted, with its first and its last tick. Window for short. |
| Work ticket | One job that waits in a queue. Ticket for short. |
One Picture: Cuts, Owners and One Description
- Processor
- Peripheral
- Bus
- Memory
- Debug
- Too large for one team
The exercise chip has 200 blocks. No team can design and test all of them together.
- Six cuts
The chip is cut into six subsystems. One team builds, tests and ships each of them, on its own days.
- A hand-off
The work queue belongs to the I/O team. The firmware that feeds it belongs to the compute team. What crosses between them is a promise.
- Written once
The I/O team writes down where its blocks are and what they connect to. A generator reads that and writes the top level.
- One pinned release
The chip release names one exact version of each subsystem. Everybody tests that same combination.
Read the diagram as text
- Chip release: 200 blocks; one version of each subsystem
- Compute team: 20 blocks, and the firmware
- I/O team: 60 blocks
- Four more teams: Memory, Media, System, Debug: 120 blocks
- Work queue: a block of the I/O team; the lab
- Interface descriptions: ports, registers, addresses, interrupts
- Generator: writes the top level, the decoder, the header
- Chip release → Compute team: pins a release
- Chip release → I/O team: pins a release
- Chip release → Four more teams: pins a release
- I/O team → Work queue: owns
- Compute team → Work queue: firmware uses it
- I/O team → Interface descriptions: writes
- Interface descriptions → Generator: read by
The six subsystems of the exercise chip ap_phone. Blocks in each: Compute 20, Memory 12, Media 48, I/O 60, System 40, Debug 20.
Here is the first part of a promise in real life. It is one entry of the address map of the small chip, and the select line that a generator wrote from it.
{"name":"GPIO","base":"0x10001000","size":"0x00001000","bus":"APB"}
// sel[4]: GPIO
assign sel[4] = ((addr & 32'hfffff000) == 32'h10001000);Nobody typed the second line. If the base address in the first line moves, the select line moves with it. So does the header that software reads.
The Smallest Example, Worked by Hand
No simulator yet. Now the second part of the promise, the one about time. The I/O team promises the compute team a queue of two places, and a consumer that takes one ticket every 3 ticks.
The compute team wants a number. How many tickets are done in a window of 12 ticks, ticks 0 to 11? The firmware always has a ticket ready. The queue starts empty.
The consumer comes by at ticks 0, 3, 6 and 9. Four visits sound like four tickets. Follow the queue and count.
| Tick | Consumer comes by? | What happens | Entered so far | Done so far |
|---|---|---|---|---|
| 0 | yes | The first ticket enters. Nothing can leave yet | 1 | 0 |
| 1 | no | A second ticket enters. The queue is full | 2 | 0 |
| 2 | no | Nothing enters: no place is free | 2 | 0 |
| 3 | yes | The oldest ticket leaves, and a new one takes its place | 3 | 1 |
| 6 | yes | The same again | 4 | 2 |
| 9 | yes | The same again | 5 | 3 |
| 11 | no | The window ends | 5 | 3 |
Three tickets, not four. The visit at tick 0 found a queue that had been empty a moment before. A ticket that enters on a tick cannot leave on the same tick.
So the promise "three tickets" means nothing by itself. It needs the start state (an empty queue), the window (ticks 0 to 11) and what is counted (tickets that left).
The Rules
Rule 1: Every cut between two teams has an owner on each side and a written promise.
The promise names what crosses the cut, and who may change it.
Rule 2: The promise about places is written once, in a description that tools read.
The top level, the address decoder and the header for software are generated from it.
Rule 3: A generated file proves only that it matches its source.
A wrong source gives the same error in every file. Check one end point against a list that was written separately.
Rule 4: The promise about time is a count in a window.
It names the start state, the first and the last tick, and what is counted.
Rule 5: A model predicts first, and the circuit is checked against it.
Both run the same workload in the same window. Their agreement holds for that workload only.
Rule 6: A release is a pinned combination.
It names the exact version of every subsystem, of the generator and of its settings, so that a result can be repeated.
Sources for These Rules
Rule 5, models that run before the circuit exists, and simple models that leave out the waiting for shared parts: Mehta, ASIC/SoC Functional Design Verification, chapter 11, sections 11.1, 11.2.1 and 11.3.1.
Rule 2: the standard format for such descriptions is IEEE 1685, called IP-XACT. That standard is not in the library of this site. We have only its title, from IEEE 1800.2-2020, Annex A, entry B3. A tool that builds a test bench from a bus design and such descriptions: Mehta, section 14.7.3.
Rule 3: a written list of connections that a formal tool turns into checks: Seligman, Schubert and Kiran Kumar, Formal Verification, second edition, chapter 7.
Rules 1, 4 and 6 are how teams work. They are practice, not rules of a standard. The cut into six subsystems and every number of the queue are exercise values.
Now Run It
The lab at the end of this page makes the prediction first, in four lines of test code. Then it runs the real queue circuit through the same 12 ticks and compares. Here are the rows of the hand table.
model window=12 completed=3
tick=0 service=1 accepted=1 completed=0 queued=1
tick=1 service=0 accepted=2 completed=0 queued=2
tick=2 service=0 accepted=2 completed=0 queued=2
tick=3 service=1 accepted=3 completed=1 queued=2
tick=6 service=1 accepted=4 completed=2 queued=2
tick=9 service=1 accepted=5 completed=3 queued=2
tick=11 service=0 accepted=5 completed=3 queued=2
rtl window=12 completed=3 agrees=1Rule 5 at work, in the first and the last row. The model says completed=3 before the circuit has run. The circuit says completed=3 as well, and agrees=1.
Rule 4, at tick 0. It has service=1 and completed=0. That is the visit that finds nothing to take, and the reason why the window must name its start state.
At tick 2 accepted stays at 2: both places are full. At tick 3 a ticket leaves and another enters on the same edge, so accepted=3 and completed=1.
This lab leaves things out. Its model and its circuit run in one simulator. The agreement covers one workload: a producer that is never late.
Why It Is Built This Way
| Choice | The alternative | Its cost |
|---|---|---|
| A top level generated from descriptions | A top level typed by hand | Thousands of wires, changed every week by six teams. One slip is found months later. |
| A count in a window | A rate: "one ticket every 3 ticks" | The rate hides the start. Our queue does 3 in 12 ticks, not 4, and nobody was wrong. |
| A model before the circuit | Measure when the circuit is ready | By then the firmware is written. A deadline that cannot be met is found too late to change the design. |
| Pinned releases | Everybody builds with the newest version | Two teams test two different chips. A fault cannot be repeated, so it cannot be found. |
The same workload is then carried from platform to platform, and each platform answers another question.
| Platform | What it is | The question it answers |
|---|---|---|
| Virtual platform | Fast models of the blocks, in software, before the circuit exists | Can the firmware find and program its devices? |
| Simulation of the circuit | The circuit itself, edge by edge, as in the lab | When does each ticket enter and leave? |
| Emulator | A machine that runs the whole circuit far faster than a simulator, and still shows every signal | Does the whole chip run real software? |
| FPGA prototype | The circuit loaded into FPGAs on a board | Does the driver work with the real device on the board? |
The Trap: The Faster Queue
Back to Friday. The old queue had a consumer that came by every 2 ticks. In the window of 12 ticks it completed 5 tickets, and the firmware was written around that number.
The new release had a better circuit inside and took one ticket every 3 ticks. Its own tests passed, because they checked every register and every ticket for order. In the same window it completes 3 tickets. On Monday the firmware waited for the fourth.
No address had changed, so no generated file had changed. The part of the promise that tools read was kept. The part about time was written nowhere, so no tool could miss it. Rule 4 is there to make that part a number that a test can check.
The second trap is the file that agrees with itself. Somebody swaps two interrupt numbers in a description. The top level, the decoder and the header are all generated from it, so all of them agree. Each interrupt now wakes the wrong handler. Only a check of one end point against a separate list shows it.
The third trap is the last tick. A window of 12 ticks that starts at 0 ends at tick 11. Count tick 12 as well, and a fourth ticket appears.
At Scale
This section looks ahead, to what a hand-off needs when a result must be repeated by people who were not there.
What a hand-off carries
More than the circuit. It carries the descriptions, the generated files and the version of the generator. It also carries the clock and reset plan, the firmware, the workload and the expected counts.
The first row that differs
When two teams disagree, they compare tick by tick. The first tick with another count names the transfer to look at, and the team to call.
A slower clock on a prototype
An FPGA prototype often runs on a slower clock than the chip. Tickets for each tick stay the same. Tickets for each second do not.
Checks that nobody typed
A list of connections can be turned into checks by a tool. Every wire of the top level is then proved against the list, not sampled.
Try It
Run the lab. Find the first tick with service=1 that completes nothing, and say why.
Set PERIOD to 2. Predict the ticks at which a ticket leaves, and the last row.
Set WINDOW to 13 and PERIOD back to 3. Predict the count. Is the promise "one ticket every 3 ticks" kept now?
Names Printed by the Lab
| Name | Meaning |
|---|---|
| model | The prediction, made before the circuit runs. |
| window | The number of ticks that are counted: ticks 0 to 11. |
| tick | The number of a clock edge. |
| service | 1 on a tick at which the consumer takes a ticket, if there is one. |
| accepted | Tickets that have entered the queue so far. |
| completed | Tickets that have left the queue so far. |
| queued | Tickets in the queue after this tick. |
| rtl | The count from the circuit. RTL is the usual name for a circuit written as registers and logic. |
| agrees | 1 if the circuit completed as many tickets as the model said. |
Sources and What the Lab Leaves Out
The circuit is a queue of two places, work_queue. The producer and the consumer are test code.
The model is four lines of the same test code. A real performance model is a program of its own, written before the circuit exists.
The lab runs on one platform, a simulator. It has no virtual platform, no emulator and no FPGA.
model window=12 completed=3 tick=0 service=1 accepted=1 completed=0 queued=1 tick=1 service=0 accepted=2 completed=0 queued=2 tick=2 service=0 accepted=2 completed=0 queued=2 tick=3 service=1 accepted=3 completed=1 queued=2 tick=4 service=0 accepted=3 completed=1 queued=2 tick=5 service=0 accepted=3 completed=1 queued=2 tick=6 service=1 accepted=4 completed=2 queued=2 tick=7 service=0 accepted=4 completed=2 queued=2 tick=8 service=0 accepted=4 completed=2 queued=2 tick=9 service=1 accepted=5 completed=3 queued=2 tick=10 service=0 accepted=5 completed=3 queued=2 tick=11 service=0 accepted=5 completed=3 queued=2 rtl window=12 completed=3 agrees=1Read included file: soc-s1011-queue.sv
// Two entries, with simultaneous replacement when the oldest entry leaves.
module work_queue (
input logic clk, reset_n, offer, service,
input logic [7:0] ticket,
output logic can_accept, has_work,
output logic [7:0] oldest
);
logic [1:0] used;
logic head, tail;
logic [7:0] slots [2];
wire pop = service && has_work;
assign has_work = used != 0;
assign can_accept = used < 2 || pop;
wire push = offer && can_accept;
assign oldest = slots[head];
always_ff @(posedge clk) begin
if (!reset_n) begin
used <= 0;
head <= 0;
tail <= 0;
end else begin
used <= used + push - pop;
if (push) begin
slots[tail] <= ticket;
tail <= ~tail;
end
if (pop) head <= ~head;
end
end
endmodule
Check Yourself
Common Mistakes
Wrong Accept generated files that agree with each other as proof of the wiring.
A wrong source gives the same error in every file.
Fix Drive one end point and compare where it lands with a list that was written separately.
Wrong Promise a rate with no window and no start state.
The first visit of the consumer finds an empty queue.
Fix Give the start state, the first and the last tick, and what is counted.
Wrong Test a new release against the newest version of everything else.
Nobody else has that combination, so no result can be repeated.
Fix Pin the version of every subsystem and of the generator.
Remember
- Every cut between two teams is a hand-off with a written promise.
- The promise about places is written once. The top level is generated from it, and one end point is still checked by hand.
- The promise about time is a count in a window, with a start state.
- A model predicts first. The circuit is checked against it on the same workload. A release pins the whole combination.