本文整理匯總了Python中myhdl.Signal.driven方法的典型用法代碼示例。如果您正苦於以下問題:Python Signal.driven方法的具體用法?Python Signal.driven怎麽用?Python Signal.driven使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類myhdl.Signal
的用法示例。
在下文中一共展示了Signal.driven方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: assign_config
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def assign_config(sig, val):
keep = Signal(bool(0))
keep.driven = 'wire'
@always_comb
def beh_assign():
sig.next = val if keep else val
return beh_assign
示例2: testDrivenAttrValue
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def testDrivenAttrValue(self):
""" driven attribute only accepts value 'reg' or 'wire' """
s1 = Signal(1)
try:
s1.driven = "signal"
except ValueError:
pass
else:
self.fail()
示例3: assign_config
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def assign_config(sig, val):
"""
Arguments:
sig (Signal): The signals to be assigned to a constant value
val (int): The constant value
"""
keep = Signal(bool(0))
keep.driven = 'wire'
@always_comb
def beh_assign():
sig.next = val if keep else val
return beh_assign
示例4: assign
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def assign(a, b):
""" assign a = b
"""
if isinstance(b, SignalType):
@always_comb
def beh_assign():
a.next = b
else:
# this is a work around for preserving constant assigns
keep = Signal(True)
keep.driven = "wire"
@always_comb
def beh_assign():
a.next = b if keep else b
return beh_assign
示例5: exciter
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def exciter(
resetn,
system_clock,
pclk,
paddr,
psel,
penable,
pwrite,
pwdata,
pready,
prdata,
pslverr,
dac_clock,
dac_data):
####### FIFO ############
# Read
re = Signal(bool(False))
rclk = system_clock
Q = Signal(intbv(0)[32:])
# Write
we = Signal(bool(False))
wclk = pclk
data = Signal(intbv(0)[32:])
# Threshold
full = Signal(bool(False))
full.driven = 'wire'
afull = Signal(bool(False))
afull.driven = 'wire'
empty = Signal(bool(False))
empty.driven = 'wire'
aempty = Signal(bool(False))
aempty.driven = 'wire'
fifo_args = resetn, re, rclk, Q, we, wclk, data, full, afull, \
empty, aempty
fifo = FIFO(*fifo_args,
width=32,
depth=1024)
######### RESAMPLER ###########
######### INTERLEAVER #########
in_phase = Signal(bool(0))
sample_i = Signal(intbv(0, 0, 2**10))
sample_q = Signal(intbv(0, 0, 2**10))
########## STATE MACHINE ######
state_t = enum('IDLE', 'WRITE_SAMPLE', 'DONE',)
state = Signal(state_t.IDLE)
############ TX EN ###########
txen = Signal(bool(0))
@always_seq(pclk.posedge, reset=resetn)
def state_machine():
if state == state_t.IDLE:
if penable and psel and pwrite:
if paddr[8:] == 0x00:
state.next = state_t.WRITE_SAMPLE
pready.next = 0
we.next = 1
data.next = pwdata
if full:
raise OverrunError
elif paddr[8:] == 0x01:
print 'hi', pwdata
txen.next = pwdata[0]
elif psel and not pwrite:
pass
elif state == state_t.WRITE_SAMPLE:
we.next = 0
state.next = state_t.DONE
elif state == state_t.DONE:
pready.next = 1
state.next = state_t.IDLE
@always(system_clock.posedge)
def resampler():
if txen: # Update the sample out of phase, locking
if re:
sample_i.next = Q[9:]
sample_q.next = Q[32:23]
re.next = not re
@always(system_clock.posedge)
def interleaver():
if txen:
dac_data.next = sample_i[10:2] if in_phase else sample_q[10:2]
dac_clock.next = not in_phase
in_phase.next = not in_phase
return fifo, state_machine, resampler, interleaver
示例6: testDrivenAttrValue
# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import driven [as 別名]
def testDrivenAttrValue(self):
""" driven attribute only accepts value 'reg' or 'wire' """
s1 = Signal(1)
with pytest.raises(ValueError):
s1.driven = "signal"