Objets/Documentation
mod5.v
Programme, données ou contrôle reproductible du dossier circuits.
Télécharger ↓// Three combinational implementations of the same total function on three bits.
module step5 #(parameter DIGIT = 1'b0) (input [2:0] r, output [2:0] y);
wire [3:0] z = {r, DIGIT};
wire [3:0] reduced = z >= 4'd5 ? z - 4'd5 : z;
assign y = r < 3'd5 ? reduced[2:0] : r;
endmodule
module six(input [2:0] r, output [2:0] y);
wire [2:0] a,b,c,d,e;
step5 #(1'b1) s1(r,a);
step5 #(1'b0) s2(a,b);
step5 #(1'b1) s3(b,c);
step5 #(1'b1) s4(c,d);
step5 #(1'b0) s5(d,e);
step5 #(1'b1) s6(e,y);
endmodule