Getting_started
Getting_started
PROJECT REPORT
submitted by
VAES Branch
to
Master of Technology
In
VLSI and Embedded Systems
OCTOBER 2022
Contents
LIST OF FIGURES
LIST OF ABBREVIATIONS
1 LITERATURE SURVEY 2
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 ZedBoard Kit contents: . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 ZedBoard Key Features . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 ZedBoard Basic Setup and Operation . . . . . . . . . . . . 6
1.4.1 Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4.2 ZedBoard System Block Diagram . . . . . . . . . . . . . . . . . . 12
3.1 ALU-Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 ALU-RTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3 ALU-RTL Schematic after Synthesis . . . . . . . . . . . . . . . . . . . . . 35
3.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.5 Addition 3+3 =6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.6 Subtraction 11-2 = 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.7 Subtraction 2-11 =-9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.8 Multiplication 3*2 =6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.9 AND 3*2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.10 OR 3/2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.11 XOR 3 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.12 Division 9/3 = 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.1 Counter-Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2 Counter-RTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.3 Counter-RTL after Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.4 Counter-Constraint file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.5 Upcounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.6 Downcounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
List of Abbreviations
1. UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Universal Asynchronous Receiver-Transmitter
1
Chapter 1
LITERATURE SURVEY
1.1 Introduction
ZedBoard™ is a low-cost development board for the Xilinx Zynq®-7000 All Pro-
grammable SoC. This board contains everything necessary to create a Linux, Android,
Windows® or other OS/RTOS-based design. Additionally, several expansion connectors
expose the processing system and programmable logic I/Os for easy user access. Take
advantage of the Zynq-7000 AP SoC’s tightly coupled ARM® processing system and 7
series programmable logic to create unique and powerful designs with ZedBoard. Zed-
Board is supported by the zedboard.org community website where users can collaborate
with other engineers also working on Zynq designs.
The ZedBoard enables hardware and software developers to create or evaluate Zynq™-
7000 All Programmable SoC designs. The expandability features of this evaluation and
development platform make it ideal for rapid prototyping and proof-of-concept devel-
opment. The ZedBoard includes Xilinx XADC, FMC (FPGA Mezzanine Card), and
Digilent Pmod™ compatible expansion headers as well as many common features used in
system design. ZedBoard enables embedded computing capability by using DDR3 mem-
ory, Flash memory, gigabit Ethernet, general purpose I/O, and UART technologies. This
Getting Started Guide will outline the steps to setup the ZedBoard hardware. It docu-
ments the procedure to run a simple Linux design to show a Linux application running
2
on the ARM® dual-core Cortex™- A9 MPCore™ Processing System (PS) and interacting
with the tightly coupled 7 series 85K Programmable Logic (PL) cells. Xilinx Embedded
Development tools are also introduced where the design can be built from scratch and
customization options can be discovered. If Xilinx ISE WebPACK or Design Suite soft-
ware is not already installed, further resources to install the software, get updated and
generate a license
*ZedBoard
*4GB SD car
*Software : Xilinx Vivado DVD, Xilinx License Voucher for Vivado Design Edition
tools for ZedBoard designs
3
1.3 ZedBoard Key Features
* Clocking : 33.33333 MHz clock source for PS, 100 MHz oscillator for PL
* Display : HDMI output supporting 1080p60 with 16-bit, YCbCr, 4:2:2 mode color,
VGA output (12-bit resolution color), 128x32 OLED display
4
Figure 1.1: ZedBoard Hardware Block Diagram
5
1.4 ZedBoard Basic Setup and Operation
The ZedBoard SD card is preloaded with an example open source Linux build with
a RAMdisk file system. This document was created using a host PC running Windows
7 and the instructions contained would apply directly to a Windows 7 host PC. See
Appendix III for an example of how to connect a Linux host PC to ZedBoard. It is also
recommended that the host PC also have a wired (RJ-45 connector) Network Interface
Card (NIC) that can operate at 100 Mbps or 1000 Mbps.
3. Insert the 4GB SD card included with ZedBoard into the SD card slot (J12) located
on the underside of ZedBoard PCB. This SD card comes preloaded with demo software
and contains a basic Linux configuration used to implement the demos listed in the later
sections.
4. Verify the ZedBoard boot (JP7-JP11) and MIO0 (JP6) jumpers are set to SD card
mode as described in the Hardware Users Guide. www.zedboard.org/documentation/1521
6
Figure 1.2: ZedBoard SC Card Boot Mode Jumper Setting
5. Turn power switch (SW8) to the ON position. ZedBoard will power on and the
Green Power Good LED (LD13) should illuminate.
6. The PC may pop-up a dialog box asking for driver installation. ZedBoard has a
USB-UART bridge based on the Cypress CY7C64225 chipset. Use of this feature requires
that a USB driver be installed on your Host PC. If Windows recognizes the USB-UART
and loads the software driver, then amber LED D6 will light. Please skip ahead to the
next section. However, if the host PC does not recognize the USB-UART and enumerate
it as a COM port device. When driver installation is complete, continue to the next step.
7. www.zedboard.org/documentation/1521
8. Wait approximately 15 seconds. The blue Done LED (LD12) should illuminate,
and a default image will be displayed on the OLED (DISP1).
7
Figure 1.3: Device Manager Showing Enumerated USB-UART as COM13
10. To enable ‘Port Persist’ mode double click on the “USB Serial Port (COMx)” or
“Cypress Serial (COMx)” port under “Ports (COM LPT)”. Select the “Port Setting”
tab. Click the “Advanced” button.
8
Figure 1.4:
11. Check the “Enable Port Persist” check box in the Advanced Settings dialog box.
Click OK to close the Advanced Settings dialog box and again to close the Serial Port
Properties box. The Port Persist property should be enabled the next time the serial port
is opened.
9
Figure 1.5: USB Serial Port Advanced Settings Dialog Box
12. On your PC, open a serial terminal program. For this demo, Windows 7 was
used which does not come with a built in terminal application. Tera Term was used in
this example which can be downloaded from the Tera Term project on the SourceForge
Japan page: ttssh2.sourceforge.jp
13. Once Tera Term is installed, Tera Term can be accessed from the desktop or start
menu shortcuts.
Figure 1.6:
10
14. To configure baud rate settings, open the Serial Port Setup window from the
SetupSerial port menu selection. Select the USB-UART COM port enumeration that
matches the listing found in Device Manager. Also set the Baud rate option to 115200,
the Data width option to 8-bit, the Parity option to none, the Stop bit option to 1 bit, and
the flow control to none. Finally, assign the transmit delay parameters to 10 msec/char
and 100 msec/line, and then click OK.
Figure 1.7:
15. Optionally, at this point, the terminal settings can be saved for later use. To
do this, use the Setup - Save setup menu selection and overwrite the existing TER-
ATERM.INI file.
16. If the amber USB-Link Status (LD11) does not flicker to indicate activity, check
the driver installation to determine if the device driver is recognized and enumerated
successfully and that there are no errors reported by Windows.
11
1.4.2 ZedBoard System Block Diagram
A script for changing the state of the LEDs is also included. To set the state of the user
LEDs (LD0-LD7), use the script writel edandspecif ythebytevaluetobewrittentotheLEDs.F orexample, r
LD7illuminatingasseenin
12
Figure 1.9: ZedBoard Example LED Output
13
Chapter 2
IMPLEMENT A 4-BIT RIPPLE CARRY ADDER DESIGNED
ON Zed BOARD
2.1 AIM
2.2 THEORY
Ripple Carry Adder is a combinational logic circuit. It is used for the purpose of
adding two n- bit binary numbers. It requires n full adders in its circuit for adding two
n-bit binary numbers.
It is also known as n-bit parallel adder. Multiple full adder circuits can be cascaded in
parallel to add an N-bit number. For an N- bit parallel adder, there must be N number
of full adder circuits. 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 a ripple
carry adder, the sum and carry out bits of any half adder stage is not valid until the carry
in of that stage occurs.
FPGAs are semiconductor devices that are based around a matrix of configurable logic
blocks (CLBs) connected via programmable interconnects. FPGAs can be reprogrammed
14
to desired application or functionality requirements after manufacturing. This feature
distinguishes FPGAs from Application Specific Integrated Circuits (ASICs), which are
custom manufactured for specific design tasks. Although one-time programmable (OTP)
FPGAs are available, the dominant types are SRAM based which can be reprogrammed as
the design evolves. ASIC and FPGAs have different value propositions, and they must be
carefully evaluated before choosing any one over the other. Information abounds that com-
pares the two technologies. While FPGAs used to be selected for lower speed/complexity/volume
designs in the past, today’s FPGAs easily push the 500 MHz performance barrier. With
unprecedented logic density increases and a host of other features, such as embedded
processors, DSP blocks, clocking, and high-speed serial at ever lower price points, FPGAs
are a compelling proposition for almost any type of design. Due to their programmable
nature, FPGAs are an ideal fit for many different markets. As the industry leader, Xilinx
provides comprehensive solutions consisting of FPGA devices, advanced software, and
configurable, ready-to-use IP cores for markets.
ZedBoard™ is a low-cost development board for the Xilinx Zynq®-7000 All Pro- grammable
SoC. This board contains everything necessary to create a Linux, Android, Windows®
or other OS/RTOS-based design. Additionally, several expansion connectors expose the
processing system and programmable logic I/Os for easy user access. Take advantage
of the Zynq-7000 AP SoC’s tightly coupled ARM® processing system and 7 series pro-
grammable logic to create unique and powerful designs with ZedBoard. Zed- Board is
supported by the zedboard.org community website where users can collaborate with other
engineers also working on Zynq designs. The ZedBoard enables hardware and software
developers to create or evaluate Zynq™- 7000 All Programmable SoC designs. The ex-
pandability features of this evaluation and development platform make it ideal for rapid
prototyping and proof-of-concept devel- opment. The ZedBoard includes Xilinx XADC,
FMC (FPGA Mezzanine Card), and Digilent Pmod™ compatible expansion headers as well
as many common features used in system design. ZedBoard enables embedded computing
capability by using DDR3 mem- ory, Flash memory, gigabit Ethernet, general purpose
I/O, and UART technologies. This Getting Started Guide will outline the steps to setup
the ZedBoard hardware. It docu- ments the procedure to run a simple Linux design to
show a Linux application running on the ARM® dual-core Cortex™- A9 MPCore™ Pro-
cessing System (PS) and interacting with the tightly coupled 7 series 85K Programmable
15
Logic (PL) cells. Xilinx Embedded Development tools are also introduced where the de-
sign can be built from scratch and customization options can be discovered. If Xilinx ISE
WebPACK or Design Suite soft- ware is not already installed, further resources to install
the software, get updated and generate a license
2.3 PROCEDURE
4) Add the source code and test bench for 4 bit ripple carry adder.
6) Run simulation and obtain the simulation results for ripple carry adder
10) Go to the layout in top right corner and choose I/O planning and the design to
be implemented will be obtained.
11) Assign the ports by choosing I/O ports. Assign slide switch for input a and input
b and LED is assigned for the sum of adder.
12) Set VCCO as tvcmos33 and save. The constraint file(.xdc) will be created.
16
13) Now run synthesis and the synthesised design will be opened.
15) Connect the Zed board by connecting the USB port of board to the pc and also
plug in the power cable to the board.
16) Click Open hardware manager and then on open target →Autoconnect →Program
device.
17) Now the board will be programmed for the counter design and is ready to imple-
ment the logic.
input a;
input b;
output sum;
output carry;
endmodule
17
2.4.2 b) Full Adder
input A;
input B;
input Cin;
output Sum;
output Cout;
wire ha1-sum;
wire ha2-sum;
wire ha1-carry;
wire ha2-carry;
wire Sum;
wire Cout;
half-add ha1(
.a(A),
.b(B),
.sum(ha1-sum),
.carry(ha1-carry)
);
half-add ha2(
.a(Cin),
.b(ha1-sum),
.sum(ha2-sum),
18
.carry(ha2-carry)
);
//sum output from 2nd half adder is connected to full adder output
//The carry’s from both the half adders are OR’ed to get the final carry./
endmodule
input[3:0] A,B;
input Cin;
output[3:0] Sum;
output Cout;
wire[2:0] cp;
Full-add FA1(
.A(A[0]),
.B(B[0]),
.Cin(Cin),
.Sum(Sum[0]),
.Cout(cp[0])
19
);
Full-add FA2(
.A(A[1]),
.B(B[1]),
.Cin(cp[0]),
.Sum(Sum[1]),
.Cout(cp[1])
);
Full-add FA3(
.A(A[2]),
.B(B[2]),
.Cin(cp[1]),
.Sum(Sum[2]),
.Cout(cp[2])
);
Full-add FA4(
.A(A[3]),
.B(B[3]),
.Cin(cp[2]),
.Sum(Sum[3]),
.Cout(Cout)
);
endmodule
20
2.5 TEST BENCH
module rc-add-4bit-tb;
/inputs
reg [3:0] A;
reg [3:0] B;
reg Cin;
/ Outputs
rc-add-4bit uut(
.A(A),
.B(B),
.Cin(Cin),
.Cout(Cout),
.Sum(Sum)
);
initial begin
21
A = 4’b0010; B = 4’b0110; Cin=0; 20;
A = 4’b0110; B = 4’b0011; Cin=0; 20;
A = 4’b0100; B = 4’b0111; Cin=0; 20;
A = 4’b0010; B = 4’b0001; Cin=0; 20;
f inish;
end
endmodule
22
2.7 RTL SCHEMATIC
23
2.8 RTL SCHEMATIC AFTER SYNTHESIS
24
Figure 2.4: Constraint file for FPGA Implementation
2.10.1 a) Adder
25
Figure 2.5: Adder 3+2
2.11 RESULT
Performed the RTL design, simulation and implementation of Ripple Carry Adder on
FPGA using Xilinx Vivado
26
Chapter 3
DESIGN AND IMPLEMENT A CUSTOM ALU ON Zed
BOARD USING VERILOG HDL.
3.1 AIM
To design and implement a 4-bit custom ALU on Zed board using Verilog HDL.
000 = Addition
001 = Subtraction
010 = Multiplication
011 = Division
101 = Logical OR
27
3.2 THEORY
An arithmetic logic unit (ALU) is a combinational digital circuit that performs arith-
metic and bitwise operations on integer binary numbers. This is in contrast to a floating-
point unit (FPU), which operates on floating point numbers. It is a fundamental building
block of many types of computing circuits, including the central processing unit (CPU)
of computers, FPUs, and graphics processing units (GPUs). The inputs to an ALU are
the data to be operated on, called operands, and a code indicating the operation to be
performed; the ALU’s output is the result of the performed operation. In many designs,
the ALU also has status inputs or outputs, or both, which convey information about a
previous operation or the current operation, respectively, between the ALU and external
status registers.
3.3 PROCEDURE
6) Run simulation and obtain the simulation results for custom ALU
28
9) Perform RTL analysis once again and open elaborated design.
10) Go to the layout in top right corner and choose I/O planning and the design to
be implemented will be obtained.
11) Assign the ports by choosing I/O ports. Assign slide switch for inputs and push
buttons as mode and LED is assigned for the output.
12) Set VCCO as tvcmos33 and save. The constraint file(.xdc) will be created.
13) Now run synthesis and the synthesised design will be opened.
15) Connect the Zed board by connecting the USB port of board to the pc and also
plug in the power cable to the board.
16) Click Open hardware manager and then on open target →Autoconnect →Program
device.
17) Now the board will be programmed for the counter design and is ready to imple-
ment the logic.
module custom-alu(
29
);
always @(*)
begin
case(ALU-Sel)
3’b000: // Addition
-Result = A + B ;
3’b001: // Subtraction
ALU-Result = A
-B;
3’b010: // Multiplication
ALU-Result = A * B;
3’b011: // Division
ALU-Result = A/B;
3’b100: //
ALU-Result = A B ;
3’b101: // Subtraction
30
ALU-Result = A — B ;
3’b110:
ALU-Result = A B ;
3’b111:
ALU-Result = (A==B)?4’d1:4’d0 ;
default: ALU-Result = A + B ;
endcase
end
endmodule
3.5.1 * ALU
module alu-tb;
reg [3:0] A, B;
reg [2:0] mode;
wire [3:0] alu-out;
integer i;
31
alu-4bit uut(
.a(A),
.b(B),
.m(mode),
.alu-out(alu-out)
);
initial
begin
A = 4’h3;
B = 4’h2;
mode = 3’h0;
for (i=0;i¡=7;i=i+1)
begin
10;
mode = mode + 3’h1;
end;
10 f inish;
end
endmodule
32
3.6 SIMUATION RESULT
33
3.7 RTL SCHEMATIC
34
3.8 RTL SCHEMATIC AFTER SYNTHESIS
35
Figure 3.4:
3.10.1 a) Addition
36
3.10.2 b) Subtraction
37
3.10.3 c) Subtraction
38
Figure 3.7: Subtraction 2-11 =-9
3.10.4 d) Multiplication
39
3.10.5 e) AND Operation
3.10.6 f ) OR Operation
40
41
3.10.7 g) XOR Operation
42
Figure 3.11: XOR 3 2
3.10.8 h) Division
3.11 RESULT
Performed the RTL design, simulation and implementation of 4-bit custom ALU on
FPGA using Xilinx Vivado
43
Chapter 4
4 BIT BINARY SYNCHRONOUS UP DOWN COUNTER.
4.1 AIM
To perform the RTL design, simulation and implementation of 4 bit binary counter
on FPGA using Xilinx Vivado.
4.2 THEORY
Counters are used in many different applications. Some count up from zero and provide
a change in state of output upon reaching a predetermined value; others count down from
a preset value to zero to provide an output state change.However, some counters can
operate in both up and down count mode, depending on the state of an up/down count
mode input pin.
Synchronous Counters are so called because the clock input of all the individual flip-
flops within the counter are all clocked together at the same time by the same clock signal.
Unlike asynchronous counters whose output of one stage is connected directly to the clock
input of the next counter stage in the chain. The synchronous counter has its stages all
clocked together at the same time.
This 4-bit synchronous counter counts sequentially on every clock pulse the resulting
outputs count upwards from 0 ( 0000 ) to 15 ( 1111 ) when the mode bit is high and
counts down when the mode bit is counts downwards from 1111 to 0000.
A clock divider is a circuit that takes an input signal of a frequency fin and generates
an output signal of a frequency fout, where fout = fin / n and ”n” is an integer. In
zedboard ,the oscillator frequency is 100Mhz. Thus when implementing counter on to the
board the output will not be visible. So a clock divider circuit is used to scale down the
44
frequency to 1Hz. And thus the counter can be effectively implemented on to the board.
4.3 PROCEDURE
4) Add the source code and test bench for 4 bit synchronous counter.
5) Since the board operates at 100 MHz frequency to observe the output on the board
a clock divider circuit is added with the source code.
7) Run simulation and obtain the simulation results for upcounter and down counter.
10) Perform RTL analysis once again and open elaborated design.
11) Go to the layout in top right corner and choose I/O planning and the design to
be implemented will be obtained.
12) Assign the ports by choosing I/O ports. Assign slide switch for mod and reset
pin of counter and LED for displaying the up counting and down counting
45
13) Since the board operates at 100 MHz frequency the clock must be assigned to pin
Y9 (clock capable pin).
14) Set VCCO as tvcmos33 and save. The constraint file(.xdc) will be created.
15) Now run synthesis and the synthesised design will be opened.
17) Connect the Zed board by connecting the USB port of board to the pc and also
plug in the power cable to the board.
18) Click Open hardware manager and then on open target →Autoconnect →Program
device.
19) Now the board will be programmed for the counter design and is ready to imple-
ment the logic.
20) Now keeping the reset ’high’ and mod as ’1’ will perform upcounting and mod ’0’
performs downcounting. When reset is set to ’low’ the board resets.
4.4.1 a) COUNTER
46
wire clk-out;
reg [3:0] out;
Clock-divider uut(
.clock-in(clk),
.clock-out(clk-out)
);
begin
if(rst == 0)
out ¡= 0;
else if ( m == 1) // up counting
if (out == 15)
out ¡= 0;
else
out ¡= out + 1;
else //down counting
if (out == 0)
out ¡= 15;
else
out ¡= out - 1;
end
endmodule
47
module Clock-divider(clock-in,clock-out);
reg[27:0] counter=28’d0;
begin
counter ¡= counter + 28’d1;
if(counter¿=(DIVISOR-1))
counter ¡= 28’d0;
clock-out ¡= (counter¡DIVISOR/2)?1’b1:1’b0;
end
endmodule
4.5.1 a) COUNTER
48
module tb-syncounter;
//inputs
reg clk, rst, m;
//outputs
wire [3:0] out;
syncounter-4bit uut (
.clk(clk),
ṙst(rst),
.m(m),
.out(out)
);
initial clk = 0;
initial begin
rst = 0;
m = 0;
100;
rst = 1;
m = 0; //down counting
155;
rst = 1;
m = 1; // up counting
200;
rst = 0;
100;
49
end
endmodule
module Clock-divider(clock-in,clock-out);
output reg clock-out; // output clock after dividing the input clock by divisor
reg[27:0] counter=28’d0;
begin
counter ¡= counter + 28’d1;
if(counter¿=(DIVISOR-1))
counter ¡= 28’d0;
clock-out ¡= (counter¡DIVISOR/2)?1’b1:1’b0;
end
endmodule
50
4.6 SIMULATION RESULT
51
4.7 RTL SCHEMATIC
52
4.8 RTL SCHEMATIC AFTER SYNTHESIS
53
4.9 CONSTRAINT FILE FOR FPGA IMPLEMENTATION
54
4.10 FPGA IMPLEMENTATION
55
4.10.2 b) DOWNCOUNTING(1111,1110,..0000) :
56
4.11 RESULT
Performed the RTL design, simulation and implementation of 4 bit binary counter on
FPGA using Xilinx Vivado
57
Chapter 5
CONCLUSIONS
The Project proposes familiarization and Implementation of 4-Bit Ripple Carry Adder,
ALU, 4- Bit binary Counter on Zed Board. Tested using Xilinx Vivado and then performed
RTL, finally implemented on Zed Board.
58
Bibliography
[1] https://www.avnet.com/wps/portal/us/products/avnet-boards/avnet-board-
families/zedboard/
[2] https://www.xilinx.com/products/boards-and-kits/1-8dyf-11.html