Table Of ContentUNIVERSIDADEFEDERALDORIOGRANDEDOSUL
INSTITUTODEINFORMÁTICA
CURSODEENGENHARIADECOMPUTAÇÃO
KAUÊCHRISTMANNCAMPOS
Implementação de Máquinas Hipotéticas
(NEANDER e AHMES) e Interface VGA
Monografia apresentada como requisito parcial
para a obtenção do grau de Bacharel em
EngenhariadaComputação
Orientador:Prof.Dr.RenatoPerezRibas
PortoAlegre
2016
UNIVERSIDADEFEDERALDORIOGRANDEDOSUL
Reitor: Prof.RuiVicenteOppermann
Vice-Reitora: Profa.JaneFragaTutikian
Pró-ReitordeGraduação: VladimirPinheirodoNascimento
DiretoradoInstitutodeInformática: Profa.CarlaMariaDalSassoFreitas
CoordenadordoCursodeEngenhariadeComputação: Prof.RaulFernandoWeber
Bibliotecária-chefedoInstitutodeInformática: BeatrizReginaBastosHaro
“It does not matter how slowly you go
as long as you do not stop.”
— CONFUCIUS
AGRADECIMENTOS
Aestauniversidade,seucorpodocente,direçãoeadministraçãoquemeoportuni-
zaramascondiçõesnecessáriasparaqueeualcançassemeusobjetivos.
Ao meu orientador por todo o tempo que dedicou a me ajudar durante este traba-
lho.
Aosmeuspaispeloamor,ensinamentoeapoio.
Emfim, a todos que contribuíram para a realização deste trabalho, seja de forma
diretaouindireta,ficaregistradoaqui,omeumuitoobrigado!
RESUMO
Este trabalho busca fazer uma abordagem didática sobre as diferentes formas de imple-
mentação das máquinas hipotéticas (Ahmes e Neander), assim como das linguagens de
descrição de hardware (Verilog e VHDL) utilizadas na implementação destas. Também
é exposto neste trabalho uma forma de apresentar as arquiteturas desenvolvidas fazendo
usodeumkitdedesenvolvimentoFPGAeummonitor. Aindanesteescoposerádescrito
um driver para mostrar caracteres de texto ASCII em um monitor VGA com a finalidade
de facilitar o uso deste em projetos diversos e também é definida e implementada uma
interfacegenérica.
Palavras-chave: FPGA.máquinashipotéticas. Ahmes. Neander. Verilog. VHDL.VGA.
Implementationofthehypotheticalmachines(NEANDERandAhmes)andVGA
interface
ABSTRACT
This work seeks a didactic approach of the different implementation methods for the hy-
pothetical machines (Ahmes and Neander) and the hardware description languages (Ver-
ilog and VHDL) that implement these computers. It is also exposed within this work a
way of presenting the designed architectures using a FPGA developer kit. Still, in this
scope it will be developed a driver for displaying ASCII text characters on the VGA
display for the purpose of facilitating its use on a variety of projects and also a generic
interfaceisdefinedandimplementedaswell.
Keywords: FPGA,hypotheticalmachines,Ahmes,Neander,Verilog,VHDL,VGA.
LISTADEABREVIATURASESIGLAS
VHDL VHSICHardwareDescriptionLanguage
VHSIC VeryHighSpeedIntegratedCircuits
FPGA FieldProgrammableGateArray
ROM ReadOnlyMemory
RAM RandomAccessMemory
FSM FiniteStateMachine
VGA VideoGraphicsArray
LISTADEFIGURAS
Figura2.1 MenudeMemória1......................................................................................17
Figura2.2 MenudeMemória2......................................................................................17
Figura2.3 MenudeMemória3......................................................................................18
Figura2.4 MenudeMemória4......................................................................................19
Figura2.5 MenudeMemória5......................................................................................19
Figura2.6 MenudeMemória6......................................................................................20
Figura2.7 MenudeMemória7......................................................................................20
Figura2.8 MenudeMemória8......................................................................................21
Figura2.9 Ciclodeleituradememória...........................................................................23
Figura2.10 Ciclodeescritanamemória........................................................................24
Figura3.1 DiagramadeBlocos.......................................................................................27
Figura3.2 ArquiteturaUCtemporizador........................................................................44
Figura3.3 DiagramadeestadosdaFSMparaROM......................................................46
Figura3.4 DiagramadeestadosdaFSMparaRAM......................................................48
Figura4.1 VarreduradoquadroVGA.............................................................................54
Figura4.2 RestriçõesdetempoH_SYNC......................................................................55
Figura4.3 RestriçõesdetempoV_SYNC......................................................................56
Figura4.4 ArquiteturadriverVGA.................................................................................58
Figura4.5 ArquiteturaGeradordePixels.......................................................................60
Figura4.6 Exemplodedesenhodecaractere((CHU,2008))..........................................61
Figura5.1 Arquiteturadivisordefrequências.................................................................65
Figura5.2 Simulaçãododivisordefrequências.............................................................66
Figura5.3 FrequênciadeH_SYNCnoosciloscópio......................................................68
Figura5.4 FrequênciadeV_SYNCnoosciloscópio......................................................69
Figura5.5 DemonstraçãoprojetoVGAgenériconomonitor.........................................69
Figura5.6 DemonstraçãodeAhmesnomonitor............................................................72
LISTADETABELAS
Tabela3.1 TabeladeInstruções......................................................................................26
Tabela3.2 Execuçãodasinstruções................................................................................29
Tabela3.3 EstadoseAções.............................................................................................47
Tabela3.4 EstadoseAções.............................................................................................49
Tabela4.1 ResoluçõesesuasEspecificações..................................................................57
SUMÁRIO
1INTRODUÇÃO...........................................................................................................11
1.1 Motivação.................................................................................................................12
1.2 Objetivo....................................................................................................................12
1.3 Estrutura..................................................................................................................12
2MEMÓRIA..................................................................................................................14
2.1 MemóriaROM........................................................................................................14
2.2 MemóriaRAM........................................................................................................16
2.2.1 ImplementaçãoviaFerramenta..............................................................................16
2.2.2 ImplementaçãoViaInferênciaaoCompilador......................................................21
2.2.3 SimulaçãodeFuncionamento................................................................................23
3MÁQUINASHIPOTÉTICAS....................................................................................25
3.1 TabeladeInstrucções..............................................................................................25
3.2 Arquitetura..............................................................................................................27
3.3 ExecuçãodasInstruções.........................................................................................27
3.4 ImplementaçãodeBlocosdaArquitetura............................................................29
3.4.1 PC...........................................................................................................................30
3.4.2 REM,RDM,RI,ACeRegistradordeEstados......................................................32
3.4.3 MUX......................................................................................................................35
3.4.4 Decodificador.........................................................................................................36
3.4.5 ULA.......................................................................................................................39
3.5 UnidadesdeControle.............................................................................................43
3.5.1 UnidadesdeControleparaROM...........................................................................43
3.5.1.1 Temporizador......................................................................................................43
3.5.1.2 FSM....................................................................................................................45
3.5.2 UnidadesdeControleparaRAM...........................................................................47
3.5.2.1 Temporizador......................................................................................................47
3.5.2.2 FSM....................................................................................................................48
3.6 SimulaçãoTestbench...............................................................................................49
3.7 EmpacotadordeMemória.....................................................................................52
4VGA(VIDEOGRAPHICSARRAY)........................................................................54
4.1 EspecificaçõesVGA.................................................................................................54
4.2 ArquiteturaDriverVGA........................................................................................57
4.3 ControleVGA..........................................................................................................58
4.3.1 SinaisdeSincronização.........................................................................................58
4.3.2 RequerimentodePixel...........................................................................................59
4.4 GeradordePixels....................................................................................................60
4.4.1 MemóriadeCaracteres..........................................................................................60
4.4.2 MemóriadeTela....................................................................................................61
4.4.3 Funcionamento.......................................................................................................62
5PROJETOVGAGENÉRICO...................................................................................64
5.1 InterfaceeDriverVGA..........................................................................................64
5.1.1 DivisordeFrequências..........................................................................................64
5.1.2 Interface.................................................................................................................66
5.2 ProjetoVGA............................................................................................................67
5.3 ComputadoresHipotéticosnoMonitor................................................................70
6CONCLUSÃOESUGESTÕESPARATRABALHOSFUTUROS.......................73
REFERÊNCIAS.............................................................................................................74
7APÊNDICE..................................................................................................................75
Description:direta ou indireta, fica registrado aqui, o meu muito obrigado! Keywords: FPGA, hypothetical machines, Ahmes, Neander, Verilog, VHDL, VGA.