Hello, I'm trying to simulate my project inside caravel at GL. So I wrapped my project with user_project_wrapper.v, then copy the gl netlist to the verilog/gl and run the test from verilog/dv/cocotb with caravel_cocotb -t test -tag test_gl -sim GL. In the test.py I'm trying to drive an IO input with a clock with:
spi_clock = Clock(dut_inst.mprj_io_in[11], 100, units="ns") # Generate clock at 10 MHz
This give no error and is working, but the problem is that I'm trying to catch the falling edges of this input clock in order to sync the spi_mosi with it, so I'm using:
await FallingEdge(dut_inst.mprj_io_in[11])
But this give me this error:
cocotb.triggers.TriggerException: Unable set up FallingEdge(ModifiableObject(caravel_top.uut.padframe.mprj_io_in[11]))
I've tried different pins:
dut_inst = dut.uut.padframe
dut_inst = dut.uut and then accesing the inout port mprj_io[X]
dut_inst = dut and then accesing the inout port mprj_io[X]
But all of them throws the same error. As far as I saw, the assignment works correctly but the problem is use it in the FallingEdge function. How can I detect edges in an input using GL simulation? Previously I did this in RTL simulation using internal signals and it works fine.
Thank you in advance!
EDIT: I realized this errors also appears in RTL simulation, I think it has to do with inout pin being used in FallingEdge(). Any tip on how to use FallingEdge function with a bidirectional pin??
SOLUTION: Finally it was a problem not related with GL simulation, but with trying to read a port from the top level cavarel chip, I was able to use the Triggers lib function using the caravelEnv object that test_configure(dut) returns. i.e:
_caravelEnv = await test_configure(dut) #configure, start up and reset caravel_
_await FallingEdge(caravelEnv.dut.gpioX_monitor)_