1.1 --- a/ula.py Tue Jun 21 23:22:33 2016 +0200
1.2 +++ b/ula.py Wed Jun 22 00:51:54 2016 +0200
1.3 @@ -335,44 +335,9 @@
1.4
1.5 "Update the state of the ULA for each clock cycle."
1.6
1.7 - self.posedge_video()
1.8 self.posedge_ram()
1.9 self.posedge_pixel()
1.10
1.11 - def posedge_video(self):
1.12 -
1.13 - "Video signalling."
1.14 -
1.15 - # Detect the end of the scanline.
1.16 -
1.17 - if self.x == MAX_SCANPOS:
1.18 - self.next_vertical()
1.19 -
1.20 - # Detect the end of the frame.
1.21 -
1.22 - if self.y == MAX_SCANLINE:
1.23 - self.next_frame()
1.24 -
1.25 - # Detect any sync conditions.
1.26 -
1.27 - if self.x == 0:
1.28 - self.hsync()
1.29 - if self.y == 0:
1.30 - self.vsync()
1.31 - self.irq_vsync = 0
1.32 - elif self.y == MAX_PIXELLINE:
1.33 - self.irq_vsync = 1
1.34 -
1.35 - # Detect the end of hsync.
1.36 -
1.37 - elif self.x == MAX_HSYNC:
1.38 - self.hsync(1)
1.39 -
1.40 - # Detect the end of vsync.
1.41 -
1.42 - elif self.y == MAX_CSYNC and self.x == MAX_SCANPOS / 2:
1.43 - self.vsync(1)
1.44 -
1.45 def posedge_ram(self):
1.46
1.47 """
1.48 @@ -469,7 +434,50 @@
1.49 def negedge(self):
1.50
1.51 """
1.52 - Update the state of the device.
1.53 + Update the state of the device on the negative edge of each clock cycle.
1.54 + """
1.55 +
1.56 + self.negedge_video()
1.57 + self.negedge_ram()
1.58 +
1.59 + def negedge_video(self):
1.60 +
1.61 + "Video signalling."
1.62 +
1.63 + # Detect the end of the scanline.
1.64 +
1.65 + if self.x == MAX_SCANPOS:
1.66 + self.next_vertical()
1.67 +
1.68 + # Detect the end of the frame.
1.69 +
1.70 + if self.y == MAX_SCANLINE:
1.71 + self.next_frame()
1.72 +
1.73 + # Detect any sync conditions.
1.74 +
1.75 + if self.x == 0:
1.76 + self.hsync()
1.77 + if self.y == 0:
1.78 + self.vsync()
1.79 + self.irq_vsync = 0
1.80 + elif self.y == MAX_PIXELLINE:
1.81 + self.irq_vsync = 1
1.82 +
1.83 + # Detect the end of hsync.
1.84 +
1.85 + elif self.x == MAX_HSYNC:
1.86 + self.hsync(1)
1.87 +
1.88 + # Detect the end of vsync.
1.89 +
1.90 + elif self.y == MAX_CSYNC and self.x == MAX_SCANPOS / 2:
1.91 + self.vsync(1)
1.92 +
1.93 + def negedge_ram(self):
1.94 +
1.95 + """
1.96 + Prepare addresses and pixel data.
1.97
1.98 States handled: * * * _ _ * _ *
1.99 """