Altera_Forum
Honored Contributor
10 years agoHow do I infer dffe instead of mux
Hi,
I am having a problem getting quartus to synthesize part of my design as a dffe register when the output of the register is fed to another module. If I run the following code (without a sub-module) through analysis & synthesis, and then view the results in the RTL viewer, the result is a dffe as expect:module dffe_test
(
input wire clk,
input wire ctrl,
input wire dat,
output wire result
);
reg dat_r;
always @ ( posedge clk )
begin
if ( ctrl )
begin
dat_r <= dat;
end
end
assign result = { &dat_r };
endmodule However, the following code uses muxes and a dff is less efficient:
module dffe_test
(
input wire clk,
input wire ctrl,
input wire dat,
output wire result
);
reg dat_r;
always @ ( posedge clk )
begin
if ( ctrl )
begin
dat_r <= dat;
end
end
widget widget_inst
(
.clk ( clk ),
.dat ( { dat_r } ),
.result( result )
);
endmodule I have attached a screenshot of the TRL viewer output for both examples. How do I get the second example to use a dffe for register dat_r ?