예제 #1
0
 def __init__(self):
     self.msg1fifo = gs.msgfifo("receiver")
     self.msg2fifo = gs.msgfifo()
     self.msg3fifo = gs.msgfifo("second_rx")
     gs.spawn(self.sender)
     gs.spawn(self.receiver)
     gs.spawn(self.internal)
     gs.spawn(self.rx2)
     gs.end_of_simulation(self.cb, args=("end-of-sim",))
     gs.end_of_elaboration(self.cb, args=("end-of-elab",))
     gs.start_of_simulation(self.cb, args=("start-of-sim",))
     tmp = no_process()
     print tmp.name, tmp.full_name
     tmp1 = no_process()
     print tmp1.name, tmp1.full_name
     tmp2 = no_process()
     print tmp2.name, tmp2.full_name
예제 #2
0
gs.config_lua("test_gs_param.cfg.lua")

# Describe the system
addr = gs.fifo()
data = gs.fifo()
cpu1 = cpu(addr,data)
memory1 = memory(addr,data)

# Try an Array Parameter
ap = gs.param("test_array")
print ap
for a in ap: print a()+20

# Test the callbacks
def pp(x): print x
gs.end_of_elaboration(lambda: pp("eoe"))
gs.end_of_simulation(lambda: pp("ssss"))
gs.end_of_simulation(lambda: pp("eos"))

# A simple process to keep the kernel alive a bit
def goon():
  for i in range(4):
    gs.wait(25+25*i,gs.NS)
    print gs.simulation_time()
gs.spawn(goon)

# Start!
gs.start(100,gs.NS)
#gs.start()

예제 #3
0
memory1 = memory(addr, data)

# Try an Array Parameter
ap = gs.param("test_array")
print ap
for a in ap:
    print a() + 20


# Test the callbacks
def pp(x):
    print x


gs.end_of_elaboration(lambda: pp("eoe"))
gs.end_of_simulation(lambda: pp("ssss"))
gs.end_of_simulation(lambda: pp("eos"))


# A simple process to keep the kernel alive a bit
def goon():
    for i in range(4):
        gs.wait(25 + 25 * i, gs.NS)
        print gs.simulation_time()


gs.spawn(goon)

# Start!
gs.start(100, gs.NS)
#gs.start()
예제 #4
0
파일: simple.py 프로젝트: sernc11/greenlib
    print "loop starts"
    for i in range(40):
      print 'p',
      for j in range(1000): pass
    print
    print "signal is now", mysig.read()


if use_wind:  gs.use_winpdb()

gs.spawn(lambda : f(100, "slow"), debug = to_debug[0])
gs.spawn(lambda : f(55, "fast"), "fast", to_debug[1], time_unit = gs.MS)
gs.spawn(g, "faster", to_debug[2], time_unit = gs.MS)

def hello():
  print "hello there at end of elab"
  print "and start of sim"
gs.end_of_elaboration(hello)
gs.start_of_simulation(hello)

def goodbye():
  print "goodbye at end of sim"
gs.end_of_simulation(goodbye)

print "processes declared"

if gs.__standalone__:
  gs.start(1,gs.US)
  gs.stop()