What the difference between <= and = in cocotb?

328 views Asked by At

It seem that I can use indifferently <= or = to set an input signal value on my design. Is there a real difference between two ?

dut.button_in = 0

or

dut.button_in <= 0

I have exactly the same output chronogram.

1

There are 1 answers

0
FabienM On BEST ANSWER

The answer can be found here.

There is no fundamental difference between <= and = except that = can ovewrite the reference and <= is only used for value assignement.

AlexanderSpirin give some examples to illustrate the problem :

@cocotb.test()
def parallel_example(dut):
    reset_n = dut.reset
    dut.reset = 1        # OK
    dut.reset <= 1       # OK hdl-like shortcut for the next one 
    dut.reset.value = 1  # OK 
    reset_n <= 1         # OK
    reset_n.value = 1    # OK
    reset_n = 1          # Doesn't work: reference overwrite

Thanks to Vinay Madupura for the clue.