80 likes | 180 Views
Processador. 8 bits de dados e 16 bits de endereço. I/O. ROM. RAM. master. 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,
E N D
Processador 8 bits de dados e 16 bits de endereço I/O ROM RAM master 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); STAi, 128, ADDR_SEG, slave slave slave STAi, 128, ADDR_LED, ----------------------------------------------------------------------------- -- Memory mapped addresses ----------------------------------------------------------------------------- constant ADDR_LED : addr_type := 0; constant ADDR_SEG : addr_type := 1; constant ADDR_SWITCH : addr_type := 2;
-- 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
-- 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
-- load constant to accu constant LDCi : data_type := 2;; 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); Acumulador -- store accu to address constant STAi : data_type := 3; Acumulador RAM x”4000” x”80” x”40” x”40” x”00” x”00” x”00” -- show on 7-segment STAi, 128, ADDR_SEG, -- add data from address to accu constant ADDi : data_type := 16; Acumulador + < > -- jump when carry flag is not set constant JNCi : data_type := 34;
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);
Preparar um programa utilizando instruções de processador para fazer tarefas 1-3. Todas as tarefas devem ser acabadas durante a aula 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
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
Tarefa 3. Implementar multiplicação de dois inteiros com valores possíveis 0,...,9. Apresente o resultado em código binário