Sunteți pe pagina 1din 25

Introduction to

Digital Hardware Design

Introduction to Basys 3 Artix-7 Board

1
An Introduction to FPGAs
 FPGA stands for Field Programmable Gate Array. It is an integrated circuit which
can be “field” programmed to work as per the intended design.
 It means it can work as a microprocessor, or as an encryption unit, or graphics
card, or even all these three at once.
 As implied by the name itself, the FPGA is field programmable. So, an FPGA
working as a microprocessor can be reprogrammed to function as the graphics card
in the field, as opposed to in the semiconductor foundries.
 The designs running on FPGAs are generally created using hardware description
languages such as VHDL and Verilog.
 FPGA is made up of thousands of Configurable Logic Blocks (CLBs) embedded in
an ocean of programmable interconnects. The CLBs are primarily made of Look-
Up Tables (LUTs), Multiplexers and Flip-Flops.
 They can implement complex logic functions. Apart from CLBs, and routing
interconnects, many FPGAs also contain dedicated hard-silicon blocks for various
functions such as Block RAM, DSP Blocks, External Memory Controllers, PLLs,
Multi-Gigabit Transceivers etc.

2
An Introduction to FPGAs
• Generic Field Programmable Gate Arrays
(FPGAs) architecture

Reconfigurable Reconfigurable
Logic Cell Input/Output Cell

Programmable
Switch Block

Specific blocks
(e.g. Memory, Programmable
Multipliers, Routing
Embedded switches
Processors )

3
An Introduction to FPGAs
• Generic Field Programmable Gate Arrays
(FPGAs) architecture
Programmable Switch Block

Programmable
routing
Switch
X
X X X
X X X X
X X

Programmable
Switch

 Most commercial FPGAs are based on SRAM technology (volatile).


Others include non-volatile Flash and one-time programmable fuse
technology.
4
Computing Platform Alternatives 1/2

General Purpose Processors (GPPs) Field Programmable Gate Arrays


e.g. Pentium (FPGAs)
Software reprogrammable and Field Customisable
general purpose Reprogrammable hardware

Application-specific processor (ASIPs), Fixed Application Specific


e.g. DSP Integrated Circuits (ASICs)
Software reprogrammable, optimised Non reprogrammable, fully
for a particular class of applications customised to only the
application in hand

5
Introduction to ASIC
 ASIC stands for Application Specific Integrated Circuit. As the name implies,
ASICs are application specific.
 They are designed for one sole purpose and they function the same their whole
operating life. For example, the CPU inside your phone is an ASIC. It is meant to
function as a CPU for its whole life.
 Its logic function cannot be changed to anything else because its digital circuitry is
made up of permanently connected gates and flip-flops in silicon.
 The logic function of ASIC is specified in a similar way as in the case of FPGAs,
using hardware description languages such as Verilog or VHDL.
 The difference in case of ASIC is that the resultant circuit is permanently drawn
into silicon whereas in FPGAs the circuit is made by connecting a number of
configurable blocks.
 For a comparison, think of creating a castle using Lego blocks versus creating a
castle using concrete. The former is analogous to FPGAs, whereas the latter is
analogous to ASICs. You can reuse Lego blocks to create a different design, but
the concrete castle is permanent.
6
Computing Platform Alternatives 2/2

Technology Performance Time to Time to Power


/ market change code Consumption
Cost functionality
Fixed ASIC Very High Very Long Impossible Low
Speed Performance

Flexibility
FPGA Medium- Long Long Low-Medium
High

ASIP Medium Medium Medium Medium-High

GPPs Low-Medium Very Very Short High


Short

7
Why FPGAs?
• Unlike ASIPs/GPPs, FPGAs are not constrained by the Von Neumann
architecture

Memory
Instructions executed
sequentially cycle by cycle in
a Von Neumann architecture
Control Unit Arithmetic Logic Unit
e.g. MAC

• FPGAs have ASIC-like performance and power consumption, with the additional
re-programmability feature
• FPGAs have a shorter development cycle, lower Non-Recurring Engineering
costs compared to ASICs
• FPGAs are nowadays widely used in Telecommunications, networking,
automotive, industrial and consumer electronics
• They are also widely used for prototyping ASIC designs before fabrication
8
FPGA Programming Tools
• FPGA are programmed through a bit-file which describes
the configuration of all switches in the fabric
• FPGA Programming tools have improved greatly since
FPGAs’ early days in the mid 1980’s:
– Schematic design: mid-80’s – 90’s
– Hardware Description Languages (HDLs): 90’s - Present
– Structured (Geometric) hardware design environments: 90’s -
present
– Graphical design environments: 90’s - present
– Object-Oriented hardware design languages: 90’s - present
– Hardware design languages from High Level Languages (HLLs):
90’s – present
9
FPGA Programming Tools
1 - Schematic Design
Design entry
 Since the early days of the
Schematic capture
technology Library of
symbols
 Intuitive way of designing Data FDC
Dout
circuits EN
CLK

 Technology dependent
Schematic to Netlist
 Not programmatic though – converter

Gate level netlist


Not easy to scale up and e.g. EDIF, XNF, …
parameterise
Place-and-route
 Not easy to port to other FPGA Configuration
tools/environments

10
FPGA Programming Tools
2- Hardware Description Languages (HDLs)
Design entry
 Became more popular since Hardware Description Languages (HDLs) e.g.
Verilog
mid-1990’s module Multiplexor_2_to_1(
input In0,
input In1,

 Programmatic approach – easy input Select,


output reg Out
);

