Digital Electronics
Registers and Counters Chapter 6 Registers and Counters
Some Terminology A Register is a group of flip-flops. Each FF is capable of storing one bit of information A Shift Register is a register capable of shifting its binary information in or both directions A Counter is a register that goes through a prescribed sequence of states upon the application of input pulses
A 4-bit Shift Register
Copy Register A to B
Universal Shift Register
Universal Shift Register Function Table Mode Control S1 S0 Register Operation 0 0 No Change 0 1 Shift Right 1 0 Shift Left 1 1 Parallel Load
Binary Ripple Counter Counts in binary from 0000 through 1111 (16 states) The clock for the second T- FF comes from the output of the first T-FF etc. There is no common clock The count ripples through like a “bucket-brigade”. This can slow things down as the number of FF’s increases.
Ripple Counter with D-FF
BCD Ripple Counter Counts in BCD from 0000 through 1001 (10 states) a.k.a. “mod 10” or “decimal” counter The clock for the second T- FF comes from the output of the first T-FF etc. There is no common clock When the count is 1001 then Q8 =1 so Q2 stays at 0 which means Q4 stays at zero. Hence the next count is 0000
4-bit Synchronous Binary Counter Pin E is count enable feature. The clock is common for all 4 JK FF’s The “next stage” output is used to cascade another 4-bit counter to make an 8-bit counter E
Binary Counter with Load
Two BCD Counter Ideas Loads 0000 after 1001 Clears on seeing 1010
VHDL for Binary Counter module counter (Count,Load,IN,CLK,Clr,A,CO); input Count,Load,CLK,Clr; input [3:0] IN; //Data input output CO; //Output carry output [3:0] A; //Data output reg [3:0] A; assign CO = Count & ~Load & (A == 4'b1111); always @ (posedge CLK or negedge Clr) if (~Clr) A = 4'b0000; else if (Load) A = IN; else if (Count) A = A + 1'b1; else A = A; // no change, default condition endmodule
That’s All Folks!