-- `Deep Thought', a softcore CPU implemented on a FPGA -- -- Copyright (C) 2010 Markus Hofstaetter -- Copyright (C) 2010 Martin Perner -- Copyright (C) 2010 Stefan Rebernig -- Copyright (C) 2010 Manfred Schwarz -- Copyright (C) 2010 Bernhard Urban -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . library ieee; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use work.mem_pkg.all; architecture behaviour of rom is signal vsim_bug : std_logic_vector(31 downto 0); begin process(clk) begin if rising_edge(clk) then -- data_out <= ram(to_integer(UNSIGNED(rd_addr))); --case rrrr_addr(10 downto 0) is case vsim_bug(6 downto 0) is -- fibonacci -- when "00000000000" => data_out <= "11101101000000000000000000000000"; -- -- when "00000000001" => data_out <= "11101101001000000000000000000000"; -- -- when "00000000010" => data_out <= "11100111101000000000000000000000"; -- -- -- when "00000000011" => data_out <= "11100001000000000000000000100001"; -- -- when "00000000100" => data_out <= "11101100100000000000001100000000"; -- -- when "00000000101" => data_out <= "00001011011111111111111010000011"; -- -- -- when "00000000110" => data_out <= "11101101000000000000000000001000"; -- -- when "00000000111" => data_out <= "11100111100000000000000000001111"; -- -- when "00000001000" => data_out <= "11100111100000000000000000010011"; -- -- -- -- -- when "00000001001" => data_out <= x"ed080048"; --x"ed080048"; -- -- when "00000001010" => data_out <= x"ed500080"; -- -- when "00000001011" => data_out <= x"fd500002"; -- -- when "00000001100" => data_out <= x"eb000107"; -- when "00000001101" => data_out <= "11101011000000000000011010000010"; --"11101011000000000000000000000010"; -- -- when "00000001110" => data_out <= x"e5088800"; -- when "00000001111" => data_out <= x"e0150800"; -- when "00000010000" => data_out <= x"e7010000"; -- when "00000010001" => data_out <= x"ec800000"; -- when "00000010010" => data_out <= x"0b000008"; -- when "00000010011" => data_out <= x"e1910020"; -- when "00000010100" => data_out <= x"eb7ffe07"; -- when "00000010101" => data_out <= x"e7197ffc"; -- when "00000010110" => data_out <= x"e0018000"; -- -- when "00000010111" => data_out <= x"e1110020"; -- when "00000011000" => data_out <= x"e7810000"; -- when "00000011001" => data_out <= x"eb00000a"; -- -- -- when "00000011010" => data_out <= x"ed290080"; -- when "00000011011" => data_out <= x"e1080000"; -- -- when "00000011100" => data_out <= x"e78a8000"; -- -- when "00000011101" => data_out <= x"ed510058"; -- when "00000011110" => data_out <= x"e7850000"; -- uart echo --1;00000000;ed010058;ldi r0, 0x200B;; --1;00000004;ed090060;ldi r1, 0x200C;; --1;00000008;ed110080;ldi r2, 0x2010;; --1;0000000c;e7188000;ldw r3, 0(r1);; --1;00000010;ec1a0000;cmp r3, r4;; --1;00000014;1b7ffd81;breq 0;; --1;00000018;e7980000;stw r3, 0(r0);; --1;0000001c;e7990000;stw r3, 0(r2);; --1;00000020;e1218000;addi r4, r3, 0;; --1;00000024;eb7ffb81;br 0;; -- when "0000000" => data_out <= x"ed010058"; -- when "0000001" => data_out <= x"ed090060"; -- when "0000010" => data_out <= x"ed110080"; --x"e7188000"; f -- when "0000011" => data_out <= x"e7188000"; --x"ec1a0000"; -- when "0000100" => data_out <= x"ec1a0000"; -- when "0000101" => data_out <= x"1b7ffe01"; -- when "0000110" => data_out <= x"e7990000"; -- f -- when "0000111" => data_out <= x"e7980000"; -- when "0001000" => data_out <= x"e1218000"; -- when "0001001" => data_out <= x"eb7ffb81"; --1;00000000;ed010058;ldi r0, 0x200B;;; --1;00000004;ed090060;ldi r1, 0x200C;;; --1;00000008;ed110080;ldi r2, 0x2010;;; --1;0000000c;ed390078;ldi r7, 0x200F;;; --1;00000010;ed480012;ldih r9, 0x0002;;; --1;00000014;e7438000;ldw r8, 0(r7);;; --1;00000018;e254c000;and r10, r9, r8;;; --1;0000001c;07188000;ldwnz r3, 0(r1);;; --1;00000020;07980000;stwnz r3, 0(r0);;; --1;00000024;07990000;stwnz r3, 0(r2);;; --1;00000028;eb7ffb01;br 0;;; --uart test: -- when "0000000" => data_out <= x"ed010058"; -- when "0000001" => data_out <= x"ed090060"; -- when "0000010" => data_out <= x"ed110080"; --x"e7188000"; f -- when "0000011" => data_out <= x"ed390000"; --x"ec1a0000"; -- when "0000100" => data_out <= x"ed480012"; -- when "0000101" => data_out <= x"e7438000"; -- when "0000110" => data_out <= x"e254c000"; -- f -- when "0000111" => data_out <= x"07188000"; -- when "0001000" => data_out <= x"07980000"; -- when "0001001" => data_out <= x"07990000"; -- when "0001010" => data_out <= x"eb7ffb81"; ------------------------------------------- -- when "00000000000" => data_out <= x"ed000000"; -- when "00000000001" => data_out <= x"ed080008"; -- when "00000000010" => data_out <= x"e9880000"; --x"e7188000"; f -- when "00000000011" => data_out <= x"e5088400"; --x"ec1a0000"; -- when "00000000100" => data_out <= x"e9880001"; -- when "00000000101" => data_out <= x"e7180000"; -- when "00000000110" => data_out <= x"e9200001"; -- f -- when "00000000111" => data_out <= x"e7a00004"; -- when "00000001000" => data_out <= x"e7280004"; -- -- when "00000001001" => data_out <= x"eb7ffb81"; when "0000000" => data_out <= x"eb000183"; -- br+ main when "0000001" => data_out <= x"eb000103"; -- br+ main when "0000010" => data_out <= x"eb000008"; -- ret when "0000011" => data_out <= x"ed510000"; -- ldi r10, UART_BASE@lo when "0000100" => data_out <= x"ed500002"; -- ldih r10, UART_BASE@hi when "0000101" => data_out <= x"ed590180"; -- ldi r11, PBASE@lo when "0000110" => data_out <= x"ed580002"; -- ldih r11, PBASE@hi when "0000111" => data_out <= x"eb000985"; -- call recv_byte when "0001000" => data_out <= x"e4088800"; -- xor r1, r1, r1 when "0001001" => data_out <= x"ec800240"; -- cmpi r0, 0x48 when "0001010" => data_out <= x"1b001703"; -- breq+ bt_H when "0001011" => data_out <= x"eb7ffe01"; -- br poll when "0001100" => data_out <= x"e71d0000"; -- ldw r3, UART_STATUS(r10) when "0001101" => data_out <= x"e2980008"; -- andx r3, UART_TRANS_EMPTY when "0001110" => data_out <= x"0b7fff03"; -- brnz+ send_byte when "0001111" => data_out <= x"e78d0008"; -- stw r1, UART_TRANS(r10) when "0010000" => data_out <= x"eb000008"; -- ret when "0010001" => data_out <= x"e5008008"; -- lrs r0, r1, 0 when "0010010" => data_out <= x"eb7ffd05"; -- call send_byte when "0010011" => data_out <= x"e500a008"; -- lrs r0, r1, 8 when "0010100" => data_out <= x"eb7ffc05"; -- call send_byte when "0010101" => data_out <= x"e500c008"; -- lrs r0, r1, 16 when "0010110" => data_out <= x"eb7ffb05"; -- call send_byte when "0010111" => data_out <= x"e500e008"; -- lrs r0, r1, 24 when "0011000" => data_out <= x"eb7ffa05"; -- call send_byte when "0011001" => data_out <= x"eb000008"; -- ret when "0011010" => data_out <= x"e71d0000"; -- ldw r3, UART_STATUS(r10) when "0011011" => data_out <= x"e2980010"; -- andx r3, UART_RECV_NEW when "0011100" => data_out <= x"1b7fff03"; -- brzs+ recv_byte when "0011101" => data_out <= x"e4000000"; -- xor r0, r0, r0 when "0011110" => data_out <= x"e705000c"; -- ldw r0, UART_RECV(r10) when "0011111" => data_out <= x"eb000008"; -- ret when "0100000" => data_out <= x"e4088800"; -- xor r1, r1, r1 when "0100001" => data_out <= x"eb7ffc85"; -- call recv_byte when "0100010" => data_out <= x"e3080800"; -- or r1, r0, r1 when "0100011" => data_out <= x"eb7ffb85"; -- call recv_byte when "0100100" => data_out <= x"e508a000"; -- lls r1, r1, 8 when "0100101" => data_out <= x"e3080800"; -- or r1, r0, r1 when "0100110" => data_out <= x"eb7ffa05"; -- call recv_byte when "0100111" => data_out <= x"e508a000"; -- lls r1, r1, 8 when "0101000" => data_out <= x"e3080800"; -- or r1, r0, r1 when "0101001" => data_out <= x"eb7ff885"; -- call recv_byte when "0101010" => data_out <= x"e508a000"; -- lls r1, r1, 8 when "0101011" => data_out <= x"e3000800"; -- or r0, r0, r1 when "0101100" => data_out <= x"e4088800"; -- xor r1, r1, r1 when "0101101" => data_out <= x"eb000008"; -- ret when "0101110" => data_out <= x"eb7ff605"; -- call recv_byte when "0101111" => data_out <= x"e4088800"; -- xor r1, r1, r1 when "0110000" => data_out <= x"ec8002b8"; -- cmpi r0, 0x57 when "0110001" => data_out <= x"1b000501"; -- breq- bt_W when "0110010" => data_out <= x"ec800288"; -- cmpi r0, 0x51 when "0110011" => data_out <= x"1b000881"; -- breq- bt_Q when "0110100" => data_out <= x"ec8002a0"; -- cmpi r0, 0x54 when "0110101" => data_out <= x"1b000c01"; -- breq- bt_T when "0110110" => data_out <= x"ec800250"; -- cmpi r0, 0x4a when "0110111" => data_out <= x"1b000e81"; -- breq- bt_J when "0111000" => data_out <= x"ed080278"; -- ldi r1, 0x4f when "0111001" => data_out <= x"eb7fe985"; -- call send_byte when "0111010" => data_out <= x"eb7ffa01"; -- br bootrom when "0111011" => data_out <= x"ed0802b8"; -- ldi r1, 0x57 when "0111100" => data_out <= x"eb7fe805"; -- call send_byte when "0111101" => data_out <= x"eb7ff185"; -- call recv_word when "0111110" => data_out <= x"e7858004"; -- stw r0, PADDR(r11) when "0111111" => data_out <= x"eb7ff085"; -- call recv_word when "1000000" => data_out <= x"e7858008"; -- stw r0, PDATA(r11) when "1000001" => data_out <= x"ed080220"; -- ldi r1, 0x44 when "1000010" => data_out <= x"eb7fe505"; -- call send_byte when "1000011" => data_out <= x"eb7ff581"; -- br bootrom when "1000100" => data_out <= x"ed080288"; -- ldi r1, 0x51 when "1000101" => data_out <= x"eb7fe385"; -- call send_byte when "1000110" => data_out <= x"eb7fed05"; -- call recv_word when "1000111" => data_out <= x"e1300000"; -- addi r6, r0, 0 when "1001000" => data_out <= x"eb7fec05"; -- call recv_word when "1001001" => data_out <= x"e7830000"; -- stw r0, 0(r6) when "1001010" => data_out <= x"ed080208"; -- ldi r1, 0x41 when "1001011" => data_out <= x"eb7fe085"; -- call send_byte when "1001100" => data_out <= x"eb7ff101"; -- br bootrom when "1001101" => data_out <= x"eb7fe985"; -- call recv_word when "1001110" => data_out <= x"e1100000"; -- mov r2, r0 when "1001111" => data_out <= x"ed080238"; -- ldi r1, 0x47 when "1010000" => data_out <= x"eb7fde05"; -- call send_byte when "1010001" => data_out <= x"e7090000"; -- ldw r1, 0(r2) when "1010010" => data_out <= x"eb7fdf85"; -- call send_word when "1010011" => data_out <= x"eb7fed81"; -- br bootrom -- just nop until rom end! when others => data_out <= x"fd000000"; end case; end if; end process; vsim_bug(6 downto 0) <= rd_addr; vsim_bug(31 downto 7) <= (others => '0'); end architecture behaviour;