COSC204 Computer Systems
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Lecture 3.2 - Counters

Asynchronous ripple counter

This one is easy to implement and understand, but the outputs do not all change simultaneously. It takes some finite time for transistors to change state, and thus for each flip-flop to alter its output, which is the clock input for the next flip-flop.

Each T flip-flop divides its clock input frequency by two. Cascading them produces slower and slower frequency outputs. Note that here we clock each flip-flop directly off the output of the preceding flip-flop, whereas in the lecture notes there is a NOT gate on the output. This is because the flip-flops used here are trailing edge triggered, meaning that they change when the clock drops low. Most flip-flops are leading edge triggered, meaning that they change when the clock goes high.

{ "width":500, "height":500, "showToolbox":false, "devices":[ {"type":"LED","id":"dev0","x":416,"y":96,"label":"LED"}, {"type":"T-FF","id":"dev1","x":256,"y":104,"label":"T-FF"}, {"type":"T-FF","id":"dev2","x":256,"y":168,"label":"T-FF"}, {"type":"LED","id":"dev3","x":416,"y":160,"label":"LED"}, {"type":"T-FF","id":"dev4","x":256,"y":240,"label":"T-FF"}, {"type":"LED","id":"dev5","x":416,"y":232,"label":"LED"}, {"type":"4bit7seg","id":"dev6","x":400,"y":296,"label":"4bit7seg"}, {"type":"DC","id":"dev7","x":112,"y":160,"label":"DC"}, {"type":"OSC","id":"dev8","x":112,"y":112,"label":"OSC","freq":"1"} ], "connectors":[ {"from":"dev0.in0","to":"dev1.out0"}, {"from":"dev1.in0","to":"dev7.out0"}, {"from":"dev1.in1","to":"dev8.out0"}, {"from":"dev2.in0","to":"dev7.out0"}, {"from":"dev2.in1","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev2.out0"}, {"from":"dev4.in0","to":"dev7.out0"}, {"from":"dev4.in1","to":"dev2.out0"}, {"from":"dev5.in0","to":"dev4.out0"}, {"from":"dev6.in0","to":"dev1.out0"}, {"from":"dev6.in1","to":"dev2.out0"}, {"from":"dev6.in2","to":"dev4.out0"} ] }

Synchronous counter

This counter has the advantage that all the outputs change at the same time because all the flip-flops are clocked from the same signal. Each T flip-flop is toggled only when all the lower bit flip-flops are high.

{ "width":500, "height":500, "showToolbox":false, "devices":[ {"type":"T-FF","id":"dev0","x":152,"y":112,"label":"T-FF"}, {"type":"OSC","id":"dev1","x":56,"y":192,"label":"OSC","freq":1}, {"type":"LED","id":"dev2","x":440,"y":176,"label":"LED"}, {"type":"T-FF","id":"dev3","x":152,"y":184,"label":"T-FF"}, {"type":"T-FF","id":"dev4","x":152,"y":256,"label":"T-FF"}, {"type":"DC","id":"dev5","x":56,"y":104,"label":"DC"}, {"type":"AND","id":"dev6","x":272,"y":144,"label":"AND"}, {"type":"LED","id":"dev7","x":440,"y":104,"label":"LED"}, {"type":"LED","id":"dev8","x":440,"y":248,"label":"LED"}, {"type":"4bit7seg","id":"dev9","x":424,"y":312,"label":"4bit7seg"} ], "connectors":[ {"from":"dev0.in0","to":"dev5.out0"}, {"from":"dev0.in1","to":"dev1.out0"}, {"from":"dev2.in0","to":"dev3.out0"}, {"from":"dev3.in0","to":"dev0.out0"}, {"from":"dev3.in1","to":"dev1.out0"}, {"from":"dev4.in0","to":"dev6.out0"}, {"from":"dev4.in1","to":"dev1.out0"}, {"from":"dev6.in0","to":"dev0.out0"}, {"from":"dev6.in1","to":"dev3.out0"}, {"from":"dev7.in0","to":"dev0.out0"}, {"from":"dev8.in0","to":"dev4.out0"}, {"from":"dev9.in0","to":"dev0.out0"}, {"from":"dev9.in1","to":"dev3.out0"}, {"from":"dev9.in2","to":"dev4.out0"} ] }

Sandbox

{ "width":700, "height":500, "showToolbox":true, "devices":[ {"type":"LED","id":"dev0","x":416,"y":96,"label":"LED"}, {"type":"T-FF","id":"dev1","x":256,"y":104,"label":"T-FF"}, {"type":"T-FF","id":"dev2","x":256,"y":168,"label":"T-FF"}, {"type":"LED","id":"dev3","x":416,"y":160,"label":"LED"}, {"type":"T-FF","id":"dev4","x":256,"y":240,"label":"T-FF"}, {"type":"LED","id":"dev5","x":416,"y":232,"label":"LED"}, {"type":"4bit7seg","id":"dev6","x":400,"y":296,"label":"4bit7seg"}, {"type":"DC","id":"dev7","x":112,"y":160,"label":"DC"}, {"type":"OSC","id":"dev8","x":112,"y":112,"label":"OSC","freq":"1"} ], "connectors":[ {"from":"dev0.in0","to":"dev1.out0"}, {"from":"dev1.in0","to":"dev7.out0"}, {"from":"dev1.in1","to":"dev8.out0"}, {"from":"dev2.in0","to":"dev7.out0"}, {"from":"dev2.in1","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev2.out0"}, {"from":"dev4.in0","to":"dev7.out0"}, {"from":"dev4.in1","to":"dev2.out0"}, {"from":"dev5.in0","to":"dev4.out0"}, {"from":"dev6.in0","to":"dev1.out0"}, {"from":"dev6.in1","to":"dev2.out0"}, {"from":"dev6.in2","to":"dev4.out0"} ] }