Skip to content

Commit c2cc9d1

Browse files
committed
docs: describe the four pipeline models and what WB now does
pipeline.md still listed two execution models; there are four, and the config tags differ from the labels. It now also says which system instructions hold the front end until they retire, that a failed fetch is raised only if the program really gets there, and that a waiting ecall stays parked. virtual-memory.md said sfence.vma ignored rs1 and always flushed the whole TLB, but it flushes only the given address when rs1 is not x0. cli.md showed mode=SingleCycle where export-config writes Serialized and listed only two of the four modes.
1 parent 5c3f74d commit c2cc9d1

6 files changed

Lines changed: 46 additions & 42 deletions

File tree

‎docs/en/cli.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ bypass.ex_to_ex=true
335335
bypass.mem_to_ex=true
336336
bypass.wb_to_id=true
337337
bypass.store_to_load=false
338-
mode=SingleCycle
338+
mode=Serialized
339339
fu.alu=1
340340
fu.mul=1
341341
fu.div=1
@@ -369,8 +369,8 @@ list.
369369

370370
- `enabled` — pipeline enabled in the TUI
371371
- `bypass.ex_to_ex` / `bypass.mem_to_ex` / `bypass.wb_to_id` / `bypass.store_to_load` — forwarding paths
372-
- `mode` — mapped in the UI as `Serialized` or `Parallel UFs`
373-
- `fu.alu` / `fu.mul` / `fu.div` / `fu.fpu` / `fu.lsu` / `fu.sys` — functional-unit counts used by `Parallel UFs` mode
372+
- `mode` — `Serialized`, `ParallelUFs`, `Scoreboard` or `TomasuloRob` (shown in the UI as `Serialized`, `Parallel UFs`, `Scoreboard` and `Tomasulo + ROB`; `SingleCycle` and `FunctionalUnits` are accepted as aliases)
373+
- `fu.alu` / `fu.mul` / `fu.div` / `fu.fpu` / `fu.lsu` / `fu.sys` — functional-unit counts used by `Parallel UFs`, `Scoreboard` and `Tomasulo + ROB`
374374
- `branch_resolve` — `Id`, `Ex`, or `Mem`
375375
- `predict` — `NotTaken`, `Taken`, `Btfnt`, or `TwoBit`
376376
- `speed` — TUI playback speed (`Slow`, `Normal`, `Fast`, `Instant`)

‎docs/en/pipeline.md‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ Each visible pipeline step corresponds to exactly one CPU clock cycle. Cache lat
5959
- Handles `ecall`, `halt`, and `ebreak`
6060
`exit/exit_group` stop the whole program; `halt` stops the current hart permanently, while `ebreak`
6161
is a resumable debug stop
62+
- Runs the system instructions whose effect younger instructions must see: Zicsr (`csrrw`, `csrrs`,
63+
`csrrc` and the immediate forms), `mret`, `sret`, `fence.i` and `sfence.vma`. Fetch holds still from the
64+
moment one of them is fetched until it retires, then resumes at the right place — `mepc`/`sepc` after a
65+
return, freshly stored code after `fence.i`, fresh translations after `sfence.vma` or a `satp` write
66+
- Raises a failed fetch (an invalid word, a bus error, an instruction page fault) only if that
67+
instruction gets here: the front end runs ahead of branches, and a fetch on a path the program never
68+
takes — past the last `ret`, say — is flushed without a trace. A page fault enters the trap handler
69+
- An `ecall` that has to wait — for a line of input, or on `screen_sleep_ms` — does not retire: it stays
70+
parked and runs again when the run resumes, exactly as in sequential mode
6271
- Counts the instruction as retired only here
6372

6473
---
@@ -163,26 +172,18 @@ Visual markers:
163172

164173
## Execution model
165174

166-
The pipeline config currently exposes two execution models:
175+
The pipeline config exposes four execution models (`mode=` in the `[pipeline]` section of a config file):
167176

168-
- `Serialized`
169-
- `Parallel UFs`
177+
| Mode | Config tag | What it models |
178+
|---|---|---|
179+
| `Serialized` | `Serialized` | One instruction in `EX` at a time. A long-latency instruction holds `EX` for its configured latency and the front of the pipe waits behind it. |
180+
| `Parallel UFs` | `ParallelUFs` | `ID` dispatches into the functional-unit bank (ALU, MUL, DIV, FPU, LSU, SYS, each with a configurable number of instances), so independent instructions overlap in different units. Issue and retirement stay in program order. Loads and stores — including `flw`/`fsw` — go through the LSU and `MEM`. |
181+
| `Scoreboard` | `Scoreboard` | CDC 6600-style dynamic scheduling without renaming: a WAW stalls at issue and a WAR is guarded at write-result. |
182+
| `Tomasulo + ROB` | `TomasuloRob` | Reservation stations with register renaming and a reorder buffer: execution runs out of order, commit stays in order, exceptions stay precise. |
170183

