head 1.13; access; symbols bg2_23:1.12 bg2_22:1.12 bg2_21:1.12 bg2_20:1.12 bg2_16:1.12 bg2_15:1.11 bg2_12:1.11 bg2_07:1.11 isorc2008_submission:1.5 handbook_alpha_edition:1.2 jtres2007_submission:1.2; locks; strict; comment @# @; 1.13 date 2008.09.21.19.51.48; author martin; state Exp; branches; next 1.12; commitid 2d7148d6a5d14567; 1.12 date 2008.06.20.15.43.04; author martin; state Exp; branches; next 1.11; commitid 6ab6485bd0044567; 1.11 date 2008.03.04.19.32.58; author martin; state Exp; branches; next 1.10; commitid 112f47cda3e74567; 1.10 date 2008.02.23.23.18.47; author martin; state Exp; branches; next 1.9; commitid b7347c0a9b84567; 1.9 date 2008.02.22.14.47.56; author 9914pich; state Exp; branches; next 1.8; commitid 447f47bee09b4567; 1.8 date 2008.02.22.13.18.54; author 9914pich; state Exp; branches; next 1.7; commitid deb47becbbd4567; 1.7 date 2008.02.20.14.29.33; author martin; state Exp; branches; next 1.6; commitid 4d7c47bc39384567; 1.6 date 2008.01.16.10.40.12; author 9914pich; state Exp; branches; next 1.5; commitid 50f2478ddf0c4567; 1.5 date 2007.12.02.15.36.09; author martin; state Exp; branches; next 1.4; commitid 177b4752d0e24567; 1.4 date 2007.11.22.14.37.48; author 9914pich; state Exp; branches; next 1.3; commitid 1c224745943a4567; 1.3 date 2007.11.21.09.15.59; author 9914pich; state Exp; branches; next 1.2; commitid 773a4743f74d4567; 1.2 date 2007.06.01.13.05.05; author 9914pich; state Exp; branches; next 1.1; commitid 643a4660197f4567; 1.1 date 2007.05.14.19.10.12; author martin; state Exp; branches; next ; commitid eb94648b4134567; desc @@ 1.13 log @use 1 KB scratchpad memory @ text @-- -- -- This file is a part of JOP, the Java Optimized Processor -- -- Copyright (C) 2001-2008, Martin Schoeberl (martin@@jopdesign.com) -- -- 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 . -- -- -- jopmul.vhd -- -- top level for multiprocessor, cycore board with EP1C12 -- -- 2002-03-28 creation -- 2002-06-27 isa bus for CS8900 -- 2002-07-27 io for baseio -- 2002-08-02 second uart (use first for download and debug) -- 2002-11-01 removed second uart -- 2002-12-01 split memio -- 2002-12-07 disable clkout -- 2003-02-21 adapt for new Cyclone board with EP1C6 -- 2003-07-08 invertion of cts, rts to uart -- 2004-09-11 new extension module -- 2004-10-08 mul operands from a and b, single instruction -- 2005-05-12 added the bsy routing through extension -- 2005-08-15 sp_ov can be used to show a stoack overflow on the wd pin -- 2005-11-30 SimpCon for IO devices -- 2007-03-17 Use jopcpu and change component interface to records library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.jop_types.all; use work.sc_pack.all; use work.sc_arbiter_pack.all; use work.jop_config.all; entity jop is generic ( ram_cnt : integer := 2; -- clock cycles for external ram -- rom_cnt : integer := 3; -- clock cycles for external rom OK for 20 MHz rom_cnt : integer := 15; -- clock cycles for external rom for 100 MHz jpc_width : integer := 10; -- address bits of java bytecode pc = cache size block_bits : integer := 4; -- 2*block_bits is number of cache blocks spm_width : integer := 8; -- size of scratchpad RAM (in number of address bits for 32-bit words) cpu_cnt : integer := 3 -- number of cpus ); port ( clk : in std_logic; -- -- serial interface -- ser_txd : out std_logic; ser_rxd : in std_logic; ser_ncts : in std_logic; ser_nrts : out std_logic; -- -- watchdog -- wd : out std_logic; freeio : out std_logic; -- -- two ram banks -- rama_a : out std_logic_vector(17 downto 0); rama_d : inout std_logic_vector(15 downto 0); rama_ncs : out std_logic; rama_noe : out std_logic; rama_nlb : out std_logic; rama_nub : out std_logic; rama_nwe : out std_logic; ramb_a : out std_logic_vector(17 downto 0); ramb_d : inout std_logic_vector(15 downto 0); ramb_ncs : out std_logic; ramb_noe : out std_logic; ramb_nlb : out std_logic; ramb_nub : out std_logic; ramb_nwe : out std_logic; -- -- config/program flash and big nand flash -- fl_a : out std_logic_vector(18 downto 0); fl_d : inout std_logic_vector(7 downto 0); fl_ncs : out std_logic; fl_ncsb : out std_logic; fl_noe : out std_logic; fl_nwe : out std_logic; fl_rdy : in std_logic; -- -- I/O pins of board -- -- io_b : inout std_logic_vector(10 downto 1); io_l : inout std_logic_vector(20 downto 1); io_r : inout std_logic_vector(20 downto 1); io_t : inout std_logic_vector(6 downto 1) ); end jop; architecture rtl of jop is -- -- components: -- component pll is generic (multiply_by : natural; divide_by : natural); port ( inclk0 : in std_logic; c0 : out std_logic ); end component; -- -- Signals -- signal clk_int : std_logic; signal int_res : std_logic; signal res_cnt : unsigned(2 downto 0) := "000"; -- for the simulation attribute altera_attribute : string; attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW"; -- -- jopcpu connections -- signal sc_arb_out : arb_out_type(0 to cpu_cnt-1); signal sc_arb_in : arb_in_type(0 to cpu_cnt-1); signal sc_mem_out : sc_out_type; signal sc_mem_in : sc_in_type; signal sc_io_out : sc_out_array_type(0 to cpu_cnt-1); signal sc_io_in : sc_in_array_type(0 to cpu_cnt-1); signal irq_in : irq_in_array_type(0 to cpu_cnt-1); signal irq_out : irq_out_array_type(0 to cpu_cnt-1); signal exc_req : exception_array_type(0 to cpu_cnt-1); -- -- IO interface -- signal ser_in : ser_in_type; signal ser_out : ser_out_type; type wd_out_array is array (0 to cpu_cnt-1) of std_logic; signal wd_out : wd_out_array; -- for generation of internal reset -- memory interface signal ram_addr : std_logic_vector(17 downto 0); signal ram_dout : std_logic_vector(31 downto 0); signal ram_din : std_logic_vector(31 downto 0); signal ram_dout_en : std_logic; signal ram_ncs : std_logic; signal ram_noe : std_logic; signal ram_nwe : std_logic; -- cmpsync signal sync_in_array : sync_in_array_type(0 to cpu_cnt-1); signal sync_out_array : sync_out_array_type(0 to cpu_cnt-1); -- remove the comment for RAM access counting -- signal ram_count : std_logic; begin -- -- intern reset -- no extern reset, epm7064 has too less pins -- process(clk_int) begin if rising_edge(clk_int) then if (res_cnt/="111") then res_cnt <= res_cnt+1; end if; int_res <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2); end if; end process; -- -- components of jop -- pll_inst : pll generic map( multiply_by => pll_mult, divide_by => pll_div ) port map ( inclk0 => clk, c0 => clk_int ); -- clk_int <= clk; -- process(wd_out) -- variable wd_help : std_logic; -- begin -- wd_help := '0'; -- for i in 0 to cpu_cnt-1 loop -- wd_help := wd_help or wd_out(i); -- end loop; -- wd <= wd_help; -- end process; wd <= wd_out(0); gen_cpu: for i in 0 to cpu_cnt-1 generate cmp_cpu: entity work.jopcpu generic map( jpc_width => jpc_width, block_bits => block_bits, spm_width => spm_width ) port map(clk_int, int_res, sc_arb_out(i), sc_arb_in(i), sc_io_out(i), sc_io_in(i), irq_in(i), irq_out(i), exc_req(i)); end generate; cmp_arbiter: entity work.arbiter generic map( addr_bits => SC_ADDR_SIZE, cpu_cnt => cpu_cnt ) port map(clk_int, int_res, sc_arb_out, sc_arb_in, sc_mem_out, sc_mem_in -- Enable for use with Round Robin Arbiter -- sync_out_array(1) ); cmp_scm: entity work.sc_mem_if generic map ( ram_ws => ram_cnt-1, rom_ws => rom_cnt-1 ) port map (clk_int, int_res, sc_mem_out, sc_mem_in, ram_addr => ram_addr, ram_dout => ram_dout, ram_din => ram_din, ram_dout_en => ram_dout_en, ram_ncs => ram_ncs, ram_noe => ram_noe, ram_nwe => ram_nwe, fl_a => fl_a, fl_d => fl_d, fl_ncs => fl_ncs, fl_ncsb => fl_ncsb, fl_noe => fl_noe, fl_nwe => fl_nwe, fl_rdy => fl_rdy ); -- syncronization of processors cmp_sync: entity work.cmpsync generic map ( cpu_cnt => cpu_cnt) port map ( clk => clk_int, reset => int_res, sync_in_array => sync_in_array, sync_out_array => sync_out_array ); -- io for processor 0 cmp_io: entity work.scio generic map ( cpu_id => 0, cpu_cnt => cpu_cnt ) port map (clk_int, int_res, sc_io_out(0), sc_io_in(0), irq_in(0), irq_out(0), exc_req(0), sync_out => sync_out_array(0), sync_in => sync_in_array(0), txd => ser_txd, rxd => ser_rxd, ncts => ser_ncts, nrts => ser_nrts, wd => wd_out(0), l => io_l, r => io_r, t => io_t --b => io_b -- remove the comment for RAM access counting -- ram_cnt => ram_count ); -- io for processors with only sc_sys gen_io: for i in 1 to cpu_cnt-1 generate cmp_io2: entity work.sc_sys generic map ( addr_bits => 4, clk_freq => clk_freq, cpu_id => i, cpu_cnt => cpu_cnt ) port map( clk => clk_int, reset => int_res, address => sc_io_out(i).address(3 downto 0), wr_data => sc_io_out(i).wr_data, rd => sc_io_out(i).rd, wr => sc_io_out(i).wr, rd_data => sc_io_in(i).rd_data, rdy_cnt => sc_io_in(i).rdy_cnt, irq_in => irq_in(i), irq_out => irq_out(i), exc_req => exc_req(i), sync_out => sync_out_array(i), sync_in => sync_in_array(i), wd => wd_out(i) -- remove the comment for RAM access counting -- ram_count => ram_count ); end generate; process(ram_dout_en, ram_dout) begin if ram_dout_en='1' then rama_d <= ram_dout(15 downto 0); ramb_d <= ram_dout(31 downto 16); else rama_d <= (others => 'Z'); ramb_d <= (others => 'Z'); end if; end process; ram_din <= ramb_d & rama_d; -- remove the comment for RAM access counting -- ram_count <= ram_ncs; -- -- To put this RAM address in an output register -- we have to make an assignment (FAST_OUTPUT_REGISTER) -- rama_a <= ram_addr; rama_ncs <= ram_ncs; rama_noe <= ram_noe; rama_nwe <= ram_nwe; rama_nlb <= '0'; rama_nub <= '0'; ramb_a <= ram_addr; ramb_ncs <= ram_ncs; ramb_noe <= ram_noe; ramb_nwe <= ram_nwe; ramb_nlb <= '0'; ramb_nub <= '0'; freeio <= 'Z'; end rtl; @ 1.12 log @CPU count from sys device @ text @d61 1 a61 1 spm_width : integer := 0; -- size of scratchpad RAM (in number of address bits for 32-bit words) @ 1.11 log @add scratchpad RAM configuration to the top-level @ text @d297 2 a298 1 cpu_id => 0 d325 2 a326 1 cpu_id => i @ 1.10 log @JOP goes GPL @ text @d61 1 d237 2 a238 1 block_bits => block_bits @ 1.9 log @no message @ text @d2 21 @ 1.8 log @no message @ text @a309 1 atomic => sc_io_out(i).atomic, @ 1.7 log @Cleanup of SimpCon types @ text @d133 1 a133 1 signal sc_io_out : sc_io_out_array_type(0 to cpu_cnt-1); d136 1 a136 1 signal irq_out : irq_out_array_type(0 to cpu_cnt-1); d164 3 a166 1 -- signal wd_help : std_logic; d199 10 a208 8 -- process(wd_out, wd_help) -- begin -- for i in 0 to cpu_cnt-1 loop -- wd_help <= wd_help or wd_out(i); -- wd <= wd_help; -- end loop; -- end process; d219 2 a220 2 sc_io_out(i), sc_io_in(i), irq_in(i), irq_out(i), exc_req(i)); d225 1 a225 1 addr_bits => 21, d292 2 a293 1 d310 1 d321 2 d340 3 @ 1.6 log @added Round Robin @ text @d130 1 a130 1 signal sc_mem_out : sc_mem_out_type; @ 1.5 log @additional signal from bcfetch to sc_sys (int ack) @ text @d38 1 a38 1 jpc_width : integer := 12; -- address bits of java bytecode pc = cache size d40 1 a40 1 cpu_cnt : integer := 2 -- number of cpus d226 4 a229 1 sc_mem_out, sc_mem_in); @ 1.4 log @no message @ text @d136 1 d216 1 a216 1 irq_in(i), exc_req(i)); d271 1 a271 1 irq_in(0), exc_req(0), d306 1 @ 1.3 log @no message @ text @d40 1 a40 1 cpu_cnt : integer := 3 -- number of cpus d258 2 @ 1.2 log @no message @ text @d40 1 a40 1 cpu_cnt : integer := 2 -- number of cpus @ 1.1 log @toplevel for CP's SimpCon arbiter @ text @d4 1 a4 1 -- top level for multiprocessor, cycore board with EP1C6 d94 1 a94 1 io_t : inout std_logic_vector(6 downto 1); a95 6 -- VGA ---------------------- vga_rgb : out std_logic_vector(3 downto 0); vga_h_out : out std_logic; vga_v_out : out std_logic d132 5 a136 4 signal sc_io_out : sc_io_out_type; signal sc_io_in : sc_in_type; signal irq_in : irq_in_type; signal exc_req : exception_type; d143 2 a144 1 signal wd_out : std_logic; d153 1 a153 1 signal ram_dout_en : std_logic; d158 7 d195 22 a216 21 wd <= wd_out; cmp_cpu: entity work.jopcpu generic map( jpc_width => jpc_width, block_bits => block_bits ) port map(clk_int, int_res, sc_arb_out(1), sc_arb_in(1), sc_io_out, sc_io_in, irq_in, exc_req); cmp_vga: entity work.vga port map(clk_int, int_res, vga_rgb, vga_h_out, vga_v_out, sc_arb_out(0).address, sc_arb_out(0).wr_data, sc_arb_out(0).rd, sc_arb_out(0).wr, sc_arb_in(0).rd_data, sc_arb_in(0).rdy_cnt); d253 13 a265 1 cmp_io: entity work.scio d267 5 a271 2 sc_io_out, sc_io_in, irq_in, exc_req, d277 1 a277 1 wd => wd_out, d282 1 d284 28 @