]> sigrok.org Git - libsigrokdecode.git/commitdiff
z80: Convert to PD API version 3 (brute force)
authorGerhard Sittig <redacted>
Sun, 15 Jan 2017 10:26:19 +0000 (11:26 +0100)
committerUwe Hermann <redacted>
Wed, 18 Jan 2017 11:38:24 +0000 (12:38 +0100)
This implementation technically uses v3 API calls, but has yet to come
up with appropriate wait() conditions, to spend less time in the decoder
and have more tedious work done in the backend.

decoders/z80/pd.py

index a8acf53c3aab2e327d544a7c4a765d7504db1afb..bd2ec575a95aa4e6ca35b303a925426e014c5df3 100644 (file)
@@ -64,7 +64,7 @@ def signed_byte(byte):
     return byte if byte < 128 else byte - 256
 
 class Decoder(srd.Decoder):
     return byte if byte < 128 else byte - 256
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id       = 'z80'
     name     = 'Z80'
     longname = 'Zilog Z80 CPU'
     id       = 'z80'
     name     = 'Z80'
     longname = 'Zilog Z80 CPU'
@@ -129,8 +129,10 @@ class Decoder(srd.Decoder):
         self.op_state   = self.state_IDLE
         self.instr_len  = 0
 
         self.op_state   = self.state_IDLE
         self.instr_len  = 0
 
-    def decode(self, ss, es, data):
-        for (self.samplenum, pins) in data:
+    def decode(self):
+        while True:
+            # TODO: Come up with more appropriate self.wait() conditions.
+            pins = self.wait({'skip': 1})
             cycle = Cycle.NONE
             if pins[Pin.MREQ] != 1: # default to asserted
                 if pins[Pin.RD] == 0:
             cycle = Cycle.NONE
             if pins[Pin.MREQ] != 1: # default to asserted
                 if pins[Pin.RD] == 0: