SISTEMES ELECTRÒNICS DIGITALS -...

18
EX2: Synthesising sequential systems in CPLD and FPGA using VHDL EX2 de Sistemes Electrònics Digitals GRUP: DATA: Descripció de les aportacions realitzades i de les conclusions d’aquest exercici TEMPS D’ESTUDI I DE PREPARACIÓ DE L’EXERCICI: Sessions TGA a l’aula: Sessions TGB al laboratori Sessions TGC fora de l’horari Aquest apartat és obligatori. Si no és present, no es corregeix l’exercici i s’ha de tornar a lliurar Heu d’apuntar tot el temps d’estudi que heu dedicat a l’exercici 1

Transcript of SISTEMES ELECTRÒNICS DIGITALS -...

Page 1: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

EX2 de Sistemes Electrònics Digitals

GRUP:

DATA:

Descripció de les aportacions realitzades i de les conclusions d’aquest exercici

TEMPS D’ESTUDI I DE PREPARACIÓ DE L’EXERCICI:

Sessions TGA a l’aula:

Sessions TGB al laboratori

Sessions TGC fora de l’horari

Treball individual

Estudiant 1:

Estudiant 2:

Estudiant 3:

Mitjana de temps total (per estudiant)

Aquest apartat és obligatori. Si no és present, no es corregeix l’exercici i s’ha de tornar a lliurar

Heu d’apuntar tot el temps d’estudi que heu dedicat a l’exercici

1

Page 2: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

ÍNDEX DE CONTINGUT

Synthesising sequential systems in CPLD and FPGA using VHDL.......................................................3

1.1 Description.....................................................................................................................................3

1.2 Objectives......................................................................................................................................3

1.3 Study time:.....................................................................................................................................3

1.4 Tutorial exercise............................................................................................................................4

1.4.1 Install Quartus II and obtain a valid license file...................................................................4

1.4.2 Run an example project.........................................................................................................5

1.5 CPLD and FPGA technology........................................................................................................5

1.6 VHDL design styles for a sequential system.................................................................................5

1.7 Implementing the SS:MM:HH operational unit............................................................................5

1.7.1 The BCD universal counter...................................................................................................5

1.7.2 The SS and MM modules.......................................................................................................6

1.7.3 The HH module......................................................................................................................6

1.7.4 Designing the display unit.....................................................................................................6

1.8 Desenvolupament de la pràctica/problema. Treball del grup (títol 2)...........................................7

1.8.1 El vostre primer subtítol (títol 3)...........................................................................................7

1.9 Bibliografia i referències consultades............................................................................................7

1.10 Pla de treball que heu preparat per resoldre el disseny..................................................................8

1.11 “Fulls de dubtes” de l’EX2............................................................................................................9

1.11.1 Sobre els apartats A) i B) d’instal·lació dels programes i tutorial........................................9

1.11.2 Sobre l’apartat C) de teoria...................................................................................................9

1.11.3 Full de dubtes sobre els apartats D) i E) de disseny jeràrquic en VHDL...........................10

1.11.4 Sobre l’apartat F) de disseny dels comptadors...................................................................10

2

Page 3: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

MOLT IMPORTANT: Aquest curs s’espera de vosaltres que ja prepareu i editeu textos de certa qualitat, per tant: preneu aquest document de plantilla d’estils i formats. Amplieu-lo i modifiqueu-lo per plantejar, desenvolupar, solucionar i verificar el funcionament del vostre disseny. NO ES POT LLIURAR CAP TREBALL QUE NO SEGUEIX EXACTAMENT AQUESTA PLANTILLA:

- Fixeu-vos que l’índex de contingut de l’exercici es genera automàticament si respecteu els estils: Normal, Títol 1, Títol 2 i Títol 3.

- Respecteu i useu l’estil del peu de figura (Llegenda) i les referències creuades a les figures que s’actualitzen automàticament quan n’inseriu de noves.

- Respecteu i useu les referències creuades a la bibliografia numerada

- Passeu el corrector ortogràfic i repasseu la gramàtica tant si escriviu en anglès, castellà o català.

- Per eliminar errors, feu una segona lectura a través dels companys de grup abans de lliurar l’exercici

Consulteu-nos també qualsevol dubte que tingueu sobre l’edició de documents i aquesta plantilla en particular.

Tingueu en compte les anotacions i indicacions que us han fet els professors en els vostres treballs previs, per tal de no cometre les mateixes errades en aquest treball

ACTIVITATS

Qui Què Com Quan

