tb: pcs: Specify clock periods directly

Instead of calculating clock periods based on the desired frequncy,
specify the periods diretly. This silences the following kind of error
caused by floating point rounding:

Unable to accurately represent 8000.000000000001(sec) with the simulator precision of 1e-12

Fixes: d351291 ("Initial commit")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2022-08-06 15:24:47 -04:00
parent 93e91e3eb0
commit 2b752c4bc1
1 changed files with 2 additions and 2 deletions

View File

@ -224,7 +224,7 @@ async def pcs_send_codes(pcs, codes):
@cocotb.test(timeout_time=10, timeout_unit='us')
async def test_tx(pcs):
await cocotb.start(Clock(pcs.tx_clk, 1/125e6, units='sec').start())
await cocotb.start(Clock(pcs.tx_clk, 8, units='ns').start())
async def tx_ce():
pcs.tx_ce.value = 1
while True:
@ -259,7 +259,7 @@ async def test_rx(pcs):
pcs.pma_data_rx_valid.value = 2
pcs.link_status.value = 1
await Timer(1)
await cocotb.start(Clock(pcs.rx_clk, 1/125e6, units='sec').start())
await cocotb.start(Clock(pcs.rx_clk, 8, units='ns').start())
packet = list(as_nibbles((0x55, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF)))
# And test errors too