coreblocks.params package
Submodules
coreblocks.params.configurations module
coreblocks.params.fu_params module
- class coreblocks.params.fu_params.BlockComponentParams
Bases:
ABC
- abstract get_optypes() set[coreblocks.arch.optypes.OpType]
- class coreblocks.params.fu_params.FunctionalComponentParams
Bases:
ABC
- abstract get_optypes() set[coreblocks.arch.optypes.OpType]
- coreblocks.params.fu_params.optypes_supported(components: Iterable[coreblocks.params.fu_params.BlockComponentParams | coreblocks.params.fu_params.FunctionalComponentParams]) set[coreblocks.arch.optypes.OpType]
coreblocks.params.genparams module
- class coreblocks.params.genparams.GenParams
Bases:
DependentCache
- __init__(cfg: CoreConfiguration)
coreblocks.params.icache_params module
- class coreblocks.params.icache_params.ICacheParameters
Bases:
object
Parameters of the Instruction Cache.
- Parameters
- addr_widthint
Length of addresses used in the cache (in bits).
- word_widthint
Length of the machine word (in bits).
- num_of_waysint
Associativity of the cache.
- num_of_sets_bitsint
Log of the number of cache sets.
- line_bytes_logint
Log of the size of a single cache line in bytes.
- enablebool
Enable the instruction cache. If disabled, requestes are bypassed to the bus.
- __init__(*, addr_width, word_width, fetch_block_bytes_log, num_of_ways, num_of_sets_bits, line_bytes_log, enable=True)
coreblocks.params.instr module
Based on riscv-python-model by Stefan Wallentowitz https://github.com/wallento/riscv-python-model
- class coreblocks.params.instr.BTypeInstr
Bases:
InstructionFunct3Type
- __init__(opcode: Opcode, funct3: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs1: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs2: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, imm: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- imm
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs1
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs2
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- class coreblocks.params.instr.EBreakInstr
Bases:
ITypeInstr
- __init__()
- class coreblocks.params.instr.ITypeInstr
Bases:
InstructionFunct3Type
- __init__(opcode: Opcode, funct3: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rd: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs1: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, imm: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- imm
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rd
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs1
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- class coreblocks.params.instr.IllegalInstr
Bases:
RISCVInstr
- __init__()
- illegal = (cat (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)) (cat (const 1'd1)))
- class coreblocks.params.instr.JTypeInstr
Bases:
RISCVInstr
- __init__(opcode: Opcode, rd: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, imm: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- imm
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rd
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- class coreblocks.params.instr.RISCVInstr
Bases:
ABC
,ValueCastable
- as_value()
Convert
self
to a value-like object.This method is called by the Amaranth language to convert
self
to a concreteValue
. It will usually return aValue
object, but it may also return another value-like object to delegate its functionality.This method must be idempotent: when called twice on the same object, the result must be exactly the same.
This method may also be called by code that is not a part of the Amaranth language.
- Returns
- Any other object recognized by
Value.cast()
.
- Any other object recognized by
- Raises
- Exception
When the conversion cannot be done. This exception must be propagated by callers, either directly or as a cause of another exception.
It is recommended that, in cases where this method raises an exception, the
shape()
method also raises an exception.
- opcode
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- shape()
Compute the shape of
self
.This method is not called by the Amaranth language itself; whenever it needs to discover the shape of a value-castable object, it calls
self.as_value().shape()
. However, that method must return aShape
, andValueCastable
subclasses may have a richer representation of their shape provided by an instance of aShapeCastable
subclass. This method may return such a representation.This method must be idempotent: when called twice on the same object, the result must be exactly the same.
The following condition must hold:
Shape.cast(self.shape()) == Value.cast(self).shape()
- Returns
- A shape-like object.
- Raises
- Exception
When the conversion cannot be done. This exception must be propagated by callers, either directly or as a cause of another exception.
It is recommended that, in cases where this method raises an exception, the
as_value()
method also raises an exception.
- class coreblocks.params.instr.RTypeInstr
Bases:
InstructionFunct3Type
,InstructionFunct7Type
- __init__(opcode: Opcode, funct3: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, funct7: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rd: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs1: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs2: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- rd
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs1
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs2
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- class coreblocks.params.instr.STypeInstr
Bases:
InstructionFunct3Type
- __init__(opcode: Opcode, funct3: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs1: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, rs2: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, imm: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- imm
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs1
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rs2
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- class coreblocks.params.instr.UTypeInstr
Bases:
RISCVInstr
- __init__(opcode: Opcode, rd: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable, imm: amaranth.hdl._ast.Value | int | enum.Enum | amaranth.hdl._ast.ValueCastable)
- imm
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.
- rd
Information about a field in a RISC-V instruction.
- Attributes
- base: int | list[int]
A bit position (or a list of positions) where this field (or parts of the field) would map in the instruction.
- size: int | list[int]
Size (or sizes of the parts) of the field
- signed: bool
Whether this field encodes a signed value.
- offset: int
How many bits of this field should be skipped when encoding the instruction. For example, the immediate of the jump instruction always skips the least significant bit. This only affects encoding procedures, so externally (for example when creating an instance of a instruction) full-size values should be always used.
- static_value: Optional[Value]
Whether the field should have a static value for a given type of an instruction.