SPRUHM8K December 2013 – May 2024 TMS320F28374D , TMS320F28375D , TMS320F28376D , TMS320F28377D , TMS320F28377D-EP , TMS320F28377D-Q1 , TMS320F28378D , TMS320F28379D , TMS320F28379D-Q1
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 26.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 26.8.
Table 26-7 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 |