Line 1... |
Line 1... |
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
|
|
entity hellfire_cpu_if is
|
entity hfrisc_soc is
|
generic(
|
generic(
|
address_width: integer := 14;
|
address_width: integer := 14;
|
memory_file : string := "code.txt";
|
memory_file : string := "code.txt";
|
uart_support : string := "yes"
|
uart_support : string := "yes"
|
);
|
);
|
Line 12... |
Line 12... |
reset_in: in std_logic;
|
reset_in: in std_logic;
|
int_in: in std_logic;
|
int_in: in std_logic;
|
uart_read: in std_logic;
|
uart_read: in std_logic;
|
uart_write: out std_logic;
|
uart_write: out std_logic;
|
|
|
|
extio_in: in std_logic_vector(7 downto 0);
|
|
extio_out: out std_logic_vector(7 downto 0);
|
|
|
ram_address: out std_logic_vector(31 downto 2);
|
ram_address: out std_logic_vector(31 downto 2);
|
ram_data: inout std_logic_vector(31 downto 0);
|
ram_data: inout std_logic_vector(31 downto 0);
|
ram_ce1_n: out std_logic;
|
ram_ce1_n: out std_logic;
|
ram_ub1_n: out std_logic;
|
ram_ub1_n: out std_logic;
|
ram_lb1_n: out std_logic;
|
ram_lb1_n: out std_logic;
|
Line 23... |
Line 26... |
ram_ub2_n: out std_logic;
|
ram_ub2_n: out std_logic;
|
ram_lb2_n: out std_logic;
|
ram_lb2_n: out std_logic;
|
ram_we_n: out std_logic;
|
ram_we_n: out std_logic;
|
ram_oe_n: out std_logic
|
ram_oe_n: out std_logic
|
);
|
);
|
end hellfire_cpu_if;
|
end hfrisc_soc;
|
|
|
architecture interface of hellfire_cpu_if is
|
architecture top_level of hfrisc_soc is
|
signal clock, boot_enable, ram_enable_n, stall, stall_cpu, busy_cpu, irq_cpu, irq_ack_cpu, data_access_cpu, ram_dly, rff1, reset: std_logic;
|
signal clock, boot_enable, ram_enable_n, stall, stall_cpu, irq_cpu, irq_ack_cpu, data_access_cpu, ram_dly, rff1, reset: std_logic;
|
signal address, data_read, data_write, data_read_boot, data_read_ram, irq_vector_cpu, inst_addr_cpu, inst_in_cpu, data_addr_cpu, data_in_cpu, data_out_cpu: std_logic_vector(31 downto 0);
|
signal address, data_read, data_write, data_read_boot, data_read_ram, irq_vector_cpu, address_cpu, data_in_cpu, data_out_cpu: std_logic_vector(31 downto 0);
|
signal ext_irq: std_logic_vector(7 downto 0);
|
|
signal data_we, data_w_cpu: std_logic_vector(3 downto 0);
|
signal data_we, data_w_cpu: std_logic_vector(3 downto 0);
|
|
|
signal we_n_next : std_logic;
|
signal we_n_next : std_logic;
|
signal we_n_reg : std_logic;
|
signal we_n_reg : std_logic;
|
signal data_reg : std_logic_vector(31 downto 0);
|
signal data_reg : std_logic_vector(31 downto 0);
|
Line 72... |
Line 74... |
reset <= rff1;
|
reset <= rff1;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
|
process (reset, clock, ext_irq, ram_enable_n)
|
process (reset, clock, ram_enable_n)
|
begin
|
begin
|
if reset = '1' then
|
if reset = '1' then
|
ram_dly <= '0';
|
ram_dly <= '0';
|
ext_irq <= x"00";
|
|
elsif clock'event and clock = '1' then
|
elsif clock'event and clock = '1' then
|
ram_dly <= not ram_enable_n;
|
ram_dly <= not ram_enable_n;
|
ext_irq <= "0000000" & int_in;
|
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
stall <= '0';
|
stall <= '0';
|
boot_enable <= '1' when address(31 downto 28) = "0000" else '0';
|
boot_enable <= '1' when address(31 downto 28) = "0000" else '0';
|
Line 92... |
Line 92... |
-- HF-RISC core
|
-- HF-RISC core
|
core: entity work.datapath
|
core: entity work.datapath
|
port map( clock => clock,
|
port map( clock => clock,
|
reset => reset,
|
reset => reset,
|
stall => stall_cpu,
|
stall => stall_cpu,
|
busy => busy_cpu,
|
|
irq_vector => irq_vector_cpu,
|
irq_vector => irq_vector_cpu,
|
irq => irq_cpu,
|
irq => irq_cpu,
|
irq_ack => irq_ack_cpu,
|
irq_ack => irq_ack_cpu,
|
inst_addr => inst_addr_cpu,
|
address => address_cpu,
|
inst_in => inst_in_cpu,
|
|
data_addr => data_addr_cpu,
|
|
data_in => data_in_cpu,
|
data_in => data_in_cpu,
|
data_out => data_out_cpu,
|
data_out => data_out_cpu,
|
data_w => data_w_cpu,
|
data_w => data_w_cpu,
|
data_access => data_access_cpu
|
data_access => data_access_cpu
|
);
|
);
|
Line 117... |
Line 114... |
reset => reset,
|
reset => reset,
|
|
|
stall => stall,
|
stall => stall,
|
|
|
stall_cpu => stall_cpu,
|
stall_cpu => stall_cpu,
|
busy_cpu => busy_cpu,
|
|
irq_vector_cpu => irq_vector_cpu,
|
irq_vector_cpu => irq_vector_cpu,
|
irq_cpu => irq_cpu,
|
irq_cpu => irq_cpu,
|
irq_ack_cpu => irq_ack_cpu,
|
irq_ack_cpu => irq_ack_cpu,
|
inst_addr_cpu => inst_addr_cpu,
|
address_cpu => address_cpu,
|
inst_in_cpu => inst_in_cpu,
|
|
data_addr_cpu => data_addr_cpu,
|
|
data_in_cpu => data_in_cpu,
|
data_in_cpu => data_in_cpu,
|
data_out_cpu => data_out_cpu,
|
data_out_cpu => data_out_cpu,
|
data_w_cpu => data_w_cpu,
|
data_w_cpu => data_w_cpu,
|
data_access_cpu => data_access_cpu,
|
data_access_cpu => data_access_cpu,
|
|
|
addr_mem => address,
|
addr_mem => address,
|
data_read_mem => data_read,
|
data_read_mem => data_read,
|
data_write_mem => data_write,
|
data_write_mem => data_write,
|
data_we_mem => data_we,
|
data_we_mem => data_we,
|
extio_in => ext_irq,
|
extio_in => extio_in,
|
extio_out => open,
|
extio_out => extio_out,
|
uart_read => uart_read,
|
uart_read => uart_read,
|
uart_write => uart_write
|
uart_write => uart_write
|
);
|
);
|
|
|
-- instruction and data memory (boot RAM)
|
-- instruction and data memory (boot RAM)
|
Line 200... |
Line 194... |
we_n_next <= '1';
|
we_n_next <= '1';
|
ram_oe_n <= '1';
|
ram_oe_n <= '1';
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
end interface;
|
end top_level;
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|