bootromfun: led2 geht aus wenn ich was uebern uart schicke \o/
authorBernhard Urban <lewurm@gmail.com>
Sun, 9 Jan 2011 01:03:55 +0000 (02:03 +0100)
committerBernhard Urban <lewurm@gmail.com>
Sun, 9 Jan 2011 01:03:55 +0000 (02:03 +0100)
d.h. instruktionen werden nun von RAM gelesen
ich lass die led2 drin, die wird mir noch sicher oefters hilfreich sein...
(fuer die altera boards (tilab & stefan) muss das led noch konfiguriert werden!)

3_test/uartint.s [new file with mode: 0644]
3b_sim/sim.cpp
cpu/src/core_pkg.vhd
cpu/src/core_top_s3e.vhd
cpu/src/fetch_stage.vhd
cpu/src/fetch_stage_b.vhd
cpu/src/rom_b.vhd
spartan3e/spartan3e.ucf

diff --git a/3_test/uartint.s b/3_test/uartint.s
new file mode 100644 (file)
index 0000000..bf8e43d
--- /dev/null
@@ -0,0 +1,65 @@
+.text
+start:
+       br+ main ;br+ 
+       call+ uartrdy ;call+ 0x80(128, 128)
+       ret
+main:
+       ldi r1, 0x200b ;ldi r1, 8203
+       ldi r2, 0x200c ;ldi r2, 8204
+       ldi r3, 0x2010 ;ldi r3, 8208
+       ldi r4, 0x2024 ;ldi r4, 8228
+       ldi r5, 3
+       stw r5, 0(r4)
+       br+ start
+       ; stwnv r5, 0(r4)
+uartrdy:
+       ; load instructions into ram
+       ldi r8, 0x2037 ; paddr
+       ldi r9, 0x203b ; pdata
+
+    ; x"e7390000"; -- ldw r7, 0(r2)
+       xor r10, r10, r10
+       stw r10, 0(r8)
+       xor r10, r10, r10
+       ldi r10, 0xe739
+       lls r10, r10, 16
+       stw r10, 0(r9)
+
+       ;x"e7b98000"; -- stw r7, 0(r3)
+       xor r10, r10, r10
+       ldi r10, 1
+       stw r10, 0(r8)
+       xor r10, r10, r10
+       ldi r10, 0xe7b9
+       lls r10, r10, 8
+       addi r10, r10, 0x80
+       lls r10, r10, 8
+       stw r10, 0(r9)
+
+       ;x"e7b88000"; -- stw r7, 0(r1)
+       xor r10, r10, r10
+       ldi r10, 2
+       stw r10, 0(r8)
+       xor r10, r10, r10
+       ldi r10, 0xe7b8
+       lls r10, r10, 8
+       addi r10, r10, 0x80
+       lls r10, r10, 8
+       stw r10, 0(r9)
+
+       ;x"eb000008"; -- ret-
+       xor r10, r10, r10
+       ldi r10, 3
+       stw r10, 0(r8)
+       xor r10, r10, r10
+       ldi r10, 0xeb00
+       lls r10, r10, 16
+       addi r10, r10, 0x8
+       stw r10, 0(r9)
+       br hmm
+
+.org 0x1fc
+hmm:
+       ldinv r0, 0
+; real ram...
+woot:
index 2102c5a98682f31394273b8f5aea65cea1f492e8..d628d10a1cff46ec1cd740a4a1bb0081eb037839 100644 (file)
@@ -20,8 +20,8 @@
 #include "SReadline/SReadline.h"
 using namespace swift;
 
-#define RAM_END (0x1000)
-#define PROG_END (0x1000)
+#define RAM_END (0x3000)
+#define PROG_END (0x3000)
 #define REG_COUNT (16)
 
 typedef boost::function<void (const vector<string> &)> Func;
index c27a5a0ca32c93295b79258dbc6add5023bb8d22..bc45ecdf0aa408c577e33eb6976bba783572be13 100644 (file)
@@ -33,7 +33,9 @@ package core_pkg is
 
                --Data outputs
                        instruction : out instruction_word_t;
-                       prog_cnt : out instruction_addr_t
+                       prog_cnt : out instruction_addr_t;
+               -- debug
+                       led2 : out std_logic
                );
        end component fetch_stage;
 
index eb1082322f202fe6bcd2bdb70d448bf7bac8d277..dd3791ba6cd00d3f8e30f7fd44a278e030a1bc43 100644 (file)
@@ -18,6 +18,7 @@ entity core_top is
                        bus_tx : out std_logic;
                        bus_rx : in std_logic;
                        led1 : out std_logic;
+                       led2 : out std_logic;
                        
                        sseg0 : out std_logic_vector(0 to 6);
                        sseg1 : out std_logic_vector(0 to 6);
@@ -99,7 +100,8 @@ begin
                        im_data => im_data,
                --Data outputs
                        instruction => instruction_pin, --: out instruction_word_t
-                       prog_cnt => prog_cnt_pin                
+                       prog_cnt => prog_cnt_pin,
+                       led2 => led2
                );
 
        decode_st : decode_stage
index d472d531feabde28a7e40b8b8e6db754ed1db079..cefd8e96ee9dfb8b2dccb978c3a3c86e6ac0890c 100644 (file)
@@ -32,7 +32,9 @@ entity fetch_stage is
 
                --Data outputs
                        instruction : out instruction_word_t;
-                       prog_cnt : out instruction_addr_t
+                       prog_cnt : out instruction_addr_t;
+               -- debug
+                       led2 : out std_logic
                );
                
 end fetch_stage;
index 1836f3a34b6c202fe2c6b40b7d9ba14e34be3f08..6a6380c838532efc7ec592e85b7a9cf3a79cc7fa 100644 (file)
@@ -120,5 +120,7 @@ begin
 
 end process;
 
