Lab assignments in digital design typically involve the use of tools such as Verilog HDL, VHDL, and MultiSim to design, simulate, and implement digital circuits. These tools help students and engineers visualize the design flow, perform simulations, and understand the practical aspects of digital circuit design.
Below are examples of lab assignments and practical exercises that use these tools:
Design and simulate simple logic gates using Verilog HDL or VHDL to understand the behavior of AND, OR, NOT, XOR, etc.
module AND_Gate(
input A,
input B,
output Y
);
assign Y = A & B;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity AND_Gate is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
Y : out STD_LOGIC);
end AND_Gate;
architecture Behavioral of AND_Gate is
begin
Y <= A AND B;
end Behavioral;
Design a simple 4-bit binary counter and simulate its functionality.
module Binary_Counter(
input clk,
input reset,
output [3:0] count
);
reg [3:0] count_reg;
always @(posedge clk or posedge reset)
begin
if (reset)
count_reg <= 4'b0000;
else
count_reg <= count_reg + 1;
end
assign count = count_reg;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Binary_Counter is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
count : out STD_LOGIC_VECTOR (3 downto 0));
end Binary_Counter;
architecture Behavioral of Binary_Counter is
signal count_reg : STD_LOGIC_VECTOR (3 downto 0);
begin
process(clk, reset)
begin
if reset = '1' then
count_reg <= "0000";
elsif rising_edge(clk) then
count_reg <= count_reg + 1;
end if;
end process;
count <= count_reg;
end Behavioral;
Design a 7-segment display decoder that takes a 4-bit binary input and drives a 7-segment display.
module Seven_Segment_Decoder(
input [3:0] binary_in,
output reg [6:0] segments
);
always @ (binary_in)
begin
case (binary_in)
4'b0000: segments = 7'b0000001; // Display 0
4'b0001: segments = 7'b1001111; // Display 1
4'b0010: segments = 7'b0010010; // Display 2
4'b0011: segments = 7'b0000110; // Display 3
4'b0100: segments = 7'b1001100; // Display 4
4'b0101: segments = 7'b0100100; // Display 5
4'b0110: segments = 7'b0100000; // Display 6
4'b0111: segments = 7'b0001111; // Display 7
4'b1000: segments = 7'b0000000; // Display 8
4'b1001: segments = 7'b0000100; // Display 9
default: segments = 7'b1111111; // Error state
endcase
end
endmodule
Design a 4-to-1 multiplexer that selects one of the four inputs based on the 2-bit control signal.
module MUX_4to1(
input [3:0] A,
input [1:0] sel,
output Y
);
assign Y = (sel == 2'b00) ? A[0] :
(sel == 2'b01) ? A[1] :
(sel == 2'b10) ? A[2] :
(sel == 2'b11) ? A[3] : 1'bz;
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity MUX_4to1 is
Port ( A : in STD_LOGIC_VECTOR (3 downto 0);
sel : in STD_LOGIC_VECTOR (1 downto 0);
Y : out STD_LOGIC);
end MUX_4to1;
architecture Behavioral of MUX_4to1 is
begin
process(A, sel)
begin
case sel is
when "00" => Y <= A(0);
when "01" => Y <= A(1);
when "10" => Y <= A(2);
when "11" => Y <= A(3);
when others => Y <= 'Z';
end case;
end process;
end Behavioral;
Design a full adder and a circuit that performs both addition and subtraction.
module Full_Adder(
input A,
input B,
input Cin,
output Sum,
output Cout
);
assign Sum = A ^ B ^ Cin;
assign Cout = (A & B) | (B & Cin) | (A & Cin);
endmodule
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Full_Adder is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC);
end Full_Adder;
architecture Behavioral of Full_Adder is
begin
Sum <= A XOR B XOR Cin;
Cout <= (A AND B) OR (B AND Cin) OR (A AND Cin);
end Behavioral;
MultiSim is a popular circuit simulation tool used for testing and validating digital and analog circuits. For the lab assignments above, you can use MultiSim to:
These are just a few examples of how Verilog HDL/VHDL and MultiSim can be used in lab assignments. They allow students to design, simulate, and analyze digital systems effectively while gaining hands-on experience with important tools used in digital design.
Open this section to load past papers