From a8ee69c5f3f268d7158e8f65b62d108e8fb76c93 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Thu, 25 Jun 2020 12:32:36 +0200 Subject: [PATCH] Use constants for CSR addresses --- gram/test/test_dfii.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gram/test/test_dfii.py b/gram/test/test_dfii.py index f143867..339ad7c 100644 --- a/gram/test/test_dfii.py +++ b/gram/test/test_dfii.py @@ -7,6 +7,14 @@ from gram.dfii import * from gram.phy.dfi import Interface from utils import * +# Phase injector CSR addresses +PI_COMMAND_ADDR = 0x00 +PI_COMMAND_ISSUE_ADDR = 0x04 +PI_ADDRESS_ADDR = 0x08 +PI_BADDRESS_ADDR = 0x0C +PI_WRDATA_ADDR = 0x10 +PI_RDDATA_ADDR = 0x14 + class CSRHost(Peripheral, Elaboratable): def __init__(self, name="csrhost"): super().__init__(name=name) @@ -48,7 +56,7 @@ class PhaseInjectorTestCase(FHDLTestCase): m, dfi, csrhost = self.generate_phaseinjector() def process(): - yield from wb_write(csrhost.bus, 0x8 >> 2, 0xCDC, sel=0xF) + yield from wb_write(csrhost.bus, PI_ADDRESS_ADDR >> 2, 0xCDC, sel=0xF) self.assertEqual((yield dfi.phases[0].address), 0xCDC) runSimulation(m, process, "test_phaseinjector.vcd") @@ -57,7 +65,7 @@ class PhaseInjectorTestCase(FHDLTestCase): m, dfi, csrhost = self.generate_phaseinjector() def process(): - yield from wb_write(csrhost.bus, 0xC >> 2, 0xA8, sel=0xF) + yield from wb_write(csrhost.bus, PI_BADDRESS_ADDR >> 2, 0xA8, sel=0xF) self.assertEqual((yield dfi.phases[0].bank), 0xA8) runSimulation(m, process, "test_phaseinjector.vcd") -- 2.30.2