Altera_Forum
Honored Contributor
13 years agoTwo Clock Inputs questions for VHDL
I have a process that needs to be run off two clocks (shifting Bits) When clk1 changes state and clk2 is low i should shift ALSO when clk2 changes state and clk1 is low i should shift.
I am having an issue getting that logic to work right in VHDL can someone assist me ? I have the code below but it does not update X and Y correctly i am trying to use Z to run the Shift Process. But its like it will not update the X and Y values properly.
process(CPIN,CPINH)
BEGIN
if ((CPIN'EVENT and CPIN = '1' )and CPINH = '0') then
X <='1';
ELSIF ((CPIN'EVENT and CPIN = '1' )and CPINH = '1') then
X <='0';
END IF ;
end process;
----------------------------------------------
PROCESS(CPIN,CPINH)
BEGIN
If ((CPINH'EVENT and CPINH = '1' )and CPIN = '0') then
Y <='1';
ELSIF ((CPINh'EVENT and CPINH = '1' )and CPIN = '1') then
Y <='0';
END IF ;
END PROCESS;
---------------------------------
process(X,Y)
BEGIN
Z<= X XOR Y;
end process;
------------------------
process(Z)
BEGIN
if (Z = '1') then
--DO STUFF
end process