+led2 <= rom_ram;
+
 end behav;
 
index d7b5da1fb29500f6a855b0d8615828b8cf2c63ba..e45f7de9f73940945cec80df26e826962668b138 100644 (file)
@@ -123,27 +123,52 @@ begin
 --                             when "00000000111" => data_out <= x"e7a00004";
 --                             when "00000001000" => data_out <= x"e7280004";
 --                     --      when "00000001001" => data_out <= x"eb7ffb81";
-
-                               when "0000000" => data_out <= "11101011000000000000010000000010";
-                               when "0000001" => data_out <= "11101011000000000001000000000110";
-                               when "0000010" => data_out <= x"eb000008";
-
-                               when "0001000" => data_out <= x"ed090058";
-                               when "0001001" => data_out <= x"ed110060";
-                               when "0001010" => data_out <= x"ed190080";
-                               when "0001011" => data_out <= x"ed210120";
-                               when "0001100" => data_out <= x"ed280018";
-                               when "0001101" => data_out <= x"e7aa0000";
-
-                       --      when "0100000" => data_out <= x"f7aa0000";
-                               when "0100001" => data_out <= x"e7390000";
-                               when "0100010" => data_out <= x"e13b8008";
-                               when "0100011" => data_out <= x"e7b98000";
-                               when "0100100" => data_out <= x"e7b88000";
-                               when "0100101" => data_out <= x"eb000008";
-
-                               when others => data_out <=    "11101011000000000000000000000010";
-
+       when "0000000" => data_out <= x"eb000183"; -- br+ main 
+       when "0000001" => data_out <= x"eb000487"; -- call+ uartrdy 
+       when "0000010" => data_out <= x"eb000008"; -- ret
+       when "0000011" => data_out <= x"ed090058"; -- ldi r1, 0x200b 
+       when "0000100" => data_out <= x"ed110060"; -- ldi r2, 0x200c 
+       when "0000101" => data_out <= x"ed190080"; -- ldi r3, 0x2010 
+       when "0000110" => data_out <= x"ed210120"; -- ldi r4, 0x2024 
+       when "0000111" => data_out <= x"ed280018"; -- ldi r5, 3
+       when "0001000" => data_out <= x"e7aa0000"; -- stw r5, 0(r4)
+       when "0001001" => data_out <= x"eb7ffb83"; -- br+ start
+       when "0001010" => data_out <= x"ed4101b8"; -- ldi r8, 0x2037 
+       when "0001011" => data_out <= x"ed4901d8"; -- ldi r9, 0x203b 
+       when "0001100" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0001101" => data_out <= x"e7d40000"; -- stw r10, 0(r8)
+       when "0001110" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0001111" => data_out <= x"ed5739c8"; -- ldi r10, 0xe739
+       when "0010000" => data_out <= x"e5554000"; -- lls r10, r10, 16
+       when "0010001" => data_out <= x"e7d48000"; -- stw r10, 0(r9)
+       when "0010010" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0010011" => data_out <= x"ed500008"; -- ldi r10, 1
+       when "0010100" => data_out <= x"e7d40000"; -- stw r10, 0(r8)
+       when "0010101" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0010110" => data_out <= x"ed573dc8"; -- ldi r10, 0xe7b9
+       when "0010111" => data_out <= x"e5552000"; -- lls r10, r10, 8
+       when "0011000" => data_out <= x"e1550400"; -- addi r10, r10, 0x80
+       when "0011001" => data_out <= x"e5552000"; -- lls r10, r10, 8
+       when "0011010" => data_out <= x"e7d48000"; -- stw r10, 0(r9)
+       when "0011011" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0011100" => data_out <= x"ed500010"; -- ldi r10, 2
+       when "0011101" => data_out <= x"e7d40000"; -- stw r10, 0(r8)
+       when "0011110" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0011111" => data_out <= x"ed573dc0"; -- ldi r10, 0xe7b8
+       when "0100000" => data_out <= x"e5552000"; -- lls r10, r10, 8
+       when "0100001" => data_out <= x"e1550400"; -- addi r10, r10, 0x80
+       when "0100010" => data_out <= x"e5552000"; -- lls r10, r10, 8
+       when "0100011" => data_out <= x"e7d48000"; -- stw r10, 0(r9)
+       when "0100100" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0100101" => data_out <= x"ed500018"; -- ldi r10, 3
+       when "0100110" => data_out <= x"e7d40000"; -- stw r10, 0(r8)
+       when "0100111" => data_out <= x"e4555000"; -- xor r10, r10, r10
+       when "0101000" => data_out <= x"ed575800"; -- ldi r10, 0xeb00
+       when "0101001" => data_out <= x"e5554000"; -- lls r10, r10, 16
+       when "0101010" => data_out <= x"e1550040"; -- addi r10, r10, 0x8
+       when "0101011" => data_out <= x"e7d48000"; -- stw r10, 0(r9)
+       -- just nop until rom end!
+       when others => data_out <= x"fd000000";
                        end case;
                end if;
        end process;
index 1cec582437b63b165a70629d55bd18772beb1a7e..1d12bc84d4111cfb6ab6061b7c231742fc0d660f 100644 (file)
@@ -81,6 +81,7 @@ NET "sys_clk" PERIOD = 20 ns HIGH 40 % ;
 #NET "FX2_IO<19>" LOC = "E12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
 #NET "FX2_IO<20>" LOC = "F12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
 NET "led1" LOC = "F12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
+NET "led2" LOC = "E11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
 #NET "FX2_IO<21>" LOC = "A13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
 #NET "FX2_IO<22>" LOC = "B13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
 #NET "FX2_IO<23>" LOC = "A14" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;