Grup de treball cooperatiu Edició impresa (primera versió) de l’informe de l’exercici. Imprimiu la pàgina 1 i 2 amb l’índex actualitzat 1 i a partir de la pàgina 11

Amb la plantilla i seguint el documents de criteris de qualitat

Abans de la data límit que trobareu al pla de treball o bé al tauló d’anuncis de la web de SED

Els professors o els companys a través d’una correcció creuada

Correcció de la primera versió

Amb la plantilla d’avaluació

Com a màxim una setmana desprès del lliurament de la primera versió impresa

(amb caràcter voluntari)2

Grup de treball cooperatiu Edició electrònica (segona versió) del document complet amb la incorporació de les millores assenyalades pels correctors

Amb un generador de fitxers PDF

Com a màxim una setmana desprès del lliurament de la correcció. S’enviarà per correu electrònic als professors.

Professors Penjar a la web de SED el document per evidenciar el treball desenvolupat

A través d’un enllaç al document a l’apartat de Grups de Classe

Durant el quadrimestre, si s’escau

1 Recordeu que l’índex de continguts el genera automàticament el processador de textos

2 És clar que la realització d’aquesta feina addicional millora la qualificació de l’exercici

3

Page 4: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

NOTA: També es valora la iniciativa. Si el grup cooperatiu vol realitzar una aplicació similar a la presentada en aquest exercici que incorpori els conceptes introduïts, bàsicament el disseny d’un altre sistema digital combinacional amb VHDL, que ho comuniqui als professors i es considerarà.

4

Page 5: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

Synthesising sequential systems in CPLD and FPGA using VHDL

1.1 DescriptionWe will install the Altera Quartus-II computed aided design (CAD) software for design, simulate and synthesise any kind of electronic digital system into complex programmable logic devices (CPLD) or field-programmable gate arrays (FPGA). As in the previous exercise, a tutorial will be followed for running the design flow from an initial VHDL project. The study of an example consisting in the implementation of a frequency divider will clarify which has to be the preferred VHDL coding style.

The digital clock project begun in EX1 and already planned and developed in ED3, will be continued in order to implement the counter subsystem which will contain the SS : MM : HH up-down BCD counters and the crystal oscillator frequency dividers. Therefore, the real time clock operational unit (OU) will be implemented, leaving the design of the FSM-based control unit (CU) for the next EX3.

One of the main characteristics of the proposed design is that it has to be carefully planned (structured) due the large number of blocks involved. Essentially, the project will consist in many VHDL source files to define components to be afterwards instantiated following a hierarchical top-down design approach. The project will be verified using the UP2 Altera board.

1.2 Objectives After completing the task and studying Units 1.5, 1.6, 1.7, 1.8 and 1.9 students will be able to:

- Remember how to design synchronous sequential systems revisiting ED materials

- Explain how a sequential system can be described as (1) a state register, (2) the next state logic, and (3) the outputs logic

- Search books and the Internet to find information about the basics if VHDL language for analyzing a frequency divider and design cascadable universal BCD counters

- Describe and conceptualize a digital system as an operational unit (OU) or datapath and a control unit (CU)

- Explain the concepts of flat and hierarchical designs using components and their instantiation

- Install and make projects using Quartus-II software following the design flow which basically consists in: (1) VHDL source files; (2) functional simulation; (3) pin assignment and synthesis; (4) gate-level simulation; (5) device programming; and (6) prototype verification

- Verify the design using the integrated Quartus-II simulator which runs both, functional and gate-level simulation.

3 http://epsc.upc.edu/projectes/ed/grups_classe/07-08-q1/1BT4/07-08-Q1-1BT4.htm

5

Page 6: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

- Use RTL and technology views as a help to interpret the synthesis process

- Explain the basics of the CPLD and FPGA technologies and how they are programmed.

- Document the work using a predefined word processor template and utilities: spelling and grammar, chapter enumeration, page headers and footers, hyperlinks, cross-references, figure captions, text styles, etc.

- Analyze their own study time

1.3 Study time: The estimated study time for this exercise is 2 weeks4: that means about 13 hours of cooperative work in laboratory sessions (TGA, TGB) or anywhere (TGC).

1.4 Tutorial exercise 1.4.1 Install Quartus II and obtain a valid license file

A) Start a process very similar to the one followed to install and validate Lattice Semiconductor software:

- Get a copy of Quartus II Web edition software version 7.0 or 7.2 (from the Altera web page or from your instructor)

- Fill in the questionnaire for obtaining a valid licence file from Altera licensing.

- Connect the UP2 development board to the computer using the parallel port and the ByteBlasterMV JTAG programming port.

