1 """useful function for emulating a wishbone interface
3 from nmigen
.sim
import Settle
7 def wb_get(wb
, mem
, name
=None):
8 """simulator process for emulating wishbone (classic) out of a dictionary
14 assert (stop
== False)
17 while True: # wait for dc_valid
25 addr
= (yield wb
.adr
) << 3
27 print (" %s WB NO entry @ %x, returning zero" % \
34 store
= (yield wb
.dat_w
)
36 data
= mem
.get(addr
, 0)
37 # note we assume 8-bit sel, here
46 print (" %s WB set %x mask %x data %x" % (name
, addr
, sel
, res
))
49 data
= mem
.get(addr
, 0)
50 yield wb
.dat_r
.eq(data
)
51 print (" %s WB get %x data %x" % (name
, addr
, data
))
53 # a dumb "single-ack", this is non-pipeline