py4hw supports the classic bitwise relational operations that you would expect to have in any programming language: ==, !=, >, <, ...
import py4hw
import matplotlib.pyplot as plt
import wavedrom as wd
hw = py4hw.HWSystem()
a = py4hw.Wire(hw, 'a', 8)
b = py4hw.Wire(hw, 'b', 8)
gt = py4hw.Wire(hw, 'gt')
eq = py4hw.Wire(hw, 'eq')
lt = py4hw.Wire(hw, 'lt')
py4hw.Sequence(hw, 'a', [1, 2, 3, 4, 6, 7, 8, 9], a)
py4hw.Sequence(hw, 'b', [1, 4, 8], b)
py4hw.Comparator(hw, 'cmp', a, b, gt, eq, lt)
wvf = py4hw.Waveform(hw, 'wvf', [a, b, gt, eq, lt])
hw.getSimulator().clk(20)
wd.render(str(wvf.get_wavedrom(shortNames=True)))
We also support comparators with constants
hw = py4hw.HWSystem()
a = py4hw.Wire(hw, 'a', 8)
is5 = py4hw.Wire(hw, 'is5')
py4hw.Sequence(hw, 'a', [1, 2, 3, 4, 5, 6, 7, 8, 9], a)
py4hw.EqualConstant(hw, 'is5', a, 5, is5)
wvf = py4hw.Waveform(hw, 'wvf', [a, is5])
hw.getSimulator().clk(20)
wd.render(str(wvf.get_wavedrom(shortNames=True)))