SPRUII0F May 2019 – June 2024 TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S
At the heart of the counter block is a 32-bit count register. This register can either be loaded statically before counting commences, or dynamically at run time. The operation of the counter submodule is determined by the inputs described below. Note that each of the inputs can be connected to the outputs of any of the other blocks in the CLB tile. These connections are made by configuring the static switch block.
The counter inputs are:
Note that the effect of a rising edge on the EVENT input only lasts for one cycle. On the next cycle, the counter operation continues based on the MODE_0, MODE_1, and RESET inputs.
MATCH1 REF and MATCH2 REF are 32-bit reference values that are used to generate the MATCH1 and MATCH2 outputs. The MATCH1 output becomes active high whenever the counter register value matches the 32-bit MATCH1 REF value. MATCH2 behaves in a similar manner in relation to the MATCH2 REF register. The reference values for MATCH1 and MATCH2 can either be setup once before the start of operation, or can be modified dynamically. The High Level Controller can load desired values into the MATCH1 REF and MATCH2 REF registers.
Note that the counter load and match registers are not memory-mapped. For more information, see Section 9.5.2.
The three logic outputs of the counter block are:
The operation of the counter block is controlled by the CFG_MISC_CTRL register. The following three bits of this register are relevant for each counter. The “x” below refers to the counter instance; 0, 1, or 2. For more information, see the CLB_MISC_CONTROL register description located in Section 9.10.
Table 9-11 shows the logical operation of the counter block in terms of the inputs and control register bits. Count up and down modes are the normal operation with EVENT = 0. The operations on the CNTVAL register are:
Load: CNTVAL = EVENT_LOAD_VAL
Shift right: CNTVAL = CNTVAL >> EVENT_LOAD_VAL
Shift left: CNTVAL = CNTVAL << EVENT_LOAD_VAL
Subtract: CNTVAL = CNTVAL - EVENT_LOAD_VAL
Add: CNTVAL = CNTVAL + EVENT_LOAD_VAL
EVENT | MODE_0 | MODE_1 | COUNT_EVENT_CTRL_x | COUNT_ADD_SHIFT_x | COUNT_DIR_x | Action on CNTVAL |
---|---|---|---|---|---|---|
0 | 0 | 0 | X | X | X | None |
0 | 0 | 1 | X | X | X | None |
0 | 1 | 0 | X | X | X | Count down |
0 | 1 | 1 | X | X | X | Count up |
1 | X | X | 0 | X | X | Load |
1 | X | X | 1 | 0 | 0 | Shift right |
1 | X | X | 1 | 0 | 1 | Shift left |
1 | X | X | 1 | 1 | 0 | Subtract |
1 | X | X | 1 | 1 | 1 | Add |