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.

Five questions this page answers
Question
1Why is a large chip cut into subsystems, and what must be agreed at each cut?
2Why is the top level generated, and not typed?
3All generated files agree with each other. What does that not prove?
4A promise about speed says "three tickets". What else must it say?
5The 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

New words on this page
WordMeaning
IP blockA finished design of one block, made to be used in many chips. IP is short for intellectual property.
Subsystem of a chipA group of blocks that one team builds, tests and ships as a unit. Subsystem for short.
Hand-off between teamsThe passing of work from one team to another, or from one tool to the next. Hand-off for short.
Release of a subsystemOne version of a subsystem that its team has tested and given out. Release for short.
Pinned releaseA release that the chip build names by its exact version, so that everybody uses the same one.
Interface descriptionA file that tools can read. It lists the ports, registers, addresses and interrupts of a block.
Top-level generatorA program that reads the interface descriptions and writes the wiring between the blocks. Generator for short.
Performance modelA small program that predicts how much work a design gets done in a given time. Model for short on this page.
WorkloadThe work that is offered to a design in a test: what arrives, and when.
Counting windowThe stretch of time over which a result is counted, with its first and its last tick. Window for short.
Work ticketOne job that waits in a queue. Ticket for short.

One Picture: Cuts, Owners and One Description

Cuts, Owners and One DescriptionStep through the picture. It starts with a chip that is too large for one team and ends with one pinned release.
  • Processor
  • Peripheral
  • Bus
  • Memory
  • Debug
Cuts, Owners and One DescriptionStep through the picture. It starts with a chip that is too large for one team and ends with one pinned release. component Chip release 200 blocks; oneversion of eachsubsystem component Compute team 20 blocks, and thefirmware component I/O team 60 blocks component Four more teams Memory, Media,System, Debug: 120blocks component Work queue a block of the I/Oteam; the lab component Interfacedescriptions ports, registers,addresses, interrupts component Generator writes the top level,the decoder, theheader pins a releasepins a releasepins a releaseownsfirmware uses itwritesread by
  1. component Chip release200 blocks; one version of each subsystem
    • pins a release → Compute team
    • pins a release → I/O team
    • pins a release → Four more teams
  2. component Compute team20 blocks, and the firmware
    • firmware uses it → Work queue
  3. component I/O team60 blocks
    • owns → Work queue
    • writes → Interface descriptions
  4. component Four more teamsMemory, Media, System, Debug: 120 blocks
  5. component Work queuea block of the I/O team; the lab
  6. component Interface descriptionsports, registers, addresses, interrupts
    • read by → Generator
  7. component Generatorwrites the top level, the decoder, the header
  1. Too large for one team

    The exercise chip has 200 blocks. No team can design and test all of them together.

  2. Six cuts

    The chip is cut into six subsystems. One team builds, tests and ships each of them, on its own days.

  3. 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.

  4. 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.

  5. 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.

One entry of the address map of ap_soc, and the select line that our 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.

Twelve ticks of the queue, by hand
TickConsumer comes by?What happensEntered so farDone so far
0yesThe first ticket enters. Nothing can leave yet10
1noA second ticket enters. The queue is full20
2noNothing enters: no place is free20
3yesThe oldest ticket leaves, and a new one takes its place31
6yesThe same again42
9yesThe same again53
11noThe window ends53

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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Printed by the lab on Icarus. Seven of the twelve tick rows are shown. Each count includes the edge of its row.
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=1

Rule 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

ChoiceThe alternativeIts cost
A top level generated from descriptionsA top level typed by handThousands of wires, changed every week by six teams. One slip is found months later.
A count in a windowA 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 circuitMeasure when the circuit is readyBy then the firmware is written. A deadline that cannot be met is found too late to change the design.
Pinned releasesEverybody builds with the newest versionTwo 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.

One workload, four platforms
PlatformWhat it isThe question it answers
Virtual platformFast models of the blocks, in software, before the circuit existsCan the firmware find and program its devices?
Simulation of the circuitThe circuit itself, edge by edge, as in the labWhen does each ticket enter and leave?
EmulatorA machine that runs the whole circuit far faster than a simulator, and still shows every signalDoes the whole chip run real software?
FPGA prototypeThe circuit loaded into FPGAs on a boardDoes 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

ap_socabout 20 blocks, one team
ap_phone200 blocks, 6 subsystems

This section looks ahead, to what a hand-off needs when a result must be repeated by people who were not there.

  1. 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.

  2. 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.

  3. 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.

  4. 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
NameMeaning
modelThe prediction, made before the circuit runs.
windowThe number of ticks that are counted: ticks 0 to 11.
tickThe number of a clock edge.
service1 on a tick at which the consumer takes a ticket, if there is one.
acceptedTickets that have entered the queue so far.
completedTickets that have left the queue so far.
queuedTickets in the queue after this tick.
rtlThe count from the circuit. RTL is the usual name for a circuit written as registers and logic.
agrees1 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.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: 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=1
Read 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

Predict the outputIn this run the consumer takes a ticket every 2 ticks, as in the old release of the story. What is the last line? Its form is: rtl window=12 completed=.. agrees=..
module tb;
  // The promise of the I/O team: a queue of two places whose consumer takes one ticket every PERIOD ticks.
  localparam int PERIOD = 2;
  localparam int WINDOW = 12;                // the window of the promise: ticks 0 to 11
  logic clk = 0, reset_n = 0;
  logic offer = 0, service = 0;
  logic [7:0] ticket = 0;
  wire can_accept, has_work;
  wire [7:0] oldest;
  int accepted = 0, completed = 0, predicted = 0;
  work_queue queue (clk, reset_n, offer, service, ticket, can_accept, has_work, oldest);
  always #5 clk = !clk;

  initial begin
    // The model, before any circuit: the queue starts empty, and a ticket that enters on a tick
    // cannot leave on the same tick. So the opening at tick 0 delivers nothing.
    for (int tick = 1; tick < WINDOW; tick++)
      if (tick % PERIOD == 0) predicted++;
    $display("model window=%0d completed=%0d", WINDOW, predicted);
    repeat (2) @(negedge clk);
    reset_n = 1;
    for (int tick = 0; tick < WINDOW; tick++) begin
      @(negedge clk);
      offer = 1;                             // a producer that always has a ticket
      service = tick % PERIOD == 0;
      ticket = accepted;
      @(posedge clk);
      if (can_accept) accepted++;
      if (service && has_work) begin
        if (oldest !== 8'(completed)) $fatal(1, "a ticket left out of order");
        completed++;
      end
      $display("tick=%0d service=%b accepted=%0d completed=%0d queued=%0d",
               tick, service, accepted, completed, accepted - completed);
    end
    $display("rtl window=%0d completed=%0d agrees=%0d", WINDOW, completed, completed == predicted);
    $finish;
  end
endmodule
Read 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
ConceptWhy is a large chip cut into subsystems?
ConceptWhy is the top level generated, and not typed?
ConceptAll generated files agree with each other. What does that not prove?
ConceptA promise about speed says "three tickets". What else must it say?

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.

Practice

Report a problem with this page