Пример #1
0
    def __init__(self, in1, in2, out):
        self.in1 = gs.sc_signal(in1)
        self.in2 = gs.sc_signal(in2)
        gs.spawn(self.doit)

        self.h = gs.param("hello")
        self.m = gs.param("message")
Пример #2
0
    def __init__(self, in1, in2, out):
        self.in1 = gs.sc_signal(in1)
        self.in2 = gs.sc_signal(in2)
        gs.spawn(self.doit)

        self.h = gs.param("hello")
        self.m = gs.param("message")
Пример #3
0
 def configure_gav_output(self):
     # Parameters
     self.addr = gs.param("addr")
     self.data = gs.param("data")
     # need to initialise a parameter if we want it searcheable by name
     self.addr(0)
     # Configure output to file "test_gav_output.txt"
     print "Output parameter changes to file: test_gav_output.txt"
     self.file_output = gs.av.output(gs.av.TXT_FILE_OUT, "test_gav_output.txt")
     # Add parameters to the output (by name or reference)
     self.file_output.add("addr")
     self.file_output.add(self.data)
Пример #4
0
 def configure_gav_output(self):
     # Parameters
     self.addr = gs.param("addr")
     self.data = gs.param("data")
     # need to initialise a parameter if we want it searcheable by name
     self.addr(0)
     # Configure output to file "test_gav_output.txt"
     print "Output parameter changes to file: test_gav_output.txt"
     self.file_output = gs.av.output(gs.av.TXT_FILE_OUT,
                                     "test_gav_output.txt")
     # Add parameters to the output (by name or reference)
     self.file_output.add("addr")
     self.file_output.add(self.data)
Пример #5
0
 def doit(self):
     k = False
     while True:
         gs.wait(self.in1.write_event() | self.in2.write_event())
         print "diff is", self.in1.read() - self.in2.read(), an_int
         print "->", self.h(), self.m()
         gs.wait(30, gs.NS)
         if not k: k = gs.param("another")
         print "-->", k()
Пример #6
0
 def doit(self):
     k = False
     while True:
         gs.wait(self.in1.write_event() | self.in2.write_event())
         print "diff is", self.in1.read() - self.in2.read(), an_int
         print "->", self.h(), self.m()
         gs.wait(30,gs.NS)
         if not k:  k = gs.param("another")
         print "-->", k()
Пример #7
0
 def doit(self):
     k = False
     while True:
         gs.wait(self.in1.write_event() | self.in2.write_event())
         self.out.write(self.in1.read() + self.in2.read())
         print "adder out", self.out.read(), an_int
         gs.wait(10, gs.NS)
         print "->", self.h(), self.m()
         if not k: k = gs.param("test")
         print "-->", k()
Пример #8
0
 def doit(self):
     k = False
     while True:
         gs.wait(self.in1.write_event() | self.in2.write_event())
         self.out.write(self.in1.read() + self.in2.read())
         print "adder out", self.out.read(), an_int
         gs.wait(10,gs.NS)
         print "->", self.h(), self.m()
         if not k:  k = gs.param("test")
         print "-->", k()
Пример #9
0
 def __init__(self, in1, out):
     self.in1 = in1
     self.out = out
     gs.spawn(self.doit)
     # Get memory contents as a parameter
     self.MEM = gs.param("MEM")
Пример #10
0
 def __init__(self, in1, out):
     self.in1 = in1
     self.out = out
     gs.spawn(self.doit)
     # Get memory contents as a parameter
     self.MEM = gs.param("MEM")
Пример #11
0
 def __init__(self, req, ack):
     self.req = req
     self.ack = ack
     gs.spawn(self.doit)
     self.testparam = gs.param("foo.bar.zoo")
Пример #12
0
        gs.spawn(self.doit)
        # Get memory contents as a parameter
        self.MEM = gs.param("MEM")


# Load config file
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)
Пример #13
0
 def __init__(self, req, ack):
     self.req = req
     self.ack = ack
     gs.spawn(self.doit)
     self.testparam = gs.param("foo.bar.zoo")
Пример #14
0
        gs.spawn(self.doit)
        # Get memory contents as a parameter
        self.MEM = gs.param("MEM")


# Load config file
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"))