NahamCon CTF
Garys Sauce - Writeup Created Sunday 01 May 2022 simulation/flag_tb.v flag_capture fc(.clk(clk), .rst(rst), .BTNL(BTNL), .SW(SW), .disp(disp)); The workhorse is the main loop that takes the last character (8 bits) of the flag, sets the signals (SW) based on their binary values. These signals are bound to the SW variables for the flag_capture function. That is where we need to look next. reg [7:0] mask = 8'b11111111; initial begin SW = 16'b0000000000000000; BTNL = 1'b0; for (i=1; i <= 38; i=i+1) begin SW = flag & mask; #20; BTNL = 1'b1; #20; BTNL = 1'b0; #40; // The flag is processed from the back, and shifted right by 1 char flag = flag >> 8; end end src/flag_capture....