to scale up and parameterise always@(In0 or In1 or Select)

endmodule
…..

 Easy to port to other


tools/environments HDL Synthesis

 Industry standard HDLs: VHDL, Gate level netlist


e.g. EDIF, XNF, …
Verilog
Place-and-route
 Can describe circuits at
FPGA Configuration
different levels of abstractions

11
FPGA Programming Tools
2- Hardware Description Languages (HDLs)
 Behavioural Description module Multiplexor_4_to_1(
input In0,
 Describes how the circuit input In1,
input In2,
behaves input In3,
input [1:0] Select,
 Borrows high level output reg Out
);
language constructs always@(In0 or In1 or In2 or In3 or Select)
(procedure calls, control case (Select)
2’b00 : Out = In0;
structures etc.) 2’b01 : Out = In1;
2’b10 : Out = In2;
 Can include time delays 2’b11 : Out = In3;
endcase
 Saves design time at the endmodule
expense of some loss of
Select[1] Select[0]
implementation efficiency In0 0 Out
In1 1 Multiplexer_4_to_1
In2 2
In3 3 12
FPGA Programming Tools
2- Hardware Description Languages (HDLs)
 Structural Description
module Multiplexer_4_to_1(
In0 In2 In1 In3 input In0,
input In1,
 Component-based 0 1 0 1
input In2,
input In3,

Multiplexer_2_to_1
Multiplexer_2_to_1
design input [1:0] Select,

Mux_1

Mux_2
Select[1] output reg Out
);
 Could be used as the wire temp1, temp2;
Multiplexer_2_to_1 mux_1(
text equivalent of .In0(In0),
.In1(In2),
schematic entry 0 1
.Select(Select[1]),
.Out(temp1)

Multiplexer_2_to_1
);
 Can result in highly
Mux_3
Select[0]
Multiplexer_2_to_1 mux_2(
.In0(In1),
efficient .In1(In3),
.Select(Select[1]),
implementations );
.Out(temp2)

Multiplexer_2_to_1 mux_3(
.In0(temp1),
Out
.In1(temp2),
.Select(Select[0]),
.Out(Out)
);
endmodule1 13
FPGA Programming Tools
• Most hardware designs include a mixture of the above
abstraction levels
• We also distinguish between synthesisable HDL code and
non-synthesisable HDL code
– Synthesisable HDL is HDL code that can be compiled and mapped
on to hardware
– Non-synthesisable HDL is HDL code which cannot be compiled and
mapped into hardware. It is often used for simulation purposes
• Most HDL languages (e.g. Verilog, VHDL) have a
synthesisable subset and a non- synthesisable one

14
Software/Hardware Used in The Lab
• In this course, you will learn to use a standard Hardware
Description Language called Verilog for FPGA hardware
programming
• You will target real FPGA hardware in the form of a
BASYS3 FPGA card from DIGILENT, Inc, which has a
Spartan 3E FPGA chip from Xilinx, Inc.

15
Basys 3: Our FPGA Board
microUSB Video out (VGA)
(power/programming) USB

Power switch

FPGA chip

Push-buttons
Seven-segment
displays

LEDs

Switches

https://reference.digilentinc.com/reference/programmable-logic/basys-3/start
16
17
18
Experiment -1 seven segment
display

19
20
21
Experiment 2 – stepper motor
interfacing
• Stepper motor
• The basic principle of stepper motor or any other motor is electromagnetic
induction which means while apply a current to the circuit, the EMF will be
induced due to change of magnetic field of the circuit.
• Working of stepper motor
• The rotor shaft of the stepper motor is surrounded by the electromagnetic
stator. The rotor and stator have poles which would be teethed or depends
upon the motor type. When apply the electrical pulse to the stator which
gets energized and produced EMF. The EMF cuts the conductor of the
rotor. Now the torque will be introduced. This torque (force) is used to
rotate the rotor shaft which means the rotor align itself along with stator.
• Type of stepper motor
• Variable reluctance stepper motor
• Permanent magnet stepper motor
• Hybrid stepper motor
22
Permanent magnet stepper motor
The stator and rotor do not have any teethed poles. Instead of this which have alternative
north and south poles and it is parallel to the axis of motor. When a stator is energized
which develops the magnetic field and the rotor align itself along the magnetic field of
the stator. As if while the other magnetic field will introduce, the rotor align itself to new
field.

Fig 1: Permanent magnet stepper motor

23
Variable reluctance motor
It has toothed poles. When apply pulse to the stator the coil is energized and the rotor moves to have
maximum gap with stator.

Fig 2: Variable Reluctance motor

24
Hybrid stepper motor
• As it name implies which has the advantage of both Permanent magnet
and Variable reluctance motor to improve the efficiency. It provides high
torque and runs very high step rate. The application of hybrid motor is CD
player and disk drive in computer, robotics.
• Step mode
• A full rotation of stepper is divided into number of steps which would be
around 200 steps. The stepper receives only one pulse at the time for one
step. Normally the rotating angle of stepper motor typically is 1.8 degrees.
• The stepper motor operates at various modes such as full step, half step.
• Full step
• The full step of stepper motor is 200 steps per revolution. So the angle of
rotation is 1.8 degrees which is calculating from given formula.
• Step angle = 360 degrees / no of steps.
• Step angle = 360 / 200 = 1.8 degrees.
• Half step
• The half step of stepper motor is 400 steps per revolution. So the angle of
rotation is 0.9 degrees which is calculating from given formula.
• Step angle = 360 degrees / no of steps.
25

S-ar putea să vă placă și