Alchitry Forums
HDMI Error - tmds_encoder.luc bug? - Printable Version

+- Alchitry Forums (https://forum.alchitry.com)
+-- Forum: Alchitry (https://forum.alchitry.com/forum-1.html)
+--- Forum: General Questions (https://forum.alchitry.com/forum-2.html)
+--- Thread: HDMI Error - tmds_encoder.luc bug? (/thread-386.html)



HDMI Error - tmds_encoder.luc bug? - cerkit - 12-26-2021

Greetings,

I am working through the HDMI shield demo and I've followed the instructions. However, I receive an error with the included tmds_encoder.luc file.


Code:
data9[i] = xor_flag ? data9[i-1] ~^ din.q[i] : data9[i-1] ^ din.q[i];


This code causes the following error:


Quote:Errors in file /home/michael/Alchitry/HDMI/HelloHDMI/HelloHDMI/source/tmds_encoder.luc:
    Line 48, Column 64 : missing '=' at '^'
    Line 48, Column 39 : missing ':' at '~'
    Line 48, Column 51 : mismatched input ':' expecting {'[', ']', '<', '.', '>', '+', '-', 'x{', '*', '/', '>>', '<<', '<<<', '>>>', '|', '&', '^', '==', '!=', '>=', '<=', '||', '&&', '?'}



I was able to get it working by making an editable copy of the file and switching the ~ and ^ operators on the true branch of the ternary operator like so:


Code:
data9[i] = xor_flag ? data9[i-1] ^ ~ din.q[i] : data9[i-1] ^ din.q[i];

Since I really don't know what a tmds encoder is actually supposed to do, the only way I've been able to debug my change is to place the design on my mojo and plug it into my monitor. It seems to be working, but I want to make sure I fixed the bug correctly and didn't introduce a bigger problem.

Thanks for your time.


RE: HDMI Error - tmds_encoder.luc bug? - alchitry - 01-11-2022

Hey Michael,

Thanks for the catch. The ~^ as a single operator was removed since it doesn't really add anything. Instead it should be
Code:
data9[i] = xor_flag ? ~(data9[i-1] ^ din.q[i]) : data9[i-1] ^ din.q[i];
 
Your change is also correct as inverting either input to an XOR inverts the output.