Код
module CountPrim
#(parameter WIDTH = 4)
(
input Reset_n, Clock, Enable,
output [WIDTH-1:0] Count,
output POut
);
wire [WIDTH-1:0] Fb; // feedback
wire [WIDTH-1:0] Lt; // look table
wire [WIDTH-1:0] Cr; // carry out
CARRY_SUM Cy0 (.sin(Fb[0]), .cin(1),
.sout(Lt[0]), .cout(Cr[0]));
DFFE Ff0 (.d(Lt[0]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[0]));
CARRY_SUM Cy1 (.sin(Fb[1]), .cin(Cr[0]),
.sout(Lt[1]), .cout(Cr[1]));
DFFE Ff1 (.d(Lt[1]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[1]));
CARRY_SUM Cy2 (.sin(Fb[2]), .cin(Cr[1]),
.sout(Lt[2]), .cout(Cr[2]));
DFFE Ff2 (.d(Lt[2]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[2]));
CARRY_SUM Cy3 (.sin(Fb[3]), .cin(Cr[2]),
.sout(Lt[3]), .cout(Cr[3]));
DFFE Ff3 (.d(Lt[3]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[3]));
assign Count = Fb;
assign POut = Cr[3];
endmodule
#(parameter WIDTH = 4)
(
input Reset_n, Clock, Enable,
output [WIDTH-1:0] Count,
output POut
);
wire [WIDTH-1:0] Fb; // feedback
wire [WIDTH-1:0] Lt; // look table
wire [WIDTH-1:0] Cr; // carry out
CARRY_SUM Cy0 (.sin(Fb[0]), .cin(1),
.sout(Lt[0]), .cout(Cr[0]));
DFFE Ff0 (.d(Lt[0]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[0]));
CARRY_SUM Cy1 (.sin(Fb[1]), .cin(Cr[0]),
.sout(Lt[1]), .cout(Cr[1]));
DFFE Ff1 (.d(Lt[1]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[1]));
CARRY_SUM Cy2 (.sin(Fb[2]), .cin(Cr[1]),
.sout(Lt[2]), .cout(Cr[2]));
DFFE Ff2 (.d(Lt[2]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[2]));
CARRY_SUM Cy3 (.sin(Fb[3]), .cin(Cr[2]),
.sout(Lt[3]), .cout(Cr[3]));
DFFE Ff3 (.d(Lt[3]), .clk(Clock),
.clrn(Reset_n), .prn(1),
.ena(Enable), .q(Fb[3]));
assign Count = Fb;
assign POut = Cr[3];
endmodule
Но не получаю желаемого (см. картинку). Где-то промахнулся. Поможите, люди добрые!