/*This module does the job of the accumulator. The accumulator is actually an 8 bit register that stores the value you pass into it through the input Q and D_store. However, it only does this when you give it the input store. When you give it a clear signal it clears the registers are cleared. The output of the registers is found on Q.*/ module register_8_bit( input [7:0] D, input clear, input store, output reg [7:0] Q ); //Declaring the register we will use reg [7:0] D_store; //The standard always block always @(clear, store, D_store, D) begin //Since the buttons are inverted, we check for !clear if (!clear) begin //These <= are blocking statements. They're like an = sign //but a little different. You should cover it in lecture a //little later. For now trust that it works like an = sign. Q <= 8'b0000_0000; D_store = 8'b0000_0000; //Since the buttons are inverted, we check for !store end else if (!store) begin Q <= D_store; //Otherwise save the value on D into D_store end else begin D_store <= D; end end endmodule