4 Students will work in cooperative groups for the whole semester. They will work an average time of 6.5 hours per week.

6

Page 7: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

Fig. 1 The main Altera Quartus-II window

Fig. 2 The UP25 board from Altera connected to a power supply and a ByteBlasterMV programming JTAG port to download the configuration file from Quartus-II environment

1.4.2 Run an example project

B) Download from the SED web pages a Quartus-II introductory example project, and run it following instructions available in previous editions of EX2. The design flow, which may be found here6, consists essentially in:

- (1) VHDL or schematics source files;

- (2) functional or behavioural simulation;

5 Additional information and tutorials in Unit 1.8: http://epsc.upc.edu/projectes/sed/unitats/unitat_1_8/Unitat_1_8.htm

6 http://epsc.upc.edu/projectes/sed/unitats/unitat_1_7/Unitat_1_7.htm

7

Page 8: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

- (3) device selection, pin assignment (constraints) and project synthesis;

- (4) RTL and technology view;

- (5) gate-level (timed) simulation;

- (6) device programming; and

- (7) verification using a prototype board

1.5 CPLD and FPGA technologyC) Search Internet to find datasheets or slides to study the architecture and the main technological

characteristics of the Altera CLPD and FPGA devices installed in the UP2 development board. Try to resume the fundamental information in a pair of sheets using figures and comments.

1.6 VHDL design styles for a sequential system D) Explore the VHDL designs for the crystal clock frequency dividers shown in Fig. 3. Write down

the main differences in the three VHDL writing styles, and explain why the last style, the one using cascaded blocks instantiating components into a top design is the best option.

CD

CE

CLK

TC25

CD

CE

CLK

TC1007

CD

CE

CLK

TC5000

CD

CLKCE

CLK_1MHzCLK_1kHz

CLK_02Hz

freq_div_5000:Freq_div_5000_Comp1freq_div_1007:Freq_div_1007_Comp1freq_div_25:Freq_div_25_Comp1

Fig. 3 RTL netlist view for the UP2 clock oscillator divider (third design style)

E) Now, redesign the synchronous clock divider system to obtain pulsed waveforms of 100 Hz and 5Hz, and a final square wave of 1Hz

1.7 Implementing the SS:MM:HH operational unit F) From here, it’s up to the cooperative group to conceive a plan, and follow a systematic strategy

for developing all de counter subsystem modules. You must simulate your designs using both functional and gate level simulation. You must correctly interpret the RLT and technology maps while, at the same time, taking into account important details such as the number of registers used when finalizing the synthesis processes. Remember that the whole project, designed using classic MSI chips can be run from this reference7. The final operational unit may correspond to a circuit like the one in Fig. 5.

7 http://epsc.upc.edu/projectes/ed/grups_classe/07-08-q1/1BT4/EX/EX7/clock_system_v7B.zip

8

Page 9: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

1.7.1 The BCD universal counter

Some ideas about the working modes of this counter can be found here:

http://epsc.upc.edu/projectes/ed/unitats/unitat_2_8/Tema_2_Problema_2_13_simulacio_Lite.DSN

You must design an entity like the one shown in Fig. 4 as a component ready to be instantiated into the top design like the other frequency divider blocks.

LD CE UD_L Mode of operation

1 X X Parallel load

0 0 X Inhibit counter (do nothing)

0 1 1 Count up

0 1 0 Count down

CCT007

74x169-like presettable synchronous 4-bit up/downbinary counter

CE

UD_L

CD

CLK

Q2Q1Q0

Q3

LD

TC10

I3I2I1I0

Fig. 4 Entity for the universal BCD counter and specifications

Remember that the VHDL code for the counter must follow a FSM style as any other sequential block already developed (state register, and combinational blocks SC1 (next state logic) and SC2 (outputs logic)). Furthermore, do not forget to draw an algorithmic state machine chart (ASM) before attempting the VHDL coding every process inside the entity.

1.7.2 The SS and MM modules

The way to develop a module-60 counter (from 00 to 59) is cascading 2 universal counters and making a new component to be named for instance: SS_module_conter

1.7.3 The HH module

The way to develop a module-24 counter (from 00 to 23, or from 01 to 12) is modifying the SS module with extra logic.

9

Page 10: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

1.7.4 Designing the display unit

Due to the fact that the UP2 board has only two 7segment digits, in order to view all the clock data, this section’s aim is to integrate into de previous HH:MM:SS counter system, the additional circuitry for representing HH, MM or SS when clicking a single pushbutton (the MAX_PB1 or the FLEX_PB1).

