Vous êtes sur la page 1sur 44

Du Software au Hardware

Introduction aux composants


programmables FPGA

Grgory ESTRADE

http://torlus.com/

Introduction aux FPGA - Plan


Electronique numrique
Logique programmable
Conception hardware sur FPGA

Langages et outils
Bases
Exemples simples
Projets avancs

En pratique

Introduction aux FPGA Electronique numrique


Bases
Portes logiques
Latches, Flip-flops
Horloge, Bus...

Srie 7400 et 4000

Premiers circuits intgrs dploys dans les 70s


Familles TTL et CMOS
Accessible aux hobbyistes
Applications : glue logic , systmes complets
( http://www.homebrewcpu.com/ )

Source : Wikipedia

Introduction aux FPGA Electronique numrique


Circuits avancs
ROM, RAM
CPU, DSP (audio, vido, tlcoms ), MCU
(Microcontrleurs)
Contrleurs USB, Ethernet
ASIC
DAC, ADC, capteurs, servo-moteurs

Logique programmable
PAL, GAL
CPLD, FPGA

Logique programmable

Synthse combinatoire
Circuits squentiels
Composants

Synthse combinatoire

S = Ci./A./B + /Ci.A./B + /Ci./A.B + Ci.A.B


Co = Ci.A./B + Ci./A.B + /Ci.A.B + Ci.A.B

PAL = Programmable Array Logic

Source : Wikipedia

Introduction aux FPGA Logique programmable

Synthse combinatoire
Gate Array (PAL, PLA, GAL)
ROM
Microcontrleur ( http://www.schells.com/intellicart.shtml )

Circuits squentiels
Horloge, bascules
Finite State Machine

Rfrence : Du Binaire au Processeur - Emmanuel Mesnard

Introduction aux FPGA Logique programmable

Composants : CPLD
Apparition dans les 80s.
Capacit : 10000 portes (500 macrocells).
Configuration stocke on-chip .
Langages de haut niveau (HDLs).

Introduction aux FPGA Logique programmable

Composants : FPGA
Extension des CPLD, architecture plus flexible
Capacit : millions de portes
Configuration stocke sur EEPROM externe
lments ddis : RAM, multiplicateurs, CPU
cores...

Source : http://www.chrec.ufl.edu/

Introduction aux FPGA Logique programmable

Composants : FPGA (suite)


Remplacement des ASICs, DSP...
Constructeurs : Xilinx, Altera, Lattice, Actel...
Dveloppement combin software/hardware
Runtime reconfiguration

Conception hardware sur FPGA

Langages et outils
Bases du langage VHDL
Exemple simple
Projets avancs

Introduction aux FPGA Conception


Outils (Xilinx)
Spartan-3 Starter Board
ISE WebPack
ModelSim
Source : Diligent

Introduction aux FPGA Conception


Etapes

Edition des sources


Edition du fichier UCF : User Constraints File
Rpartition des signaux de lentit principale sur des pins
Contraintes de timing
IO Standards (LVTTL, LVCMOS33, LVCMOS25)
Synthse et gnration du fichier programme
Gnration de limage EEPROM
Flashage de lEEPROM

Introduction aux FPGA Conception


Langages
VHDL
Origine : DoD amricain
Syntaxe ADA
Meilleure abstraction

Verilog
Origine : industrie
Syntaxe proche du C
Plus simple dapprentissage, plus concret

Saisie de schmas

Introduction aux FPGA Conception


Langages (suite)
Software Programming Language
Compilation en langage machine
Excution squentielle

Hardware Description Language


Synthse en portes et cbles
Excution concurrente
Excution squentielle en simulation (Test benchs)

Introduction aux FPGA Conception


Langages (suite)
Piges

Excution concurrente
Optimisations
Synthse (guidage, asynchronisme)
Problmes hardware (Routage, clock skew, SSO)

Remdes
Simulation
Rapports de synthse
Visualisation loscilloscope, analyseur logique

VHDL - Porte ET 2 entres


-- imports
library IEEE;
use IEEE.std_logic_1164.all;
-- entit
entity porte_et is
port( a,b : in std_logic; s : out std_logic );
end porte_et;
-- architecture
architecture rtl of porte_et is
begin
s <= a and b;
end rtl;

VHDL - Utilisation de la porte ET 2 entres


library IEEE;
use IEEE.std_logic_1164.all;
entity mon_systeme is

end mon_systeme;
architecture arch of mon_systeme is
-- dclaration de porte_et pour utilisation
component porte_et is
port( a,b : in std_logic; s : out std_logic );
end component;
-- dclaration de registres 8 bits
signal op1 : std_logic_vector(7 downto 0);
signal op2 : std_logic_vector(7 downto 0);
signal res : std_logic_vector(7 downto 0);
begin
-- instanciation de 8 portes_et
et8 : for i in op1range generate
et8_0 : porte_et port map
(a => op1(i),
b => op2(i),
s => res(i));
end generate et8;
end arch;

Autres exemples : reprsentation dun MUX


-- template 1:
X <= A when S = '1' else B;
-- template 2:
with S select X <= A when '1' else B;
-- template 3:
process(A,B,S)
begin
case S is
when '1' => X <= A;
when others => X <= B;
end case;
end process;
-- template 4:
process(A,B,S)
begin
if S = '1' then
X <= A;
else
X <= B;
end if;
end process;
Source : Wikipedia

Autres exemples (suite)


-- logique 3 tats et dont care :
B <= A when CE = 0,
Z when OE = 1
else X;
-- horloge et reset asynchrone
process(clk, reset)
if (reset = 0) then

elsif clkevent and clk = 1 then

end if;
begin
end process;
-- simulation : gnration dune horloge
process
begin
clk <= 0;
wait for 20ns;
clk <= 1;
wait for 20ns;
end process;

Introduction aux FPGA Conception


Exemple : Communication RS-232

Utilisation dun convertisseur (MAX232)

Introduction aux FPGA Conception


Exemple : Communication RS-232
Caractristiques
Fonctionnement 16Mhz
Communication 9600 bps, format 8N1

Exemple dinterface

Caractres lire et crire


Signal de demande dcriture
Signal busy en criture
Signal de demande de lecture
Signal avail en lecture
Reset

Exemple : Communication RS-232


entity UART is
port(
clk : in std_logic;
reset : in std_logic;
tx : out std_logic;
rx : in std_logic;
rd : in std_logic;
rd_data : out std_logic_vector(7 downto 0);
avail : out std_logic;
wr : in std_logic;
wr_data : in std_logic_vector(7 downto 0);
busy : out std_logic
);
end UART;

Introduction aux FPGA Conception


Exemple : Communication RS-232
Fonctionnement
Surchantillonage x16 (utile en rception uniquement)
Compteur serclk_cnt (adapt au baudrate)
16 000 000 / 9600 / 16 = 103

Compteurs rx_cnt et tx_cnt sur 8 bits


4 bits de poids faible : surchantillonage
4 bits de poids fort : compteur des bits transmettre/recevoir
Bit de start
Bits de donnes
Bit de stop

Architecture de lUART Vue densemble


architecture rtl of UART is
-- signaux de contrle (non dtaills)
signal serclk_cnt : std_logic_vector(6 downto 0);
signal tx_data : std_logic_vector(7 downto 0);
signal tx_cnt : std_logic_vector(7 downto 0);
signal rx_data : std_logic_vector(7 downto 0);
signal rx_cnt : std_logic_vector(7 downto 0);
begin
process(clk, reset)
begin
if reset = 0 then
-- rinitalisation (non dtaille)
elsif rising_edge(clk) then
-- gestion des signaux de contrle (non dtaille)
serclk_cnt <= serclk_cnt + 1;
if serclk_cnt = 103 then
serclk_cnt <= (others => '0');
-- unit de rception
-- unit dmission
end if;
end if;
end process;
end rtl;

Architecture de lUART Emission


-- un ordre dcriture positionne tx_cnt 00010000 et
busy 1
if tx_cnt(7 downto 4) = "0000" then
tx <= '1';
elsif tx_cnt(7 downto 4) = "0001" then -- start bit
tx <= '0';
tx_cnt <= tx_cnt + 1;
elsif tx_cnt(7 downto 4) < "1010" then -- data bits
tx <= tx_data(0);
if tx_cnt(3 downto 0) = "1111" then
tx_data <= "0" & tx_data(7 downto 1);
end if;
tx_cnt <= tx_cnt + 1;
elsif tx_cnt(7 downto 4) = "1010" then -- stop bit
tx <= '1';
tx_cnt <= tx_cnt + 1;
else
busy <= 0;
tx_cnt <= "00000000";
end if;

Architecture de lUART Rception


if rx_cnt(7 downto 4) = "0000" then
if rx = '0' then -- start bit
rx_cnt <= rx_cnt + 1;
if rx_cnt(3 downto 0) = "1000" then
rx_cnt <= "00010000";
end if;
else
rx_cnt <= "00000000";
end if;
elsif rx_cnt(7 downto 4) < "1001" then -- data bits
rx_cnt <= rx_cnt + 1;
if rx_cnt(3 downto 0) = "1111" then
rx_data <= rx & rx_data(7 downto 1);
end if;
else
rx_cnt <= "00000000";
end if;

Introduction aux FPGA Conception


Projets avancs
http://www.opencores.org/
CPU Cores : T65, T80, 6809, 8051
Contrleurs Ethernet, USB, LCD, SPI, IC

Emulation de machines anciennes


http://zxgate.sourceforge.net/ (ZX81, ZX Spectrum, Jupiter ACE,
TRS80)
http://www.fpgaarcade.com/ (Hardware arcade, VIC-20)
Minimig (Amiga 500 sur base 68k + FPGA)
http://www.experiment-s.de/ (Atari STE)

Introduction aux FPGA Conception


Projets avancs (suite)
http://c64upgra.de/c-one/ (Commodore ONE)
http://www.bazix.nl/onechipmsx.html (MSX)

Divers
http://jeanfrancoisdelnero.free.fr/floppy_drive_emulator/index.htm
l
Emulation de lecteur de disquette avec interface USB
Custom CPUs
http://www.tripoint.org/kevtris/ (le site de Kevin Horton : NES,
Intellivision, SID)
http://torlus.com/ (Blog ddi au dveloppement)

