I am trying to design the following:
- The datapath of an octal calculator which has a 24-bit input register in reg and a 24-bit accumulator acc.
- The contents of both registers are displayed as eight octal (radix-8) digits. Both are cleared on reset.
- The calculator has buttons for C (clear), the numbers 0-7, and the functions +, -, and x. Pressing C once clears in reg.
- Pressing C a second time with no other intervening keys clears acc. Pressing a number shifts in reg to the left three bits and puts the number pressed into the low three bits.
- Pressing a function performs that function on the two registers and puts the result in acc. Draw a block diagram from the datapath of this calculator
What I have so far is:
- reg_in and acc flip flops, with the same clock and reset
- an ALU(performing function operations) taking in input from in_reg and acc and outputting back into in_reg, driven by an ALUselect signal
- a shift register to shift the input bits by 3 and put them back into the reg_in
However, the part that I am stuck on is how to implement the "pressing C" part. What design choice can I make which will allow me to clear reg_in if C is pressed once and clear acc if C is pressed again? I want to a find a simpler method than using a counter.
Any help is appreciated!