Update 'ALU'

Mario Romero 2023-06-06 16:28:22 +00:00
parent 74b5ecea81
commit 64b9d0ceff

45
ALU.md

@ -1,2 +1,43 @@
# Alu
![](https://git.1159.cl/Mario1159/RVSCC/media/branch/main/docs/figures/build/alu.svg)
# Arithmetic Logic Unit (ALU)
> *Defined in [rtl/alu.sv](https://git.1159.cl/Mario1159/RVSCC/src/branch/main/rtl/alu.sv)*
<table>
<tr>
<th>Figure</th>
<th>Direction</th>
<th>Signal</th>
</tr>
<tr>
<td rowspan="5"><img src="https://git.1159.cl/Mario1159/RVSCC/media/branch/main/docs/figures/build/alu.svg"/></td>
<td rowspan="3">Input</td>
<td>a</td>
</tr>
<tr>
<td>b</td>
</tr>
<tr>
<td>operation</td>
</tr>
<tr>
<td rowspan="2">Output</td>
<td>result</td>
</tr>
<tr>
<td>status</td>
</tr>
</table>
The Arithmetic Logic Unit (ALU) is the combinatorial circuit in charge to perform the binary operation selected by the `operation` signal.
`alu_opcode_t` is the enum that represent the operations, these are defined in [rv32i_defs.sv](https://git.1159.cl/Mario1159/RVSCC/src/branch/main/rtl/rv32i_defs.sv).
The `status` bus represent the following flags:
| Bit index | Flag | Description |
| --------- | -------- | ------------------ |
| 0 | N | Result is negative |
| 1 | Z | Result is zero |
| 2 | C | Carry out |
| 3 | V | Overflow |