You are on page 1of 30

UNIVERSIDADE CATÓLICA DE

PELOTAS
Departamento de Engenharia de Computação

Circuito em linguagem de descrição de hardware


(VHDL) estrutura para escrita e leitura na memória
de dados do processador MIPS utilizando barramento
de 16 bits

Aluno: Francisco Neto


D.r Professor Eduardo Antonio César da Costa

Junho
2018
UNIVERSIDADE CATÓLICA DE
PELOTAS
Departamento de Engenharia de Computação

Relatório

O Relatório demonstra a implementação de um código


em linguagem de descrição de hardware (VHDL) de
uma estrutura para escrita e leitura na memória de
dados do processador MIPS utilizando barramento
de 16 bits. Estudados na disciplina de Sistemas Di-
gitais II do Curso Engenharia de Computação da
Universidade Católica de Pelotas.

Aluno: Francisco Neto


D.r Professor Eduardo Antonio César da Costa

Junho
2018
Conteúdo
1 Introdução 1

2 Objetivo 2

3 Metodologia 3

4 Código em VHDL - Módulo Registrador 16 bits 4

5 Código em VHDL - Módulo Decodificador 7

6 Código em VHDL - Módulo MUX 8

7 Código em VHDL - Módulo Memória Ram 12

8 Código em VHDL - Módulo Banco de Registradores 16 Bits 14

9 Código em VHDL - Módulo BrenKung16Bits 17

10 Código em VHDL - Módulo ULA 20

11 Código em VHDL - Módulo Pipeline 22

12 Código em VHDL - Módulo CONECTANDO 23

13 Conclusão 26

Bibliografia 27
1 Introdução
O trabalho tem como objetivo o desenvolvimento de um código na lingua-
gem de descrição de hardware VHDL (Very High Speed Integrated Circuits
Hardware Description Language), visando uma estrutura de escrita e leitura
da memória de dados do processador MIPS, com o uso de barramento de 16
bits, onde uma implementação do MIPS básica possui instruções de referência
a memória load word (LW - lê da memória) e store word (SW - escrita na
memória), instruções lógicas e aritméticas como adição, subtração.

1
2 Objetivo
Desenvolver em linguagem de descrição de hardware VHDL, uma estru-
tura para escrita e leitura na memória de dados do processador MIPS uti-
lizando barramento de 16 bits. A arquitetura deve conter um estágio de
pipeline entre o banco de registradores e a ULA, de acordo com a figura
abaixo:

Figura 1: Exemplo para implementação em VHDL

2
3 Metodologia
A metodologia aplicada nesse trabalho consiste em construir cada bloco
de código separadamente, afim de uni-los com um bloco integrador de si-
nal, todos os blocos levam em conta um barramento de 16 bits. A seguir
cada seção apresenta-rá seu respectivo código na linguagem VHDL e sua
Simulação.

3
4 Código em VHDL - Módulo Registrador 16
bits
O código abaixo demonstra um registrador de 16 bits, com 3 sinais de
entrada(CLOCK, ENABLE, REG1) e um sinal de saı́da (Sreg1). Registrador
16 Bits.

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY R e g i s t r a d o r 1 6 B i t s IS
PORT (
clk , enable : IN s t d l o g i c ;
reg1 : IN s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
S re g1 : OUT s t d l o g i c v e c t o r ( 1 5 downto 0 )
);
END R e g i s t r a d o r 1 6 B i t s ;

ARCHITECTURE r e g i s t r a d o r OF R e g i s t r a d o r 1 6 B i t s IS
BEGIN
PROCESS( c l k , e n a b l e )
BEGIN
IF ( c l k ’EVENT AND c l k = ’ 1 ’ ) THEN
i f ( e n a b l e = ’ 1 ’ ) then
Sreg1 <= r e g 1 ;
else
Sreg1 <= ” 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ” ;
end i f ;
END IF ;
END PROCESS;

END a r c h i t e c t u r e ;

4
Figura 2: Exemplo Simulação Registrador 16 bits

