Altera_Forum
Honored Contributor
13 years agosynthesis error 10818
Hi,
while working with OpenCores SD card controller ( http://opencores.org/project,sdcard_mass_storage_controller ) I got error 10818 while trying to synthesize this for Cyclone IV (DE2-115). The issue boils down to this not synthesizable construct:
module sd_bd (
input clk,
input rst,
input ena,
output reg result
);
always @(posedge clk, posedge rst )
begin
result <=0;
if (rst)
result <=0;
else if (ena)
result <= 1;
end
endmodule
gives this error message when trying to synthesize it for Quartus 12.1 Build 177:
Critical Warning (10237): Verilog HDL warning at sd_bd.v(10):
can't infer register for assignment in edge-triggered always construct because the clock isn't obvious. Generated combinational logic instead
Error (10818): Can't infer register for "result" at sd_bd.v(13) because it does not hold its value outside the clock edge
File: /commonroot/home/vleo/000_JOB/EISU_OR1200/sdc_test_on_DE2_115/vhdl/sd_controller/sd_bd.v Line: 13 What is described there - seems like a D-trigger, i.e. the ena input is feteched on the clk edge, then held till next clock. This is certainly not a good way to code what's intended, but this construct is used over and over in sdc_controller project. i wonder what is the workaround, i.e. minimal patch that will allow this to function. Actual code contains other signals on input and output, but the root cause of Quartus error is this ill-shaped D-trigger. I'm attaching ModelSim archive that shows that this code simulates as expected and Quartus project, that gives error 10818 p.s. I first thought that this illustrates Verilog language deficiency - none of this should happen in VHDL. But unfortunately I got the very same error with VHDL version of the example as well. In Verilog though, it works, when rst is removed from sensitivity list. So - Verilog seems to win here :)