SUFYAN Lab Report
SUFYAN Lab Report
SUFYAN Lab Report
initial CLK=0;
labtask1 stim(A,B,SEL,CLK,RST,TOTAL,SUM);
always #5 CLK=~CLK;
initial begin #5 RST=0; #2 RST=1; #12 RST=0; end initial begin #5 A=0;B=0;SEL=0; for(i=0;i<=10;i=i+1) begin #5 A=A+1;B=B+1;SEL=SEL+1; End end endmodule
LAB TASK 02
module alu(a,b,sel,out);
input [15:0]a,b; input [1:0]sel; output reg [15:0]out; always@(*) begin case(sel) 2'b00: out<=a+b; 2'b01: out<=a-b; 2'b10: out<=a&b; 2'b11: out<=a|b; endcase
end endmodule
STIMULAS LABTASK 02
module alu_stim(); reg [15:0]A,B; reg [1:0]SEL; wire [15:0]OUT; integer i,j,k; alu stim(A,B,SEL,OUT); initial begin #5 SEL=-1;A=0;B=0; for(i=0;i<4;i=i+1) begin SEL=SEL+1;