update driver api
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 22 Mar 2013 11:35:12 +0000 (12:35 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 22 Mar 2013 11:35:12 +0000 (12:35 +0100)
examples/de0_nano/client/test_miio.py
examples/de0_nano/client/test_mila.py
miscope/miio.py
miscope/mila.py
miscope/recorder.py
miscope/trigger.py

index dea73da9d351b6bc1b3e6dcedb446ee4ec965fd0..747e48d9ce7cca4b1ab115f9fb723ddb41fb4dd5 100644 (file)
@@ -15,9 +15,9 @@ miio = miio.MiIo(MIIO_ADDR, 8, "IO", csr)
 
 def led_anim0():
        for i in range(10):
-               miio.write(0xA5)
+               miio.set(0xA5)
                time.sleep(0.1)
-               miio.write(0x5A)
+               miio.set(0x5A)
                time.sleep(0.1)
 
 def led_anim1():
@@ -25,13 +25,13 @@ def led_anim1():
                #Led <<
                ledData = 1
                for i in range(8):
-                       miio.write(ledData)
+                       miio.set(ledData)
                        time.sleep(i*i*0.0020)
                        ledData = (ledData<<1)
                #Led >>
                ledData = 128
                for i in range(8): 
-                       miio.write(ledData)
+                       miio.set(ledData)
                        time.sleep(i*i*0.0020)
                        ledData = (ledData>>1)
 
@@ -39,11 +39,11 @@ def led_anim1():
 #                  T E S T  M I G I O 
 #==============================================================================
 
-print("- Small Led Animation...")
+print("- Led Animation...")
 led_anim0()
 time.sleep(1)
 led_anim1()
 time.sleep(1)
 
 print("- Read Switch: ",end=' ')
-print("%02X" %miio.read())
+print("%02X" %miio.get())
index fcd6a7556cb2c2ec136c6751d9f0fa2e836cd8fa..2b90492559e9b27c41baef4844b08e73aa7f6bfa 100644 (file)
@@ -35,10 +35,10 @@ def capture(size):
        global recorder
        global dat_vcd
        sum_tt = gen_truth_table("term")
-       mila.trigger.sum.write(sum_tt)
+       mila.trigger.sum.set(sum_tt)
        mila.recorder.reset()
-       recorder.size(rec_size) 
-       mila.recorder.offset(rec_offset)
+       recorder.set_size(rec_size)     
+       mila.recorder.set_offset(rec_offset)
        mila.recorder.arm()
        print("-Recorder [Armed]")
        print("-Waiting Trigger...", end=' ')
@@ -48,12 +48,12 @@ def capture(size):
        
        print("-Receiving Data...", end=' ')
        sys.stdout.flush()
-       dat_vcd += mila.recorder.read(size)
+       dat_vcd += mila.recorder.pull(size)
        print("[Done]")
 
 print("Capturing ...")
 print("----------------------")
-term.write(0x0000, 0xFFFF)
+term.set(0x0000, 0xFFFF)
 capture(rec_size)
 
 mila_layout = [
index 0772910335ae2db74ca0671d630dfeca7022f700..d104928a6541b8c76af9b93b9ee3ab6fc8cfb1bd 100644 (file)
@@ -35,10 +35,10 @@ class MiIo:
                        
                return Fragment(comb) + self.bank.get_fragment()
        #
-       #Driver
+       # Driver
        #
-       def write(self, data):
+       def set(self, data):
                        self.interface.write(self.bank.get_base(), data)
                        
-       def read(self):
+       def get(self):
                return self.interface.read(self.bank.get_base() + self.words)
\ No newline at end of file
index 177ee583f97007a713d2a909e8f0d0d1b89e946a..9596cbd115f9635eed8fb9934d2e5b3f2579f5f2 100644 (file)
@@ -28,8 +28,6 @@ class MiLa:
                self.trigger.set_interface(interface)
                self.recorder.set_interface(interface)
                
-
-       
        def get_fragment(self):
                comb =[
                        self.trigger.trig.eq(self.trig),
index caa236741f8268f132826f23789f39bbe4f024fe..af6c6cfc94dca534cd342d6deb72430c4ebbfa8a 100644 (file)
@@ -129,7 +129,6 @@ class Sequencer:
                        self.enable.eq(1)
                )
                
-               # trig_hit rising_edge
                hit_rising = RisingEdge(self.hit)
                
                # connexion
@@ -230,7 +229,7 @@ class Recorder:
                        _pull_stb_rising.get_fragment()
                        
        #
-       #Driver
+       # Driver
        #
        def reset(self):
                self.interface.write(self.bank.get_base() + REC_RST_BASE, 1)
@@ -243,13 +242,13 @@ class Recorder:
        def is_done(self):
                return self.interface.read(self.bank.get_base() + REC_DONE_BASE) == 1
                
-       def size(self, dat):
+       def set_size(self, dat):
                self.interface.write_n(self.bank.get_base() + REC_SIZE_BASE, dat, 16)
                
-       def offset(self, dat):
+       def set_offset(self, dat):
                self.interface.write_n(self.bank.get_base() + REC_OFFSET_BASE, dat, 16)
                
-       def read(self, size):
+       def pull(self, size):
                r = []
                for i in range(size):
                        self.interface.write(self.bank.get_base() + REC_READ_BASE, 1)
index 8beae52946bba961f55731fee28db164691f9ef9..33fe873e890cdf47a50e3988cb819c6e1fc288a7 100644 (file)
@@ -39,20 +39,20 @@ class Term:
                self.reg_p = RegParams("term_reg", 0, width, 2)
                self.reg = None
        
-       def get_registers_glue(self):
+       def get_registers_comb(self):
                comb = [self.t.eq(self.reg.field.r[0*self.width:1*self.width])]
                comb += [self.m.eq(self.reg.field.r[1*self.width:2*self.width])]
                return comb
        
        def get_fragment(self):
                comb = [self.o.eq((self.m & self.i) == self.t)]
-               comb += self.get_registers_glue()
+               comb += self.get_registers_comb()
                return Fragment(comb)
        
        #
        # Driver
        #
-       def write(self, dat, mask=None):
+       def set(self, dat, mask=None):
                if mask is None:
                        mask = (2**self.width)-1
                self.interface.write_n(self.reg_p.base, mask, self.width)       
@@ -75,22 +75,22 @@ class RangeDetector:
                self.high = Signal(width)
                self.o = Signal()
                
-       def get_registers_glue(self):
+       def get_registers_comb(self):
                comb = [self.low.eq(self.reg.field.r[0*self.width:1*self.width])]
                comb += [self.low.eq(self.reg.field.r[1*self.width:2*self.width])]
                return comb
                
        def get_fragment(self):
                comb = [self.o.eq((self.i >= self.low) & (self.i <= self.high))]
-               comb += self.get_registers_glue()
+               comb += self.get_registers_comb()
                return Fragment(comb)
        #
        # Driver
        #
-       def write_low(self, dat):
+       def set_low(self, dat):
                self.interface.write_n(self.reg_p.base, dat ,self.width)
        
-       def write_high(self, dat):
+       def set_high(self, dat):
                self.interface.write_n(self.reg_p.base + self.reg_p.words, dat ,self.width)
 
 class EdgeDetector:
@@ -118,7 +118,7 @@ class EdgeDetector:
                        self.bo = Signal()
                self.o = Signal()
        
-       def get_registers_glue(self):
+       def get_registers_comb(self):
                comb = []
                i = 0
                if "R" in self.mode:
@@ -158,7 +158,7 @@ class EdgeDetector:
                comb += [self.o.eq(self.ro | self.fo | self.bo)]
                
                # Registers
-               comb += self.get_registers_glue()
+               comb += self.get_registers_comb()
                
                return Fragment(comb, sync)
                
@@ -180,13 +180,13 @@ class EdgeDetector:
                        return r
                return 0
                        
-       def write_r(self, dat):
+       def set_r(self, dat):
                self.interface.write_n(self.reg_p.base + self.get_offset("R"), dat ,self.width)
        
-       def write_f(self, dat):
+       def set_f(self, dat):
                self.interface.write_n(self.reg_p.base + self.get_offset("F"), dat ,self.width)
                
-       def write_b(self, dat):
+       def set_b(self, dat):
                self.interface.write_n(self.reg_p.base + self.get_offset("B"), dat ,self.width)
 
 class Sum:
@@ -212,7 +212,7 @@ class Sum:
                self._lut_port = self._mem.get_port()
                self._prog_port = self._mem.get_port(write_capable=True)
        
-       def get_registers_glue(self):
+       def get_registers_comb(self):
                comb = [
                        self.prog_adr.eq(self.reg.field.r[0:16]),
                        self.prog_dat.eq(self.reg.field.r[16]),
@@ -231,13 +231,13 @@ class Sum:
                                
                                self.o.eq(self._o)
                ]
-               comb += self.get_registers_glue()
+               comb += self.get_registers_comb()
                return Fragment(comb, specials={self._mem})
        
        #
-       #Driver
+       # Driver
        #
-       def write(self, truth_table):
+       def set(self, truth_table):
                for i in range(len(truth_table)):
                        val = truth_table[i]
                        we = 1<<17