на тему рефераты Информационно-образоательный портал
Рефераты, курсовые, дипломы, научные работы,
на тему рефераты
на тему рефераты
МЕНЮ|
на тему рефераты
поиск
Моделирование процессора (операционного и управляющего автоматов) для выполнения набора машинных команд
p align="left">end if;

if Reset='1'then Sout<= «000000»;

end if;

end process;

end Add;

Временная диаграмма работы счетчика Add для УУ:

Описание ALU:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

use IEEE.STD_LOGIC_signed.all;

use IEEE.std_logic_arith.all;

entity ALU is

port (B: in std_logic_vector (7 downto 0);

A: in std_logic_vector (7 downto 0);

SADD: in std_logic;

CLK: in std_logic;

Q: out std_logic_vector (7 downto 0);

FC: out std_logic;

FZ: out std_logic);

end ALU;

architecture ALU of ALU is

signal rez: std_logic_vector (7 downto 0):= «00000000»;

begin

process(CLK)

begin

if CLK='0' and CLK'event then FC<='0';

if SADD='1' then

Q<= CONV_STD_LOGIC_VECTOR((CONV_INTEGER ('0'& A)+CONV_INTEGER ('0'& B)), 9) (7 downto 0) after 4 ns;

FC<= CONV_STD_LOGIC_VECTOR((CONV_INTEGER ('0'& A)+CONV_INTEGER ('0'& B)), 9) (8) after 4 ns;

else Q<= «00000000»;

end if;

if A= «00000000» then FZ<='0';

else FZ<='1';

end if;

end if;

end process;

end ALU;

Временная диаграмма работы устройства сложения ALU:

Описание счетчика микрокоманд PC:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

use IEEE.STD_LOGIC_signed.all;

entity PC is

port (RST: in std_logic;

CLK: in std_logic;

PCIn: in std_logic;

IncPC: in std_logic;

AdrIn: in std_logic_vector (7 downto 0);

AdrOut: out std_logic_vector (7 downto 0));

end PC;

architecture PC of PC is

signal reg: std_logic_vector (7 downto 0);

begin

process (CLK, RST)

begin

If CLK='0' and CLK'event and PCIn='1' then reg<=AdrIn;

end if;

If CLK='0' and CLK'event and IncPC='1' then reg<=reg+ «0000001» after 2ns;

end if;

If CLK='1' and CLK'event then AdrOut<=reg after 2ns;

end if;

if RST='1' then reg<= «00000000»;

end if;

end process;

end PC;

Временная диаграмма работы счетчика микрокоманд PC:

Описание регистров РОН и их выбора:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

entity R0 is

port (RST: in std_logic;

CLK: in std_logic;

C: in std_logic;

RIn: in std_logic;

ROut: in std_logic;

DataIn: in std_logic_vector (7 downto 0);

DataOut: out std_logic_vector (7 downto 0));

end R0;

architecture R0 of R0 is

signal regist: std_logic_vector (7 downto 0);

begin

process (CLK, RST)

begin

if CLK='0' and CLK'event and RIn='1'and C='1' then regist<=DataIN;

end if;

if CLK='0' and CLK'event and ROut='1'and C='1' then DataOut<=regist after 3 ns;

end if;

if CLK='0' and CLK'event and ROut='0' then DataOut<= «ZZZZZZZZ» after 3 ns;

end if;

if RST='1' then regist<= «00000000»;

end if;

end process;

end R0;

-

library IEEE;

use IEEE.STD_LOGIC_1164.all;

entity RDC is

port (Number: in std_logic_vector (7 downto 0);

RDCIn: in std_logic;

R1: out std_logic;

R2: out std_logic;

R3: out std_logic;

R4: out std_logic);

end RDC;

architecture RDC of RDC is

begin

process(RDCIn)

begin

if RDCIn='1' and RDCIn'event then

R1<='0';

R2<='0';

R3<='0';

R4<='0';

if Number= «00000001» then R1<='1'after 2ns;

end if;