Registrador16x16
LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY Mux21com16bits IS
PORT (
s e l : in s t d l o g i c ;
a , b : IN STD LOGIC vector (1 5 downto 0 ) ;
y : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
END Mux21com16bits ;

ARCHITECTURE M u l t i p l e x a d o r OF Mux21com16bits IS
BEGIN
WITH s e l SELECT
y <= a WHEN ’ 0 ’ ,
b WHEN OTHERS;
END a r c h i t e c t u r e ;

5
Figura 3: Exemplo Simulação Registrador 16X16

Figura 4: Exemplo Simulação Registrador 16X16

6
5 Código em VHDL - Módulo Decodificador

library ieee ;
us e i e e e . s t d l o g i c 1 1 6 4 . a l l ;

entity Decodificador i s
port (
endereco : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
s : out s t d l o g i c v e c t o r ( 1 5 downto 0 )
);
end D e c o d i f i c a d o r ;

Architecture circuito of Decodificador i s


begin

with e n d e r e c o s e l e c t

s <= ”0000000000000001” WHEN ”0 000 ” ,


”0000000000000010” WHEN ”0 001 ” ,
”0000000000000100” WHEN ”0 010 ” ,
”0000000000001000” WHEN ”0 011 ” ,
”0000000000010000” WHEN ”0 100 ” ,
”0000000000100000” WHEN ”0 101 ” ,
”0000000001000000” WHEN ”0 110 ” ,
”0000000010000000” WHEN ”0 111 ” ,
”0000000100000000” WHEN ”1 000 ” ,
”0000001000000000” WHEN ”1 001 ” ,
”0000010000000000” WHEN ”1 010 ” ,
”0000100000000000” WHEN ”1 011 ” ,
”0001000000000000” WHEN ”1 100 ” ,
”0010000000000000” WHEN ”1 101 ” ,
”0100000000000000” WHEN ”1 110 ” ,
”1000000000000000” WHEN OTHERS;

end c i r c u i t o ;

7
Figura 5: Exemplo Simulação Decodificador 16 Bits

6 Código em VHDL - Módulo MUX


Mux 2X1:

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY Mux2X1 IS
PORT (
s e l : in s t d l o g i c ;
b : IN STD LOGIC vector ( 15 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
END Mux2X1 ;

ARCHITECTURE M u l t i p l e x a d o r OF Mux2X1 IS

s i g n a l bnot : STD LOGIC vector (1 5 downto 0 ) ;

BEGIN

bnot <= ( not b ) ;


WITH s e l SELECT
s <= b WHEN ’ 0 ’ ,
bnot WHEN OTHERS;

END a r c h i t e c t u r e ;

8
Figura 6: Exemplo Simulação Mux2x1

9
Mux 4X1:

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY Mux4X1 IS
PORT (
s e l : in s t d l o g i c v e c t o r ( 1 downto 0 ) ;
s i n 1 , s i n 2 , s i n 3 , s l t : IN STD LOGIC vector ( 1 5 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
END Mux4X1 ;

ARCHITECTURE M u l t i p l e x a d o r OF Mux4X1 IS BEGIN


WITH s e l SELECT

s <= s i n 1 WHEN ” 0 0 ” ,
s i n 2 WHEN ” 0 1 ” ,
s i n 3 WHEN ” 1 0 ” ,
s l t WHEN OTHERS;
END a r c h i t e c t u r e ;

Figura 7: Exemplo Simulação Mux4x1

10
Mux 16X1:

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY Mux16X1 IS
PORT (
s e l : in s t d l o g i c v e c t o r ( 3 downto 0 ) ;
reg0 , reg1 , reg2 , reg3 , reg4 , reg5 , reg6 , reg7 , reg8 ,

reg9 , reg10 , reg11 , reg12 , reg13 , reg14 , r e g 1 5 :


IN STD LOGIC vector ( 15 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
END Mux16X1 ;

ARCHITECTURE M u l t i p l e x a d o r OF Mux16X1 IS
BEGIN WITH s e l SELECT
s <= r e g 0 WHEN ” 000 0” ,
reg1 WHEN ” 000 1” ,
reg2 WHEN ” 001 0” ,
reg3 WHEN ” 001 1” ,
reg4 WHEN ” 010 0” ,
reg5 WHEN ” 010 1” ,
reg6 WHEN ” 011 0” ,
reg7 WHEN ” 011 1” ,
reg8 WHEN ” 100 0” ,
reg9 WHEN ” 100 1” ,
reg10 WHEN ”1 010 ” ,
reg11 WHEN ”1 011 ” ,
reg12 WHEN ”1 100 ” ,
reg13 WHEN ”1 101 ” ,
reg14 WHEN ”1 110 ” ,
reg15 WHEN OTHERS;

END a r c h i t e c t u r e ;

11
Figura 8: Exemplo Simulação Mux16x1

7 Código em VHDL - Módulo Memória Ram

library ieee ;
us e i e e e . s t d l o g i c 1 1 6 4 . a l l ;

e n t i t y ram i s g e n e r i c (
b i t s : i n t e g e r := 1 6 ;
l i n h a s : i n t e g e r := 16 s ) ;
port (
e n a bl e , c l k : in s t d l o g i c ;
endereco : i n i n t e g e r range 0 t o l i n h a s −1;
dados : i n s t d l o g i c v e c t o r ( b i t s −1 downto 0 ) ;
s: out s t d l o g i c v e c t o r ( b i t s −1 downto 0 ) ) ;

end ram ;

a r c h i t e c t u r e memoria o f ram i s

type v e c t o r a r r a y i s a r r a y ( 0 t o l i n h a s −1) o f
s t d l o g i c v e c t o r ( b i t s −1 downto 0 ) ;

s i g n a l memoria : v e c t o r a r r a y ;

begin

12
process ( clk , enable )
begin

i f ( e n a b l e = ’ 1 ’ ) then
i f ( c l k ’ e v e n t and c l k = ’ 1 ’ ) then
memoria ( e n d e r e c o ) <= dados ;
end i f ;
end i f ;
end p r o c e s s ;
s <= memoria ( e n d e r e c o ) ;
end a r c h i t e c t u r e ;

Figura 9: Exemplo Simulação Memória Ram

13
8 Código em VHDL - Módulo Banco de Re-
gistradores 16 Bits

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY B a n c o R e g i s t r a d o r IS
PORT (
clk : in s t d l o g i c ;
rd , reg2 , r e g 1 : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
escrita : i n s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
S a i d a r e g 2 , S a i d a r e g 1 : out s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
END B a n c o R e g i s t r a d o r ;

ARCHITECTURE r e g i s t r a d o r OF B a n c o R e g i s t r a d o r IS

s i g n a l e n a b l e : s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
s i g n a l sreg0 , sreg1 , sreg2 , sreg3 , sreg4 , sreg5 , sreg6 ,
sreg7 , sreg8 , sreg9 , sreg10 , sreg11 ,
sreg12 , sreg13 , sreg14 , sreg15 :
s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;

component R e g i s t r a d o r 1 6 x 1 6 IS
PORT (
c l k : IN s t d l o g i c ;
reg0 , reg1 , reg2 , reg3 , reg4 , reg5 , reg6 , reg7 , reg8 ,
reg9 , reg10 , reg11 , reg12 , reg13 , reg14 , reg15 , e n a b l e : IN
s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
sreg0 , sreg1 , sreg2 , sreg3 , sreg4 , sreg5 , sreg6 , sreg7 ,
s r e g 8 , s r e g 9 , s r e g 1 0 , s r e g 1 1 , s r e g 1 2 , s r e g 1 3 , s r e g 1 4 , s r e g 1 5 : OUT s t d
END component ;

component D e c o d i f i c a d o r i s
port (
e n d e r e c o : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
s : out s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
end component ;

component Mux16X1 IS

14
PORT ( s e l : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
reg0 , reg1 , reg2 , reg3 , reg4 , reg5 , reg6 , reg7 , reg8 ,
reg9 , reg10 , reg11 , reg12 , reg13 , reg14 , r e g 1 5 : IN
STD LOGIC vector ( 15 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
END component ;

BEGIN

decodificador

dec0 : D e c o d i f i c a d o r p o r t map ( rd , e n a b l e ) ;

r e g 0 : R e g i s t r a d o r 1 6 X 1 6 p o r t map ( c l k , e s c r i t a , e s c r i t a ,
escrita , escrita , escrita , escrita , escrita , escrita ,
escrita , escrita , escrita , escrita , escrita , escrita ,
e s c r i t a , e s c r i t a , e s c r i t a , e s c r i t a , e s c r i t a , e na bl e ,
sreg0 , sreg1 , sreg2 , sreg3 , sreg4 , sreg5 , sreg6 , sreg7 ,
sreg8 , sreg9 , sreg10 , sreg11 , sreg12 , sreg13 , sreg14 ,
sreg15 ) ;

mux1 : Mux16X1 p o r t map ( reg1 , s r e g 0 , s r e g 1 , s r e g 2 , s r e g 3 ,


sreg4 , sreg5 , sreg6 , sreg7 , sreg8 , sreg9 , sreg10 ,
sreg11 , sreg12 , sreg13 , sreg14 , sreg15 , Saidareg1 ) ;

mux2 : Mux16X1 p o r t map ( reg2 , s r e g 0 , s r e g 1 , s r e g 2 , s r e g 3 ,


sreg4 , sreg5 , sreg6 , sreg7 , sreg8 , sreg9 , sreg10 , sreg11 ,
sreg12 , sreg13 , sreg14 , sreg15 , Saidareg2 ) ;

end a r c h i t e c t u r e ;

15
Figura 10: Exemplo Simulação Registrador 16X16

Figura 11: Exemplo Simulação Registrador 16X16

16
9 Código em VHDL - Módulo BrenKung16Bits

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY BrenKung 16Bits IS


PORT (
a , b : IN STD LOGIC VECTOR (1 5 DOWNTO 0 ) ;
s: OUT STD LOGIC VECTOR (1 5 DOWNTO 0 ) ;
c o u t : out STD LOGIC ) ;
END BrenKung 16Bits ;

ARCHITECTURE somador OF BrenKung 16Bits IS


s i g n a l p , g , c : s t d l o g i c v e c t o r (1 5 downto 0 ) ;
s i g n a l Gg , Pp : s t d l o g i c v e c t o r (5 6 downto 0 ) ;

Gg ( 0 ) <= g ( 1 ) o r ( g ( 0 ) and p ( 1 ) ) ;
Pp ( 0 ) <= p ( 1 ) and p ( 0 ) ;

Gg ( 1 ) <= g ( 3 ) o r ( g ( 2 ) and p ( 3 ) ) ;
Pp ( 1 ) <= p ( 3 ) and p ( 2 ) ;

Gg ( 2 ) <= g ( 5 ) o r ( g ( 4 ) and p ( 5 ) ) ;
Pp ( 2 ) <= p ( 5 ) and p ( 4 ) ;

Gg ( 3 ) <= g ( 7 ) o r ( g ( 6 ) and p ( 7 ) ) ;
Pp ( 3 ) <= p ( 7 ) and p ( 6 ) ;

Gg ( 4 ) <= g ( 9 ) o r ( g ( 8 ) and p ( 9 ) ) ;
Pp ( 4 ) <= p ( 9 ) and p ( 8 ) ;

Gg ( 5 ) <= g ( 1 1 ) o r ( g ( 1 0 ) and p ( 1 1 ) ) ;
Pp ( 5 ) <= p ( 1 1 ) and p ( 1 0 ) ;

Gg ( 6 ) <= g ( 1 3 ) o r ( g ( 1 2 ) and p ( 1 3 ) ) ;
Pp ( 6 ) <= p ( 1 3 ) and p ( 1 2 ) ;

Gg ( 7 ) <= g ( 1 5 ) o r ( g ( 1 4 ) and p ( 1 5 ) ) ;
Pp ( 7 ) <= p ( 1 5 ) and p ( 1 4 ) ;

17
Gg ( 8 ) <= Gg( 1 ) o r (Gg( 0 ) and Pp ( 1 ) ) ;
Pp ( 8 ) <= Pp ( 1 ) and Pp ( 0 ) ;

Gg ( 9 ) <= Gg( 3 ) o r (Gg( 2 ) and Pp ( 3 ) ) ;


Pp ( 9 ) <= Pp ( 3 ) and Pp ( 2 ) ;

Gg( 1 0 ) <= Gg( 5 ) o r (Gg( 4 ) and Pp ( 5 ) ) ;


Pp ( 1 0 ) <= Pp ( 5 ) and Pp ( 4 ) ;

Gg( 1 1 ) <= Gg( 7 ) o r (Gg( 6 ) and Pp ( 7 ) ) ;


Pp ( 1 1 ) <= Pp ( 7 ) and Pp ( 6 ) ;

Gg( 1 2 ) <= Gg( 9 ) o r (Gg( 8 ) and Pp ( 9 ) ) ;


Pp ( 1 2 ) <= Pp ( 9 ) and Pp ( 8 ) ;

Gg( 1 3 ) <= Gg( 1 1 ) o r (Gg( 1 0 ) and Pp ( 1 1 ) ) ;


Pp ( 1 3 ) <= Pp ( 1 1 ) and Pp ( 1 0 ) ;

Gg( 1 4 ) <= Gg( 1 3 ) o r (Gg( 1 2 ) and Pp ( 1 3 ) ) ;


Pp ( 1 4 ) <= Pp ( 1 3 ) and Pp ( 1 2 ) ;

Gg( 1 5 ) <= Gg( 1 0 ) o r (Gg( 1 2 ) and Pp ( 1 0 ) ) ;


Pp ( 1 5 ) <= Pp ( 1 0 ) and Pp ( 1 2 ) ;

s (0)<= p(0);
s (1)<= p ( 1 ) xor g ( 0 ) ;
s (2)<= p ( 2 ) xor c ( 1 ) ;
s (3)<= p ( 3 ) xor c ( 2 ) ;
s (4)<= p ( 4 ) xor c ( 3 ) ;
s (5)<= p ( 5 ) xor c ( 4 ) ;
s (6)<= p ( 6 ) xor c ( 5 ) ;
s (7)<= p ( 7 ) xor c ( 6 ) ;
s (8)<= p ( 8 ) xor c ( 7 ) ;
s (9)<= p ( 9 ) xor c ( 8 ) ;
s (10)<= p ( 1 0 ) xor c ( 9 ) ;
s (11)<= p ( 1 1 ) xor c ( 1 0 ) ;
s (12)<= p ( 1 2 ) xor c ( 1 1 ) ;
s (13)<= p ( 1 3 ) xor c ( 1 2 ) ;
s (14)<= p ( 1 4 ) xor c ( 1 3 ) ;
s (15)<= p ( 1 5 ) xor c ( 1 4 ) ;

18
cout<= c ( 1 5 ) ;

end a r c h i t e c t u r e ;

Figura 12: Exemplo Simulação Brekung16Bits

19
10 Código em VHDL - Módulo ULA

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY ULA IS
PORT (
a, b, slt : IN STD LOGIC vector (1 5 downto 0 ) ;
z e r o : out STD LOGIc ;
s: OUT STD LOGIC vector ( 1 5 downto 0 ) ;
inverteBit : IN STD LOGIC ;
Operacao : IN STD LOGIC vector ( 1 downto 0 ) ;
CarryOut : out STD LOGIc ) ;
END ULA;

ARCHITECTURE somador OF ULA IS


s i g n a l s i n 1 , s i n 2 , s i n 3 , s i n 4 : s t d l o g i c v e c t o r (1 5 downto 0 ) ;

component Mux2X1 i s p o r t (
s e l : in s t d l o g i c ;
b : IN STD LOGIC vector ( 15 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
end component ;

component Mux4X1 i s p o r t (
s e l : in s t d l o g i c v e c t o r ( 1 downto 0 ) ;
s i n 1 , s i n 2 , s i n 3 , s l t : IN STD LOGIC vector (1 5 downto 0 ) ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
end component ;

component BrenKung16Bits i s p o r t (
a , b : IN STD LOGIC VECTOR (1 5 DOWNTO 0 ) ;
s: OUT STD LOGIC VECTOR (1 5 DOWNTO 0 ) ;
c o u t : out STD LOGIC ) ;
end component ;

begin

mux0 : Mux2X1 p o r t map ( i n v e r t e B i t , b , Sin4 ) ;

20
S i n 1 <= a and s i n 4 ;
S i n 2 <= a o r s i n 4 ;

soma : BrenKung 16Bits p o r t map ( a , s i n 4 , s i n 3 , CarryOut ) ;

mux1 : Mux4X1 p o r t map ( Operacao , s i n 1 , s i n 2 , s i n 3 , s l t , s ) ;

process ( sin3 )
begin
i f ( s i n 3 = ”00000000000000000000000000000000”) then
z e r o <= ’ 1 ’ ;
else
z e r o <= ’ 0 ’ ;
end i f ;
end p r o c e s s ;

end a r c h i t e c t u r e ;

Figura 13: Exemplo Simulação ULA

21
11 Código em VHDL - Módulo Pipeline

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;

ENTITY P i p e l i n e IS
PORT (
clk : IN s t d l o g i c ;
reg1 , r e g 2 : IN s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
Sreg1 , Sreg2 : OUT s t d l o g i c v e c t o r ( 1 5 downto 0 )
);
END P i p e l i n e ;

ARCHITECTURE p i p e l i n e OF P i p e l i n e IS
BEGIN
PROCESS( c l k )
BEGIN
IF ( c l k ’EVENT AND c l k = ’ 1 ’ ) THEN
Sreg1 <= r e g 1 ;
Sreg2 <= r e g 2 ;
END IF ;
END PROCESS;

END a r c h i t e c t u r e ;

22
Figura 14: Exemplo Simulação Pipeline

12 Código em VHDL - Módulo CONECTANDO

LIBRARY i e e e ;
USE i e e e . s t d l o g i c 1 1 6 4 . a l l ;
us e IEEE . s t d l o g i c u n s i g n e d . a l l ;
USE i e e e . s t d l o g i c a r i t h . ALL ;

ENTITY CONECTANDO IS PORT (


c l k , e n ab le , e s c r i t a : in s t d l o g i c ;
rd , reg2 , r e g 1 : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
inverteBit : IN STD LOGIC ;
Operacao : IN STD LOGIC vector ( 1 downto 0 ) ;
z e r o , coutULA : out s t d l o g i c ;
e n t r a d a E s c r i t a : i n s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
s r e g 1 , s r e g 2 , saidaULA , saidaram , Smux : b u f f e r
s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
END CONECTANDO;

ARCHITECTURE somador OF CONECTANDO IS


component B a n c o R e g i s t r a d o r IS
PORT ( c l k : in s t d l o g i c ;
rd , reg2 , r e g 1 : i n s t d l o g i c v e c t o r ( 3 downto 0 ) ;
e s c r i t a : i n s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
S a i d a r e g 2 , S a i d a r e g 1 : out s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
END component ;

23
component P i p e l i n e IS
PORT (
c l k : IN s t d l o g i c ;
reg1 , r e g 2 : IN s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
Sreg1 , Sreg2 : OUT s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
END component ;

component ULA IS
PORT (
a , b , s l t : IN STD LOGIC vector (1 5 downto 0 ) ;
z e r o : out STD LOGIc ;
s : OUT STD LOGIC vector (1 5 downto 0 ) ;
i n v e r t e B i t : IN STD LOGIC ;
Operacao : IN STD LOGIC vector ( 1 downto 0 ) ;
CarryOut : out STD LOGIc
);
END component ;

component ram i s
port (
e n a bl e , c l k : i n s t d l o g i c ;
e n d e r e c o : i n i n t e g e r range 0 t o 1 5 ;
dados : i n s t d l o g i c v e c t o r ( 1 5 downto 0 ) ;
s : out s t d l o g i c v e c t o r ( 1 5 downto 0 ) ) ;
end component ;

component Mux21com16bits i s
port (
s e l : in s t d l o g i c ;
a , b : IN STD LOGIC vector (1 5 downto 0 ) ;
y : OUT STD LOGIC vector (1 5 downto 0 ) ) ;
end component ;

s i g n a l e s c r e v e , p1 , p2 : s t d l o g i c v e c t o r (1 6 downto 0 ) ;
s i g n a l c : i n t e g e r range 0 t o 1 5 ;

begin

br0 : B a n c o R e g i s t r a d o r p o r t map( c l k , rd , reg2 , reg1 , Smux ,


sreg1 , sreg2 ) ;

24
p i p e : P i p e l i n e p o r t map ( c l k , s r e g 1 , s r e g 2 , p1 , p2 ) ;

u l a 1 : ULA p o r t map ( p1 , p2 , p1 , z e r o , saidaULA ,


i n v e r t e B i t , Operacao , coutULA ) ;

c <= ( c o n v i n t e g e r ( u n s i g n e d ( saidaULA ) ) ) ;
memram : ram p o r t map ( en ab l e , c l k , c , p2 , saidaram ) ;

mux1 : Mux21com16bits p o r t map( e s c r i t a , saidaram ,


e n t r a d a E s c r i t a , Smux ) ;
end a r c h i t e c t u r e ;

Figura 15: Exemplo Simulação Conectando

25
13 Conclusão
Neste trabalho abordámos o desenvolvimento de uma estrutura de escrita
e leitura na memória de dados dos do processador Mips com barramento de
16 Bits e concluı́mos com exito o desenvolvimento de cada código com sua
respectiva simulação.
Cumprimos todos os objetivos que nos tı́nhamos proposto, uma vez que se
tinha o conhecimento básico para o desenvolvimento e o apoio de nosso Pro-
fessor quando solicitado.
Este trabalho foi de suma importância para o meu aprofundamento deste
tema, pois me permitiu conhecer melhor a linguagem de programação VHDL
em alto nı́vel, instigando o meu conhecimento além do necessário.

26
Bibliografia
PROFA. LUIZA M. R. CODÁ. Apostila de Introdução a VHDL. São Paulo. 2014.

MARLIN P. MENEZES, LIRIA M. SATO, EDSON T. MIDORIKAWA. PROJETO DE


CIRCUITOS COM QUARTUS(R) II 9.1 Versão 1.0. São Paulo. 2011.

PATTERSON, David; HENNESSY, John. Organização e Projeto de Computadores: A


Interface Hardware Software. Rio de Janeiro. Elsevier. 2005.

27

You might also like