Le code de ACC
Le code de ACC
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity ACC is
Port (
accLD : in std_logic;
data_in : in std_logic_vector(15 downto 0);
data_out: out std_logic_vector(15 downto 0);
accZ : out std_logic;
acc15 : out std_logic
);
end ACC;
end Behavioral;
CODE de IR :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity IR is
Port (
data_in : in STD_LOGIC_VECTOR(15 downto 0);
ir_ld : in STD_LOGIC;
data_out : out STD_LOGIC_VECTOR(11 downto 0);
opcode : out STD_LOGIC_VECTOR(3 downto 0)
);
end IR;
architecture Behavioral_IR of IR is
signal data : STD_LOGIC_VECTOR(15 downto 0) := (others => '0');
begin
process(ir_ld, data_in)
begin
if ir_ld = '1' then
data <= data_in;
end if;
end process;
opcode <= data(15 downto 12);
data_out <= data(11 downto 0);
end Behavioral_IR;
CODE de PC:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity PC is
Port (
data_in : in STD_LOGIC_VECTOR(15 downto 0);
pc_ld : in STD_LOGIC;
data_out : out STD_LOGIC_VECTOR(11 downto 0)
);
end PC;
architecture Behavioral_PC of PC is
signal data : STD_LOGIC_VECTOR(15 downto 0) := (others => '0');
begin
process(pc_ld, data_in)
begin
if pc_ld = '1' then
data <= data_in;
end if;
end process;
data_out <= data(11 downto 0);
end Behavioral_PC;
le code de L’UAL :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity UAL is
Port (
inA : in std_logic_vector(15 downto 0);
inB : in std_logic_vector(15 downto 0);
alufs : in std_logic_vector(3 downto 0);
aluOut : out std_logic_vector(15 downto 0);
);
end UAL;
Code de la triangle :
entity triangle is
Port (
data_in : in STD_LOGIC_VECTOR(15 downto 0);
acc_oe : in STD_LOGIC;
data_out : out STD_LOGIC_VECTOR(15 downto 0)
);
end triangle;
architecture Behavioral_ triangle of triangle is
begin
process(data_in, acc_oe)
begin
if acc_oe = '1' then
data_out <= data_in;
else
data_out <= (others => 'Z');
end if;
end process;
end Behavioral_ triangle;
Code de MUX_16 :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Mux_16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
selB : in STD_LOGIC;
S : out STD_LOGIC_VECTOR(15 downto 0)
);
end Mux_16bit;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Mux_12 is
Port (
A : in STD_LOGIC_VECTOR(12 downto 0);
B : in STD_LOGIC_VECTOR(12 downto 0);
selA : in STD_LOGIC;
S : out STD_LOGIC_VECTOR(12 downto 0)
);
end Mux_12bit;
entity ROM is
Port (
addr : in std_logic_vector(11 downto 0); -- 12 bits d’adresse
dataOut : out std_logic_vector(15 downto 0) -- 16 bits de données
);
end ROM;
entity sequencer is
Port (
clk : in std_logic;
reset : in std_logic;
opcode : in std_logic_vector(2 downto 0);
acc_Z : in std_logic;
acc_15 : in std_logic;
selA : out std_logic;
selB : out std_logic;
RnW : out std_logic;
pc_ld : out std_logic;
ir_ld : out std_logic;
acc_ld : out std_logic;
acc_oe : out std_logic;
alufs : out std_logic_vector(1 downto 0)
);
end sequencer;
begin
-- Synchronous process for state transitions
process(clk, reset)
begin
if reset = '1' then
current_state <= IDLE;
elsif rising_edge(clk) then
current_state <= next_state;
end if;
end process;
case current_state is
when FETCH =>
ir_ld <= '1'; -- Load instruction register
RnW <= '1'; -- Read from memory
when DECODE =>
-- Could add additional decoding control signals if needed
null;
end behavioral;