head 1.7; access; symbols bg2_23:1.7 bg2_22:1.7 bg2_21:1.7 bg2_20:1.7 bg2_16:1.7 bg2_15:1.7 bg2_12:1.7 bg2_07:1.7 isorc2008_submission:1.4 handbook_alpha_edition:1.3 jtres2007_submission:1.1 bg1_07:1.1 bg1_06:1.1 bg1_05:1.1 TAL_101:1.1 TAL_100:1.1; locks; strict; comment @# @; 1.7 date 2008.03.04.19.32.58; author martin; state Exp; branches; next 1.6; commitid 112f47cda3e74567; 1.6 date 2008.02.23.23.18.47; author martin; state Exp; branches; next 1.5; commitid b7347c0a9b84567; 1.5 date 2008.02.20.14.29.33; author martin; state Exp; branches; next 1.4; commitid 4d7c47bc39384567; 1.4 date 2007.12.02.15.36.09; author martin; state Exp; branches; next 1.3; commitid 177b4752d0e24567; 1.3 date 2007.09.12.16.55.26; author 9914pich; state Exp; branches; next 1.2; commitid 121e46e819fc4567; 1.2 date 2007.09.12.15.39.52; author martin; state Exp; branches; next 1.1; commitid 61fa46e808454567; 1.1 date 2006.08.11.00.56.57; author martin; state Exp; branches; next ; commitid 31ca44dbd5d84567; desc @@ 1.7 log @add scratchpad RAM configuration to the top-level @ 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 . -- -- -- jop_avalon.vhd -- -- top level for Avalon (SPOC Builder) version -- -- 2006-08-10 adapted from jop_256x16.vhd -- -- 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.jop_config.all; entity jop_avalon is generic ( addr_bits : integer := 24; -- address range for the avalone interface jpc_width : integer := 12; -- address bits of java bytecode pc = cache size block_bits : integer := 4; -- 2*block_bits is number of cache blocks spm_width : integer := 0 -- size of scratchpad RAM (in number of address bits for 32-bit words) ); port ( clk, reset : in std_logic; -- -- serial interface -- ser_txd : out std_logic; ser_rxd : in std_logic; -- -- watchdog -- wd : out std_logic; -- -- Avalon interface -- address : out std_logic_vector(addr_bits-1+2 downto 0); writedata : out std_logic_vector(31 downto 0); byteenable : out std_logic_vector(3 downto 0); readdata : in std_logic_vector(31 downto 0); read : out std_logic; write : out std_logic; waitrequest : in std_logic ); end jop_avalon; architecture rtl of jop_avalon is -- -- components: -- component sc2avalon is generic (addr_bits : integer); port ( clk, reset : in std_logic; -- SimpCon interface sc_address : in std_logic_vector(addr_bits-1 downto 0); sc_wr_data : in std_logic_vector(31 downto 0); sc_rd, sc_wr : in std_logic; sc_rd_data : out std_logic_vector(31 downto 0); sc_rdy_cnt : out unsigned(1 downto 0); -- Avalon interface av_address : out std_logic_vector(addr_bits-1+2 downto 0); av_writedata : out std_logic_vector(31 downto 0); av_byteenable : out std_logic_vector(3 downto 0); av_readdata : in std_logic_vector(31 downto 0); av_read : out std_logic; av_write : out std_logic; av_waitrequest : in 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_mem_out : sc_out_type; signal sc_mem_in : sc_in_type; signal sc_io_out : sc_out_type; signal sc_io_in : sc_in_type; signal irq_in : irq_bcf_type; signal irq_out : irq_ack_type; signal exc_req : exception_type; -- -- IO interface -- signal ser_in : ser_in_type; signal ser_out : ser_out_type; signal wd_out : std_logic; -- for generation of internal reset -- memory interface signal ram_addr : std_logic_vector(17 downto 0); signal ram_dout : std_logic_vector(15 downto 0); signal ram_din : std_logic_vector(15 downto 0); signal ram_dout_en : std_logic; signal ram_ncs : std_logic; signal ram_noe : std_logic; signal ram_nwe : std_logic; -- not available at this board: signal ser_ncts : std_logic; signal ser_nrts : std_logic; begin ser_ncts <= '0'; -- -- avalon reset (hopefully synchronized...) -- int_res <= reset; -- no pll inside the avalon component clk_int <= clk; wd <= wd_out; cpm_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_mem_out, sc_mem_in, sc_io_out, sc_io_in, irq_in, irq_out, exc_req); cmp_io: entity work.scio port map (clk_int, int_res, sc_io_out, sc_io_in, irq_in, irq_out, exc_req, txd => ser_txd, rxd => ser_rxd, ncts => ser_ncts, nrts => ser_nrts, wd => wd_out, l => open, r => open, t => open, b => open ); sc2av: sc2avalon generic map ( addr_bits => addr_bits ) port map ( clk => clk_int, reset => int_res, sc_address(20 downto 0) => sc_mem_out.address, sc_address(23 downto 21) => "000", sc_wr_data => sc_mem_out.wr_data, sc_rd => sc_mem_out.rd, sc_wr => sc_mem_out.wr, sc_rd_data => sc_mem_in.rd_data, sc_rdy_cnt => sc_mem_in.rdy_cnt, av_address => address, av_writedata => writedata, av_byteenable => byteenable, av_readdata => readdata, av_read => read, av_write => write, av_waitrequest => waitrequest ); end rtl; @ 1.6 log @JOP goes GPL @ text @d46 2 a47 1 block_bits : integer := 4 -- 2*block_bits is number of cache blocks d186 2 a187 1 block_bits => block_bits @ 1.5 log @Cleanup of SimpCon types @ text @d2 21 @ 1.4 log @additional signal from bcfetch to sc_sys (int ack) @ text @d119 1 a119 1 signal sc_mem_out : sc_mem_out_type; d121 1 a121 1 signal sc_io_out : sc_io_out_type; @ 1.3 log @deleted cmp sc_mem_if and aligned addr_bits @ text @d123 2 a124 1 signal irq_in : irq_in_type; d169 1 a169 1 irq_in, exc_req); d174 1 a174 1 irq_in, exc_req, @ 1.2 log @adapted to jopcpu @ text @a185 16 cmp_scm: entity work.sc_mem_if generic map ( ram_ws => ram_cnt-1, addr_bits => 18 ) 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 ); d195 2 a196 1 sc_address => sc_mem_out.address, @ 1.1 log @SOPC (Avalon master) top level @ text @d16 2 a23 2 exta_width : integer := 3; -- length of exta part in JOP microcode io_addr_bits : integer := 7; -- address bits of internal io a61 151 component core is generic(jpc_width : integer); -- address bits of java bytecode pc port ( clk, reset : in std_logic; -- memio connection bsy : in std_logic; din : in std_logic_vector(31 downto 0); ext_addr : out std_logic_vector(exta_width-1 downto 0); rd, wr : out std_logic; -- jbc connections jbc_addr : out std_logic_vector(jpc_width-1 downto 0); jbc_data : in std_logic_vector(7 downto 0); -- interrupt from io irq : in std_logic; irq_ena : in std_logic; exc_int : in std_logic; sp_ov : out std_logic; aout : out std_logic_vector(31 downto 0); bout : out std_logic_vector(31 downto 0) ); end component; component extension is generic (exta_width : integer; io_addr_bits : integer); port ( clk, reset : in std_logic; -- core interface ain : in std_logic_vector(31 downto 0); -- TOS bin : in std_logic_vector(31 downto 0); -- NOS ext_addr : in std_logic_vector(exta_width-1 downto 0); rd, wr : in std_logic; bsy : out std_logic; dout : out std_logic_vector(31 downto 0); -- to stack -- mem interface mem_rd : out std_logic; mem_wr : out std_logic; mem_addr_wr : out std_logic; mem_bc_rd : out std_logic; mem_data : in std_logic_vector(31 downto 0); -- output of memory module mem_bcstart : in std_logic_vector(31 downto 0); -- start of method in bc cache mem_bsy : in std_logic; -- SimpCon master io interface scio_address : out std_logic_vector(io_addr_bits-1 downto 0); scio_wr_data : out std_logic_vector(31 downto 0); scio_rd, scio_wr : out std_logic; scio_rd_data : in std_logic_vector(31 downto 0); scio_rdy_cnt : in unsigned(1 downto 0) ); end component; component scio is generic (addr_bits : integer); port ( clk : in std_logic; reset : in std_logic; -- SimpCon interface address : in std_logic_vector(addr_bits-1 downto 0); wr_data : in std_logic_vector(31 downto 0); rd, wr : in std_logic; rd_data : out std_logic_vector(31 downto 0); rdy_cnt : out unsigned(1 downto 0); -- interrupt irq : out std_logic; irq_ena : out std_logic; -- exception exc_req : in exception_type; exc_int : out std_logic; -- serial interface txd : out std_logic; rxd : in std_logic; ncts : in std_logic; nrts : out std_logic; -- watch dog wd : out std_logic; -- core i/o pins l : inout std_logic_vector(20 downto 1); r : inout std_logic_vector(20 downto 1); t : inout std_logic_vector(6 downto 1); b : inout std_logic_vector(10 downto 1) ); end component; component mem_sc is generic (jpc_width : integer; block_bits : integer; addr_bits : integer); port ( -- jop interface clk, reset : in std_logic; din : in std_logic_vector(31 downto 0); mem_rd : in std_logic; mem_wr : in std_logic; mem_addr_wr : in std_logic; mem_bc_rd : in std_logic; dout : out std_logic_vector(31 downto 0); bcstart : out std_logic_vector(31 downto 0); -- start of method in bc cache bsy : out std_logic; -- jbc connections jbc_addr : in std_logic_vector(jpc_width-1 downto 0); jbc_data : out std_logic_vector(7 downto 0); -- SimpCon interface address : out std_logic_vector(addr_bits-1 downto 0); wr_data : out std_logic_vector(31 downto 0); rd, wr : out std_logic; rd_data : in std_logic_vector(31 downto 0); rdy_cnt : in unsigned(1 downto 0) ); end component; d107 1 d110 2 a111 36 signal stack_tos : std_logic_vector(31 downto 0); signal stack_nos : std_logic_vector(31 downto 0); signal rd, wr : std_logic; signal ext_addr : std_logic_vector(exta_width-1 downto 0); signal stack_din : std_logic_vector(31 downto 0); -- extension/mem interface signal mem_rd : std_logic; signal mem_wr : std_logic; signal mem_addr_wr : std_logic; signal mem_bc_rd : std_logic; signal mem_dout : std_logic_vector(31 downto 0); signal mem_bcstart : std_logic_vector(31 downto 0); signal mem_bsy : std_logic; signal bsy : std_logic; signal jbc_addr : std_logic_vector(jpc_width-1 downto 0); signal jbc_data : std_logic_vector(7 downto 0); -- mem/sc interface signal sc_address : std_logic_vector(addr_bits-1 downto 0); signal sc_wr_data : std_logic_vector(31 downto 0); signal sc_rd, sc_wr : std_logic; signal sc_rd_data : std_logic_vector(31 downto 0); signal sc_rdy_cnt : unsigned(1 downto 0); -- SimpCon io interface signal scio_address : std_logic_vector(io_addr_bits-1 downto 0); signal scio_wr_data : std_logic_vector(31 downto 0); signal scio_rd : std_logic; signal scio_wr : std_logic; signal scio_rd_data : std_logic_vector(31 downto 0); signal scio_rdy_cnt : unsigned(1 downto 0); d113 2 a114 4 -- interrupt io interface signal io_irq : std_logic; signal io_irq_ena : std_logic; d116 8 a124 5 signal exc_int : std_logic; signal int_res : std_logic; signal wd_out, sp_ov : std_logic; d126 17 d146 1 a157 3 -- sp_ov indicates stack overflow -- We can use the wd LED -- wd <= sp_ov; d160 4 a163 17 cmp_core: core generic map(jpc_width) port map (clk_int, int_res, bsy, stack_din, ext_addr, rd, wr, jbc_addr, jbc_data, io_irq, io_irq_ena, exc_int, sp_ov, stack_tos, stack_nos ); exc_req.spov <= sp_ov; cmp_ext: extension generic map ( exta_width => exta_width, io_addr_bits => io_addr_bits d165 4 a168 5 port map ( clk => clk_int, reset => int_res, ain => stack_tos, bin => stack_nos, d170 4 a173 21 ext_addr => ext_addr, rd => rd, wr => wr, bsy => bsy, dout => stack_din, mem_rd => mem_rd, mem_wr => mem_wr, mem_addr_wr => mem_addr_wr, mem_bc_rd => mem_bc_rd, mem_data => mem_dout, mem_bcstart => mem_bcstart, mem_bsy => mem_bsy, scio_address => scio_address, scio_wr_data => scio_wr_data, scio_rd => scio_rd, scio_wr => scio_wr, scio_rd_data => scio_rd_data, scio_rdy_cnt => scio_rdy_cnt ); a174 20 cmp_io: scio generic map ( addr_bits => io_addr_bits ) port map ( clk => clk_int, reset => int_res, address => scio_address, wr_data => scio_wr_data, rd => scio_rd, wr => scio_wr, rd_data => scio_rd_data, rdy_cnt => scio_rdy_cnt, irq => io_irq, irq_ena => io_irq_ena, exc_req => exc_req, exc_int => exc_int, d186 1 a186 1 cmp_mem: mem_sc d188 2 a189 3 jpc_width => jpc_width, block_bits => block_bits, addr_bits => addr_bits d191 2 a192 4 port map ( clk => clk_int, reset => int_res, din => stack_tos, d194 7 a200 17 mem_rd => mem_rd, mem_wr => mem_wr, mem_addr_wr => mem_addr_wr, mem_bc_rd => mem_bc_rd, dout => mem_dout, bcstart => mem_bcstart, bsy => mem_bsy, jbc_addr => jbc_addr, jbc_data => jbc_data, address => sc_address, wr_data => sc_wr_data, rd => sc_rd, wr => sc_wr, rd_data => sc_rd_data, rdy_cnt => sc_rdy_cnt d211 6 a216 6 sc_address => sc_address, sc_wr_data => sc_wr_data, sc_rd => sc_rd, sc_wr => sc_wr, sc_rd_data => sc_rd_data, sc_rdy_cnt => sc_rdy_cnt, @