if Number= «00000010» then R2<='1'after 2ns;

end if;

if Number= «00000011» then R3<='1'after 2ns;

end if;

if Number= «00000100» then R4<='1'after 2ns;

end if;

end if;

end process;

end RDC;

Временная диаграмма работы выбора регистров РОН RDC:

Описание памяти RAM:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

use IEEE.STD_LOGIC_signed.all;

entity RAM is

port (RdWr: in std_logic;

CS: in std_logic;

Adr: in std_logic_vector (7 downto 0);

Data: inout std_logic_vector (7 downto 0));

end RAM;

architecture RAM of RAM is

type MemoryType is array (0 to 8) of std_logic_vector (7 downto 0);

signal Memory: MemoryType:=(

«00000000», - mov A,#d

«00110011», -#d

«00000001», - mov R,#d

«00000001», - number R

«11110110», -#d

«00000010», - add A, Rn

«00000001», - number R

«00000100», - JBC bit, rel

«00000000»); - restart

begin

process (RdWr, CS, Adr)

begin

if RdWr='1' and CS='1' then Data<=Memory (CONV_INTEGER ('0'& Adr)) after 3ns;

end if;

if RdWr='0' and CS='1' then Memory (CONV_INTEGER ('0'& Adr))<=Data;

end if;

end process;

end RAM;

Описание регистра в один бит:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

entity R_1bit is

port (reg_in, IE: in std_logic;

CLK, Zero:in std_logic;

reg_out: out std_logic);

end R_1bit;

architecture R_1bit of R_1bit is

signal regist: std_logic;

begin

process(CLK)

begin

reg_out<= regist;

if CLK='0' and CLK'event and IE='1' then regist<=reg_in after 2ns;

elsif Zero='1' then regist<='0' after 2ns;

end if;

end process;

end R_1bit;

-

Временная диаграмма работы памяти МПА RAM:

Описание регистра-аккумулятора RA:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

entity RA is

port (

CLK: in std_logic;

RAIn: in std_logic;

DIn: in std_logic_vector (7 downto 0);

DOut: out std_logic_vector (7 downto 0)

);

end RA;

architecture RA of RA is

signal reg: std_logic_vector (7 downto 0):= «00000000»;

begin

process (CLK, RAIn)

begin

DOut<=reg after 3 ns;

if CLK='0' and CLK'event and RAIn='1' then

reg<=DIn;

end if;

end process;

end RA;

Временная диаграмма работы регистра-аккумулятора RA:

Описание узла памяти Memory:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

use IEEE.STD_LOGIC_signed.all;

entity Memory is

port (Adr: in std_logic_vector (5 downto 0);

RD: in std_logic;

MrOut: out std_logic;

InstrCom: out std_logic_vector (0 to 27));

end Memory;

architecture Memory of Memory is

type MemoryType is array (0 to 59) of std_logic_vector (0 to 27);

signal Memory: MemoryType;

begin

Memory(0)<= «000»& «000000»& «0000000»& «0000000»& «0000»& «0»;

Memory(1)<= «000»& «000000»& «0001000»& «0000000»& «0000»& «0»; - MarIn

Memory(2)<= «000»& «000000»& «0000110»& «0000000»& «0000»& «0»; - RdWr, CS

Memory(3)<= «000»& «000000»& «0000001»& «0000000»& «0000»& «0»; - MbrIn

Memory(4)<= «000»& «000000»& «0000000»& «1000000»& «0000»& «0»; - MbrOut

Memory(5)<= «000»& «000000»& «0010000»& «0000000»& «0000»& «0»; - IrIn

Memory(6)<= «100»& «000000»& «0000000»& «0000000»& «0000»& «0»; - Instr0

- mov A,#d

Memory(7) <= «000»& «000000»& «0100000»& «0000000»& «0000»& «0»; - IncPC

Memory(8) <= «000»& «000000»& «0001000»& «0000000»& «0000»& «0»; - MarIn

