PyHCL/example/Assert.py

22 lines
447 B
Python
Raw Permalink Normal View History

2023-01-08 12:09:24 +08:00
# Copyright (c) 2019 scutdig
# Licensed under the MIT license.
2021-12-10 19:37:54 +08:00
from pyhcl import *
class AND(RawModule):
io = IO(
a=Input(U.w(1)),
b=Input(U.w(1)),
s=Output(U.w(1)),
)
myclock = Input(Clock())
myreset = Input(Bool)
2022-07-18 19:36:03 +08:00
io.s @= io.a ^ io.b
2021-12-10 19:37:54 +08:00
_ = doAssert(myclock, io.a, io.s, "IF io.a is HIGH then io.s is HIGH")
if __name__ == '__main__':
fa = AND()
Emitter.dump(Emitter.emit(fa), "and.fir")