1. Homepage
  2. Programming
  3. Project 3: ALU Implementation using Verilog

Project 3: ALU Implementation using Verilog

Engage in a Conversation

Project 3 CourseNana.COM

1. Overview CourseNana.COM

In project 3, you are required to implement an important computation unit in CPU, the Arithmetic and Logic Unit (ALU), using Verilog language. You are going to implement the functionality of ALU module by yourself. To reduce the learning curve, a poorly written template will be given. CourseNana.COM

2. Requirements CourseNana.COM

Before start, you should review the content of ALU and learn the Verilog language by yourself. The following gives a brief review of ALU. CourseNana.COM

2.1 Simple CPU CourseNana.COM

Basically, you are going to implement a simple CPU which supports simple instruction parsing, register value fetching, and ALU functions. As shown in the diagram below, when parsing the machine code of MIPS instruction, ALU receives three fixed inputs, , , regB (32 bit) . When the instruction is excecuted, ALU outputs two signals, , and . CourseNana.COM

2.2 Simple Register Fetch CourseNana.COM

opcode (4 bit)

regA (32 bit) CourseNana.COM

result (32 bit)

flags (3 bit) CourseNana.COM

Since we are using up to 2 registers as the inputs, the size of the register array is defined as 2. It means the register address in the MPIS code can only be one of 00000 and 00001 . For example, instruction[25:21] is the address of rs. However, you can manually change the value in the register during the testing. CourseNana.COM

2.3 ALU Functions CourseNana.COM

You are required to support the following MIPS instruction in your ALU: CourseNana.COM

2.4 Some Specifications CourseNana.COM

For the overflow flag, you should only consider add , addi , and sub instructions. For the zero flag, you should only consider beq and bne instructions. For the negative flag, you only need to deal with slt , CourseNana.COM

slti , sltiu , and sltu instructions. For example, at any time, when you execute addu instruction, the overflow flag will remain zero. And for subu instruction, even the result is less than 0, the negative flag will remain zero. CourseNana.COM

3. How to Use the Given Template CourseNana.COM

A poorly written ALU template is given in the alu.v , which already has the instruction parsing and register fetching parts. Furthermore, two instructions, addu and addiu have already been implemented as examples. A testbench test_alu.v is provided for testing your code, which already contains the test cases for addu and addiu. CourseNana.COM

To run the given template, you should: CourseNana.COM

Transfer the folder to the virtual machine.
Enter the folder .
Compile and run the code by instruction
make test in the terminal. CourseNana.COM

The process of compiling and running the code can be done both in the terminal of the virtual machine and VSCode, as shown in the following figures. CourseNana.COM

add, addi, addu, addiu
sub, subu
and, andi, nor, or, ori, xor, xori beq, bne, slt, slti, sltiu, sltu
lw, sw
sll, sllv, srl, srlv, sra, srav

Project3 CourseNana.COM

Project3 CourseNana.COM

What you need to do based on the given template:
Improve the poorly written
alu.v by adding more implementations of instruction. CourseNana.COM

Written the test for the new instructions in the testbench test_alu.v .
Note: I strongly recommend that after completing the template-based work, you can implement it from CourseNana.COM

scratch by yourself. CourseNana.COM

4. Grading
4.1 Submission Requirements CourseNana.COM

Your project 3 should be written in Verilog only.
Your submission should contain at least the following file:

alu.v test_alu.v makefile Report.pdf CourseNana.COM


If necessary, you can submit more Verilog files beyond those mentioned above and you can also rewrite the makefile.
You should place all of your source files in a folder and compress it into a .zip file. Name it with your student ID and submit it through BB.

Submission Deadline: 23:59, November 26, 2023
If you submit after the deadline, you will lose 10 points for each day of delay, and if you submit more than 3 days late, you will receive a score of 0.

4.2 Report CourseNana.COM

The report of this project should be no longer than 5 pages . Keep your words concise and clear. In your report, you should include: CourseNana.COM

Your big picture thoughts and ideas, showing us you really understand ALU functionality.
A data flow chart explaining what you have extend.
The high level implementation ideas. i.e., how you break down the problem into small problems, and the modules you implemented, etc.
The implementation details. i.e., explain some special tricks used.

In your report, you should not:
Include too many screenshots of your code. Copy and paste others' reports.

4.3 Grading Details CourseNana.COM

This project worth 15% of your total grade. The grading details of this project will be: Correctness of ALU functionalities 80%
Completeness and readability of ALU test bench 10%
Report 10% CourseNana.COM

4.4 Honesty CourseNana.COM

We take your honesty seriously. If you are caught copying others' code, you will get an automatic 0 in this project. Please write your own code.  CourseNana.COM

Get in Touch with Our Experts

Wechat WeChat
Whatsapp Whatsapp
ALU代写,MIPS代写,Verilog代写,CPU代写,ALU代编,MIPS代编,Verilog代编,CPU代编,ALU代考,MIPS代考,Verilog代考,CPU代考,ALUhelp,MIPShelp,Veriloghelp,CPUhelp,ALU作业代写,MIPS作业代写,Verilog作业代写,CPU作业代写,ALU编程代写,MIPS编程代写,Verilog编程代写,CPU编程代写,ALUprogramming help,MIPSprogramming help,Verilogprogramming help,CPUprogramming help,ALUassignment help,MIPSassignment help,Verilogassignment help,CPUassignment help,ALUsolution,MIPSsolution,Verilogsolution,CPUsolution,