Previous

CD4CE

4-Bit Cascadable BCD Counter with Clock Enable and Asynchronous Clear

XC3000
XC4000E
XC4000X
XC5200
XC9000
Spartan
SpartanXL
Virtex
Macro
Macro
Macro
Macro
Macro
Macro
Macro
Macro

figures/x4369n.gif

CD4CE is a 4-bit (stage), asynchronous, clearable, cascadable binary-coded-decimal (BCD) counter. The asynchronous clear input (CLR) is the highest priority input. When CLR is High, all other inputs are ignored; the Q outputs, terminal count (TC), and clock enable out (CEO) go to logic level zero, independent of clock transitions. The Q outputs increment when clock enable (CE) is High during the Low-to-High clock (C) transition. The counter ignores clock transitions when CE is Low. The TC output is High when Q3 and Q0 are High and Q2 and Q1 are Low.

The counter recovers from any of six possible illegal states and returns to a normal count sequence within two clock cycles for FPGA architectures, as shown in the following state diagram. For XC9000, the counter resets to zero or recovers within the first clock cycle.

figures/x2355n.gif

Larger counters are created by connecting the count enable out (CEO) output of the first stage to the CE input of the next stage and connecting the CLR and clock inputs in parallel. CEO is active (High) when TC and CE are High. The maximum length of the counter is determined by the accumulated CE-to-TC propagation delays versus the clock period. The clock period must be greater than n(tCE-TC), where n is the number of stages and the time tCE-TC is the CE-to-TC propagation delay of each stage. When cascading counters, use the CEO output if the counter uses the CE input; use the TC output if it does not.

The counter is asynchronously cleared, output Low, when power is applied. For CPLDs, the power-on condition can be simulated by applying a High-level pulse to the PRLD global net. FPGAs simulate power-on when global reset (GR) or global set/reset (GSR) is active. GR for XC3000 is active-Low. GR for XC5200 and GSR (XC4000, Spartans, Virtex) default to active-High but can be inverted by adding an inverter in front of the GR/GSR input of the STARTUP or STARTUP_VIRTEX symbol.

Inputs
Outputs
CLR
CE
C
Q3
Q2
Q1
Q0
TC
CEO
1
X
X
0
0
0
0
0
0
0
1

Inc
Inc
Inc
Inc
TC
CEO
0
0
X
No Chg
No Chg
No Chg
No Chg
TC
0
0
1
X
1
0
0
1
1
1
TC = Q3•!Q2•!Q1•Q0
CEO = TC•CE

Figure 4.30 CD4CE Implementation XC3000, XC4000, XC5200, Spartans, Virtex

Figure 4.31 CD4CE Implementation XC9000

Next