← ProblemsVerification: Reading Simulations / Finding bugs in code

Case statement

36%debuggingconditionals

This combinational circuit recognizes 8-bit keyboard scancodes for the keys 0 through 9. It should indicate whether one of the ten cases was recognized (valid = 1) and, if so, which key, using this mapping:

8'h45 -> 0    8'h16 -> 1    8'h1e -> 2    8'h26 -> 3    8'h25 -> 4
8'h2e -> 5    8'h36 -> 6    8'h3d -> 7    8'h3e -> 8    8'h46 -> 9

For any other scancode, out must be 0 and valid must be 0. The code below doesn't work — find and fix the bug(s).