-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegGL.py
40 lines (28 loc) · 875 Bytes
/
RegGL.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#=========================================================================
# RegGL
#=========================================================================
from pymtl3 import *
from FlipFlopGL import FlipFlopGL
class RegGL( Component ):
def construct( s, nbits=4 ):
s.in_ = InPort (nbits)
s.out = OutPort(nbits)
s.ffs = [ FlipFlopGL() for _ in range(nbits) ]
for i in range(nbits):
s.in_[i] //= s.ffs[i].d
s.out[i] //= s.ffs[i].q
#-------------------------------------------------------------------------
# main
#-------------------------------------------------------------------------
if __name__ == "__main__":
dut = RegGL()
dut.apply( DefaultPassGroup(textwave=True) )
dut.sim_reset()
dut.in_ @= 0
dut.sim_tick()
dut.in_ @= 4
dut.sim_tick()
dut.in_ @= 6
dut.sim_tick()
dut.sim_tick()
dut.print_textwave()