Crate lib_rv32

Source

Modules§

decode
Decoding macros.
mcu
Reference implementation of an MCU.
traits
Traits to be implementation by other implementations of an MCU.

Macros§

b_imm
Decode the B-type immediate from a u32 formatted instruction.
bit_concat
Concatenate the bits of integers.
bit_extend
Extend a bit (useful for sign extension).
bit_slice
Macro to help with bit level access to integers. Example attempts to mimic Verilog syntax.
func3
Decode the FUNC3 field from a u32 formatted instruction.
func7
Decode the FUNC7 field from a u32 formatted instruction.
i_imm
Decode the I-type immediate from a u32 formatted instruction.
j_imm
Decode the J-type immediate from a u32 formatted instruction.
opcode
Decode the opcode field from a u32 formatted instruction.
rd
Decode the destination register field from a u32 formatted instruction.
rs1
Decode the first operand register field from a u32 formatted instruction.
rs2
Decode the second operand register field from a u32 formatted instruction.
s_imm
Decode the S-type immediate from a u32 formatted instruction.
sized_bit_extend
Like bit_extend, but outputs the result and its size in a tuple.
sized_bit_slice
Like bit_slice, but outputs the result and its size in a tuple.
u_imm
Decode the U-type immediate from a u32 formatted instruction.

Structs§

Assertions
Used to contain a set of assertions about the state of an MCU.

Enums§

RiscvError
Enum that encapsulates the various different ways execution can fail. Some errors are caused by other errors and reference them.

Statics§

REG_NAMES
Array to match register numbers to their common names.

Functions§

exec_one
Decode and execute instruction. This will use the program counter to fetch an instruction from memory, decode/evaluate it, and commit the results to pc, mem, and rf.