// Wire and registers in the circuit wire X, Y, X1, Y1, A, B, C, D, E, F, G; reg b1 = {.in = &X1, .out = &X}; reg b0 = {.in = &Y1, .out = &Y};
intmain() { CLOCK_CYCLE { // 1. Propagate wire values through combinatorial logic X1 = AND(NOT(X), Y); Y1 = NOT(OR(X, Y)); A = D = E = NOT(Y); B = 1; C = NOT(X); F = Y1; G = X;
TEMPLATE = ''' AAAAAAAAAAAA FF BB FF BB FF BB FF BB FEGGGGGGGGBC EE CC EE CC EE CC EE CC DDDDDDDDDDDD '''
# These are ANSI Escape Codes CLEAR = '\033[2J\033[1;1f'# Clear screen and move cursor to top-left WHITE = '\033[37m░\033[0m'# A white block BLACK = '\033[31m█\033[0m'# A black block
for line in fileinput.input(): # Execute the input line (like "A=0; B=1; ...") as Python code; the # variables A, B, ... will be stored in ctx. exec(line, (ctx := {}))
# Initialize the display with a clear screen and the template. disp = CLEAR + TEMPLATE
for ch in'ABCDEFG': # Determine the block color. block = { 0: WHITE, 1: BLACK, }.get(ctx.get(ch, 0), '?')
# Replace each character in the template with its block. disp = disp.replace(ch, block)