SECONDS

MODULE-60 COUNTER

CLK

LDT

LDU

tens[3..0]

TC60

data_u[3..0]

UD_L

CD

CE

units[3..0]

data_t[3..0]

HOURS

MODULE-24 COUNTER

CLK

LDT

LDU

tens[3..0]

TC24

data_u[3..0]

UD_L

CD

CE

units[3..0]

data_t[3..0]

HM

AM_LED

PM_LED

HT[3..0]

HU[3..0]

MT[3..0]

MU[3..0]

ST[3..0]

SU[3..0]

MINUTES

MODULE-60 COUNTER

CLK

LDT

LDU

tens[3..0]

TC60

data_u[3..0]

UD_L

CD

CE

units[3..0]

data_t[3..0]

CLK

CD

UD_L

CE

COD[3..0]

PM_LED

AM_LED

MLDU

MLDT

SLDT

SLDU

HLDT

HLDU

HM

Fig. 5 The real time clock counter subsystem

10

Page 11: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

1.8 Desenvolupament de la pràctica/problema. Treball del grup (títol 2)1.8.1 El vostre primer subtítol (títol 3)

La instal·lació del Quartus-II (títol 4)

Afegiu aquí el vostre text (estil normal) encapçalat amb títols (Títol 2 i 3 i 4), amb figures (estil llegenda o “epígrafe”) i referències creuades en el text com aquesta Fig. 6 (és una referència creuada a la llegenda) a les figures que inseriu. Feu referència també en el text a les fonts bibliogràfiques o de web que consulteu d’aquesta manera [1] (és una referència creuada a l’element numerat [1]). Expliqueu perquè les heu consultat i quina informació útil heu trobat.

Fig. 6 Exemple de peu de figura que segueix la numeració de l’enunciat (llegenda)

1.9 Bibliografia i referències consultadesAmplieu i modifiqueu aquesta secció de referències.

[1] http://epsc.upc.edu/projectes/sed/ . Pàgina web de SED on trobareu materials i treballs de cursos anteriors. Vegeu la secció unitats didàctiques i grups de classe

[2] Brown,S., Vranesic, Z., “Fundamentals of digital logic with VHDL design”, Mc Graw-Hill, 2005

[3] http://epsc.upc.edu/projectes/ed/problemes/problemes_PA/Problemes_PA.htm . Pàgina web d’ED on hi ha el problema que descriu el funcionament i el disseny del descodificador HEX-7SEG.

[4] http://epsc.upc.edu/projectes/sed/projectes_aplicacio/Projectes_Aplic.htm . Lloc on hi trobareu el full de plantilla per a distribuir tasques entre els membres del grup cooperatiu

11

Page 12: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

1.10 Pla de treball que heu preparat per resoldre el disseny

Consulteu els documents de la web [4] per veure com us podeu preparar el pla de treball i el repartiment de tasques per realitzar una bona feina en equip. Useu diagrames de flux, mapes conceptuals, esquemes, taules, etc.

Aquest apartat és obligatori. Si no és present, no es corregeix l’exercici i s’ha de tornar a lliurar

12

Page 13: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

1.11 “Fulls de dubtes” de l’EX28

1.11.1 Sobre els apartats A) i B) d’instal·lació dels programes i tutorial

Grup de treball:

Data:

Pla de treball:

Dubtes:

8 Afegiu, si és necessari, altres mitjos fulls com aquests per documentar el vostre progrés a través del projecte i poder realitzar consultes i discussions

Aquest apartat és obligatori. Si no és present, no es corregeix l’exercici i s’ha de tornar a lliurar

13

Page 14: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

1.11.2 Sobre l’apartat C) de teoria

Grup de treball:

Data:

Pla de treball:

Dubtes:

14

Page 15: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EX2: Synthesising sequential systems in CPLD and FPGA using VHDL

1.11.3 Full de dubtes sobre els apartats D) i E) de disseny jeràrquic en VHDL

Grup de treball:

Data:

Pla de treball:

Dubtes:

15

Page 16: SISTEMES ELECTRÒNICS DIGITALS - digsys.upc.esdigsys.upc.es/.../2AT4/exercicis/EX2/SED_Curs_07-08_Q2_2AT4_E… · Web viewAquest apartat és obligatori. Si no és present, no es corregeix

EPSC – SED: Sistemes Electrònics Digitals

1.11.4 Sobre l’apartat F) de disseny dels comptadors

Grup de treball:

Data:

Pla de treball:

Dubtes:

16