Skip to content

Commit

Permalink
Merge pull request #201 from timvideos/hdmi-debugging
Browse files Browse the repository at this point in the history
Adding HDMI debugging back in.
  • Loading branch information
mithro committed Jan 28, 2016
2 parents 893f1c8 + 10d358e commit 1a0b637
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions firmware/lm32/ci.c
Expand Up @@ -630,6 +630,18 @@ void ci_service(void)
token = get_token(&str);
if(strcmp(token, "pll") == 0)
debug_pll();
#ifdef CSR_HDMI_IN0_BASE
else if(strcmp(token, "input0") == 0) {
hdmi_in0_debug = !hdmi_in0_debug;
printf("HDMI Input 0 debug %s\r\n", hdmi_in0_debug ? "on" : "off");
}
#endif
#ifdef CSR_HDMI_IN1_BASE
else if(strcmp(token, "input1") == 0) {
hdmi_in1_debug = !hdmi_in1_debug;
printf("HDMI Input 1 debug %s\r\n", hdmi_in1_debug ? "on" : "off");
}
#endif
else if(strcmp(token, "ddr") == 0)
debug_ddr();
else if(strcmp(token, "dna") == 0)
Expand Down
10 changes: 10 additions & 0 deletions gateware/hdmi_in/wer.py
Expand Up @@ -7,6 +7,12 @@


class WER(Module, AutoCSR):
"""Word Error Rate calculation module.
https://en.wikipedia.org/wiki/Transition-minimized_differential_signaling
"""

def __init__(self, period_bits=24):
self.data = Signal(10)
self._update = CSR()
Expand All @@ -20,11 +26,15 @@ def __init__(self, period_bits=24):
self.sync.pix += data_r.eq(self.data[:9])

# pipeline stage 2
# Count the number of transitions in the TMDS word.
transitions = Signal(8)
self.comb += [transitions[i].eq(data_r[i] ^ data_r[i+1]) for i in range(8)]
transition_count = Signal(max=9)
self.sync.pix += transition_count.eq(optree("+", [transitions[i] for i in range(8)]))

# Control data characters are designed to have a large number (7) of
# transitions to help the receiver synchronize its clock with the
# transmitter clock.
is_control = Signal()
self.sync.pix += is_control.eq(optree("|", [data_r == ct for ct in control_tokens]))

Expand Down

0 comments on commit 1a0b637

Please sign in to comment.