2015-09-22 12:36:47 -04:00
|
|
|
from migen import *
|
2015-03-01 04:01:23 -05:00
|
|
|
from migen.genlib.record import Record
|
|
|
|
|
2015-09-23 12:18:27 -04:00
|
|
|
from misoc.dvisampler.common import control_tokens, channel_layout
|
2015-03-01 04:01:23 -05:00
|
|
|
|
2015-04-13 10:47:22 -04:00
|
|
|
|
2015-03-01 04:01:23 -05:00
|
|
|
class Decoding(Module):
|
2015-04-13 10:19:55 -04:00
|
|
|
def __init__(self):
|
|
|
|
self.valid_i = Signal()
|
|
|
|
self.input = Signal(10)
|
|
|
|
self.valid_o = Signal()
|
|
|
|
self.output = Record(channel_layout)
|
2015-03-01 04:01:23 -05:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
###
|
2015-03-01 04:01:23 -05:00
|
|
|
|
2015-04-13 10:19:55 -04:00
|
|
|
self.sync.pix += self.output.de.eq(1)
|
|
|
|
for i, t in enumerate(control_tokens):
|
|
|
|
self.sync.pix += If(self.input == t,
|
|
|
|
self.output.de.eq(0),
|
|
|
|
self.output.c.eq(i)
|
|
|
|
)
|
|
|
|
self.sync.pix += self.output.d[0].eq(self.input[0] ^ self.input[9])
|
|
|
|
for i in range(1, 8):
|
|
|
|
self.sync.pix += self.output.d[i].eq(self.input[i] ^ self.input[i-1] ^ ~self.input[8])
|
|
|
|
self.sync.pix += self.valid_o.eq(self.valid_i)
|