171-
Both use the same functional-unit panel in the UI. The difference is semantic, not cosmetic.
184+
All four use the same functional-unit declaration and latencies (`CPIConfig`), so switching model changes the scheduling, not the machine. Under `Scoreboard` and `Tomasulo + ROB` an instruction changes the machine in one piece when it commits, in program order — which is what keeps their exceptions precise — and the front end starts over after any instruction that moved the PC without being a branch (a trap, `mret`, `sret`) and after every system instruction.
172185

173-
In the current implementation, execution still behaves like a single in-order EX path, and `EX` can remain busy for multiple cycles depending on class:
174-
175-
- `ALU`
176-
- `MUL`
177-
- `DIV`
178-
- `LOAD`
179-
- `STORE`
180-
- `BRANCH`
181-
- `JUMP`
182-
- `SYSTEM`
183-
- `FP`
184-
185-
While a long-latency instruction holds `EX`, the front of the pipe remains blocked and Raven keeps that state visible without letting unrelated IF latency progress incorrectly. The functional-unit panel breaks that latency down by FU so the user can see which resource is active and where parallelism could exist once the execution model allows it.
186+
While a long-latency instruction holds a unit, the panel shows which resource is busy and for how long, so the user can see where parallelism exists and which model exploits it.
186187

187188
---
188189

‎docs/en/virtual-memory.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ The **`sfence.vma`** instruction signals the hardware: "invalidate the cached tr
443443
- `sfence.vma rs1=x0, rs2=asid` → flush only the given ASID.
444444
- `sfence.vma rs1=vaddr, rs2=asid` → flush the specific entry.
445445

446-
Raven implements `sfence.vma` as a **full flush** in this release (`rs1`/`rs2` ignored), which is correct but not optimized. Writing `satp` also flushes, since switching tables invalidates everything.
446+
Raven honours `rs1`: `sfence.vma` with `rs1 = x0` flushes the whole TLB, and with a register it drops only the entries that translate that address (in every ASID — `rs2` is ignored, which is correct, just less selective). Writing `satp` also flushes everything, since switching tables invalidates every translation.
447447

448448
---
449449

‎docs/pt-BR/cli.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ bypass.ex_to_ex=true
333333
bypass.mem_to_ex=true
334334
bypass.wb_to_id=true
335335
bypass.store_to_load=false
336-
mode=SingleCycle
336+
mode=Serialized
337337
fu.alu=1
338338
fu.mul=1
339339
fu.div=1
@@ -367,8 +367,8 @@ lista completa de campos.
367367

368368
- `enabled` — pipeline habilitado na TUI
369369
- `bypass.ex_to_ex` / `bypass.mem_to_ex` / `bypass.wb_to_id` / `bypass.store_to_load` — caminhos de forwarding
370-
- `mode` — mapeado na UI como `Serialized` ou `Parallel UFs`
371-
- `fu.alu` / `fu.mul` / `fu.div` / `fu.fpu` / `fu.lsu` / `fu.sys` — quantidade de unidades funcionais usada no modo `Parallel UFs`
370+
- `mode` — `Serialized`, `ParallelUFs`, `Scoreboard` ou `TomasuloRob` (mostrados na UI como `Serialized`, `Parallel UFs`, `Scoreboard` e `Tomasulo + ROB`; `SingleCycle` e `FunctionalUnits` também são aceitos)
371+
- `fu.alu` / `fu.mul` / `fu.div` / `fu.fpu` / `fu.lsu` / `fu.sys` — quantidade de unidades funcionais usada em `Parallel UFs`, `Scoreboard` e `Tomasulo + ROB`
372372
- `branch_resolve` — `Id`, `Ex` ou `Mem`
373373
- `predict` — `NotTaken`, `Taken`, `Btfnt` ou `TwoBit`
374374
- `speed` — velocidade de reprodução na TUI (`Slow`, `Normal`, `Fast`, `Instant`)

‎docs/pt-BR/pipeline.md‎

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ Cada passo visível no pipeline corresponde exatamente a um ciclo de clock da CP
5959
- Trata `ecall`, `halt` e `ebreak`
6060
`exit/exit_group` param o programa inteiro; `halt` para o hart atual permanentemente, enquanto `ebreak`
6161
é uma pausa de debug resumível
62+
- Executa as instruções de sistema cujo efeito as instruções mais novas precisam ver: Zicsr (`csrrw`,
63+
`csrrs`, `csrrc` e as formas com imediato), `mret`, `sret`, `fence.i` e `sfence.vma`. A busca fica parada
64+
desde que uma delas é buscada até ela ser retirada, e retoma no lugar certo — `mepc`/`sepc` depois de um
65+
retorno, o código recém-escrito depois de `fence.i`, traduções novas depois de `sfence.vma` ou de uma
66+
escrita em `satp`
67+
- Só levanta uma busca que falhou (palavra inválida, erro de barramento, page fault de instrução) se essa
68+
instrução chegar aqui: o front end corre à frente dos desvios, e uma busca num caminho que o programa
69+
nunca toma — depois do último `ret`, por exemplo — é descartada sem deixar rastro. Um page fault entra no
70+
tratador de trap
71+
- Um `ecall` que precisa esperar — por uma linha de entrada, ou em `screen_sleep_ms` — não é retirado: fica
72+
estacionado e executa de novo quando a execução continua, exatamente como no modo sequencial
6273
- Conta a instrução como retirada apenas aqui
6374

