Assignment Ar
Assignment Ar
Assignment Ar
Id 221001851
Q1)
Cycles per instruction (CPI):
CPI= Total cycles / Total instructions
CPI= 12000 cycles/300 instructions = 40 cycles/instructions
Instructions Per Cycle (IPC):
IPC = 1/CPI
IPC= 1/40 cycles/instruction = 0.025 instruction/cycle
Sequence 2:
Total cycles = (1*2) + (2*5) +(5 * 3) =2+10+15 =27 million cycles
CPI = Total cycles / Total instructions =27/(1+5+2)=27/8=3.375 cycles/instruction
Q3)
b.11011001 → 11111101
xnor
11011001
- 11011011
= 11111101
c.11011001 -> 00001010
xor
11011001
+ 11010011
= 00001010
D. 11011001->11111110
Nand
11011001
! 00100111
11111110
Q4
// Code your testbench here // Code your design here
// or browse Examples // Code your design here
// Code your testbench here module OR(
// or browse Examples input wire x,
module testbench(); input wire y,
reg A,B ,C; output reg out
wire out; );
always@(x,y)
Final_module f4(A, B ,C , out); begin
initial out =(x | y);
begin end
$monitor("The output = ",out); endmodule
A= 1'b1;
B= 1'b1; module NOT(
C= 1'b1; input wire x,
end output reg out
endmodule );
always@(x)
begin
out =( ~x );
end
endmodule
module AND(
input wire x,
input wire y,
output reg out
);
always@(x,y)
begin
out =(x & y);
end
endmodule
module Final_module(
input A, B, C,
output reg out
);
inout wire S;
inout wire N;
inout wire V;
inout wire D;
inout wire O;
AND f1(A,B,S);
OR f2(A,B,N);
NOT f3(C,V);
AND f4(C,S,D);
AND f5(V,N,O);
OR f6(O,D,out);
endmodule
Q5
module test(); module mux2x1(
reg [15:0] in; input wire [1:0] in,
reg [3:0]sel; input wire sel,
wire out; output reg out
final11 f(in,sel, out); );
always @(*)
initial begin
begin case(sel)
in = 16'b1111111111111111; 1'b0: out = in[0];
sel=4'b1110; 1'b1: out = in[1];
$monitor(out); endcase
end end
endmodule endmodule
module final11(
input wire [15:0] in,
input wire [3:0] sel,
output reg out
);
inout wire [13:0] out_internal;