Module Dha (A, B, C, S) Input A, B Output C, S Assign S A B Assign C A&B Endmodule Module Tbha - V
Module Dha (A, B, C, S) Input A, B Output C, S Assign S A B Assign C A&B Endmodule Module Tbha - V
Module Dha (A, B, C, S) Input A, B Output C, S Assign S A B Assign C A&B Endmodule Module Tbha - V
// Inputs
reg a;
reg b;
// Outputs
wire c;
wire s;
dha uut (
.a(a),
.b(b),
.c(c),
.s(s)
);
initial
begin
a = 0;b = 0;
#2 a = 0; b = 1;
#2 a = 1; b = 0;
#2 a = 1; b = 1;
end
endmodule
module mux4_1_synth_conditional(w, s, f );
input [3:0] w;
input [1:0] s;
output f;
assignf = s[1]?(s[0]?w[3]:w[2]):(s[0]?w[1]:w[0]);
endmodule
FULL ADDER(GATE LEVEL)
module mux4_1_gatelevel( input i0, input i1, input i2, input i3,input s1, input
s0,output out);
wire s1n,s0n;
wire y0,y1,y2,y3;
not (s1n,s1);
not (s0n,s0);
and (y0,i0,s1n,s0n);
and (y1, i1,s1n,s0);
and (y2,i2,s1,s0n);
and (y3,i3,s1,s0);
or (out,y0,y1,y2,y3);
endmodule
JK FF(ASYNCHRONOUS RESET)
module jk_behav (input j, k, clk, reset, output qb, output reg q);
assign qb = ~q;
always@ ( posedge clk or posedge reset)
begin
if (reset)
q <= 4'b0;
else
case ({j, k})
2'd0: q <= q;
2'd1: q <= 1'b0;
2'd2: q <= 1'b1;
2'd3: q <= ~q;
endcase
end
endmodule
D FF