4.3.5 LPM_COUNTER

 

Copyright © 1998 University of Manchester

Ports
Port Name
Type
Usage
DescriptionComments
Data
I
Optional
Parallel Data load for the counter Vector, LPM_Width wide

Uses Aload and/or Sload

Clock
I
Required
Positive Edge Triggered
Clk_En
I
Optional
Enable all synchronous activities Default is enabled (1)
Cnt_En
I
Optional
Disables count when low (0) (without affecting Sload, Sset, Sclr) Default is enabled (1)
UpDown
I
Note 1
Controls direction of count

High = 1 = count up

Low = 0 = count down

Default is Up (1)
Eq
O
Note 2
Counter decode outputs. Active high when at the specified count Note 3
Q
O
Note 2
Count output. Vector, LPM_Width wide
Sload
I
Optional
Load the counter with Data on the next clock. Note 4
Sset
I
Optional
Set counter value to all 1's or to the value of LPM_Svalue, if present Note 5, Note 6
Sclr
I
Optional
Clear the counter (set to all 0's) Note 6
Aload
I
Optional
Load the counter with Data. Note 4
Aset
I
Optional
Set counter value to all 1's or to the value of LPM_Avalue, if present. Note 5, Note 6
Aclr
I
Optional
Clear the counter (set to all 0's) Note 6
TestEnab
I
Note 7
Test clock enable input
TestIn
I
Note 7
Serial test data input
TestOut
O
Note 7
Serial test data output TestOut = QLPM_Width-1

Note 1: If the LPM_Direction property is used, then the UpDown port cannot be connected. If the LPM_Direction property is not used, then the UpDown port is optional.

Note 2: Either Q or at least one of the Eq ports must be connected.

Note 3: Since the counter goes through C counts where 0 < = C < Modulus, up to Modulus EqC ports can be used. Modulus is either the value specified by LPM_Modulus if present, or 2LPM_Width. The EqC ports are optional; not all of the EqC ports need to appear on the symbol. Generally there will only be one Eq port which will be EqLPM_Modulus-1 which is the terminal count.. The EqC outputs are asynchronous. For any count, EqC goes high when the count is C.

Note 4: If Aload and/or Sload are used, then the Data port must be connected.

Note 5: Sset and Aset will set the count to the value of LPM_Svalue or LPM_Avalue respectively, if those values are present. If no LPM_Svalue is specified, then Sset will set the count to all ones, likewise Aset.

Note 6: For outputs such as Q and EqC on the LPM_COUNTER, Aset, Aclr, Sset and Sclr affect the output before polarity is applied.

Note 7: Either all of the Test ports must be connected or none of them.

Properties
Property
Usage
ValueComments
LPM_Width
Required
LPM Value > 0Width of input and output vectors. If no output vectors are specified, then this is the number of bits in the count.
LPM_Modulus
Optional
LPM Value > 0The maximum count. plus one
LPM_Direction
Optional
UP | DOWNNote 1
LPM_Avalue
Optional
LPM ValueLoaded when Aset is active (1) Note 2
LPM_Svalue
Optional
LPM ValueLoaded when Sset is active (1) Note 2
LPM_Pvalue
Optional
LPM ValueLoaded at power on. Note 2

Note 1: If the LPM_Direction property is used, then the UpDown port cannot be connected. This property allows implementation of a Down counter as the default when the UpDown port is not connected.

Note 2: If the value specified is larger than the Modulus, then the behavior of the counter is UNDEFINED. The Modulus is the LPM_Modulus, if present, or else 2LPM_Width .

The LPM_Counter defaults to an unsigned binary counter. The LPM_Hint property can be used to suggest an implementation style other than unsigned binary.

It is suggested, but not required, that all of the following styles be supported in the fitting tool and in simulation.
Unsigned binarySigned Binary BCD
standard Gray CodeJohnson LFSR

Functions
Aclr

Aset

Aload
Sclr

Sset

Sload
Clock
Cnt_En
Clk_En
Up-

Down
Test-

Enab
Output
H
L
X
X
X
X
X
Asynchronous value.

Note 1

L
H
X
H
X
X
Synchronous value

Note 2

L
H
X
L
X
X
No change
H
H
X
X
X
X
X
UNDEFINED
L
L
H
L
X
X
No change
L
L
H
H
H
X
Previous output + 1
L
L
H
H
L
X
Previous output - 1
L
L
H
H
U
X
Note 3
L
X
X
X
X
H
Qi is shifted into Qi+1

TestIn is loaded into Q0

Note 1: The asynchronous value is determined by which asynchronous port is high: Aclr, Aset or Aload. If Aclr and Aset are both high, then the output is UNDEFINED. Aclr or Aset takes priority over Aload. Asynchronous controls have priority over synchronous controls. If the LPM_Avalue property is defined, then the Aset port, when active, will set the count to the value of the LPM_Avalue..

Note 2: The synchronous value is determined by which synchronous port is high: Sclr, Sset or Sload. If more then one synchronous port is high, then Sclr takes priority over Sset which takes priority over Sload. Asynchronous controls have priority over synchronous controls. If the LPM_Svalue property is defined, then the Sset port, when active, will set the count to the value of the LPM_Svalue..

Note 3: If the UpDown port is not connected, then the LPM_Direction property, if present, will determine the direction of the count. The LPM_Direction property defaults to UP. The UpDown and the LPM_Direction property are mutually exclusive; if one is used, then using the other is an ERROR.