CIRCUITI LOGICI •Circuiti combinatori •Circuiti sequenziali •PLD
Transcript
CIRCUITI LOGICI •Circuiti combinatori •Circuiti sequenziali •PLD
ELETTRONICA DIGITALE CIRCUITI LOGICI •Circuiti combinatori •Circuiti sequenziali •PLD •CPLD •FPGA Logica booleana q Teoremi fondamentali: ØA + A * B = A; A * (A + B) = A ØXY + X’Z + YZ = XY + X’Z ØDeMorgan: (x + y)’ = x’y’; (xy)’ = x’ + y’ ØDeMorgan generalizzato: [ f (x1, x2, …, xn, 0, 1, +, * ) ]’ = f (x1’, x2’, …, xn’, 1, 0, *, + ) q Minimizzazione logica: mappe di Karnaugh – Minimizzare F = A’B + A’C + A’D + ACD – F = A’B (C’D’ + C’D + CD’ + CD) + A’C (B’D’ + B’D + BD’ + BD) + A’D (B’C’ + B’C + BC’ + BC) + ACD (B’ + B) = A’BC’D’ + A’BC’D + A’BCD’ + A’BCD + … --> forma canonica sum-of-products (SOP) 2 Mappe di Karnaugh – Coprire la mappa e risolvere – Il risultato dovrebbe essere F = CD + A’B + A’C + A’D (1) (2) (3) (4) CD (4) (1) AB 00 00 01 1 01 11 10 1 1 1 1 1 1 11 1 10 1 (3) (2) Implement using 2-input NAND gates only. C D C D A' B A' B A' C A' D F Implement using NAND gates only A' C F A' D 3 Realizzazione mediante gate • Insiemi di gate funzionalmente completi – { OR, AND, NOT} – { OR, NOT} – { AND, NOT } – NAND e NOR sono gate universali A + BC + DE'F A A B C B C D E' F D E' F A B C D E' F 4 Progetto di logica combinatoria • • • • Implementazione mediante gate: – AND-OR, NAND-NAND, OR-AND, NOR-NOR, … Altri Gates SSI – XOR, XNOR, buffer, tri-state buffer, wired-AND Dispositivi MSI – MUX, DEMUX, Decoder, Encoder, Priority Encoder, – Adder, Buffer, Comparator, – Parity Generator, Parity Checker, … Implementazione mediante MUX: I1 I1 Out Out I0 I0 sel sel Implementazione AND-OR Implementazione Three-state 5 Progetto di logica combinatoria (2) • Qualunque funzione di k variabili puo` essere implementata con MUX a 2k vie 2 - 1 MUX 0 I1 1 I0 Out 2 - 1 MUX f = x' : x I1 x' I0 sel Out f = x'y' + xy: sel x y • Qualunque funzione di k variabili puo` essere implementata con un decoder da k a 2k e porte NAND 2 - 4 Decoder x I1 y I0 O3 O2 O1 O0 f = x'y' + xy: 6 Gate CMOS Val In questo modo si realizza la funzione logica NOR IN1 IN2 INn OUT ... Il circuito SW-SW e’ generalizzabile con una rete di interruttori in parallelo verso Gnd ed una rete di interruttori in serie verso Val collegati agli ingressi IN1, IN2, INn IN1 IN2 INn Gnd ... OUT = IN1 + IN2 .. + ... INn I CALCOLI DELLA POTENZA DISSIPATA E DEL RITARDO SONO GLI STESSI DEL’INVERTER 7 Gate CMOS (2) Val Se la rete superiore ha gli SW in parallelo e la rete inferiore ha gli SW in serie à si realizza la funzione logica NAND IN1 IN2 INn ... OUT IN1 IN2 INn Gnd ... OUT = IN1 IN2 .. ... INn I CALCOLI DELLA POTENZA DISSIPATA E DEL RITARDO SONO GLI STESSI DEL’INVERTER 8 Gate CMOS: esempio Val à Realizzare la funzione logica A B C OUT = C + ( A B ) A B C SUGGERIMENTO: USARE LE LEGGI DI DE MORGAN!! B A C A B OUT Gnd Calcolare Tf e Tr nelle diverse configurazioni degli ingressi C (Tutte le resistenze degli switch sono uguali a RSWU e RSWd ) 9 Circuiti sequenziali Struttura generale di un circuito sequenziale •Tipi di circuiti sequenziali: –Sequenziali asincroni: lo stato puo` cambiare in ogni istante –Sequenziali sincroni: lo stato puo` cambiare solo in modo sincrono con il clock 10 Latch S-R 11 Latch e flip-flop tipo D 12 Tempistica del flip-flop DATO UN FLIP FLOP DI TIPO D SI DICE CHE “SUL FRONTE DI SALITA DEL CLOCK SI CAMPIONA L’INGRESSO D CHE VIENE MEMORIZZATO IN USCITA” ..... MA COSA SUCCEDE SE D CAMBIA PROPRIO SUL FRONTE DEL CLOCK? CK D Q Qn METASTABILITA` L’USCITA NON VARIA COME PREVISTO; PUO’ OSCILLARE ANCHE PER LUNGO TEMPO! 13 Tempi di set-up e hold IL CAMPIONAMENTO DEL DATO D E’ COME FARE UNA FOTO; SE IL SOGGETTO SI MUOVE MENTRE SI SCATTA LA FOTO RIMANE MOSSA... COME PER LE FOTO E’ NECESSARIO CHE D NON CAMBI DURANTE IL FRONTE DEL CLOCK: Tsu = TEMPO (DI SET-UP ) PRIMA DEL FRONTE IN CUI D NON DEVE VARIARE Th = TEMPO (DI HOLD) DOPO IL FRONTE IN CUI D NON DEVE VARIARE CK Tsu Th D 14 Rimedi alla metastabilita` • • La metastabilita` non puo` essere eliminata completamente Si puo` pero` ridurre la probabilita` di insorgenza del fenomeno – Soluzioni per ingressi asincroni 1. Avere dati di ingresso con transizioni rapide 2. Passare I dati in parecchi flip-flop prima di usarli 15 Macchine a stati finiti 1. Macchina di Mealy: » Le uscite dipendono dagli ingressi attuali e dallo stato presente 2. Macchina di Moore: » Le uscite dipendono solo dallo stato presente • Passi di progetto per una FSM 1. Disegnare il diagramma degli stati 2. Assegnare gli stati 3. Ottenere la tabella delle transizioni degli stati 4. Ricavare le equazioni logiche 5. Disegnare il circuito logico ESEMPIO: contatore sincrono binario a 3 bit 16 Esempio Diagramma degli stati: Assegnazione degli stati e tabella delle transizioni 17 Esempio (2) Equazioni per lo stato futuro: Circuito logico: 18 Circuiti sequenziali MSI • n-bit Register • Shift Register • Contatore ripple carry 19 Introduzione alle PLD DALL’INIZIO DEGLI ANNI 80 SONO STATI PRODOTTI CIRCUITI INTEGRATI “PROGRAMMABILI” (PROGRAMMABLE LOGIC DEVICES - PLD -) , IN CUI L’UTENTE “PROGRAMMA” LE FUNZIONI LOGICHE DENTRO IL CHIP (HARDWARE PROGRAMMATO VIA SOFTWARE!) NEL CHIP ESISTONO ARRAY DI GATE (COMBINATORI E FF) CON LE INTERCONNESSIONI PROGRAMMABILI (IN MODO PERMANENTE O TEMPORANEO). LE FUNZIONI LOGICHE SI BASANO SUL CONCETTO DEL WIRED-OR PER CUI L’OPERAZIONE LOGICA AVVIENE TRA TUTTI GLI INGRESSI CONNESSI • Tipi di Programmable Logic Devices (PLDs) – Programmable Logic Array (PLA) – Programmable AND-Array Logic (PAL) – PROM e EPROM – Generic Array Logic (GAL) – Complex PLD (CPLD) – Field Programmable Gate Array (FPGA) 20 Struttura logica di una PLA Programmable Connections Product Terms Programmable Connections Sum of Products Expressions Problema: troppe connessioni programmabili 21 ESEMPIO DI PROGRAMMAZIONE CHE FUNZIONI REALIZZANO LE USCITE DELLA PLD? I1 I2 I3 O1 = I2 I3 + I3 I4 I4 O1 O2 O3 O4 ; O2 = I1 I4 + I1 I2 ; O3 = I1 I2 ; O4 = I2 I3 + I1 I4 22 Programmazione delle connessioni 23 Struttura di una PAL combinatoria Sum of Products (SoP) A B C Piano AND programmabile Piano OR fisso (nr. Ingressi variabile) f1 = A • B • C + A • B • C f2 = A • B + A • B • C AND plane 24 PAL18L4 25 PAL18L4: esempio • Esempio: Z0 = A’BC + C’D – Z0’ = (A + B’ + C’) (C + D’) = AC + B’C + AD’ + B’D’ + C’D’ 26 PAL registrate Possono implementare strutture combinatorie e sequenziali A B Select C Enable f1 Flip-flop MUX D Q Clock To AND plane 27 PAL16R8 Configurata come contatore a tre bit, in codice di Gray Le GAL sono versioni riprogrammabili delle PAL registrate Example: GAL16V8R –GAL configured as a “PAL16R8 type” device –8 of the 16 inputs come from the D flip-flop outputs 28 Esempio: 22V10 29 Uso di PROM e EPROM • Struttura logica di una PROM minterms canonical SOPs 30 Uso di PROM e EPROM (2) • Esempio: Uso di una PROM 256 x 4 , – Implementare f1 = w’xy’+x’yz’ + xz e f2 = a’b’y + abx’y’ + a’bx’y’ 31 CPLD PLD block PLD block I/O block I/O block Interconnection wires PLD block PLD block I/O block •Piu` product terms; •Piu` risorse di routing; •Piu` macro celle; •Piu` connettivita` fra macro celle (possibilita` di implementare funzioni piu` complesse). I/O block Concetto generale: molte PLD in un unico IC 32 Esempio di CPLD: Xilinx XC9500 3 JTAG Controller JTAG Port In-System Programming Controller Function Block 1 I/O I/O I/O I/O Blocks I/O Global Clocks Global Set/Reset Function Block 2 FastCONNECT Switch Matrix Function Block 3 3 1 Function Block 4 Global Tri-States • • • • • 5 volt in-system programmable (ISP) CPLDs 5 ns pin-to-pin 36 to 288 macrocells (6400 gates) 10,000 program/erase cycles Complete IEEE 1149.1 JTAG capability 2 or 4 33 Caratteristiche dell’architettura XC9500 • Uniform, all pins fast, PAL-like architecture • FastCONNECT switch matrix provides 100% routing with 100% utilization • Flexible function block – 36 inputs with 18 outputs – Expandable to 90 product terms per macrocell – Product term and global three-state enables – Product term and global clocks – Product term and global set/reset signals • 3.3V/5V I/O operation • Complete IEEE 1149.1 JTAG interface 34 XC9500: blocco funzionale Global Clocks AND Array 3 Global Tri-State 2 or 4 Macrocell 1 I/O Macrocell 18 I/O ProductTerm Allocator 36 From FastCONNECT To FastCONNECT Ogni blocco funzionale e` come una 36V18 ! 35 Esempio: Altera Max 7000 36 Esempio: Altera Max 7000 (2) 37 FIELD PROGRAMMABLE GATE ARRAY (FPGA) DALLE PRIME PLD AD OGGI L’INTEGRAZIONE HA PERMESSO DI REALIZZARE CIRCUITI LOGICI PROGRAMMABILI MOLTO COMPLESSI. SI CHIAMANO FIELD-PROGRAMMABLE-GATE-ARRAY (FPGA) E STANNO RIMPIAZZANDO I CIRCUITI REALIZZATI CON LE FAMIGLIE LOGICHE TRADIZIONALI IN NUMEROSE APPLICAZIONI. CELLE LOGICHE PROGRAMMABILI INTERCONNESSIONI PROGRAMMABILI CELLE DI I/O PROGRAMMABILI 38 FAMIGLIE LOGICHE AVANZATE FPGA AD OGGI SONO DISPONIBILI SUL MERCATO FPGA CON DIVERSI MILIONI DI GATE PROGRAMMABILI E CON DIVERSE CENTINAIA DI KBIT DI MEMORIA. LAVORANO A CENTINAIA DI MHz CON PIU’ DI 500 PIN DI I/O DEVICE SYSTEM GATES LOGIC GATES DIFF I/O PAIRS USER I/O BLOCK RAM Bits DISTRIB. RAM Bits XCV200E 214.640 63.504 119 284 114.688 75.264 XCV600E 985.882 186.624 247 512 294.912 221.184 XCV2000E 2.541.952 518.400 344 804 655.360 614.400 XCV3200E 4.074.387 876.096 344 804 851.968 1.038.336 39 FPGA: struttura generale Blocco logico base Logic block Interconnection switches I/O block Select I/O block I/O block Out Flip -flop In1 In2 In3 In4 D Q LUT C lock La Look-up-table puo` essere usata: I/O block 1. Funzione booleana di 4 ingressi 2. Memoria 16x1 40 Esempio: funzione di 4 variabili A B Out C D A Out B C D A B C D Out 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 41 Interconnessioni programmabili LB LB Switch Matrix LB LB Switch Matrix LB LB 42 Funzionamento delle switch matrix Prima della programmazione Dopo la programmazione 43 Differenze CPLD - FPGA CPLD Complex Programmable Logic Device FPGA Field-Programmable Gate Array Architecture PAL/22V10-like More Combinational Gate array-like More Registers + RAM Density Low-to-medium 0.5-10K logic gates Medium-to-high 1K to 1M system gates Performance Predictable timing Up to 250 MHz today Application dependent Up to 150MHz today Interconnect “Crossbar Switch” Incremental 44 FPGA a grana fine e grossa Grana grossa (tecnologia SRAM) – per es. Altera, Xilinx • • • • Blocchi logici grandi e complessi Funzioni dedicate (per es. RAM o catene di propagazione del carry) Riprogrammabili Ritardi di propagazione non predicibili Grana fine (tecnologia Antifuse) – per es. Actel • • • • Blocchi logici piccoli Ritardi di propagazione predicibili Velocita` superiori One time programmable (OTP) 45 FPGA - Xilinx 4000 Series – struttura I/O blocks Switch Matrix CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB CLB Single length Long lines 46 FPGA - Xilinx 4000 Series - CLB 47 FPGA - Xilinx 4000 Series – CLB Two 4-input function generators (F and G) offer unrestricted versatility (most combinatorial logic functions need four or fewer inputs). A third function generator, labeled H’, can implement any Boolean function of its three inputs. The CLB storage elements can be configured as latches or flip-flops, positive or negative edge triggered. An asynchronous storage element input (SR) can be configured as either set or reset. This configuration option determines the state in which each flip-flop becomes operational after configuration. Multiplexers in the CLB map the four control inputs (C1 - C4) into the four internal control signals (H1, DIN/H2, SR/H0, and EC). Any of these inputs can drive any of the four internal control signals. Optional modes for each CLB make the memory look-up tables in the F’ and G’ function generators usable as an array of Read/Write memory cells. Depending on the selected mode, a single CLB can be configured as either a 16x2, 32x1, or 16x1 bit array. The F1-F4 and G1-G4 inputs to the function generators act as address lines, selecting a particular memory cell in each look-up table. The DIN/H2, H1, and SR/H0 lines become the two data inputs (D0, D1) and the Write Enable (WE) input for the 16x2 memory. When the 32x1 configuration is selected, D1 acts as the fifth address bit and D0 is the data input. 48 FPGA - Xilinx 4000 Series – IO block 49 FPGA - Xilinx 4000 Series – IO block Segnali di ingresso User-configurable input/output blocks (IOBs) provide the interface between external package pins and the internal logic. Each IOB controls one package pin and can be configured for input, output, or bidirectional signals. Two paths, labeled I1 and I2, bring input signals into the array. Inputs also connect to an input register that can be programmed as either an edge-triggered flip-flop or a levelsensitive latch. The data input to the register can optionally be delayed by several nanoseconds. With the delay enabled, the setup time of the input flip-flop is increased so that normal clock routing does not result in a positive hold-time requirement. The delay guarantees a zero hold time with respect to clocks routed through any of the global clock buffers. An additional optional latch on the input is clocked by the output clock; this additional latch allows the very fast capture of input data, which is then synchronized to the internal clock by the IOB flip-flop or latch. 50 FPGA - Xilinx 4000 Series – IO block Segnali di uscita Output signals can be optionally inverted within the IOB, and can pass directly to the pad or be stored in an edge-triggered flip-flop. An active-High 3-state signal can be used to place the output buffer in a high-impedance state, implementing 3-state outputs or bidirectional I/O. FPGAs can directly drive buses on a printed circuit board, since a guaranteed output sink current of 12 mA is given. The output pull-up structure can be configured as a TTL-like totem-pole or as CMOS drivers, with p-channel pull-up transistors pulling to Vcc. A multiplexer can be configured as a 2-input function generator, implementing a passgate, AND-gate, OR-gate, or XOR-gate, with 0, 1, or 2 inverted inputs: •When configured as a multiplexer, this feature allows two output signals to time-share the same output pad, effectively doubling the number of device outputs without requiring a larger, more expensive package. •When the MUX is configured as a 2-input function generator, logic can be implemented within the IOB itself, so allowing for very high-speed gating of a single signal. 51 FPGA - Xilinx 4000 Series – routing • 1) Fast Direct Interconnect - CLB to CLB • 2) General Purpose Interconnect - Uses switch matrix • 3) Long Lines – Segmented across chip – Global clocks, lowest skew – 2 Tri-states per CLB for busses • Other routing types in CPLDs CLB CLB Switch Matrix CLB CLB Switch Matrix CLB CLB CLB CLB 52 FPGA - Xilinx 4000 Series – altre risorse • Tri-state buffers for busses (BUFT’s) • Global clock & high speed buffers (BUFG’s) • Wide Decoders (DECODEx) • Internal Oscillator (OSC4) • Global Reset to all Flip-Flops, Latches (STARTUP) • CLB special resources – Fast Carry logic built into CLBs – Synchronous Dual Port RAM – Boundary Scan 53 FPGA - Altera FLEX 10K - struttura 54 FPGA - Altera FLEX 10K – Logic Element FLEX 10K Series Logic Element (LE), from Altera FLEX 10K data sheet 55 FPGA - Altera FLEX 10K - EAB Embedded Array Block (EAB) 56 Esempio di FPGA a grana fine - Actel SX - struttura 57 FPGA Example - Actel SX Family – celle R e C Cella C Cella R 58 Tecnologia delle interconnessioni Static Random Access Memory (SRAM) • • ogni switch e` un pass transistor controllato dallo stato di una cella SRAM Richiede una PROM per configurare la FPGA al power-on Electrically Erasable Programmable ROM (EPROM) • • ogni switch e` un transistor floating-gate. Il codice di configurazione e` residente nella FPGA Riprogrammabile, anche in-circuit (ISP/JTAG) Fusible Links - one time programmable (“Antifuse”) • • • Quando e` programmato elettricamente, forma un percorso a bassa resistenza one-time programmable, mediante hardware apposito radiation tolerant 59 Esempio di FPGA - Actel SX Family Architettura tipo “sea-of-modules” Tutto il dispositivo e` coperto da una griglia di moduli logici Le risorse di routing and interconnessione stanno sotto la griglia from Actel’s SX Family of FPGA’s - Technology Backgrounder 60 Tagli tipici No of I/O No of regs Memory Altera 20K30E-2 128 1200 24 Kbits Altera 20K200E-1 376 8320 100 Kbits Altera EP2A15C7 492 16640 450 Kbits Xilinx XC2S15-5 86 384 16 Kbits Xilinx XC2S200-5 284 4704 57 Kbits Xilinx XC2V3000 684 28672 1728 Kbits I prezzi dipendono anche dalla velocita`. (per es. La versione piu` veloce puo` essere piu` costosa del 50%). I dispositivi in tabella costano da $30 a $900. Una PLD a 32 registri costa da $2 Serve anche il dispositivo di configurazione: Altera PROM: $8, EEPROM: $21 61 Flusso di progetto con FPGA - CPLD 1 Design Entry in schematic, ABEL, VHDL, and/or Verilog. Vendors include Synopsys, Aldec (Xilinx Foundation), Mentor, Cadence, Viewlogic, and 35 others. 2 Implementation includes Placement & Routing and bitstream generation using Xilinx’s M1 Technology. Also, analyze timing, view layout, and more. M1 Technology Download directly to the Xilinx hardware device(s) with unlimited reconfigurations* !! XC4000 3 XC4000 XC4000 *XC9500 has 20,000 write/erase cycles 62 Flusso di progetto IL PROGETTO E LA PROGRAMMAZIONE AVVIENE MEDIANTE STRUMENTI CAD CON IL SEGUENTE DESIGN FLOW: Start DESIGN ENTRY PRELAYOUT SIMULATION LOGIC SYNTHESIS SYSTEM PARTITIONING FLOORPLANNING POSTLAYOUT SIMULATION PLACEMENT ROUTING CIRCUIT EXTRACTION PROGRAMMING End 63