Reading an SoC Specification
A chip is described by documents long before it exists. Learn their parts, and how to pull one answer out of five tables. Learn what to do when a table is silent or wrong.
You Will Be Able To
- Name the parts of a data sheet and of an architecture document.
- Answer a question about one device by crossing the tables of the document.
- Find what a document leaves out, and where the RTL disagrees with it.
- Lesson
- S1.6
- Time
- 26 min
- Runs on
- Your browser
- Check
- 5 questions
The document says the timer is at 0x1000_2000. The RTL answers at 0x1000_3000. Both passed their reviews. Software written from the document will talk to the wrong device.
Before You Start
You need the memory map from S0.2, and reset and interrupts from S0.8. You need the architecture document and its owner from S1.4.
| Question | |
|---|---|
| 1 | Which two documents describe a chip, and who reads each? |
| 2 | Which five tables does an architecture document always have? |
| 3 | How do you collect everything about one device? |
| 4 | What do you do when a table says nothing about a device? |
| 5 | How do you find where the RTL disagrees with the document? |
The Idea: The Document Is the Chip, Until There Is a Chip
For most of the flow of S1.4 there is no chip. There is a document. Designers write RTL from it. Verification engineers write tests from it. Firmware engineers write code from it.
So reading that document well is a working skill, and it is the first one a new engineer needs. The skill has three parts.
Know where things are. Join facts that live in different tables. And notice what is absent or contradicted, because that is where the bugs of S1.4 begin.
New Words
| Word | Meaning |
|---|---|
| Data sheet | The document for the user of a chip. It says what the chip does, and what each pin needs. |
| Pin list | The table of every pin: its name, its direction and the device behind it. |
| Reserved | Kept for later use. Software must not use a reserved address or bit. |
| Reset source | One of the things that can reset the chip, such as its reset pin. A power-on reset is the one that acts when power arrives. |
| Reset cause register | A register that records which reset source acted last. |
| Oscillator | A circuit that makes a clock. |
| PLL | Phase-locked loop: a circuit that makes a faster clock from a slower one. |
| Open point | A place where a document is silent, unclear or contradicted. It is written down and sent to the owner. |
| Debugger | A tool outside the chip that can stop the processor and look inside. S1.1 met its block. |
Two short names belong to UART0: TX stands for transmit, and RX stands for receive.
The architecture document of S1.4 is the second document of a chip. The data sheet faces outward, to the customer. The architecture document faces inward, to the team.
One Picture: Five Tables, Joined by a Name
| Data sheet | Architecture document | |
|---|---|---|
| Reader | the engineer who puts the chip on a board | the team that builds the chip |
| Main parts | summary and block diagram, pin list, how to operate it, voltages and timing | block diagram, memory map, clock table, reset table, interrupt table, pin list |
| Written | before the chip is made, for the customer | first of all, at the architecture stage |
- Peripheral
- Memory
- Processor
- Clock / reset
- Power
- Pads
- Memory map
Software reaches UART0 at 0x1000_0000. The region is 0x1000 bytes long.
- Interrupt table
UART0 raises interrupt source 1.
- Clock table
UART0 is a device of table 1, so the peripheral clock of 50 MHz drives it.
- Reset table
Every source except the debugger resets the devices. A debugger reset leaves UART0 as it was.
- Pin list
UART0 owns two pins: one out and one in.
Read the diagram as text
- UART0: one name, used the same way in every table
- Memory map: where its registers are
- Interrupt table: which source number it raises
- Clock table: which clock drives it
- Reset table: which resets clear it
- Pin list: which pins it owns
- Memory map → UART0: 0x1000_0000
- Interrupt table → UART0: source 1
- Clock table → UART0: 50 MHz
- Reset table → UART0: four of five sources
- Pin list → UART0: UART TX, UART RX
Every edge is one row of the excerpt below.
The Smallest Example, Worked by Hand: Everything About UART0
Here is an excerpt of the ap_soc architecture document. We wrote it for this page, with the real values of ap_soc version 1.0.
| Device | First address | Size | Purpose |
|---|---|---|---|
| UART0 | 0x1000_0000 | 0x0000_1000 | Serial console. |
| GPIO | 0x1000_1000 | 0x0000_1000 | 16 general-purpose pins. |
| Timer and PWM | 0x1000_2000 | 0x0000_1000 | Timer and pulse-width modulation. |
| Watchdog | 0x1000_3000 | 0x0000_1000 | Watchdog reset control. |
| ap_sysctl | 0x1000_4000 | 0x0000_1000 | Chip ID, reset cause, clock control, pin mux and straps. |
| SPI | 0x1000_5000 | 0x0000_1000 | SPI controller. |
| DMA | 0x1000_6000 | 0x0000_1000 | DMA control registers; transfers use its AHB manager port. |
From the ap_soc architecture document, version 1.0. Addresses 0x1000_8000 to 0x1000_FFFF are reserved.
| Source | Device |
|---|---|
| 1 | UART0 |
| 2 | GPIO |
| 3 | Timer and PWM |
| 4 | SPI |
| 5 | DMA |
| 6 | Watchdog, shortly before it resets the chip |
| 7 to 16 | spare, no device |
| Clock | Rate | Used by |
|---|---|---|
| RC oscillator | 25 MHz | the chip, from power-on until it switches to the PLL |
| Crystal oscillator | 50 MHz | the PLL, as its reference |
| PLL output | 100 MHz | the processor and the bus |
| Peripheral clock | 50 MHz, the PLL output divided by two | the devices of table 1 |
| Source | Bit of the reset cause register | What it resets |
|---|---|---|
| Power-on | 0 | everything |
| Reset pin | 1 | processor, bus and devices |
| Watchdog | 2 | processor, bus and devices |
| Software | 3 | processor, bus and devices |
| Debugger | 4 | the processor only |
The reset cause register is in ap_sysctl, at offset 4. It reads 01 after a power-on reset.
| Pin | Direction | Device |
|---|---|---|
| CLK | in | crystal oscillator |
| RST | in | reset pin |
| JTAG | in and out | debug |
| UART TX | out | UART0 |
| UART RX | in | UART0 |
| GPIO pins, 16 of them | in and out | GPIO |
A firmware engineer must print one letter and be told when it has gone. That needs four facts, and each lives in a different table.
| Needed | Table | Answer |
|---|---|---|
| Where to write the letter | 1, memory map | the UART0 region, from 0x1000_0000 |
| Which interrupt says "sent" | 2, interrupt sources | source 1 |
| Which pin to watch on the board | 5, pins | UART TX |
| How fast UART0 is clocked | 3, clocks | 50 MHz, the peripheral clock |
Now look for silence. Take each device of table 1 and find it in tables 2 and 5.
| Device | In table 2, interrupts | In table 5, pins |
|---|---|---|
| UART0 | source 1 | UART TX, UART RX |
| GPIO | source 2 | GPIO pins, 16 of them |
| Timer and PWM | source 3 | no row |
| Watchdog | source 6 | no row |
| ap_sysctl | no row | no row |
| SPI | source 4 | no row |
| DMA | source 5 | no row |
Built from the excerpt. "No row" may be correct, or it may be an omission. The excerpt does not say which.
Two blanks are worth a question. ap_sysctl has no interrupt: is that meant? And SPI talks to chips outside, yet it has no pins. Its pins may be shared through the pin mux of S1.1, and the excerpt is silent.
The Rules
Rule 1: Find the five tables first.
They are the memory map, the clocks, the resets, the interrupts and the pins. Almost every question starts in one of them.
Rule 2: Join tables by the name of the device.
A full answer about one device takes a row from several tables. The name must be spelled the same in each.
Rule 3: A blank is an open point.
If a table has no row for a device, the document must say why. Do not guess. Ask the owner of the document.
Rule 4: Reserved means "do not touch".
A reserved address or bit may gain a meaning in a later version. Software that used it will then break.
Rule 5: When the document and the RTL disagree, one of them has a bug.
Do not decide alone which one. Report the difference to both owners.
Sources for These Rules
The parts of a data sheet: Weste and Harris, CMOS VLSI Design, 4th edition, section 14.6.
The five tables and the five rules are common practice. They are not taken from a library source.
Every value of the excerpt is a value of ap_soc version 1.0, the chip of this course. No vendor document was copied.
Now Run It: The Document Against the RTL
The lab at the end of this page holds a small top level. It decodes three devices, wires three interrupts and gives one reset value. The test code walks seven rows of the excerpt and checks each against the RTL.
map: UART0 at 0x1000_0000: agrees
map: GPIO at 0x1000_1000: agrees
map: Timer and PWM at 0x1000_2000: DIFFERS
interrupts: UART0 is source 1: agrees
interrupts: GPIO is source 2: DIFFERS
interrupts: Timer and PWM is source 3: agrees
resets: cause reads 01 after power-on: DIFFERS
rows that differ: 3 of 7Three rows differ. Rule 5 at work: each one is a bug in the RTL or in the document. The lab alone cannot say which.
| Row | The document says | The RTL does | Who would be hurt |
|---|---|---|---|
| Map, Timer and PWM | first address 0x1000_2000 | it answers at 0x1000_3000, the place of the Watchdog | software: every timer access reaches nothing |
| Interrupts, GPIO | source 2 | it raises source 4, the number of SPI | firmware: the SPI handler runs for a GPIO event |
| Resets, cause register | 01 after power-on | it reads 00 | firmware: it cannot tell why the chip started |
None of these would stop the RTL from compiling. None would show in a synthesis report. Only a check that reads the document finds them.
The lab leaves things out. Seven rows are checked by hand-written calls. A real team builds such checks from the document itself, so that no row is skipped.
Why It Is Built This Way
| Design choice | The alternative | What the choice buys, and costs |
|---|---|---|
| One table for each kind of fact | One chapter for each device | Clashes show at a glance: two devices at one address sit in adjacent rows. A device is spread over five tables. |
| Reserved ranges written down | Unused space left unmentioned | Later versions can grow without breaking software. The RTL must refuse access to them. |
| The document is the reference | The RTL is the reference | Firmware and tests can start before the RTL exists. The document must be kept up to date. |
The Trap: Reading the RTL in Place of the Document
An engineer needs the timer address. The document is long, and the RTL is open on the screen. The decoder says 0x1000_3000, and the engineer uses that.
The code works on today's RTL. Next month the RTL bug is repaired, and the code breaks. The engineer copied a bug into software.
The cure is rule 5, used in both directions. Take the fact from the document. If the RTL differs, do not pick a side. Report the open point.
At Scale
This section looks ahead. The excerpt has five small tables. The document of a phone chip has thousands of rows.
Tables as data
The tables are kept as files that tools can read. The decoder, the firmware addresses and the tests are all built from them.
Checks built from the document
A tool turns each row into a check like the calls of the lab. A new row brings its check with it.
Versions
Every hand-off names the version of the document it was built from. A change to a table is reviewed like a change to RTL.
Later in this course
Each table gets its own module: the map in S4, clocks and resets in S5, interrupts in S6, pins in S7.
Try It
Run the lab. Find each of the three differences in the RTL of small_top.
Repair the RTL so that all seven rows agree. Change no line of the test code.
Add an eighth row for a reserved address: no select may rise at 0x1000_8000.
map: UART0 at 0x1000_0000: agrees map: GPIO at 0x1000_1000: agrees map: Timer and PWM at 0x1000_2000: DIFFERS interrupts: UART0 is source 1: agrees interrupts: GPIO is source 2: DIFFERS interrupts: Timer and PWM is source 3: agrees resets: cause reads 01 after power-on: DIFFERS rows that differ: 3 of 7Check Yourself
Common Mistakes
Wrong Take an address from the RTL because it is quicker to find.
The RTL may hold a bug that the document does not.
Fix Take it from the document, and report any difference.
Wrong Read a missing row as "none".
A blank can be a decision or an omission.
Fix Ask the owner, and have the answer written into the document.
Wrong Use a reserved address for a quick test.
A later version may give it a meaning.
Fix Leave every reserved address and bit alone.
Remember
- A data sheet faces the customer; an architecture document faces the team.
- Five tables hold most facts: map, clocks, resets, interrupts and pins.
- Join the tables by the name of the device.
- A blank, and a reserved range, are facts to respect and to question.
- A difference between the document and the RTL is an open point for both owners.