Forum Discussion
Altera_Forum
Honored Contributor
15 years ago --- Quote Start --- excuse me, i m a beginner, so the question may be meaningless. I SIMPLY WROTE MY CODE LIKE: process(a_in , clk) begin if clk'event and clk='1' then c_out<=a_in; else c_out<='0'; end if; end process; then i met the error like this:"Can't infer register for 'c_out' at test.vhd(20) because it does not hold its value outside the clock edge". i think i have wrote "else c_out<=' 0'; " why Quartus II still says it does not hold its value outside the clock edge? WHEN I CHANGE THE CODE TO: c_out <= a_in; if clk'event and clk='1' then c_out<=a_in; end if; IT DOESN'T REPORT ANY ERRORS. BUT WHEN IT IS c_out <= '1'; if clk'event and clk='1' then c_out<=a_in; end if; THE SAME ERROR OCCURS. so, could anyone give some help? --- Quote End --- Hi, in your code you define a register which is sensitive to the rising clock edge. With the rising edge the register will store the value of the input a_in. The output of a register could only change at the active edge ( in your case the rising edge). The only possible else branch is "else c_out <= c_out;" which means store the value until the next rising clock edge. Kind regards GPK