CPLD 双向端口操作实例,我介绍一下主要关键设计要点:
1。data_CF 是双向数据端口;
2。DI,DO是输入输出寄存器;
3。RD_DIR, WR_DIR 是方向控制常量;
4。DIR1 ,方向控制变量
----Bi-direct io control---------
--PROCESS(data_CF,do,Dir1)
PROCESS(clk,rst) -- sychronized on nov 29.
BEGIN
IF rst = '1' THEN
di <= (OTHERS=>'Z');
data_CF <= (OTHERS=>'Z');
ELSIF clk'event AND clk = '1' THEN
IF Dir1 = RD_Dir THEN
di <= data_CF;
data_CF <= (OTHERS=>'Z');
ELSIF Dir1= WR_Dir THEN
data_CF <= do;
di <= (OTHERS=>'Z');
ELSE
di <= (OTHERS=>'Z');
data_CF <= (OTHERS=>'Z');
END IF;
END IF;
END PROCESS;
----------------------------------