-- -- Dalton Project -- Tony Givargis, Rilesh Patel, Deepa Varghese, Roman Lysecky -- 12/21/98 -- Version 1.2 -- Notes: This file implements the BIOS device. This device contains -- some program instructions that it loads into the main memory -- and asserts the ready signal. Subsequently the processors -- can be activated when the ready signal is asserted and thus -- starting execution of the loaded program. -- -- --*************************************************************************-- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_ARITH.all; --*************************************************************************-- entity BIOS is generic (COMP_RATIO : INTEGER range 0 to 4 := 1); port( clk : in STD_LOGIC; rst : in STD_LOGIC; data : out UNSIGNED(31 downto 0); addr : out UNSIGNED(22 downto 0); rd : out STD_LOGIC; wr : out STD_LOGIC; rdy : in STD_LOGIC; cs : out STD_LOGIC ); end BIOS; --*************************************************************************-- architecture BHV_BIOS of BIOS is -- -- type declarations -- type STATE_TYPE is (WRITE_S, WRITE2_S, DONE_S); subtype MEM_CELL_TYPE is UNSIGNED(31 downto 0); -- -- outputted portion -- type PROG_MEM_TYPE is array(0 to 47) of MEM_CELL_TYPE; constant PROG_SIZE : UNSIGNED(22 downto 0) := "00000000000000000110000"; constant PROGRAM : PROG_MEM_TYPE := ( "000001111" & CONV_UNSIGNED(COMP_RATIO,23), --LI R15 COMP_RATIO "00000000100000000000000010000000", --LI R1 128 "000010010" & CONV_UNSIGNED(COMP_RATIO,23), --LI R18 COMP_RATIO "00110000100000000000010000000111", --STORE R1 1031 "00000000100000000000000000000001", --LI R1 1 "00110000100000000000001000000001", --STORE R1 513 "000000110" & CONV_UNSIGNED(PROG_SIZE,23), --LI R6 PROG_SIZE --:L2 "00100001000000000000001000000000", --LOAD R2 512 "10110001100010000010000000000000", --EQ R3 R2 R1 "01010001100000000000000000001011", --JNZ R3 L1 "01110000000000000000000000000111", --JMP L2 --:L1 "00010001000000000000000000000000", --MOV R2 R0 "00000001100000000000000100000000", --LI R3 256 --:L6 "00000011100000000000000000000010", --LI R7 2 "00000100000000000000000000000011", --LI R8 3 "01000010000010000110000000000000", --GE R4 R2 R3 "01010010000000000000000000101111", --JNZ R4 L3 "00110011100000000000010000000011", --STORE R7 1027 "00010111000000000000000000000000", --MOV R14 R0 --:L7 "01001111000010000110000000000000", --GE R30 R2 R3 "01011111000000000000000000011000", --JNZ R30 L11 "00100010100000000000001000000010", --LOAD R5 514 "00110010100000000000010000000000", --STORE R5 1024 "01110000000000000000000000011001", --JMP L12 --:L11 "00110000000000000000010000000000", --STORE R0 1024 --:L12 "01100111001110000010000000000000", --ADD R14 R14 R1 "01100001000010000010000000000000", --ADD R2 R2 R1 "10111000001111011100000000000000", --EQ R16 R15 R14 "01011000000000000000000000011110", --JNZ R16 L8 "01110000000000000000000000010011", --JMP L7 --:L8 "00110100000000000000010000000011", --STORE R8 1027 --:L5 "00100100100000000000010000000010", --LOAD R9 1026 "10110101001001000010000000000000", --EQ R10 R9 R1 "01010101000000000000000000100011", --JNZ R10 L4 "01110000000000000000000000011111", --JMP L5 --:L4 "00100101100000000000010000000001", --LOAD R11 1025 "11000101100110000000000000000000", --STOREI R11 R6 "00011001100000000000000000000000", --MOV R19 R0 --:L9 "00110101100000000000010000000100", --STORE R11 1028 "00110101100000000000101110111000", --STORE R11 3000 "10100101101000000000000000000000", --SHFR R11 8 "01101001110011000010000000000000", --ADD R19 R19 R1 "10111010010011100100000000000000", --EQ R20 R19 R18 "01011010000000000000000000101101", --JNZ R20 L10 "01110000000000000000000000100110", --JMP L9 --:L10 "01100011000110000010000000000000", --ADD R6 R6 R1 "01110000000000000000000000001101", --JMP L6 --:L3 "01110000000000000000000000101111" --JMP L3 ); -- -- constant -- constant Z_32 : UNSIGNED(31 downto 0) := "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; constant Z_23 : UNSIGNED(22 downto 0) := "ZZZZZZZZZZZZZZZZZZZZZZZ"; constant C0_32 : UNSIGNED(31 downto 0) := "00000000000000000000000000000000"; constant C0_23 : UNSIGNED(22 downto 0) := "00000000000000000000000"; constant C1_23 : UNSIGNED(22 downto 0) := "00000000000000000000001"; signal loct : UNSIGNED(22 downto 0); signal state : STATE_TYPE; begin process(clk, rst) begin if( rst = '1' ) then -- -- steady state -- state <= WRITE_S; loct <= C0_23; data <= C0_32; addr <= C0_23; wr <= '0'; rd <= '0'; cs <= '0'; elsif( clk'event and clk = '1' ) then -- -- steady state -- data <= C0_32; addr <= C0_23; rd <= '0'; wr <= '0'; cs <= '0'; -- -- otherwise -- case( state ) is when WRITE_S => state <= WRITE_S; if(loct = PROG_SIZE and rdy = '1') then state <= DONE_S; elsif( rdy = '1' ) then data <= PROGRAM(conv_integer(loct)); addr <= loct; wr <= '1'; loct <= loct + C1_23; state <= WRITE2_S; end if; when WRITE2_S => state <= WRITE_S; when DONE_S => data <= Z_32; addr <= Z_23; rd <= 'Z'; wr <= 'Z'; cs <= '1'; state <= DONE_S; end case; end if; end process; end BHV_BIOS; --*************************************************************************-- --configuration CFG_BIOS of BIOS is -- for BHV_BIOS -- end for; --end CFG_BIOS; -- end of file --