Lab Manual NBA
Lab Manual NBA
Lab Manual NBA
OBJECTIVE: To design XOR gate and simulate its operation using Xilink
Software and VHDL in dataflow model.
THEORY:
XOR gates have two inputs and one output and they implement the
special boolean logic of inequality detection. The EXOR gate gives a high
output every time it detects an inequality in the inputs. Its equation is as
follows Y (A xor B) = AB’ + A’B
This can be implemented using VHDL codes and can be simulated using a
verilog program.It is verified by matching the output waveform with
theoritical knowledge.
VHDL PROGRAM:
entity XOR1 is
port(a: in STD_LOGIC;b: in STD_LOGIC;c: out STD_LOGIC;);
end XOR1;
architecture dataflow of XOR1 is
begin
c<=a XOR b;
end dataflow;
VERILOG PROGRAM:
Module XOR1
Reg a;
Reg b;
wire c;
XOR1 uut (a(a);b(b);c(c););
Initial begin
a=0;
b=0;
#100;
a=0;
b=1;
#100
a=1;
b=0;
#100
a=1;
b=1;
#100
End;
End module;
OUTPUT WAVEFORM:
CONCLUSION:
Many VHDL constructs although useful for simulation and other
Stages in the design process are not relevant for synthesis.A subset of
VHDL can only be used for synthesis.
Verilog is much more easier to use and learn and is most widely used in
synthesis and simulation.It is also used in ASIC design.
EXPERIMENT NO-
OBJECTIVE: To design Half Adder and simulate its operation using Xilink
Software and VHDL in dataflow model.
THEORY:
S=A XOR B;
C=A AND B;
This can be implemented using VHDL codes and can be simulated using a
verilog program.It is verified by matching the output waveform with
theoritical knowledge.
VHDL PROGRAM:
entity HA is
port(a: in STD_LOGIC;b: in STD_LOGIC;S: out STD_LOGIC;
C: out STD_LOGIC;);
end HA;
architecture dataflow of XOR1 is
Begin
S<=a XOR b;
C<=a AND b;
end dataflow;
VERILOG PROGRAM:
Module HA
Reg a;
Reg b;
Wire s;
Wire c;
XOR1 uut (.a(a);.b(b);.C(C);.S(S));
Initial begin
a=0;
b=0;
#100;
a=0;
b=1;
#100
a=1;
b=0;
#100
a=1;
b=1;
#100
End;
End module;
OUTPUT WAVEFORM:
CONCLUSION:
Many VHDL constructs although useful for simulation and other
Stages in the design process are not relevant for synthesis.A subset of
VHDL can only be used for synthesis.
Verilog is much more easier to use and learn and is most widely used in
synthesis and simulation.It is also used in ASIC design.
EXPERIMENT NO-
OBJECTIVE: To design 4:1 MUX and simulate its operation using Xilink
Software and VHDL in behavioral model.
THEORY:
A multiplexer is a data selector. It has multiple inputs, out of which it
selects one and connects that one to the output. This selection is done
on the basis of the values of the select inputs. In this program, we will
write the VHDL code for a 4:1 Mux. A 4:1 mux will have two select inputs.
Since we are using behavioral architecture, it is necessary to understand
and implement the logic circuit’s truth table.
I0 I1 I2 I3 S0 S1 Y
I0 x x x 0 0 I0
x I1 x x 0 1 I1
x x I2 x 1 0 I2
x x x I3 1 1 I3
VERILOG PROGRAM:
module MUX_SOURCE;
reg [3:0] a;
reg [3:0] b;
reg [3:0] c;
reg [3:0] d;
wire [3:0] out;
reg [1:0] sel;
integer i;
MUX_SOURCE mux0 ( .a (a),
.b (b),
.c (c),
.d (d),
.sel (sel),
.out (out));
initial begin
// Launch a monitor in background to display values to log whenever
a/b/c/d/sel/out changes//
$monitor ("[%0t] sel=0x%0h a=0x%0h b=0x%0h c=0x%0h d=0x%0h
out=0x%0h", $time, sel, a, b, c, d, out);
CONCLUSION:
Many VHDL constructs although useful for simulation and other
Stages in the design process are not relevant for synthesis.A subset of
VHDL can only be used for synthesis.
Verilog is much more easier to use and learn and is most widely used in
synthesis and simulation.It is also used in ASIC design.