Livt packages
Eccelerators.RiscV
Version 0.3.0
Composable RV32I and Zmmul processors, machine-mode support, and reusable FPGA system components written in Livt.
Published files (120)
- fixtures
- DelayedWordDevice.lvt
- PipelineFetchMemory.lvt
- PipelineWordDevice.lvt
- README.md
- Rv32BusCoreTest.lvt
- Rv32BusProtocolTest.lvt
- Rv32CsrEngineTest.lvt
- Rv32CsrRetirement.lvt
- Rv32DspControlTest.lvt
- Rv32DspEngineTest.lvt
- Rv32DspMultiplierTest.lvt
- Rv32DualReadDistributedTest.lvt
- Rv32DualReadRegisterBankTest.lvt
- Rv32ExternalInterruptTest.lvt
- Rv32FetchBusTest.lvt
- Rv32iConstantsTest.lvt
- Rv32iDecodeTest.lvt
- Rv32InterruptCsrTest.lvt
- Rv32iPackageApiTest.lvt
- Rv32iSemanticsTest.lvt
- Rv32IterativeMultiplierTest.lvt
- Rv32LoadStoreBusTest.lvt
- Rv32MachineCsrsTest.lvt
- Rv32MachineDecoderTest.lvt
- Rv32MultiplyRetirement.lvt
- Rv32MultiplyVectors.lvt
- Rv32PipelineControlTest.lvt
- Rv32PipelineCsrEngineTest.lvt
- Rv32PipelineDspEngineTest.lvt
- Rv32PipelineEngineTest.lvt
- Rv32PipelineExternalInterruptTest.lvt
- Rv32PipelineTimerInterruptTest.lvt
- Rv32PipelineTrapEngineTest.lvt
- Rv32PipelineZmmulEngineTest.lvt
- Rv32RegisterBankTest.lvt
- Rv32SequentialControlTest.lvt
- Rv32SequentialEngineTest.lvt
- Rv32TimerInterruptTest.lvt
- Rv32TrapEngineTest.lvt
- Rv32TrapPolicyTest.lvt
- Rv32ZicsrAccessTest.lvt
- Rv32ZicsrDecoderTest.lvt
- Rv32ZmmulControlTest.lvt
- Rv32ZmmulDecodeTest.lvt
- Rv32ZmmulEngineTest.lvt
- RvExternalInterruptsTest.lvt
- RvMachineSystemTest.lvt
- RvMachineTimerTest.lvt
- RvPipelineSystemTest.lvt
- RvSystemTest.lvt
- RvUartDeviceTest.lvt
- RvUartSystemTest.lvt
tests/Rv32MachineDecoderTest.lvt
namespace Eccelerators.RiscV.Tests
using Eccelerators.RiscV.Sequential
using Eccelerators.RiscV.Machine
using Eccelerators.RiscV.Contracts
/**
* Tests the exact MRET overlay independently of CSR address legality.
*/
@Test
component Rv32MachineDecoderTest
{
// Owned decode chain; each overlay borrows its sole predecessor.
base: Rv32iZmmulDecoder
csr: Rv32ZicsrDecoder
subject: Rv32MachineDecoder
/**
* Uses the same decoder chain as the explicit trap composition.
*/
new()
{
base = new Rv32iZmmulDecoder()
csr = new Rv32ZicsrDecoder(base)
subject = new Rv32MachineDecoder(csr)
}
/**
* Exact MRET has no register operands/writes; every single-bit mutation differs.
*/
@Test
fn ExactReturn()
{
subject.instruction = 0x30200073
Simulation.Wait(2)
var control = subject.control as uint
assert RvDecoded.IsLegal(control)
assert !RvDecoded.HasSource1(control) && !RvDecoded.HasSource2(control)
assert !RvDecoded.HasDestinationWrite(control)
assert RvDecoded.Operation(control) == 240
for (var bit: uint = 0; bit < 32; bit++) {
subject.instruction = (0x30200073 ^ ((1 as uint) << bit)) as logic[32]
Simulation.Wait(2)
var category = RvDecoded.Operation(subject.control as uint) >> 4
assert category != 15
}
subject.instruction = 0x10200073
Simulation.Wait(2)
assert !RvDecoded.IsLegal(subject.control as uint)
subject.instruction = 0x10500073
Simulation.Wait(2)
assert !RvDecoded.IsLegal(subject.control as uint)
}
}