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/Rv32iPackageApiTest.lvt
namespace Eccelerators.RiscV.Tests
using Eccelerators.RiscV.System
using Eccelerators.RiscV.Presets
/**
* Checks the public turnkey system API through its exported namespace: default
* device provisioning, run-to-halt execution and software restart. Scenarios
* initialize their own program image while the core is idle.
*/
@Test
component Rv32iPackageApiTest
{
// Owned system-level machine using the default ROM/RAM devices.
system: RvMemorySystem<Rv32iSequentialCore>
/**
* Constructs the owned subject; scenarios supply their own program.
*/
new()
{
system = new RvMemorySystem<Rv32iSequentialCore>()
}
/**
* Idles the system, then loads a two-word program while not running.
*/
fn Load(word: uint)
{
system.run = 0b0
var elapsed: uint = 0
while (system.idle == 0b0 && elapsed < 100) {
state {
elapsed++
}
}
assert system.idle == 0b1
var ticket = ~system.restartAck
state {
system.restartRequest = ticket
}
elapsed = 0
while (system.restartAck != ticket && elapsed < 100) {
state {
elapsed++
}
}
assert system.restartAck == ticket
assert system.halted == 0b0
state {
system.fetchProgramWrite = 0b1
system.fetchProgramIndex = 0 as logic[10]
system.fetchProgramData = word as logic[32]
}
state {
system.fetchProgramIndex = 1 as logic[10]
system.fetchProgramData = 0x00100073 as logic[32]
}
state {
system.fetchProgramWrite = 0b0
}
}
/**
* A documented entry point executes addi, reports retirement and restarts.
*/
@Test
fn TestDocumentedEntryPoint()
{
Load(0x04400093)
var elapsed: uint = 0
state {
system.run = 0b1
}
while (system.halted == 0b0 && elapsed < 300) {
state {
elapsed++
}
}
assert system.halted == 0b1
assert system.faultCause as uint == 3
assert system.faultValue as uint == 4
assert system.pc as uint == 4
assert system.retired == 0b0
assert system.retiredRd as uint == 1
assert system.retiredValue as uint == 0x44
assert system.retiredPc as uint == 0
assert system.retiredInstruction as uint == 0x00100073
state {
system.run = 0b0
}
var ticket = ~system.restartRequest
state {
system.restartRequest = ticket
}
elapsed = 0
while (system.restartAck != ticket && elapsed < 100) {
state {
elapsed++
}
}
assert system.restartAck == ticket
assert system.halted == 0b0 && system.pc as uint == 0
}
}