uses a register and some combinational logic. There is a simple state machine so you must release the button for enable_arithmetic before enabeling it again. Basically, the same operation won't happen every clock cycle 100k times a second.
Switch 6. after reset, the output should be zero. Hitting enable (Switch 5) will compute the current arithOp (+ = 2'b00, - = 2'b01, ^ = 2'b10, << = 2'b11
# | Input | Output |
---|---|---|
0 | clock | LED[7] |
1 | reset | LED[6] |
2 | enable | LED[5] |
3 | in_val[2] | LED[4] |
4 | in_val[1] | LED[3] |
5 | in_val[0] | LED[2] |
6 | arithOp[1] | LED[1] |
7 | arithOp[0] | LED[0] |