mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
partial check in
This commit is contained in:
parent
42f26ccded
commit
cacdd4e884
@ -1,8 +1,5 @@
|
||||
from __future__ import generators
|
||||
|
||||
from myhdl import *
|
||||
|
||||
# SEARCH, CONFIRM, SYNC = range(3)
|
||||
ACTIVE_LOW = 0
|
||||
FRAME_SIZE = 8
|
||||
t_State = enum('SEARCH', 'CONFIRM', 'SYNC')
|
||||
@ -21,10 +18,8 @@ def FramerCtrl(SOF, state, syncFlag, clk, reset_n):
|
||||
|
||||
index = Signal(0) # position in frame
|
||||
|
||||
@always(clk.posedge, reset_n.negedge)
|
||||
def FSM():
|
||||
while 1:
|
||||
yield posedge(clk), negedge(reset_n)
|
||||
|
||||
if reset_n == ACTIVE_LOW:
|
||||
SOF.next = 0
|
||||
index.next = 0
|
||||
@ -55,8 +50,7 @@ def FramerCtrl(SOF, state, syncFlag, clk, reset_n):
|
||||
else:
|
||||
raise ValueError("Undefined state")
|
||||
|
||||
FSM_1 = FSM()
|
||||
return FSM_1
|
||||
return FSM
|
||||
|
||||
|
||||
def testbench():
|
||||
|
@ -2,7 +2,9 @@ from myhdl import Signal, delay, always, now, Simulation
|
||||
|
||||
def HelloWorld():
|
||||
|
||||
@always(delay(10))
|
||||
interval = delay(10)
|
||||
|
||||
@always(interval)
|
||||
def sayHello():
|
||||
print "%s Hello World!" % now()
|
||||
|
||||
|
@ -2,7 +2,9 @@ from myhdl import Signal, delay, always, now, Simulation
|
||||
|
||||
def ClkDriver(clk):
|
||||
|
||||
@always(delay(10))
|
||||
halfPeriod = delay(10)
|
||||
|
||||
@always(halfPeriod)
|
||||
def driveClk():
|
||||
clk.next = not clk
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user