Orientation

From logic gates to configured hardware

Objectives

Use Quartus Prime 25.1 Lite and a DE0-Nano board to create schematic and Verilog combinational designs, compile them, assign pins, program the FPGA, and verify behaviour with switches and LEDs.

Schematic design

Build logic graphically with a Block Diagram/Schematic File.

Verilog design

Describe hardware with Verilog HDL.

Both paths

Compile, assign I/O, program, and test the actual board.

Equipment

Learn the DE0-Nano board

Before you build anything, use the DE0-Nano board guide to find the basic board information below. You do not need to memorize it. Open the guide, find each answer, and type it into the matching box.

Safety first.
Keep the board on a non-conductive surface. Turn power off before moving wires. Only program the board after the USB-Blaster and board connection are secure.

Need help finding these answers?
→ DE0-Nano Board Reference

Setup

Create a Quartus Prime project

  1. Open Quartus Prime 25.1 Lite Edition.
  2. Choose File → New Project Wizard. Create a writable project folder; use a short project name and use the same top-level entity name for the first design.
  3. Select Empty project; do not add files yet.
  4. Select the Cyclone IV E target device EP4CE22F17C6. Review the project summary and finish.
  5. Save the project before creating a design file.
Quartus New Project Wizard showing the project folder, project name, and top-level entity fields
Enter a project folder, project name, and matching top-level entity name.
Quartus New Project Wizard showing the Empty project option selected
Choose Empty project.
Quartus New Project Wizard Add Files page with no files selected
Do not add design files yet; click Next.
Quartus device selection page with Cyclone IV E and EP4CE22F17C6 highlighted
Select the Cyclone IV E device EP4CE22F17C6.
Quartus EDA Tool Settings page with no external tools selected
Leave the EDA tool settings at their defaults.
Quartus New Project Wizard summary showing the project folder, entity, Cyclone IV E family, and EP4CE22F17C6 device
Check the summary, then click Finish.
Quartus New dialog with Block Diagram/Schematic File highlighted
Later, use File → New to create a Block Diagram/Schematic File.

Need a refresher?
→ Creating a Quartus Prime Project · → Selecting the Target FPGA

Schematic design

Build the first AND gate

  1. Create a Block Diagram/Schematic File and save it using the project top-level name.
  2. Open the Symbol dialog. Under Primitives → Logic, place an and2 primitive.
  3. Under Primitives → Pin, add two input pins and one output pin. Name them A, B, and F.
  4. Wire A and B to the AND inputs and wire F to the output. Save.
  5. Start Compilation. Correct errors, save, and compile again until successful.
Quartus Block Diagram/Schematic editor with the symbol placement tool highlighted
Open the symbol tool in the schematic editor.
Quartus Symbol dialog with primitives, logic, and the and2 symbol selected
Choose Primitives → logic → and2.
Completed simple AND schematic with A and B inputs, an AND2 gate, and C output
Place the input pins, and2 gate, output pin, and wires.

Need a refresher?
→ Block Diagram/Schematic Files · → Compiling a Design

Hardware verification

Assign pins, program, and verify

  1. Open Assignments → Pin Planner. Assign the input and output ports to the required DE0-Nano switch and LED pins. Confirm each assignment against the board reference.
  2. Save, then compile again so the assignment changes are included.
  3. Open Tools → Programmer. Select USB-Blaster, use JTAG mode, and add the compiled .sof from output_files.
  4. Start programming. The .sof is the compiled SRAM configuration file loaded into the FPGA for the current design.
  5. Test all A/B combinations using the assigned DIP switches and LED output. Show the working AND gate to the instructor.
Quartus compilation report showing a successful compile and the Processing menu
Compile the project and confirm that the compile completes successfully.
Reference table listing DE0-Nano DIP switch names and FPGA pin assignments
Use the board reference for the DIP-switch pin assignments.
Quartus Assignments menu with Pin Planner highlighted
Open Assignments → Pin Planner.
Quartus Pin Planner showing named input and output signals with assigned FPGA locations
Enter and check the pin locations for A, B, and the output.
Quartus Programmer window showing USB-Blaster in JTAG mode with a compiled SOF file listed
Open Programmer, choose USB-Blaster and JTAG, and add the compiled .sof.
Quartus Programmer showing USB-Blaster and a successful 100 percent programming result
Click Start and wait for the successful programming result.

Logic gates

Implement and verify logic gates

Create and test OR, NAND, NOR, XOR, and XNOR using the same project flow. Replace the primitive, save, compile, assign pins if needed, program the FPGA, and test every DIP-switch combination. Enter the predicted output and your LED observation.

Need a refresher?
→ Basic Logic Gates · → Truth Tables

A B F Actual LED status

Combinational design

Implement the supplied combinational circuit

Combinational logic circuit with d1 and d2 inputs and LED0 through LED7 outputs, using a direct connection and AND, OR, XOR, NAND, NOR, and XNOR gates.
Build and test the supplied combinational circuit. Keep the signal names and LED output labels exactly as shown.

Using the supplied circuit diagram, analyse the function, build the complete schematic, compile it, assign the required I/O, program the FPGA, and verify the output combinations on the board. Do not simplify the circuit until you have recorded its required behaviour.

Verilog HDL

Describe combinational hardware with Verilog

A schematic describes hardware graphically. Synthesizable Verilog describes the intended hardware with modules, ports, and logic expressions; synthesis converts that description into FPGA logic.

  1. Create File → New → Verilog HDL File, then save it with the file name of your choice.
  2. Define one module whose name matches with your file name. Declare its inputs and outputs, then implement the specified combinational behaviour.
  3. Add the saved file to the project and confirm it appears in project files. Save all.
  4. Run Analysis & Synthesis, correct syntax errors, and confirm the top-level entity is correct.

Need a refresher?
→ Verilog Modules and Ports · → Combinational Logic in Verilog

Starter code - light.v
module light (LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7);
	output LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7; //LEDs 

	reg [7:0] LEDs = 8'b10110000;

	assign LED0 = LEDs[0]; 
	assign LED1 = LEDs[1];
	assign LED2 = LEDs[2];
	assign LED3 = LEDs[3];
	assign LED4 = LEDs[4];
	assign LED5 = LEDs[5];
	assign LED6 = LEDs[6];
	assign LED7 = LEDs[7];
endmodule

Type or paste this starter code into your Verilog HDL file. The file name and top-level module must match your file name.

Build and test

Compile the design and test the board

Now turn your Verilog file into a working FPGA program. Follow these steps in order.

  1. In Quartus, run Analysis & Synthesis. Then choose Tools → Netlist Viewers → RTL Viewer.
  2. Take a screenshot of the RTL Viewer. This shows the logic Quartus found in your Verilog file.
  3. Open Pin Planner. Enter the LED and switch pin numbers, save, and compile the project again.
  4. Open Programmer, select USB-Blaster, load the new .sof file, and click Start. Test the LEDs and switches on the board.

Analysis

Think it through

Completion

Review and create the local submission ZIP

Demonstrate the completed laboratory work and your programming checklist to the instructor. The ZIP retains the required responses and files selected in this browser session.

Submission package

Download your Lab 2 submission ZIP

The ZIP includes completion.json and selected evidence/design files.

Submission Details

Enter all four required details before downloading.

Evidence files must be reselected after reopening the page.