Professional Documents
Culture Documents
1.0 Introduction
This is a step-by-step tutorial for building a full adder in Xilinx Vivado
By the end of this tutorial, you should be able to:
Create a new design using Verilog.
Verify the function of a design by behavioral simulation.
Objectives After completing this tutorial, you will be able to:
Create a Vivado project sourcing HDL model(s) But we are not targeting a specific FPGA
device
Simulate the design using the XSim simulator
This steps are not mandatory for the project but if you are interested I can provide
information for the next steps that can also be done on XILINX
Synthesize and implement the design
Generate the bitstream
Configure the FPGA using the generated bitstream and verify the functionality
2.0 ALU
The objective of this tutorial is to create an ALU that can add, substract, and set on less than two 32 bits
inputs (a and b).
Inputs:
a, b will be two numbers of 32 bits
ALUOperation is a 5 bit input value that determines the function the ALU will perform
Outputs:
Result is a 32 bit number the result of the operation on a, b
Zero is a one bit value that is 1 when Result is 0
(Forget by now about the CarryOut and Overflow)
You have no files to add so just ignore the file options you are going to create your
own not import them
2.
3
31
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module ALU(
input [31:0] a;
input [31:0] b;
input [3:0] ALUop;
output [31:0] result;
output zero;
)
endmodule
now add the code to add, etc
module alu(
input [31:0] a,
input [31:0] b,
output reg [31:0] result,
output zero,
input [3:0] ALUop
);
2. Select the Add or Create Simulation Sources option and click Next.
In the Add Sources Files form, click the Create Files... button.
The tutorial_tb.v file is added under the Simulation Sources group
You will get a waveform similar to this one, check that the output is correct
some hints about the simulation screen to view results nicer: