Assignments in Mcgill-ECSE222 (Digital Logic).
Assignments are done on the Altera DE1-Soc FPGA board. The language used to describe digital systems in these assignments is VHDL (Very High Speed Integrated Circuit Hardware Description Language)

- Learning the basics of Altera Quartus II design software
- Creating a framework and set the configurations for FPGA board of the Cyclone V family; this framework will be used in future designs
- Designing a 4-bit comparator circuit with two 4-bit inputs
- Creating a schematic gate diagram of the 4-bit comparator logic curcuit
- Design a testbench
- Simulating the circuit
- Analysing timing constraints
4-bit comparator circuit
A circular barrel shifter is a circuit that can shift inputs by a given number of bits with combinational logic. In this assignment, I implement a 4-bit circular barrel shifter using a combination of muxes. A multiplexer is a circuit that selects between several inputs and forwards the value to a single output. As the barrel shifter instantiates multiple structural desciptions of a 2-to-1 Mux, a 2-to-1 Mux will also be implemented and tested.
We are interested to both the structural and behavioral descriptions of the mentioned circuits. Therefore aforementioned circuits will be implemented using both structural and behavioral descriptions.
4-bit circular barrel shifter
A ripple carry adder is a logic circuit in which the carry-out of each full adder is the carry in of the succeeding next most significant full adder. It is called a ripple carry adder because each carry bit gets rippled into the next stage. In this assignment, I implement, test and simulate a half adder and a full adder in order to implement a 4-bit ripple-carry adder (RCA). All mentioned circuits are implemented using structural and behavioral descriptions.
| Half Adder | Full Adder | Ripple-Carry Adder |
|---|---|---|
![]() |
![]() |
![]() |
In this assignment, I design a One-Digit BCD Adder. A one-digit BCD adder adds two four-bit numbers represented in a BCD format. The result of the addition is a BCD-format 4-bit output, representing decimal sum, and a carry that is generated if this sum exceeds a decimal value of 9.
An exhaustive timing analysis of the designed circuit is also done. Measuring the latency and throughput, determining the slack and the critical path is done by setting time constraints and examining timing violations in the circuit.
Single Digit BCD adder
Timing waveform of the critical path
In this assignment, I test the one-digit binary coded decimal (BCD) adder designed in the previous assignment on the Altera DE1-SoC board using the board’s 7-Segment LED display as output and sliding switches as inputs. This implies the implementation of a 7-segment decoder to read the input/output of the circuit (two 7-segment decoders for the input and 2 for the output). The wrapper circuit performs the addition of the two 4-bit BCD formatted inputs and displays the inputs and the result of the addition in BCD format using the 7-segment LEDs on the DE1-SoC board.
Example addition of 7 and 6
This assignment is focused on describing storage elements and sequential logic circuits in VHDL. A 3-bit up-counter counting in increments of 1 second is implemented and simulated ModelSim. To achieve the mentioned counter, a JK flip-flop a counter and a clock divider are implemented and have been simulated within a testbench considering the clock signal.
3-bit up-counter counting in increments of 1 second
| JK-Flip Flop | Clock Divider |
|---|---|
![]() |
![]() |