Memory(9) <= «000»& «000000»& «0000110»& «0000000»& «0000»& «0»; - RdWr, CS

Memory(10)<= «000»& «000000»& «0000001»& «0000000»& «0000»& «0»; - MbrIn

Memory(11)<= «000»& «000000»& «0000000»& «1000000»& «0000»& «0»; - MbrOut

Memory(12)<= «000»& «000000»& «0000000»& «0000001»& «0000»& «0»; - RAin

Memory(13)<= «001»& «000000»& «0100000»& «0000000»& «0000»& «0»; - Instr2, IncPC

- mov Rn,#d

Memory(14)<= «000»& «000000»& «0100000»& «0000000»& «0000»& «0»; - IncPC

Memory(15)<= «000»& «000000»& «0001000»& «0000000»& «0000»& «0»; - MarIn

Memory(16)<= «000»& «000000»& «0000110»& «0000000»& «0000»& «0»; - RdWr, CS

Memory(17)<= «000»& «000000»& «0000001»& «0000000»& «0000»& «0»; - MbrIn

Memory(18)<= «000»& «000000»& «0000000»& «1000000»& «0000»& «0»; - MbrOut

Memory(19)<= «000»& «000000»& «0000000»& «0000000»& «0010»& «0»; - RDCIn

Memory(20)<= «000»& «000000»& «0100000»& «0000000»& «0000»& «0»; - IncPC

Memory(21)<= «000»& «000000»& «0001000»& «0000000»& «0000»& «0»; - MarIn

Memory(22)<= «000»& «000000»& «0000110»& «0000000»& «0000»& «0»; - RdWr, CS

Memory(23)<= «000»& «000000»& «0000001»& «0000000»& «0000»& «0»; - MbrIn

Memory(24)<= «000»& «000000»& «0000000»& «1000000»& «0000»& «0»; - MbrOut

Memory(25)<= «000»& «000000»& «0000000»& «0000000»& «1000»& «0»; - RIn

Memory(26)<= «001»& «000000»& «0100000»& «0000000»& «0000»& «0»; - Instr2, IncPC

- add A, Rn

Memory(27)<= «000»& «000000»& «0100000»& «0000000»& «0000»& «0»; - IncPC

Memory(28)<= «000»& «000000»& «0001000»& «0000000»& «0000»& «0»; - MarIn

Memory(29)<= «000»& «000000»& «0000110»& «0000000»& «0000»& «0»; - RdWr, CS

Memory(30)<= «000»& «000000»& «0000001»& «0000000»& «0000»& «0»; - MbrIn

Memory(31)<= «000»& «000000»& «0000000»& «1000000»& «0000»& «0»; - MbrOut

Memory(32)<= «000»& «000000»& «0000000»& «0000000»& «0010»& «0»; - RDCIn

Memory(33)<= «000»& «000000»& «0000000»& «0000000»& «0100»& «0»; - ROut

Memory(34)<= «000»& «000000»& «0000000»& «0000000»& «0001»& «0»; - SADD

Memory(35)<= «000»& «000000»& «0000000»& «0001000»& «0000»& «0»; - RZin

Memory(36)<= «000»& «000000»& «0000000»& «0000100»& «0000»& «0»; - RZout

Memory(37)<= «000»& «000000»& «0000000»& «0000001»& «0000»& «0»; - RAin

Memory(38)<= «001»& «000000»& «0100000»& «0000000»& «0000»& «0»; - Instr2, IncPC

- JBC

Страницы: 1, 2, 3, 4



© 2003-2013
Рефераты бесплатно, курсовые, рефераты биология, большая бибилиотека рефератов, дипломы, научные работы, рефераты право, рефераты, рефераты скачать, рефераты литература, курсовые работы, реферат, доклады, рефераты медицина, рефераты на тему, сочинения, реферат бесплатно, рефераты авиация, рефераты психология, рефераты математика, рефераты кулинария, рефераты логистика, рефераты анатомия, рефераты маркетинг, рефераты релиния, рефераты социология, рефераты менеджемент.