En pratique
Outils et composants
Interfaage avec dautres systmes
Ralisation de PCB

Introduction aux FPGA En pratique


Equipement
Pour commencer

Breadboard, cartes pastilles, fil.


Composants passifs : rsistances, condensateurs.
Fer souder <18W, soudure 0.5mm.
Tresse ou pompe dessouder.
Multimtre

Pour aller plus loin


Oscilloscope (analogique, numrique, USB)
Analyseur logique

Introduction aux FPGA En pratique


Interfaage - Problmatiques
Evolution des standards
5V TTL / CMOS
3.3V CMOS (2.5V, 1.8V, 1.2V)

Evolution des composants


Packages thru-hole
Packages SMT (CMS, Composants Monts en Surface)

Introduction aux FPGA En pratique


Interfaage - Circuits intgrs : Packages
Packages Thru-hole
DIP : 2,54mm
PLCC, PGA : 2,54mm 1,27mm

Packages SMT (CMS)


SOIC : 1,27mm
*QFP, *SOP : 0,8mm 0,5mm
*BGA

Introduction aux FPGA En pratique


Interfaage - Solutions
Conversion 5V / 3.3V : circuits dadaptation
Utilisation des CMS
Adaptateurs
Utilisation de PCB
Fabriqus par un tiers (ex : http://www.pcbfabexpress.com/ )
Fabriqus soi-mme

Introduction aux FPGA En pratique

Ralisation de PCB Processus


Utilisation de plaques photosensibles
Conception du circuit EAGLE, Proteus, OrCAD
Edition dun typon Impression laser sur transparent
Insolation Kit insoleuse nons UV
Rvlation Bac et rvlateur en poudre
Gravure Kit graveuse verticale (bac, chauffage et bulleur) et perchlorure
de fer

Etamage Solution dtamage froid

Graveuse et Insoleuse KF photo Selectronic

Introduction aux FPGA En pratique


Ralisation de PCB Matriel additionnel
Meuleuse et support (Dremel 300 et Dremel Workstation 220)
Soudure
Fer 11W avec panne CMS
Station de soudage thermo-rgule
Flux de soudure (flux pen Kester solder)
Loupe

Divers
Plaques de cuivre simples
Feutres pour CI
Gomme abrasive

Du Software au Hardware Pour


conclure
Ouvre de nouvelles perspectives
Investissement non ngligeable
Initial
Rcurrent

Demande du temps
Demande mthode et patience

Du Software au Hardware Bibliographie


Du binaire au processeur - Emmanuel Mesnard (Thorique)
Design your own video game console eBook Andr LaMothe
http://www.xgamestation.com/
Understanding the Apple II - Jim Sather
Trac des circuits imprims - Philippe Dunand

Merci pour votre


attention
Grgory ESTRADE

http://torlus.com/

Vous aimerez peut-être aussi