Digital logic

profilerramos
M1A3Lab.docx

M1A3 Lab: Introduction to Verilog: Simple Light Controller Circuit

Problem Statement and Analysis

For this laboratory, you will use the two-way light controller circuit shown in Figure 1. The circuit can be used to control a single light from either of the two switches, x1 and x2, where a closed switch corresponds to the logic value 1. The truth table for the circuit is also given in the figure. Note: this is only the Exclusive-OR function of the inputs x1 and x2; you will need to specify it using the gates shown.

The required circuit is described by the Verilog code in Figure 2. This code can be typed into a file by using any text editor that stores ASCII files, or by using the Quartus II text editing facilities. While the file can be given any name, designers generally use the same name as that of the top-level Verilog module. The file name must include the extension v, which indicates a Verilog file. Accordingly, you will use the name light.v.

module light (x1, x2, f);

input x1, x2;

output f;

assign f = (x1 & ∼x2) | (∼x1 & x2);

end module

Figure 2: Verilog Code for the circuit in Figure 1

[Note: ~ sign represents inverse in Verilog. This is located below the Esc key on most keyboards.]

On the basis of the above explanation, complete the following:

Step 1 – Downloading and Installing Quatrus Prime Software Lite Edition

Download and install the Quatrus Prime Software Lite Edition. I recommend version 16.1 but you may consider installing other versions based on your computer and operating system. Follow the step-by-step process below:

Go to the following URL: https://www.altera.com/myaltera/mal-signin.jsp

(Links to an external site.)

. You must create an account by entering your email address. You will also be asked to enter some personal information to complete the registration process. Review their Privacy Policy

(Links to an external site.)

.

After creating an account, click on the “Download Quatrus Prime” at the right of the page.

On the next page, click on the “Quatrus Prime Software Lite edition” button.

Select release 16.1 You must select the “Operating System” and “Download Method”. Choose “Direct Download” as your “Download Method”.

There are three options for downloading the software. If you want to download the complete package, which is the largest size, you must select “Combined Files”. However, for the purpose of this course, there is no need to install all files. Therefore, you can select the “Individual Files” option and download the following files only, which is smaller in size and takes less time. Note: Remember to download all the files into a same directory.

Quartus II Software (includes Nios II EDS)

ModelSim-Altera Edition (includes Starter Edition)

Cyclone V device support

Quartus II Help

Download the Quick Start Guide.

After downloading the required files, you are now ready to install the software. To do so, run the Quartus Prime file and follow the installation process. There is no need to modify anything in the process. This will install Quatrus II, ModelSim and Device Support file.

Once the installation is complete, the software will be launched automatically.

Step 2 – Creating and Compiling the Project with Quatrus II Verilog

Read sections 3 through 6 of the file Quatrus_II_Introduction.pdf. Follow the steps in these sections and enter the Verilog code in Figure 2 to Quatrus II program.

Step 3 – Simulating the Project with Quatrus II Verilog

Read section 8 of the file Quatrus_II_Introduction.pdf. Follow the steps in this section. Simulate the Verilog code and generate the output waveform.

Step 4 – Checking the Simulation

Check your simulation and make sure that your simulation satisfies the design requirements (the Truth Table in Figure 1).

Step 5 – Writing the Lab report

Write the laboratory report using the laboratory report format.

Step 6 – Submitting the Report

Submit your report by the due date.

Use the American Psychological Association (APA) style (6th edition) for writing your assignment.

Reference:

• Altera Corporation. (n.d.). myAltera Sign In

(Links to an external site.)

. Retrieved from https://www.altera.com/myaltera/mal-signin.jsp