6475
---
@@ -170,26 +181,18 @@ Marcadores visuais:
170181

171182
## Modelo de execução
172183

173-
A configuração do pipeline atualmente expõe dois modelos de execução:
184+
A configuração do pipeline expõe quatro modelos de execução (`mode=` na seção `[pipeline]` de um arquivo de configuração):
174185

175-
- `Serialized`
176-
- `Parallel UFs`
186+
| Modo | Tag na configuração | O que modela |
187+
|---|---|---|
188+
| `Serialized` | `Serialized` | Uma instrução em `EX` por vez. Uma instrução de longa latência ocupa o `EX` pela latência configurada e a frente do pipeline espera atrás dela. |
189+
| `Parallel UFs` | `ParallelUFs` | O `ID` despacha para o banco de unidades funcionais (ALU, MUL, DIV, FPU, LSU, SYS, cada uma com um número configurável de instâncias), então instruções independentes se sobrepõem em unidades diferentes. A emissão e a retirada continuam em ordem de programa. Loads e stores — incluindo `flw`/`fsw` — passam pela LSU e pelo `MEM`. |
190+
| `Scoreboard` | `Scoreboard` | Escalonamento dinâmico ao estilo do CDC 6600, sem renomeação: um WAW para na emissão e um WAR é protegido na escrita do resultado. |
191+
| `Tomasulo + ROB` | `TomasuloRob` | Estações de reserva com renomeação de registradores e um buffer de reordenação: a execução corre fora de ordem, o commit continua em ordem e as exceções continuam precisas. |
177192

178-
Ambos usam o mesmo painel de unidades funcionais na UI. A diferença é semântica, não cosmética.
193+
Os quatro usam a mesma declaração de unidades funcionais e as mesmas latências (`CPIConfig`), então trocar de modelo muda o escalonamento, não a máquina. Em `Scoreboard` e `Tomasulo + ROB` uma instrução altera a máquina de uma vez, no commit, em ordem de programa — é isso que mantém as exceções precisas — e o front end recomeça depois de qualquer instrução que moveu o PC sem ser um desvio (um trap, `mret`, `sret`) e depois de toda instrução de sistema.
179194

180-
Na implementação atual, a execução ainda se comporta como um único caminho EX in-order, e `EX` pode permanecer ocupado por múltiplos ciclos dependendo da classe:
181-
182-
- `ALU`
183-
- `MUL`
184-
- `DIV`
185-
- `LOAD`
186-
- `STORE`
187-
- `BRANCH`
188-
- `JUMP`
189-
- `SYSTEM`
190-
- `FP`
191-
192-
Enquanto uma instrução de longa latência mantém o `EX` ocupado, a frente do pipeline permanece bloqueada e o Raven mantém esse estado visível sem deixar a latência de IF não relacionada progredir incorretamente. O painel de unidades funcionais decompõe essa latência por UF para que o usuário possa ver qual recurso está ativo e onde o paralelismo poderia existir quando o modelo de execução permitir.
195+
Enquanto uma instrução de longa latência ocupa uma unidade, o painel mostra qual recurso está ocupado e por quanto tempo, para que o usuário veja onde existe paralelismo e qual modelo o aproveita.
193196

194197
---
195198

‎docs/pt-BR/virtual-memory.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ A instrução **`sfence.vma`** sinaliza pro hardware: "invalide as traduções c
443443
- `sfence.vma rs1=x0, rs2=asid` → flush só o ASID dado.
444444
- `sfence.vma rs1=vaddr, rs2=asid` → flush a entrada específica.
445445

446-
O Raven implementa `sfence.vma` como **flush total** nessa fase (`rs1`/`rs2` ignorados), o que é correto mas não otimizado. Escrever em `satp` também flusha, já que troca de tabela invalida tudo.
446+
O Raven respeita o `rs1`: `sfence.vma` com `rs1 = x0` esvazia a TLB inteira e, com um registrador, descarta só as entradas que traduzem aquele endereço (em qualquer ASID — o `rs2` é ignorado, o que é correto, só menos seletivo). Escrever em `satp` também esvazia tudo, já que trocar de tabela invalida todas as traduções.
447447

448448
---
449449

0 commit comments

Comments
 (0)