Skip to content

Instantly share code, notes, and snippets.

@cfelton
Last active May 9, 2016 12:40
Show Gist options
  • Save cfelton/e33ecffd0f3dad75bf460833c5d2af3b to your computer and use it in GitHub Desktop.
Save cfelton/e33ecffd0f3dad75bf460833c5d2af3b to your computer and use it in GitHub Desktop.
from myhdl import Signal, intbv
class SomeInterface(object):
def __init__(self, clock):
self.clock = clock
self.datain = Signa(intbv(0)[8:])
self.dataout = Signal(intbv(0)[8:])
self.data_valid = Signal(bool(0))
def writetrans(self, data):
self.datain.next = data
self.data_valid.next = True
yield self.clock
self.data_valid.next = False
def transactors_in_use():
intf = SomeInterface()
@instance
def testbench_driver():
yield intf.writetrans(4)
yield intf.writetrans(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment