processador 8 bits de dados e 16 bits de endereço rom ram i/o master slave constant mem : mem_type...

8

Click here to load reader

Upload: zoe-orr

Post on 28-Mar-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

Processador

8 bits de dados e 16 bits de endereço

ROM RAM I/O

master

slave slave slave

constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000 STAi, 64, 0, -- show on 7-segment STAi, 128, ADDR_SEG, -- increment with value at 0x4000 ADDi, 64, 0, -- if no carry out repeat at address 5 JNCi, 0, 5, -- turn on LED(7) LDCi, 128, STAi, 128, ADDR_LED, -- endless loop to address 19 JMPi, 0, 19, others => 0);

----------------------------------------------------------------------------- -- Memory mapped addresses ----------------------------------------------------------------------------- constant ADDR_LED : addr_type := 0; constant ADDR_SEG : addr_type := 1; constant ADDR_SWITCH : addr_type := 2;

STAi, 128, ADDR_LED,

STAi, 128, ADDR_SEG,

Page 2: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

-- Load and store constant LDAi : data_type := 1; -- load from address to accu constant LDCi : data_type := 2; -- load constant to accu constant STAi : data_type := 3; -- store accu to address

constant LDXi : data_type := 8; -- load index register with constant constant INCXi : data_type := 9; -- increment index register constant DECXi : data_type := 10; -- decrement index register

-- Arithmetic constant ADDi : data_type := 16; -- add data from address to accu constant SUBi : data_type := 17; -- sub data from address from accu constant NOTi : data_type := 18; -- sub data from address from accu constant ANDi : data_type := 19; -- AND data from address with accu constant ORi : data_type := 20; -- OR data from address with accu constant XORi : data_type := 21; -- XOR data from address with accu

Page 3: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

-- Shift constant SLLi : data_type := 24; -- shift logical left constant SLRi : data_type := 25; -- shift logical right constant ROLi : data_type := 26; -- rotate left constant RORi : data_type := 27; -- rotate right

-- Jump constant JMPi : data_type := 32; -- jump to address constant JCi : data_type := 33; -- jump when carry flag is set constant JNCi : data_type := 34; -- jump when carry flag is not set constant JZi : data_type := 35; -- jump when zero flag is set constant JNZi : data_type := 36; -- jump when zero flag is not set

Page 4: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000 STAi, 64, 0, -- show on 7-segment STAi, 128, ADDR_SEG, -- increment with value at 0x4000 ADDi, 64, 0, -- if no carry out repeat at address 5 JNCi, 0, 5, -- turn on LED(7) LDCi, 128, STAi, 128, ADDR_LED, -- endless loop to address 19 JMPi, 0, 19, others => 0);

-- load constant to accuconstant LDCi : data_type := 2;;

Acumulador

-- store accu to addressconstant STAi : data_type := 3;

AcumuladorRAMx”40”x”00”

x”4000”

-- show on 7-segment STAi, 128, ADDR_SEG,

x”80”x”00”

-- add data from address to accuconstant ADDi : data_type := 16;

x”40”x”00” Acumulador+< >

-- jump when carry flag is not setconstant JNCi : data_type := 34;

Page 5: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

constant mem : mem_type := ( -- load increment LDCi, 1, -- endereço 0,1 -- store it at 0x4000 STAi, 64, 0, -- endereço 2,3,4 -- show on 7-segment STAi, 128, ADDR_SEG, -- endereço 5,6,7 -- increment with value at 0x4000 ADDi, 64, 0, -- endereço 8,9,10 -- if no carry out repeat at address 5 JNCi, 0, 5, -- endereço 11,12,13 -- turn on LED(7) LDCi, 128, -- endereço 14, 15 STAi, 128, ADDR_LED, -- endereço 16,17,18 -- endless loop to address 19 JMPi, 0, 19, -- endereço 19,20,21 others => 0);

Page 6: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

Tarefa 1.Contar até 10 e depois terminar a execução. Utilize leds para mostrar a sequência seguinte de códigos 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1001, 1010

Preparar um programa utilizando instruções de processador para fazer tarefas 1-3.Todas as tarefas devem ser acabadas durante a aula

Page 7: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

Tarefa 2.Utilizar leds para mostrar códigos seguintes: 1010, 1001, 1000, 0111, 0110, 0101, 0100, 0011, 0010, 0001. Depois terminar a execução do projecto

Page 8: Processador 8 bits de dados e 16 bits de endereço ROM RAM I/O master slave constant mem : mem_type := ( -- load increment LDCi, 1, -- store it at 0x4000

Tarefa 3.Implementar multiplicação de dois inteiros com valores possíveis 0,...,9. Apresente o resultado em código binário