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/Rv32RegisterBankTest.lvt
namespace Eccelerators.RiscV.Tests
using Eccelerators.RiscV.Storage
using Livt.IO
/**
* Independent architectural checks for the single-port register bank. Read
* responses arrive one enabled edge after the request; disabled cycles hold.
*/
@Test
component Rv32RegisterBankTest
{
// Owned bank under test in the test clock domain.
subject: Rv32RegisterBank<MemoryStyle.Block>
/**
* Instantiates the concrete block-style bank.
*/
new()
{
subject = new Rv32RegisterBank<MemoryStyle.Block>()
}
/**
* Writes the sentinel index * 17 into x1..x31 through the public port.
*/
fn Initialize()
{
subject.enable = 0b1
subject.write = 0b0
for (var index: uint = 1; index < 32; index++) {
subject.index = index as logic[5]
subject.writeData = (index * 17) as logic[32]
subject.write = 0b1
Simulation.Wait(2)
}
subject.write = 0b0
Simulation.Wait(2)
}
/**
* Every register, including x31 and x0, reads exactly its initialized payload.
*/
@Test
fn ReadsAllRegisters()
{
Initialize()
for (var index: uint = 0; index < 32; index++) {
subject.index = index as logic[5]
Simulation.Wait(2)
assert subject.readData as uint == index * 17
}
}
/**
* x0 always reads zero and never stores payload.
*/
@Test
fn ZeroRegisterStaysZero()
{
Initialize()
subject.index = 0
subject.writeData = 99
subject.write = 0b1
Simulation.Wait(4)
subject.write = 0b0
Simulation.Wait(2)
assert subject.readData == 0
}
/**
* A disabled access leaves the previous read response unchanged.
*/
@Test
fn DisabledAccessHolds()
{
Initialize()
subject.enable = 0b1
subject.index = 2
Simulation.Wait(2)
subject.enable = 0b0
subject.index = 1
Simulation.Wait(6)
assert subject.readData as uint == 34
subject.enable = 0b1
Simulation.Wait(2)
assert subject.readData as uint == 17
}
}