Altera_Forum
Honored Contributor
14 years agoVHDL for Double Data Rate registers?
Hello,
I'm writing some code for picking up nibbles at double data rate, then assembling the pieces into a byte for clocking out. Here's my code:
-- Assemble nibbles into byte
PROCESS(clk, reset)
BEGIN
IF (reset = '1') THEN
reg_DATA_OUT <= "UUUUUUUU";
final_reg_DATA_OUT <= "UUUUUUUU";
-- In Gb mode, pick up least significant nibble on rising edge
ELSIF (clk'event AND clk = '1') THEN
reg_DATA_OUT(3 downto 0) <= data_in;
-- In Gb mode, pick up most significant nibble on falling edge
ELSIF (clk'event AND clk = '0') THEN
final_reg_DATA_OUT <= reg_DATA_OUT;
IF (gb = '1') THEN
reg_DATA_OUT(7 downto 4) <= data_in;
ELSE
-- If not Gb mode, shift data to assemble on alternating rising edge
reg_DATA_OUT(7 downto 4) <= reg_DATA_OUT(3 downto 0);
END IF;
END IF;
END PROCESS;
DATA_OUT <= final_reg_DATA_OUT;
RTL Simulation works fine, however I get some Design Assistant warnings: Rule C106: Clock signal source should not drive registers triggered by different clock Positive edge destination node(s) list reg_DATA_OUT[0] Positive edge destination node(s) list reg_DATA_OUT[1] Positive edge destination node(s) list reg_DATA_OUT[2] Positive edge destination node(s) list reg_DATA_OUT[3] Negative edge destination node(s) list final_reg_DATA_OUT[0] Negative edge destination node(s) list reg_DATA_OUT[4] Negative edge destination node(s) list final_reg_DATA_OUT[1] Negative edge destination node(s) list reg_DATA_OUT[5] Negative edge destination node(s) list final_reg_DATA_OUT[2] Negative edge destination node(s) list reg_DATA_OUT[6] Negative edge destination node(s) list final_reg_DATA_OUT[3] Negative edge destination node(s) list reg_DATA_OUT[7] Is there better ways of doing this? Preferably not using ALTDDIO_IN. This does actually raise a fundamental question, I might have gotten it wrong... Is it bad or incorrect to "set registers" on one edge, and clock output of the same registers into other modules on the opposite edge? :confused: Best regards, M.