HDL Report 2++
HDL Report 2++
HDL report 2
1-Ex 4.40
module ex4_40 (
output [3 : 0] Sum_diff ,
output V , // overflow
input [3:0] A , B ,
input M
);
always@ (M , A , B)
endmodule
2- Ex 4.43
We can consider the code above as a description for a 2x1 multiplexer circuit
with enable switch.
When the enable switch is off the output is in high impedance state
(open circuit).
While when the enable switch is on the input S selects which of the inputs A
or B to be the output of the multiplexer as explained in the diagram shown.
3-Ex 4.50
module ex4_50_a (
);
case (B_84_2_1)
endcase
endmodule
module ex4_50_b (
);
case (B_84_2_1)
endcase
endmodule
4-ALU with 4 bit select
module ALU_with_4_bit_select(
input [7:0] A , B ,
);
y=0 ;
case (Select)
4’b0010 : y= A|B ; // OR
4’b0110 : y= ~A ; // complement
4’b0111 : y= A ;
4’b1000 : y=B ;
endcase
end // begin
endmodule