
PSD GPLD Primer - PSD6XX/7XX/8XX é Application Note
055
WSi Inc. Fremont CA 800-832-6974 www.wsipsd.com
20
Use the WSIPSD PROPERTY statements to align the desired order of the bits in these count functions
(FirstCnt, Counter) with the bit order of the
OMC
registers in the
csiop
array. These statements also assign
particular banks of OMCs to these counter functions; see lines 126 and 130.
Assign clock and reset to the 'Counter' function as shown in lines 220 and 221.
Assign clock and reset functions to the state machine registers as in lines 223 and 224. Note that the state
machine is advanced on the opposite edge of the clock than the edge that latches state machine inputs
(keypad inputs and the value of 'Counter') for stability.
Examine the state machine construct starting at line 232. See how 'Counter' is conditionally loaded with
'FirstCnt' and conditionally decremented.
Do this at run time:
After power up or upon reset, the MCU should load the initial count value of 'FirstCnt' by writing to the
appropriate
OMC
register. No other action is necessary to place the OMCs in motion.
2.4.3.2.2 Pin
The following example is not part of the sample design in Appendix A.
This example uses registered OMCs as a shift register in which only the MSB is connected to a pin. In
this example, signal 'sd7' is the registered OMC signal that goes out to a pin.
Do this in the PSDabel file:
Declare the names; notice some are pins, some are nodes:
sd7 pin istype'reg';
sd6, sd5, sd4, sd3, sd3, sd2, sd1, sd0 node istype 'buffer, reg'; ò remaining bits are internal nodes
scl pin;
ò shift reg clock
ò connect msb of shift register to pin
Use the property statement:
WSIPSD PROPERTY DataBus_OMC D[7:0]: sd[7:0] MCELLC'; ò align shift register to data
"bus for easy load. Use
the
"eight MicroCells of
MCELLC
Define these labels:
sdata = [sd7, sd6, sd5, sd4, sd3, sd2, sd1, sd0];
shift = [sd6, sd5, sd4, sd3, sd2, sd1, sd0, 0];
ò 8 bit shift register
ò shift direction is toward msb
Write equations:
sdata.c = scl;
sdata.re = !reset;
sdata := shift;
ò define the clock
ò define the reset
ò do the shift
scl = !wr & (Address == ^hC006); "create a clock pulse
Do this at run time:
The MCU should load the shift register with a value by writing to the appropriate
OMC
register in the
csiop
array. Then data is clocked out by the MCU writing dummy data to address 0xC006. The MCU can
also read the shift register at any time by reading the same
OMC
register.