This past Fall, I was a teacher’s assistant (TA) for a digital logic class that starts with the basics of digital logic gates and builds up to synthesizing VHDL to an Upduino. This was the second time I’ve been a TA and it’s definitely a lot of fun running lab sections and grading student’s assignments.
To assist myself in grading assignments, specifically with double-checking their work with simplifying logic statements, I wrote logidiff. With this tool, I could enter in the student’s answer, the correct answer, and determine if they were equivalent and for which cases they weren’t. This saved me significant time in grading, and so I released it in hopes that it may be beneficial to others as well.
It operates on a quirk of Python: Infix operations. I used these to create custom operators, as Python doesn’t have bitwise XNOR and NOR (among others) and I was too lazy to try to parse the input to use normal Python functions. I’ve used these in the past for parsing in VHDLproc. All of the operators were replaced with infix operators to preserve order of operations, then all possible values for each variable and whether it evaluates properly are brute forced and the results are given. I also added aliases for