repo_name
stringlengths
6
79
path
stringlengths
6
236
copies
int64
1
472
size
int64
137
1.04M
content
stringlengths
137
1.04M
license
stringclasses
15 values
hash
stringlengths
32
32
alpha_frac
float64
0.25
0.96
ratio
float64
1.51
17.5
autogenerated
bool
1 class
config_or_test
bool
2 classes
has_no_keywords
bool
1 class
has_few_assignments
bool
1 class
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/sim/pwm_check.vhd
1
31,865
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: pwm_check -- File: pwm_check.vhd -- Author: Jonas Ekergarn - Aeroflex Gaisler (parts are copied from -- grtestmod.vhd) -- Description: Simulation unit that examines the PWMs generated by the GRPWM -- when software/leon3/grpwm.c is run. Note that pwm_check -- requires that the system includes an I/O memory interface -- and that grtestmod.vhd is instantiated in the system testbench. -- If the subtests in software/leon3/grpwm.c is modified then the -- configuration below and the procedure verify_subtest must be -- changed as well. ------------------------------------------------------------------------------- -- pragma translate_off library ieee, grlib, gaisler; use ieee.std_logic_1164.all; use std.textio.all; use grlib.stdlib.all; use grlib.stdio.all; use grlib.devices.all; use gaisler.sim.all; entity pwm_check is port ( clk : in std_ulogic; address : in std_logic_vector(21 downto 2); data : inout std_logic_vector(31 downto 0); iosn : in std_ulogic; oen : in std_ulogic; writen : in std_ulogic; pwm : in std_logic_vector(15 downto 0) ); end; architecture sim of pwm_check is signal ior, iow : std_ulogic; signal addr : std_logic_vector(21 downto 2); signal ldata : std_logic_vector(31 downto 0); signal pwmh : std_logic_vector(1 downto 0); signal pwmh0 : integer := 0; signal pwmh1 : integer := 1; ----------------------------------------------------------------------------- -- Configuration of the PWMs that should be verified ----------------------------------------------------------------------------- -- Number of "useful" words in the waveform ram. The core will read address -- 0 - (STX_WRAMSIZE-1). constant ST3_WRAMSIZE : integer := 32; constant ST4_WRAMSIZE : integer := 32; -- Number of periods to verify for each subtest. Verification of the very -- first period after PWM is started is skipped because there is no way of -- knowing exactly when it starts. It is assumed that the first period is -- correct. If it isn't then the verification of the other periods will fail -- as well. constant ST1_NPER : integer := 10; constant ST2_NPER : integer := 10; constant ST3_NPER : integer := 2*ST3_WRAMSIZE; constant ST4_NPER : integer := 2*ST4_WRAMSIZE; type st1_vector is array (0 to ST1_NPER) of integer; type st2_vector is array (0 to ST2_NPER) of integer; type st3_vector is array (0 to ST3_NPER) of integer; type st4_vector is array (0 to ST4_NPER) of integer; type st1_array is array (0 to 7) of st1_vector; type st2_array is array (0 to 7) of st2_vector; type st3_array is array (0 to 7) of st3_vector; type st4_array is array (0 to 7) of st4_vector; type wram_type is array (0 to 8191) of integer; -- Polarity for each PWM in the different subtests constant ST1_POL : std_logic_vector(7 downto 0) := (others=>'1'); constant ST2_POL : std_logic_vector(7 downto 0) := (others=>'1'); constant ST3_POL : std_logic_vector(7 downto 0) := (others=>'1'); constant ST4_POL : std_logic_vector(7 downto 0) := (others=>'1'); -- Period, compare, and dead band values for each pwm period in subtest 1, -- in clock cycles constant ST1_PER : st1_array := ( 0 => (others=>200), 1 => (others=>201), 2 => (others=>202), 3 => (others=>203), 4 => (others=>204), 5 => (others=>205), 6 => (others=>206), 7 => (others=>207)); constant ST1_COMPA : st1_array := ( 0 => (others=>100), 1 => (others=>101), 2 => (others=>102), 3 => (others=>103), 4 => (others=>104), 5 => (others=>105), 6 => (others=>106), 7 => (others=>107)); constant ST1_DB : st1_array := ( 0 => (others=>10), 1 => (others=>11), 2 => (others=>12), 3 => (others=>13), 4 => (others=>14), 5 => (others=>15), 6 => (others=>16), 7 => (others=>17)); -- Period, compare, and dead band values for each pwm period in subtest 2, -- in clock cycles constant ST2_PER : st2_array := ( 0 => (others=>200), 1 => (others=>202), 2 => (others=>204), 3 => (others=>206), 4 => (others=>208), 5 => (others=>210), 6 => (others=>212), 7 => (others=>214)); constant ST2_COMPA : st2_array := ( 0 => (others=>50), 1 => (others=>51), 2 => (others=>52), 3 => (others=>53), 4 => (others=>54), 5 => (others=>55), 6 => (others=>56), 7 => (others=>57)); constant ST2_DB : st2_array := ( 0 => (others=>10), 1 => (others=>11), 2 => (others=>12), 3 => (others=>13), 4 => (others=>14), 5 => (others=>15), 6 => (others=>16), 7 => (others=>17)); -- Period, compare, and dead band values for each pwm period in subtest 3, -- in clock cycles. (Only the PWM with the highest index is active during -- subtest 3, but since we here don't know how many PWM outputs there are, -- all get the same value) constant ST3_WRAM : wram_type := ( 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55, 56,57,58,59,60,61,62,63, others=>0); constant ST3_PER : st3_array := ( 0 => (others=>200), 1 => (others=>200), 2 => (others=>200), 3 => (others=>200), 4 => (others=>200), 5 => (others=>200), 6 => (others=>200), 7 => (others=>200)); constant ST3_DB : st3_array := ( 0 => (others=>10), 1 => (others=>10), 2 => (others=>10), 3 => (others=>10), 4 => (others=>10), 5 => (others=>10), 6 => (others=>10), 7 => (others=>10)); -- Period, compare, and dead band values for each pwm period in subtest 4, -- in clock cycles. (Only the PWM with the highest index is active during -- subtest 4, but since we here don't know how many PWM outputs there are, -- all get the same value) constant ST4_WRAM : wram_type := ( 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55, 56,57,58,59,60,61,62,63, others=>0); constant ST4_PER : st4_array := ( 0 => (others=>200), 1 => (others=>200), 2 => (others=>200), 3 => (others=>200), 4 => (others=>200), 5 => (others=>200), 6 => (others=>200), 7 => (others=>200)); constant ST4_DB : st4_array := ( 0 => (others=>10), 1 => (others=>10), 2 => (others=>10), 3 => (others=>10), 4 => (others=>10), 5 => (others=>10), 6 => (others=>10), 7 => (others=>10)); type pwm_int_array is array (0 to 7) of integer; type pwm_bool_array is array (0 to 7) of boolean; procedure verify_subtest ( constant subtest : in integer; constant npwm : in integer range 1 to 8; signal clk : in std_ulogic; signal pwm : in std_logic_vector(15 downto 0); signal pwmh : in std_logic_vector(1 downto 0)) is variable cnt : pwm_int_array := (others=>0); variable cnt2 : pwm_int_array := (others=>0); variable pcnt : pwm_int_array := (others=>0); variable parta : pwm_bool_array := (others=>false); variable partb : pwm_bool_array := (others=>false); variable partc : pwm_bool_array := (others=>false); variable partd : pwm_bool_array := (others=>false); variable done : pwm_bool_array := (others=>false); variable ST2_COMPB : st2_array; variable ST4_COMPB : st4_array; variable addr : integer; variable il, ih : integer; begin case subtest is when 1 => ------------------------------------------------------------------------- -- Subtest 1: npwm assymmetric PWM pairs are generated, all with -- different periods, compare values, and dead band values. Verify -- periods, compare matches, and dead band times. ------------------------------------------------------------------------- for i in 0 to 7 loop if npwm < i+1 then done(i) := true; end if; -- no dead band time is inserted in the very first pwm period after -- startup parta(i) := true; end loop; while not(done(0) and done(1) and done(2) and done(3) and done(4) and done(5) and done(6) and done(7)) loop wait until rising_edge(clk); for i in 0 to npwm-1 loop cnt(i) := cnt(i)+1; end loop; wait until (pwm'event or falling_edge(clk)); if clk = '1' then for i in 0 to npwm-1 loop if (not done(i)) then if (not parta(i)) then -- pwm is in time period between period start and when paired -- output goes active (after dead band time) if pwm(2*i+1) = ST1_POL(i) then parta(i) := true; if pcnt(i) /= 0 then if cnt(i) /= ST1_DB(i)(pcnt(i)) then Print("ERROR: Wrong dead band (1) detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)) & ", should be " & tost(ST1_DB(i)(pcnt(i)))); end if; end if; end if; elsif (not partb(i)) then -- pwm is in time period between paired output going active and -- paired output going inactive if pwm(2*i+1) = (not ST1_POL(i)) then partb(i) := true; if pcnt(i) /= 0 then if cnt(i) /= ST1_COMPA(i)(pcnt(i)) then Print("ERROR: Wrong compare match detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)) & ", should be " & tost(ST1_COMPA(i)(pcnt(i)))); end if; if ST1_DB(i)(pcnt(i)) = 0 then partc(i) := true; if pwm(2*i) /= ST1_POL(i) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; elsif (not partc(i)) then -- pwm is in time period between paired output going inactive and -- output going active (after dead band time) if pwm(2*i) = ST1_POL(i) then partc(i) := true; if pcnt(i) /= 0 then if cnt(i) /= (ST1_COMPA(i)(pcnt(i)) + ST1_DB(i)(pcnt(i))) then Print("ERROR: Wrong dead band (2) time detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)-ST1_COMPA(i)(pcnt(i))) & ", should be " & tost(ST1_DB(i)(pcnt(i)))); end if; end if; end if; else -- pwm is in time period between output going active and period end -- (output going inactive) if pwm(2*i) = (not ST1_POL(i)) then parta(i) := false; partb(i) := false; partc(i) := false; if pcnt(i) /= 0 then if cnt(i) /= ST1_PER(i)(pcnt(i)) then Print("ERROR: Wrong PWM period detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)) & ", should be " & tost(ST1_PER(i)(pcnt(i)))); end if; end if; if pcnt(i) = ST1_NPER then done(i) := true; end if; pcnt(i) := pcnt(i)+1; cnt(i) := 0; if pcnt(i) < ST1_NPER then if ST1_DB(i)(pcnt(i)) = 0 then parta(i) := true; if pwm(2*i+1) /= ST1_POL(i) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; end if; end if; end loop; end if; end loop; when 2 => ------------------------------------------------------------------------- -- Subtest 2: npwm symmetric PWM pairs are generated, all with -- different periods, compare values, and dead band values. Verify -- periods, compare matches, and dead band times ------------------------------------------------------------------------- for i in 0 to 7 loop for j in 0 to ST2_NPER loop ST2_COMPB(i)(j) := ST2_PER(i)(j)-ST2_COMPA(i)(j); end loop; if npwm < i+1 then done(i) := true; end if; end loop; while not(done(0) and done(1) and done(2) and done(3) and done(4) and done(5) and done(6) and done(7)) loop wait until rising_edge(clk); for i in 0 to npwm-1 loop cnt(i) := cnt(i)+1; cnt2(i) := cnt2(i)+1; end loop; wait until (pwm'event or falling_edge(clk)); if clk = '1' then for i in 0 to npwm-1 loop if (not done(i)) then if (not parta(i)) then -- pwm is in time period between period start and when paired -- output goes inactive if pwm(2*i+1) = (not ST2_POL(i)) then parta(i) := true; if pcnt(i) /= 0 then if cnt(i) /= ST2_COMPA(i)(pcnt(i)) then Print("ERROR: Wrong compare match 1 detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)) & ", should be " & tost(ST2_COMPA(i)(pcnt(i)))); end if; if ST2_DB(i)(pcnt(i)) = 0 then partb(i) := true; if pwm(2*i) /= ST2_POL(i) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; elsif (not partb(i)) then -- pwm is in time period between paired output going inactive and -- output going active (after dead band time) if pwm(2*i) = ST2_POL(i) then partb(i) := true; if pcnt(i) /= 0 then if cnt(i) /= (ST2_COMPA(i)(pcnt(i)) + ST2_DB(i)(pcnt(i))) then Print("ERROR: Wrong dead band (1) time detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)-ST2_COMPA(i)(pcnt(i))) & ", should be " & tost(ST2_DB(i)(pcnt(i)))); end if; end if; end if; elsif (not partc(i)) then -- pwm is in time period between output going active and -- output going inactive if pwm(2*i) = (not ST2_POL(i)) then partc(i) := true; if pcnt(i) /= 0 then if cnt(i) /= ST2_COMPB(i)(pcnt(i)) then Print("ERROR: Wrong compare match (2) detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)) & ", should be " & tost(ST2_COMPB(i)(pcnt(i)))); end if; if ST2_DB(i)(pcnt(i)) = 0 then partd(i) := true; if pwm(2*i+1) /= ST2_POL(i) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; else if ST2_DB(i)(0) = 0 then cnt2(i) := 0; partd(i) := true; end if; end if; end if; elsif (not partd(i)) then -- pwm is in time period between output going inactive and -- paired output going active (after dead band time) if pwm(2*i+1) = ST2_POL(i) then partd(i) := true; if pcnt(i) /= 0 then if cnt(i) /= (ST2_COMPB(i)(pcnt(i)) + ST2_DB(i)(pcnt(i))) then Print("ERROR: Wrong dead band (2) time detected for pwm " & tost(i+1) & " in period = " & tost(pcnt(i)) & ". Is " & tost(cnt(i)-ST2_COMPB(i)(pcnt(i))) & ", should be " & tost(ST2_DB(i)(pcnt(i)))); end if; else cnt2(i) := 0; end if; end if; end if; end if; end loop; end if; for i in 0 to npwm-1 loop if (not done(i)) then if partd(i) then -- pwm is in time period between paired output going active -- and period end if pcnt(i) /= 0 then if cnt(i) = ST2_PER(i)(pcnt(i)) then parta(i) := false; partb(i) := false; partc(i) := false; partd(i) := false; pcnt(i) := pcnt(i)+1; cnt(i) := 0; end if; else if (cnt2(i)+ST2_COMPB(i)(0)+ST2_DB(i)(0)) = ST2_PER(i)(0) then parta(i) := false; partb(i) := false; partc(i) := false; partd(i) := false; pcnt(i) := pcnt(i)+1; cnt(i) := 0; end if; end if; if pcnt(i) = ST2_NPER then done(i) := true; end if; end if; end if; end loop; end loop; when 3 => ------------------------------------------------------------------------- -- Subtest 3: One asymmetric waveform PWM is generated. Verify period, -- compare matches and dead band time ------------------------------------------------------------------------- parta(npwm-1) := true; while not done(npwm-1) loop wait until rising_edge(clk); cnt(npwm-1) := cnt(npwm-1)+1; wait until (pwmh'event or falling_edge(clk)); if clk = '1' then addr := pcnt(npwm-1) - (pcnt(npwm-1)/ST3_WRAMSIZE)*ST3_WRAMSIZE; if (not parta(npwm-1)) then -- pwm is in time period between period start and when paired -- output goes active (after dead band time) if pwmh(1) = ST3_POL(npwm-1) then parta(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= ST3_DB(npwm-1)(pcnt(npwm-1)) then Print("ERROR: Wrong dead band (1) detected for pwm " & tost((npwm-1)+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)) & ", should be " & tost(ST3_DB(npwm-1)(pcnt(npwm-1)))); end if; end if; end if; elsif (not partb(npwm-1)) then -- pwm is in time period between paired output going active and -- paired output going inactive if pwmh(1) = (not ST3_POL(npwm-1)) then partb(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= ST3_WRAM(addr) then Print("ERROR: Wrong compare match detected for pwm " & tost((npwm-1)+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)) & ", should be " & tost(ST3_WRAM(addr))); end if; if ST3_DB(npwm-1)(pcnt(npwm-1)) = 0 then partc(npwm-1) := true; if pwmh(0) /= ST3_POL(npwm-1) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; elsif (not partc(npwm-1)) then -- pwm is in time period between paired output going inactive and -- output going active (after dead band time) if pwmh(0) = ST3_POL(npwm-1) then partc(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= (ST3_WRAM(addr) + ST3_DB(npwm-1)(pcnt(npwm-1))) then Print("ERROR: Wrong dead band (2) time detected for pwm " & tost((npwm-1)+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)-ST3_WRAM(addr)) & ", should be " & tost(ST3_DB(npwm-1)(pcnt(npwm-1)))); end if; end if; end if; else -- pwm is in time period between output going active and period end -- (output going inactive) if pwmh(0) = (not ST3_POL(npwm-1)) then parta(npwm-1) := false; partb(npwm-1) := false; partc(npwm-1) := false; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= ST3_PER(npwm-1)(pcnt(npwm-1)) then Print("ERROR: Wrong PWM period detected for pwm " & tost((npwm-1)+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)) & ", should be " & tost(ST3_PER(npwm-1)(pcnt(npwm-1)))); end if; end if; if pcnt(npwm-1) = ST3_NPER then done(npwm-1) := true; end if; pcnt(npwm-1) := pcnt(npwm-1)+1; cnt(npwm-1) := 0; if pcnt(npwm-1) < ST3_NPER then if ST3_DB(npwm-1)(pcnt(npwm-1)) = 0 then parta(npwm-1) := true; if pwmh(1) /= ST3_POL(npwm-1) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; end if; end if; end loop; when 4 => ------------------------------------------------------------------------- -- Subtest 4: One symmetric waveform PWM is generated. Verify period, -- compare matches, and dead band time ------------------------------------------------------------------------- for j in 0 to ST4_NPER loop addr := j - (j/ST4_WRAMSIZE)*ST4_WRAMSIZE; ST4_COMPB(npwm-1)(j) := ST4_PER(npwm-1)(j)-ST4_WRAM(addr); end loop; while not done(npwm-1) loop wait until rising_edge(clk); cnt(npwm-1) := cnt(npwm-1)+1; cnt2(npwm-1) := cnt2(npwm-1)+1; wait until (pwmh'event or falling_edge(clk)); if clk = '1' then addr := pcnt(npwm-1) - (pcnt(npwm-1)/ST4_WRAMSIZE)*ST4_WRAMSIZE; if (not parta(npwm-1)) then -- pwm is in time period between period start and when paired -- output goes inactive if pwmh(1) = (not ST4_POL(npwm-1)) then parta(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= ST4_WRAM(addr) then Print("ERROR: Wrong compare match 1 detected for pwm " & tost(npwm-1+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)) & ", should be " & tost(ST4_WRAM(addr))); end if; if ST4_DB(npwm-1)(pcnt(npwm-1)) = 0 then partb(npwm-1) := true; if pwmh(0) /= ST4_POL(npwm-1) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; end if; end if; elsif (not partb(npwm-1)) then -- pwm is in time period between paired output going inactive and -- output going active (after dead band time) if pwmh(0) = ST4_POL(npwm-1) then partb(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= (ST4_WRAM(addr) + ST4_DB(npwm-1)(pcnt(npwm-1))) then Print("ERROR: Wrong dead band (1) time detected for pwm " & tost(npwm-1+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)-ST4_WRAM(addr)) & ", should be " & tost(ST4_DB(npwm-1)(pcnt(npwm-1)))); end if; end if; end if; elsif (not partc(npwm-1)) then -- pwm is in time period between output going active and -- output going inactive if pwmh(0) = (not ST4_POL(npwm-1)) then partc(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= ST4_COMPB(npwm-1)(pcnt(npwm-1)) then Print("ERROR: Wrong compare match (2) detected for pwm " & tost(npwm-1+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)) & ", should be " & tost(ST4_COMPB(npwm-1)(pcnt(npwm-1)))); end if; if ST4_DB(npwm-1)(pcnt(npwm-1)) = 0 then partd(npwm-1) := true; if pwmh(1) /= ST4_POL(npwm-1) then Print("ERROR: Both outputs did not switch simultaneously" & " even though dead band time was zero"); end if; end if; else if ST4_DB(npwm-1)(0) = 0 then cnt2(npwm-1) := 0; partd(npwm-1) := true; end if; end if; end if; elsif (not partd(npwm-1)) then -- pwm is in time period between output going inactive and -- paired output going active (after dead band time) if pwmh(1) = ST4_POL(npwm-1) then partd(npwm-1) := true; if pcnt(npwm-1) /= 0 then if cnt(npwm-1) /= (ST4_COMPB(npwm-1)(pcnt(npwm-1)) + ST4_DB(npwm-1)(pcnt(npwm-1))) then Print("ERROR: Wrong dead band (2) time detected for pwm " & tost(npwm-1+1) & " in period = " & tost(pcnt(npwm-1)) & ". Is " & tost(cnt(npwm-1)-ST4_COMPB(npwm-1)(pcnt(npwm-1))) & ", should be " & tost(ST4_DB(npwm-1)(pcnt(npwm-1)))); end if; else cnt2(npwm-1) := 0; end if; end if; end if; end if; if partd(npwm-1) then -- pwm is in time period between paired output going active -- and period end if pcnt(npwm-1) /= 0 then if cnt(npwm-1) = ST4_PER(npwm-1)(pcnt(npwm-1)) then parta(npwm-1) := false; partb(npwm-1) := false; partc(npwm-1) := false; partd(npwm-1) := false; pcnt(npwm-1) := pcnt(npwm-1)+1; cnt(npwm-1) := 0; end if; else if (cnt2(npwm-1)+ST4_COMPB(npwm-1)(0)+ST4_DB(npwm-1)(0)) = ST4_PER(npwm-1)(0) then parta(npwm-1) := false; partb(npwm-1) := false; partc(npwm-1) := false; partd(npwm-1) := false; pcnt(npwm-1) := pcnt(npwm-1)+1; cnt(npwm-1) := 0; end if; end if; if pcnt(npwm-1) = ST4_NPER then done(npwm-1) := true; end if; end if; end loop; when others => null; end case; end verify_subtest; begin ior <= iosn or oen; iow <= iosn or writen; data <= (others => 'Z'); addr <= to_X01(address) when rising_edge(clk) else addr; ldata <= to_X01(data) when rising_edge(clk) else ldata; pwmh <= pwm(pwmh1 downto pwmh0); process variable vid, did, subtest : integer; variable npwm : integer := 8; begin pwmh0 <= 2*(npwm-1); pwmh1 <= 2*(npwm-1)+1; wait until ((rising_edge(ior) nor falling_edge(ior)) and rising_edge(iow)); case addr(7 downto 2) is when "000000" => vid := conv_integer(ldata(31 downto 24)); did := conv_integer(ldata(23 downto 12)); when "000010" => subtest := conv_integer(ldata(7 downto 0)); if vid = VENDOR_GAISLER and did = GAISLER_PWM then if subtest > 246 then -- set npwm npwm := 255 - subtest; else verify_subtest(subtest, npwm, clk, pwm, pwmh); end if; end if; when others => end case; end process; end sim; -- pragma translate_on
gpl-2.0
9d0b02ac6b9883bccc8336d6d5e1f378
0.445599
4.004147
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-gr-pci-xc2v3000/testbench.vhd
1
11,723
------------------------------------------------------------------------------ -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 20; -- system clock period romwidth : integer := 32; -- rom data width (8/32) romdepth : integer := 16; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 18; -- ram address depth srambanks : integer := 2 -- number of ram banks ); port ( pci_rst : inout std_logic; -- PCI bus pci_clk : in std_logic; pci_gnt : in std_logic; pci_idsel : in std_logic; pci_lock : inout std_logic; pci_ad : inout std_logic_vector(31 downto 0); pci_cbe : inout std_logic_vector(3 downto 0); pci_frame : inout std_logic; pci_irdy : inout std_logic; pci_trdy : inout std_logic; pci_devsel : inout std_logic; pci_stop : inout std_logic; pci_perr : inout std_logic; pci_par : inout std_logic; pci_req : inout std_logic; pci_serr : inout std_logic; pci_host : in std_logic; pci_66 : in std_logic ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal Rst : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal address : std_logic_vector(27 downto 0); signal data : std_logic_vector(31 downto 0); signal ramsn : std_logic_vector(4 downto 0); signal ramoen : std_logic_vector(4 downto 0); signal rwen : std_logic_vector(3 downto 0); signal rwenx : std_logic_vector(3 downto 0); signal romsn : std_logic_vector(1 downto 0); signal iosn : std_logic; signal oen : std_logic; signal read : std_logic; signal writen : std_logic; signal brdyn : std_logic; signal bexcn : std_logic; signal wdog : std_logic; signal dsuen, dsutx, dsurx, dsubre, dsuact : std_logic; signal dsurst : std_logic; signal test : std_logic; signal error : std_logic; signal gpio : std_logic_vector(7 downto 0); signal GND : std_logic := '0'; signal VCC : std_logic := '1'; signal NC : std_logic := 'Z'; signal clk2 : std_logic := '1'; signal sdcke : std_logic_vector ( 1 downto 0); -- clk en signal sdcsn : std_logic_vector ( 1 downto 0); -- chip sel signal sdwen : std_logic; -- write en signal sdrasn : std_logic; -- row addr stb signal sdcasn : std_logic; -- col addr stb signal sddqm : std_logic_vector ( 3 downto 0); -- data i/o mask signal sdclk : std_logic; signal plllock : std_logic; signal txd1, rxd1 : std_logic; signal txd2, rxd2 : std_logic; signal etx_clk, erx_clk, erx_dv, erx_er, erx_col, erx_crs, etx_en, etx_er : std_logic:='0'; signal erxd, etxd: std_logic_vector(3 downto 0):=(others=>'0'); signal erxdt, etxdt: std_logic_vector(7 downto 0):=(others=>'0'); signal emdc, emdio: std_logic; signal gtx_clk : std_logic; constant lresp : boolean := false; signal pci_arb_req, pci_arb_gnt : std_logic_vector(0 to 3); signal pllref : std_logic; signal spw_rxd : std_logic_vector(0 to 1) := "00"; signal spw_rxs : std_logic_vector(0 to 1) := "00"; signal spw_txd : std_logic_vector(0 to 1); signal spw_txs : std_logic_vector(0 to 1); begin -- clock and reset spw_rxd(0) <= spw_txd(0); spw_rxs(0) <= spw_txs(0); spw_rxd(1) <= spw_txd(1); spw_rxs(1) <= spw_txs(1); clk <= not clk after ct * 1 ns; rst <= dsurst; dsuen <= '1'; dsubre <= '0'; rxd1 <= '1'; pllref <= sdclk; d3 : entity work.leon3mp generic map ( fabtech, memtech, padtech, clktech, disas, dbguart, pclow ) port map (rst, clk, pllref, error, address(27 downto 0), data, sdclk, sdcke, sdcsn, sdwen, sdrasn, sdcasn, sddqm, dsutx, dsurx, dsuen, dsubre, dsuact, txd1, rxd1, txd2, rxd2, ramsn, ramoen, rwen, oen, writen, read, iosn, romsn, gpio, emdio, etx_clk, erx_clk, erxd, erx_dv, erx_er, erx_col, erx_crs, etxd, etx_en, etx_er, emdc, pci_rst, pci_clk, pci_gnt, pci_idsel, pci_lock, pci_ad, pci_cbe, pci_frame, pci_irdy, pci_trdy, pci_devsel, pci_stop, pci_perr, pci_par, pci_req, pci_serr, pci_host, pci_66, pci_arb_req, pci_arb_gnt, spw_rxd, spw_rxs, spw_txd, spw_txs); -- sdram u0: mt48lc16m16a2 generic map (index => 0, fname => sdramfile) PORT MAP( Dq => data(31 downto 16), Addr => address(14 downto 2), Ba => address(16 downto 15), Clk => sdclk, Cke => sdcke(0), Cs_n => sdcsn(0), Ras_n => sdrasn, Cas_n => sdcasn, We_n => sdwen, Dqm => sddqm(3 downto 2)); u1: mt48lc16m16a2 generic map (index => 16, fname => sdramfile) PORT MAP( Dq => data(15 downto 0), Addr => address(14 downto 2), Ba => address(16 downto 15), Clk => sdclk, Cke => sdcke(0), Cs_n => sdcsn(0), Ras_n => sdrasn, Cas_n => sdcasn, We_n => sdwen, Dqm => sddqm(1 downto 0)); u2: mt48lc16m16a2 generic map (index => 0, fname => sdramfile) PORT MAP( Dq => data(31 downto 16), Addr => address(14 downto 2), Ba => address(16 downto 15), Clk => sdclk, Cke => sdcke(0), Cs_n => sdcsn(1), Ras_n => sdrasn, Cas_n => sdcasn, We_n => sdwen, Dqm => sddqm(3 downto 2)); u3: mt48lc16m16a2 generic map (index => 16, fname => sdramfile) PORT MAP( Dq => data(15 downto 0), Addr => address(14 downto 2), Ba => address(16 downto 15), Clk => sdclk, Cke => sdcke(0), Cs_n => sdcsn(1), Ras_n => sdrasn, Cas_n => sdcasn, We_n => sdwen, Dqm => sddqm(1 downto 0)); prom0 : for i in 0 to (romwidth/8)-1 generate sr0 : sram generic map (index => i, abits => romdepth, fname => promfile) port map (address(romdepth+1 downto 2), data(31-i*8 downto 24-i*8), romsn(0), rwen(i), oen); end generate; sram0 : for i in 0 to (sramwidth/8)-1 generate sr0 : sram generic map (index => i, abits => sramdepth, fname => sramfile) port map (address(sramdepth+1 downto 2), data(31-i*8 downto 24-i*8), ramsn(0), rwen(0), ramoen(0)); end generate; phy0 : if (CFG_GRETH = 1) generate emdio <= 'H'; erxd <= erxdt(3 downto 0); etxdt <= "0000" & etxd; p0: phy generic map(base1000_t_fd => 0, base1000_t_hd => 0) port map(rst, emdio, etx_clk, erx_clk, erxdt, erx_dv, erx_er, erx_col, erx_crs, etxdt, etx_en, etx_er, emdc, gtx_clk); end generate; error <= 'H'; -- ERROR pull-up iuerr : process begin wait for 2500 ns; if to_x01(error) = '1' then wait on error; end if; assert (to_x01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; data <= buskeep(data), (others => 'H') after 250 ns; test0 : grtestmod port map ( rst, clk, error, address(21 downto 2), data, iosn, oen, writen, brdyn); dsucom : process procedure dsucfg(signal dsurx : in std_logic; signal dsutx : out std_logic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; wait for 500 ns; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#02#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#24#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#03#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#fc#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#2f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#6f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#11#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#00#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#04#, txp); txa(dsutx, 16#00#, 16#02#, 16#20#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#02#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#43#, 16#10#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#24#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#70#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#03#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
21ec52ae82516bf9e9961b5a22703212
0.577412
3.048102
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_sg_v4_1/0535f152/hdl/src/vhdl/axi_sg_ftch_q_mngr.vhd
3
45,519
-- ************************************************************************* -- -- (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- ************************************************************************* -- ------------------------------------------------------------------------------- -- Filename: axi_sg_ftch_queue.vhd -- Description: This entity is the descriptor fetch queue interface -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library axi_sg_v4_1; use axi_sg_v4_1.axi_sg_pkg.all; library lib_pkg_v1_0; use lib_pkg_v1_0.lib_pkg.all; ------------------------------------------------------------------------------- entity axi_sg_ftch_q_mngr is generic ( C_M_AXI_SG_ADDR_WIDTH : integer range 32 to 64 := 32; -- Master AXI Memory Map Address Width C_M_AXIS_SG_TDATA_WIDTH : integer range 32 to 32 := 32; -- Master AXI Stream Data width C_AXIS_IS_ASYNC : integer range 0 to 1 := 0; -- Channel 1 is async to sg_aclk -- 0 = Synchronous to SG ACLK -- 1 = Asynchronous to SG ACLK C_ASYNC : integer range 0 to 1 := 0; -- Channel 1 is async to sg_aclk -- 0 = Synchronous to SG ACLK -- 1 = Asynchronous to SG ACLK C_SG_FTCH_DESC2QUEUE : integer range 0 to 8 := 0; -- Number of descriptors to fetch and queue for each channel. -- A value of zero excludes the fetch queues. C_ENABLE_MULTI_CHANNEL : integer range 0 to 1 := 0; C_SG_CH1_WORDS_TO_FETCH : integer range 4 to 16 := 8; -- Number of words to fetch for channel 1 C_SG_CH2_WORDS_TO_FETCH : integer range 4 to 16 := 8; -- Number of words to fetch for channel 1 C_SG_CH1_ENBL_STALE_ERROR : integer range 0 to 1 := 1; -- Enable or disable stale descriptor check -- 0 = Disable stale descriptor error check -- 1 = Enable stale descriptor error check C_SG_CH2_ENBL_STALE_ERROR : integer range 0 to 1 := 1; -- Enable or disable stale descriptor check -- 0 = Disable stale descriptor error check -- 1 = Enable stale descriptor error check C_INCLUDE_CH1 : integer range 0 to 1 := 1; -- Include or Exclude channel 1 scatter gather engine -- 0 = Exclude Channel 1 SG Engine -- 1 = Include Channel 1 SG Engine C_INCLUDE_CH2 : integer range 0 to 1 := 1; -- Include or Exclude channel 2 scatter gather engine -- 0 = Exclude Channel 2 SG Engine -- 1 = Include Channel 2 SG Engine C_ENABLE_CDMA : integer range 0 to 1 := 0; C_FAMILY : string := "virtex7" -- Device family used for proper BRAM selection ); port ( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk : in std_logic ; -- m_axi_mm2s_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- p_reset_n : in std_logic ; ch2_sg_idle : in std_logic ; -- -- Channel 1 Control -- ch1_desc_flush : in std_logic ; -- ch1_cyclic : in std_logic ; -- ch1_cntrl_strm_stop : in std_logic ; ch1_ftch_active : in std_logic ; -- ch1_nxtdesc_wren : out std_logic ; -- ch1_ftch_queue_empty : out std_logic ; -- ch1_ftch_queue_full : out std_logic ; -- ch1_ftch_pause : out std_logic ; -- -- -- Channel 2 Control -- ch2_desc_flush : in std_logic ; -- ch2_cyclic : in std_logic ; -- ch2_ftch_active : in std_logic ; -- ch2_nxtdesc_wren : out std_logic ; -- ch2_ftch_queue_empty : out std_logic ; -- ch2_ftch_queue_full : out std_logic ; -- ch2_ftch_pause : out std_logic ; -- nxtdesc : out std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- -- DataMover Command -- ftch_cmnd_wr : in std_logic ; -- ftch_cmnd_data : in std_logic_vector -- ((C_M_AXI_SG_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); -- ftch_stale_desc : out std_logic ; -- -- -- MM2S Stream In from DataMover -- m_axis_mm2s_tdata : in std_logic_vector -- (C_M_AXIS_SG_TDATA_WIDTH-1 downto 0) ; -- m_axis_mm2s_tkeep : in std_logic_vector -- ((C_M_AXIS_SG_TDATA_WIDTH/8)-1 downto 0); -- m_axis_mm2s_tlast : in std_logic ; -- m_axis_mm2s_tvalid : in std_logic ; -- m_axis_mm2s_tready : out std_logic ; -- -- -- -- Channel 1 AXI Fetch Stream Out -- m_axis_ch1_ftch_aclk : in std_logic ; m_axis_ch1_ftch_tdata : out std_logic_vector -- (C_M_AXIS_SG_TDATA_WIDTH-1 downto 0); -- m_axis_ch1_ftch_tvalid : out std_logic ; -- m_axis_ch1_ftch_tready : in std_logic ; -- m_axis_ch1_ftch_tlast : out std_logic ; -- m_axis_ch1_ftch_tdata_new : out std_logic_vector -- (96+31*C_ENABLE_CDMA downto 0); -- m_axis_ch1_ftch_tdata_mcdma_new : out std_logic_vector -- (63 downto 0); -- m_axis_ch1_ftch_tvalid_new : out std_logic ; -- m_axis_ftch1_desc_available : out std_logic ; -- m_axis_ch2_ftch_tdata_new : out std_logic_vector -- (96+31*C_ENABLE_CDMA downto 0); -- m_axis_ch2_ftch_tdata_mcdma_new : out std_logic_vector -- (63 downto 0); -- m_axis_ch2_ftch_tdata_mcdma_nxt : out std_logic_vector -- (31 downto 0); -- m_axis_ch2_ftch_tvalid_new : out std_logic ; -- m_axis_ftch2_desc_available : out std_logic ; -- -- Channel 2 AXI Fetch Stream Out -- m_axis_ch2_ftch_aclk : in std_logic ; -- m_axis_ch2_ftch_tdata : out std_logic_vector -- (C_M_AXIS_SG_TDATA_WIDTH-1 downto 0) ; -- m_axis_ch2_ftch_tvalid : out std_logic ; -- m_axis_ch2_ftch_tready : in std_logic ; -- m_axis_ch2_ftch_tlast : out std_logic ; -- m_axis_mm2s_cntrl_tdata : out std_logic_vector -- (31 downto 0); -- m_axis_mm2s_cntrl_tkeep : out std_logic_vector -- (3 downto 0); -- m_axis_mm2s_cntrl_tvalid : out std_logic ; -- m_axis_mm2s_cntrl_tready : in std_logic := '0'; -- m_axis_mm2s_cntrl_tlast : out std_logic -- ); end axi_sg_ftch_q_mngr; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_sg_ftch_q_mngr is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; attribute mark_debug : string; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- Determine the maximum word count for use in setting the word counter width -- Set bit width on max num words to fetch constant FETCH_COUNT : integer := max2(C_SG_CH1_WORDS_TO_FETCH ,C_SG_CH2_WORDS_TO_FETCH); -- LOG2 to get width of counter constant WORDS2FETCH_BITWIDTH : integer := clog2(FETCH_COUNT); -- Zero value for counter constant WORD_ZERO : std_logic_vector(WORDS2FETCH_BITWIDTH-1 downto 0) := (others => '0'); -- One value for counter constant WORD_ONE : std_logic_vector(WORDS2FETCH_BITWIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,WORDS2FETCH_BITWIDTH)); -- Seven value for counter constant WORD_SEVEN : std_logic_vector(WORDS2FETCH_BITWIDTH-1 downto 0) := std_logic_vector(to_unsigned(7,WORDS2FETCH_BITWIDTH)); constant USE_LOGIC_FIFOS : integer := 0; -- Use Logic FIFOs constant USE_BRAM_FIFOS : integer := 1; -- Use BRAM FIFOs ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal m_axis_mm2s_tready_i : std_logic := '0'; signal ch1_ftch_tready : std_logic := '0'; signal ch2_ftch_tready : std_logic := '0'; -- Misc Signals signal writing_curdesc : std_logic := '0'; signal fetch_word_count : std_logic_vector (WORDS2FETCH_BITWIDTH-1 downto 0) := (others => '0'); signal msb_curdesc : std_logic_vector(31 downto 0) := (others => '0'); signal lsbnxtdesc_tready : std_logic := '0'; signal msbnxtdesc_tready : std_logic := '0'; signal nxtdesc_tready : std_logic := '0'; signal ch1_writing_curdesc : std_logic := '0'; signal ch2_writing_curdesc : std_logic := '0'; signal m_axis_ch2_ftch_tvalid_1 : std_logic := '0'; -- KAPIL signal ch_desc_flush : std_logic := '0'; signal m_axis_ch_ftch_tready : std_logic := '0'; signal ch_ftch_queue_empty : std_logic := '0'; signal ch_ftch_queue_full : std_logic := '0'; signal ch_ftch_pause : std_logic := '0'; signal ch_writing_curdesc : std_logic := '0'; signal ch_ftch_tready : std_logic := '0'; signal m_axis_ch_ftch_tdata : std_logic_vector (C_M_AXIS_SG_TDATA_WIDTH-1 downto 0) := (others => '0'); signal m_axis_ch_ftch_tvalid : std_logic := '0'; signal m_axis_ch_ftch_tlast : std_logic := '0'; signal data_concat : std_logic_vector (95 downto 0) := (others => '0'); signal data_concat_mcdma : std_logic_vector (63 downto 0) := (others => '0'); signal next_bd : std_logic_vector (31 downto 0) := (others => '0'); signal data_concat_valid, tvalid_new : std_logic; attribute mark_debug of data_concat_valid : signal is "true"; attribute mark_debug of tvalid_new : signal is "true"; signal data_concat_tlast, tlast_new : std_logic; attribute mark_debug of data_concat_tlast : signal is "true"; attribute mark_debug of tlast_new : signal is "true"; signal counter : std_logic_vector (C_SG_CH1_WORDS_TO_FETCH-1 downto 0); attribute mark_debug of counter : signal is "true"; signal sof_ftch_desc : std_logic; signal nxtdesc_int : std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- attribute mark_debug of nxtdesc_int : signal is "true"; signal cyclic_enable : std_logic := '0'; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin cyclic_enable <= ch1_cyclic when ch1_ftch_active = '1' else ch2_cyclic; nxtdesc <= nxtdesc_int; TLAST_GEN : if (C_SG_CH1_WORDS_TO_FETCH = 13) generate -- TLAST is generated when 8th beat is received tlast_new <= counter (7) and m_axis_mm2s_tvalid; tvalid_new <= counter (7) and m_axis_mm2s_tvalid; SOF_CHECK : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' or (m_axis_mm2s_tvalid = '1' and m_axis_mm2s_tlast = '1'))then sof_ftch_desc <= '0'; elsif(counter (6) = '1' and m_axis_mm2s_tready_i = '1' and m_axis_mm2s_tdata(27) = '1' )then sof_ftch_desc <= '1'; end if; end if; end process SOF_CHECK; end generate TLAST_GEN; NOTLAST_GEN : if (C_SG_CH1_WORDS_TO_FETCH /= 13) generate sof_ftch_desc <= '0'; CDMA : if C_ENABLE_CDMA = 1 generate -- For CDMA TLAST is generated when 7th beat is received -- because last one is not needed tlast_new <= counter (6) and m_axis_mm2s_tvalid; tvalid_new <=counter (6) and m_axis_mm2s_tvalid; end generate CDMA; NOCDMA : if C_ENABLE_CDMA = 0 generate -- For DMA tlast is generated with 8th beat tlast_new <= counter (7) and m_axis_mm2s_tvalid; tvalid_new <= counter (7) and m_axis_mm2s_tvalid; end generate NOCDMA; end generate NOTLAST_GEN; -- Following shift register keeps track of number of data beats -- of BD that is being read DATA_BEAT_REG : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0' or (m_axis_mm2s_tlast = '1' and m_axis_mm2s_tvalid = '1')) then counter (0) <= '1'; counter (C_SG_CH1_WORDS_TO_FETCH-1 downto 1) <= (others => '0'); Elsif (m_axis_mm2s_tvalid = '1') then counter (C_SG_CH1_WORDS_TO_FETCH-1 downto 1) <= counter (C_SG_CH1_WORDS_TO_FETCH-2 downto 0); counter (0) <= '0'; end if; end if; end process DATA_BEAT_REG; -- Registering the Buffer address from BD, 3rd beat -- Common for DMA, CDMA DATA_REG1 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat (31 downto 0) <= (others => '0'); Elsif (counter (2) = '1') then data_concat (31 downto 0) <= m_axis_mm2s_tdata; end if; end if; end process DATA_REG1; DMA_REG2 : if C_ENABLE_CDMA = 0 generate begin -- For DMA, the 7th beat has the control information DATA_REG2 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat (63 downto 32) <= (others => '0'); Elsif (counter (6) = '1') then data_concat (63 downto 32) <= m_axis_mm2s_tdata; end if; end if; end process DATA_REG2; end generate DMA_REG2; CDMA_REG2 : if C_ENABLE_CDMA = 1 generate begin -- For CDMA, the 5th beat has the DA information DATA_REG2 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat (63 downto 32) <= (others => '0'); Elsif (counter (4) = '1') then data_concat (63 downto 32) <= m_axis_mm2s_tdata; end if; end if; end process DATA_REG2; end generate CDMA_REG2; NOFLOP_FOR_QUEUE : if C_SG_CH1_WORDS_TO_FETCH = 8 generate begin -- Last beat is directly concatenated and passed to FIFO -- Masking the CMPLT bit with cyclic_enable data_concat (95 downto 64) <= (m_axis_mm2s_tdata(31) and (not cyclic_enable)) & m_axis_mm2s_tdata (30 downto 0); data_concat_valid <= tvalid_new; data_concat_tlast <= tlast_new; end generate NOFLOP_FOR_QUEUE; -- In absence of queuing option the last beat needs to be floped FLOP_FOR_NOQUEUE : if C_SG_CH1_WORDS_TO_FETCH = 13 generate begin NO_FETCH_Q : if C_SG_FTCH_DESC2QUEUE = 0 generate DATA_REG3 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat (95 downto 64) <= (others => '0'); Elsif (counter (7) = '1') then data_concat (95 downto 64) <= (m_axis_mm2s_tdata(31) and (not cyclic_enable)) & m_axis_mm2s_tdata (30 downto 0); end if; end if; end process DATA_REG3; end generate NO_FETCH_Q; FETCH_Q : if C_SG_FTCH_DESC2QUEUE /= 0 generate DATA_REG3 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat (95) <= '0'; Elsif (counter (7) = '1') then data_concat (95) <= m_axis_mm2s_tdata (31) and (not cyclic_enable); end if; end if; end process DATA_REG3; data_concat (94 downto 64) <= (others => '0'); end generate FETCH_Q; DATA_CNTRL : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat_valid <= '0'; data_concat_tlast <= '0'; Else data_concat_valid <= tvalid_new; data_concat_tlast <= tlast_new; end if; end if; end process DATA_CNTRL; end generate FLOP_FOR_NOQUEUE; -- Since the McDMA BD has two more fields to be captured -- following procedures are needed NOMCDMA_FTECH : if C_ENABLE_MULTI_CHANNEL = 0 generate begin data_concat_mcdma <= (others => '0'); end generate NOMCDMA_FTECH; MCDMA_BD_FETCH : if C_ENABLE_MULTI_CHANNEL = 1 generate begin DATA_MCDMA_REG1 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat_mcdma (31 downto 0) <= (others => '0'); Elsif (counter (4) = '1') then data_concat_mcdma (31 downto 0) <= m_axis_mm2s_tdata; end if; end if; end process DATA_MCDMA_REG1; DATA_MCDMA_REG2 : process (m_axi_sg_aclk) begin if (m_axi_sg_aclk'event and m_axi_sg_aclk = '1') then if (m_axi_sg_aresetn = '0') then data_concat_mcdma (63 downto 32) <= (others => '0'); Elsif (counter (5) = '1') then data_concat_mcdma (63 downto 32) <= m_axis_mm2s_tdata; end if; end if; end process DATA_MCDMA_REG2; end generate MCDMA_BD_FETCH; --------------------------------------------------------------------------- -- For 32-bit SG addresses then drive zero on msb --------------------------------------------------------------------------- GEN_CURDESC_32 : if C_M_AXI_SG_ADDR_WIDTH = 32 generate begin msb_curdesc <= (others => '0'); end generate GEN_CURDESC_32; --------------------------------------------------------------------------- -- For 64-bit SG addresses then capture upper order adder to msb --------------------------------------------------------------------------- GEN_CURDESC_64 : if C_M_AXI_SG_ADDR_WIDTH = 64 generate begin CAPTURE_CURADDR : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then msb_curdesc <= (others => '0'); elsif(ftch_cmnd_wr = '1')then msb_curdesc <= ftch_cmnd_data(DATAMOVER_CMD_ADDRMSB_BOFST + C_M_AXI_SG_ADDR_WIDTH downto DATAMOVER_CMD_ADDRMSB_BOFST + DATAMOVER_CMD_ADDRLSB_BIT + 1); end if; end if; end process CAPTURE_CURADDR; end generate GEN_CURDESC_64; --------------------------------------------------------------------------- -- Write lower order Next Descriptor Pointer out to pntr_mngr --------------------------------------------------------------------------- REG_LSB_NXTPNTR : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' )then nxtdesc_int(31 downto 0) <= (others => '0'); -- On valid and word count at 0 and channel active capture LSB next pointer elsif(m_axis_mm2s_tvalid = '1' and counter (0) = '1')then nxtdesc_int(31 downto 6) <= m_axis_mm2s_tdata (31 downto 6); -- BD addresses are always 16 word 32-bit aligned nxtdesc_int(5 downto 0) <= (others => '0'); end if; end if; end process REG_LSB_NXTPNTR; lsbnxtdesc_tready <= '1' when m_axis_mm2s_tvalid = '1' and counter (0) = '1' --etch_word_count = WORD_ZERO else '0'; --------------------------------------------------------------------------- -- 64 Bit Scatter Gather addresses enabled --------------------------------------------------------------------------- GEN_UPPER_MSB_NXTDESC : if C_M_AXI_SG_ADDR_WIDTH = 64 generate begin --------------------------------------------------------------------------- -- Write upper order Next Descriptor Pointer out to pntr_mngr --------------------------------------------------------------------------- REG_MSB_NXTPNTR : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' )then nxtdesc_int(63 downto 32) <= (others => '0'); ch1_nxtdesc_wren <= '0'; ch2_nxtdesc_wren <= '0'; -- Capture upper pointer, drive ready to progress DataMover -- and also write nxtdesc out elsif(m_axis_mm2s_tvalid = '1' and counter (1) = '1') then -- etch_word_count = WORD_ONE)then nxtdesc_int(63 downto 32) <= m_axis_mm2s_tdata; ch1_nxtdesc_wren <= ch1_ftch_active; ch2_nxtdesc_wren <= ch2_ftch_active; -- Assert tready/wren for only 1 clock else ch1_nxtdesc_wren <= '0'; ch2_nxtdesc_wren <= '0'; end if; end if; end process REG_MSB_NXTPNTR; msbnxtdesc_tready <= '1' when m_axis_mm2s_tvalid = '1' and counter (1) = '1' --fetch_word_count = WORD_ONE else '0'; end generate GEN_UPPER_MSB_NXTDESC; --------------------------------------------------------------------------- -- 32 Bit Scatter Gather addresses enabled --------------------------------------------------------------------------- GEN_NO_UPR_MSB_NXTDESC : if C_M_AXI_SG_ADDR_WIDTH = 32 generate begin ----------------------------------------------------------------------- -- No upper order therefore dump fetched word and write pntr lower next -- pointer to pntr mngr ----------------------------------------------------------------------- REG_MSB_NXTPNTR : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' )then ch1_nxtdesc_wren <= '0'; ch2_nxtdesc_wren <= '0'; -- Throw away second word but drive ready to progress DataMover -- and also write nxtdesc out elsif(m_axis_mm2s_tvalid = '1' and counter (1) = '1') then --fetch_word_count = WORD_ONE)then ch1_nxtdesc_wren <= ch1_ftch_active; ch2_nxtdesc_wren <= ch2_ftch_active; -- Assert for only 1 clock else ch1_nxtdesc_wren <= '0'; ch2_nxtdesc_wren <= '0'; end if; end if; end process REG_MSB_NXTPNTR; msbnxtdesc_tready <= '1' when m_axis_mm2s_tvalid = '1' and counter (1) = '1' --fetch_word_count = WORD_ONE else '0'; end generate GEN_NO_UPR_MSB_NXTDESC; -- Drive ready to DataMover for ether lsb or msb capture nxtdesc_tready <= msbnxtdesc_tready or lsbnxtdesc_tready; -- Generate logic for checking stale descriptor GEN_STALE_DESC_CHECK : if C_SG_CH1_ENBL_STALE_ERROR = 1 or C_SG_CH2_ENBL_STALE_ERROR = 1 generate begin --------------------------------------------------------------------------- -- Examine Completed BIT to determine if stale descriptor fetched --------------------------------------------------------------------------- CMPLTD_CHECK : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' )then ftch_stale_desc <= '0'; -- On valid and word count at 0 and channel active capture LSB next pointer elsif(m_axis_mm2s_tvalid = '1' and counter (7) = '1' --fetch_word_count = WORD_SEVEN and m_axis_mm2s_tready_i = '1' and m_axis_mm2s_tdata(DESC_STS_CMPLTD_BIT) = '1' )then ftch_stale_desc <= '1' and (not cyclic_enable); else ftch_stale_desc <= '0'; end if; end if; end process CMPLTD_CHECK; end generate GEN_STALE_DESC_CHECK; -- No needed logic for checking stale descriptor GEN_NO_STALE_CHECK : if C_SG_CH1_ENBL_STALE_ERROR = 0 and C_SG_CH2_ENBL_STALE_ERROR = 0 generate begin ftch_stale_desc <= '0'; end generate GEN_NO_STALE_CHECK; --------------------------------------------------------------------------- -- SG Queueing therefore pass stream signals to -- FIFO --------------------------------------------------------------------------- GEN_QUEUE : if C_SG_FTCH_DESC2QUEUE /= 0 generate begin -- Instantiate the queue version FTCH_QUEUE_I : entity axi_sg_v4_1.axi_sg_ftch_queue generic map( C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXIS_SG_TDATA_WIDTH => C_M_AXIS_SG_TDATA_WIDTH , C_SG_FTCH_DESC2QUEUE => C_SG_FTCH_DESC2QUEUE , C_SG_WORDS_TO_FETCH => C_SG_CH1_WORDS_TO_FETCH , C_AXIS_IS_ASYNC => C_AXIS_IS_ASYNC , C_ASYNC => C_ASYNC , C_FAMILY => C_FAMILY , C_SG2_WORDS_TO_FETCH => C_SG_CH2_WORDS_TO_FETCH , C_INCLUDE_MM2S => C_INCLUDE_CH1, C_INCLUDE_S2MM => C_INCLUDE_CH2, C_ENABLE_CDMA => C_ENABLE_CDMA, C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL ) port map( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk => m_axi_sg_aclk , m_axi_primary_aclk => m_axi_mm2s_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , p_reset_n => p_reset_n , ch2_sg_idle => '0' , -- Channel Control desc1_flush => ch1_desc_flush , desc2_flush => ch2_desc_flush , ch1_cntrl_strm_stop => ch1_cntrl_strm_stop , ftch1_active => ch1_ftch_active , ftch2_active => ch2_ftch_active , ftch1_queue_empty => ch1_ftch_queue_empty , ftch2_queue_empty => ch2_ftch_queue_empty , ftch1_queue_full => ch1_ftch_queue_full , ftch2_queue_full => ch2_ftch_queue_full , ftch1_pause => ch1_ftch_pause , ftch2_pause => ch2_ftch_pause , writing_nxtdesc_in => nxtdesc_tready , writing1_curdesc_out => ch1_writing_curdesc , writing2_curdesc_out => ch2_writing_curdesc , -- DataMover Command ftch_cmnd_wr => ftch_cmnd_wr , ftch_cmnd_data => ftch_cmnd_data , -- MM2S Stream In from DataMover m_axis_mm2s_tdata => m_axis_mm2s_tdata , m_axis_mm2s_tlast => m_axis_mm2s_tlast , m_axis_mm2s_tvalid => m_axis_mm2s_tvalid , sof_ftch_desc => sof_ftch_desc , next_bd => nxtdesc_int , data_concat => data_concat, data_concat_mcdma => data_concat_mcdma, data_concat_valid => data_concat_valid, data_concat_tlast => data_concat_tlast, m_axis1_mm2s_tready => ch1_ftch_tready , m_axis2_mm2s_tready => ch2_ftch_tready , -- Channel 1 AXI Fetch Stream Out m_axis_ftch_aclk => m_axi_sg_aclk, --m_axis_ch_ftch_aclk , m_axis_ftch1_tdata => m_axis_ch1_ftch_tdata , m_axis_ftch1_tvalid => m_axis_ch1_ftch_tvalid , m_axis_ftch1_tready => m_axis_ch1_ftch_tready , m_axis_ftch1_tlast => m_axis_ch1_ftch_tlast , m_axis_ftch1_tdata_new => m_axis_ch1_ftch_tdata_new , m_axis_ftch1_tdata_mcdma_new => m_axis_ch1_ftch_tdata_mcdma_new , m_axis_ftch1_tvalid_new => m_axis_ch1_ftch_tvalid_new , m_axis_ftch1_desc_available => m_axis_ftch1_desc_available , m_axis_ftch2_tdata_new => m_axis_ch2_ftch_tdata_new , m_axis_ftch2_tdata_mcdma_new => m_axis_ch2_ftch_tdata_mcdma_new , m_axis_ftch2_tvalid_new => m_axis_ch2_ftch_tvalid_new , m_axis_ftch2_desc_available => m_axis_ftch2_desc_available , m_axis_ftch2_tdata => m_axis_ch2_ftch_tdata , m_axis_ftch2_tvalid => m_axis_ch2_ftch_tvalid , m_axis_ftch2_tready => m_axis_ch2_ftch_tready , m_axis_ftch2_tlast => m_axis_ch2_ftch_tlast , m_axis_mm2s_cntrl_tdata => m_axis_mm2s_cntrl_tdata , m_axis_mm2s_cntrl_tkeep => m_axis_mm2s_cntrl_tkeep , m_axis_mm2s_cntrl_tvalid => m_axis_mm2s_cntrl_tvalid , m_axis_mm2s_cntrl_tready => m_axis_mm2s_cntrl_tready , m_axis_mm2s_cntrl_tlast => m_axis_mm2s_cntrl_tlast ); m_axis_ch2_ftch_tdata_mcdma_nxt <= (others => '0'); end generate GEN_QUEUE; -- No SG Queueing therefore pass stream signals straight -- out channel port GEN_NO_QUEUE : if C_SG_FTCH_DESC2QUEUE = 0 generate begin -- Instantiate the No queue version NO_FTCH_QUEUE_I : entity axi_sg_v4_1.axi_sg_ftch_noqueue generic map ( C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH, C_M_AXIS_SG_TDATA_WIDTH => C_M_AXIS_SG_TDATA_WIDTH, C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL, C_AXIS_IS_ASYNC => C_AXIS_IS_ASYNC , C_ASYNC => C_ASYNC , C_FAMILY => C_FAMILY , C_SG_WORDS_TO_FETCH => C_SG_CH1_WORDS_TO_FETCH , C_ENABLE_CH1 => C_INCLUDE_CH1 ) port map( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk => m_axi_sg_aclk , m_axi_primary_aclk => m_axi_mm2s_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , p_reset_n => p_reset_n , -- Channel Control desc_flush => ch1_desc_flush , ch1_cntrl_strm_stop => ch1_cntrl_strm_stop , ftch_active => ch1_ftch_active , ftch_queue_empty => ch1_ftch_queue_empty , ftch_queue_full => ch1_ftch_queue_full , desc2_flush => ch2_desc_flush , ftch2_active => ch2_ftch_active , ftch2_queue_empty => ch2_ftch_queue_empty , ftch2_queue_full => ch2_ftch_queue_full , writing_nxtdesc_in => nxtdesc_tready , writing_curdesc_out => ch1_writing_curdesc , writing2_curdesc_out => ch2_writing_curdesc , -- DataMover Command ftch_cmnd_wr => ftch_cmnd_wr , ftch_cmnd_data => ftch_cmnd_data , -- MM2S Stream In from DataMover m_axis_mm2s_tdata => m_axis_mm2s_tdata , m_axis_mm2s_tlast => m_axis_mm2s_tlast , m_axis_mm2s_tvalid => m_axis_mm2s_tvalid , m_axis_mm2s_tready => ch1_ftch_tready , m_axis2_mm2s_tready => ch2_ftch_tready , sof_ftch_desc => sof_ftch_desc , next_bd => nxtdesc_int , data_concat => data_concat, data_concat_mcdma => data_concat_mcdma, data_concat_valid => data_concat_valid, data_concat_tlast => data_concat_tlast, -- Channel 1 AXI Fetch Stream Out m_axis_ftch_tdata => m_axis_ch1_ftch_tdata , m_axis_ftch_tvalid => m_axis_ch1_ftch_tvalid , m_axis_ftch_tready => m_axis_ch1_ftch_tready , m_axis_ftch_tlast => m_axis_ch1_ftch_tlast , m_axis_ftch_tdata_new => m_axis_ch1_ftch_tdata_new , m_axis_ftch_tdata_mcdma_new => m_axis_ch1_ftch_tdata_mcdma_new , m_axis_ftch_tvalid_new => m_axis_ch1_ftch_tvalid_new , m_axis_ftch_desc_available => m_axis_ftch1_desc_available , m_axis2_ftch_tdata_new => m_axis_ch2_ftch_tdata_new , m_axis2_ftch_tdata_mcdma_new => m_axis_ch2_ftch_tdata_mcdma_new , m_axis2_ftch_tdata_mcdma_nxt => m_axis_ch2_ftch_tdata_mcdma_nxt , m_axis2_ftch_tvalid_new => m_axis_ch2_ftch_tvalid_new , m_axis2_ftch_desc_available => m_axis_ftch2_desc_available , m_axis2_ftch_tdata => m_axis_ch2_ftch_tdata , m_axis2_ftch_tvalid => m_axis_ch2_ftch_tvalid , m_axis2_ftch_tready => m_axis_ch2_ftch_tready , m_axis2_ftch_tlast => m_axis_ch2_ftch_tlast , m_axis_mm2s_cntrl_tdata => m_axis_mm2s_cntrl_tdata , m_axis_mm2s_cntrl_tkeep => m_axis_mm2s_cntrl_tkeep , m_axis_mm2s_cntrl_tvalid => m_axis_mm2s_cntrl_tvalid , m_axis_mm2s_cntrl_tready => m_axis_mm2s_cntrl_tready , m_axis_mm2s_cntrl_tlast => m_axis_mm2s_cntrl_tlast ); ch1_ftch_pause <= '0'; ch2_ftch_pause <= '0'; end generate GEN_NO_QUEUE; ------------------------------------------------------------------------------- -- DataMover TREADY MUX ------------------------------------------------------------------------------- writing_curdesc <= ch1_writing_curdesc or ch2_writing_curdesc or ftch_cmnd_wr; TREADY_MUX : process(writing_curdesc, fetch_word_count, nxtdesc_tready, -- channel 1 signals ch1_ftch_active, ch1_desc_flush, ch1_ftch_tready, -- channel 2 signals ch2_ftch_active, ch2_desc_flush, counter(0), counter(1), ch2_ftch_tready) begin -- If commmanded to flush descriptor then assert ready -- to datamover until active de-asserts. this allows -- any commanded fetches to complete. if( (ch1_desc_flush = '1' and ch1_ftch_active = '1') or(ch2_desc_flush = '1' and ch2_ftch_active = '1'))then m_axis_mm2s_tready_i <= '1'; -- NOT ready if cmnd being written because -- curdesc gets written to queue elsif(writing_curdesc = '1')then m_axis_mm2s_tready_i <= '0'; -- First two words drive ready from internal logic elsif(counter(0) = '1' or counter(1)='1')then m_axis_mm2s_tready_i <= nxtdesc_tready; -- Remainder stream words drive ready from channel input else m_axis_mm2s_tready_i <= (ch1_ftch_active and ch1_ftch_tready) or (ch2_ftch_active and ch2_ftch_tready); end if; end process TREADY_MUX; m_axis_mm2s_tready <= m_axis_mm2s_tready_i; end implementation;
gpl-3.0
e21eab84b623a9215deb89fcf9ce28ae
0.433116
4.256499
false
false
false
false
capitanov/Stupid_watch
src/rtl/game_cores/cl_mines.vhd
1
5,948
-------------------------------------------------------------------------------- -- -- Title : cl_mines.vhd -- Design : Example -- Author : Kapitanov -- Company : InSys -- -- Version : 1.0 -------------------------------------------------------------------------------- -- -- Description : Game block for mines -- -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use work.ctrl_types_pkg.array8x8; use work.ctrl_types_pkg.data3x8; use work.ctrl_types_pkg.data8x8; entity cl_mines is generic( constant yend : std_logic_vector(4 downto 0); --! Y end area constant ystart : std_logic_vector(4 downto 0); --! Y start area constant xend : std_logic_vector(6 downto 0); --! X end area constant xstart : std_logic_vector(6 downto 0) --! X start area ); port( -- system signals: clk : in std_logic; --! clock reset : in std_logic; --! system reset -- vga XoY coordinates: show_disp : in array8x8; --! show square display -- vga XoY coordinates: addr_rnd : in std_logic_vector(4 downto 0); --! address round display : in std_logic; --! games counter enable x_char : in std_logic_vector(9 downto 0); --! X line: 0:79 y_char : in std_logic_vector(8 downto 0); --! Y line: 0:29 -- out color scheme: data_out : out std_logic_vector(7 downto 0); --! send data rgb : out std_logic_vector(2 downto 0) --! RGB Colour ); end cl_mines; architecture cl_mines of cl_mines is component ctrl_rounds_rom is port( clk : in std_logic; addr : in std_logic_vector(7 downto 0); data : out std_logic_vector(23 downto 0) ); end component; component ctrl_8x16_rom is port( clk : in std_logic; addr : in std_logic_vector(10 downto 0); data : out std_logic_vector(7 downto 0) ); end component; signal x_in : std_logic_vector(6 downto 0); signal y_in : std_logic_vector(4 downto 0); signal x_rev : std_logic_vector(2 downto 0); signal x_del : std_logic_vector(2 downto 0); signal x_z : std_logic_vector(2 downto 0); signal y_charzz : std_logic_vector(3 downto 0); signal y_charz : std_logic_vector(3 downto 0); constant color2 : std_logic_vector(2 downto 0):="010"; signal addr_round : std_logic_vector(7 downto 0); signal data_round : std_logic_vector(23 downto 0); signal addr_rom2 : std_logic_vector(10 downto 0); signal data_rom2 : std_logic_vector(7 downto 0); signal data_box : std_logic_vector(7 downto 0); signal data_disp : data8x8; signal data2 : std_logic; signal x_inz : std_logic_vector(6 downto 0); signal y_inz : std_logic_vector(4 downto 0); signal dataxy : std_logic; begin y_charz <= y_char(3 downto 0) when rising_edge(clk); y_charzz <= y_charz when rising_edge(clk); x_in <= x_char(9 downto 3); y_in <= y_char(8 downto 4); x_inz <= x_in after 1 ns when rising_edge(clk); y_inz <= y_in after 1 ns when rising_edge(clk); addr_round <= ((not addr_rnd) & (not y_in(2 downto 0))) when (y_in(4 downto 3) = "10"); x_rounds: ctrl_rounds_rom port map( clk => clk, addr => addr_round, data => data_round ); x_char_rom2: ctrl_8x16_rom port map( clk => clk, addr => addr_rom2, data => data_rom2 ); x_gen_round: for ii in 0 to 7 generate signal conv_3x8 : data3x8; begin conv_3x8(ii) <= data_round(23-3*ii downto 21-3*ii); pr_round_box2: process(clk, reset) is begin if reset = '0' then data_disp(ii) <= x"00"; elsif rising_edge(clk) then case conv_3x8(ii) is when "000" => data_disp(ii) <= x"30"; when "001" => data_disp(ii) <= x"31"; when "010" => data_disp(ii) <= x"32"; when "011" => data_disp(ii) <= x"33"; when "100" => data_disp(ii) <= x"34"; when "101" => data_disp(ii) <= x"35"; when "110" => data_disp(ii) <= x"36"; when others => data_disp(ii) <= x"0F"; end case; end if; end process; end generate; pr_select2: process(clk, reset) is begin if reset = '0' then data_box <= x"00"; elsif rising_edge(clk) then if (dataxy = '1') then if (ystart <= y_inz) and (y_inz < yend) then if x_inz(6 downto 3) = "0010" then case x_inz(2 downto 0) is when "000" => data_box <= data_disp(0); when "001" => data_box <= data_disp(1); when "010" => data_box <= data_disp(2); when "011" => data_box <= data_disp(3); when "100" => data_box <= data_disp(4); when "101" => data_box <= data_disp(5); when "110" => data_box <= data_disp(6); when others => data_box <= data_disp(7); end case; else data_box <= x"00"; end if; else data_box <= x"00"; end if; else data_box <= x"00"; end if; end if; end process; addr_rom2 <= data_box(6 downto 0) & y_charzz(3 downto 0); pr_select3: process(clk, reset) is begin if reset = '0' then dataxy <= '0'; elsif rising_edge(clk) then if display = '0' then dataxy <= '0'; else if ((xstart <= x_in) and (x_in < xend)) then if ((ystart <= y_in) and (y_in < yend)) then dataxy <= show_disp(conv_integer(x_in(2 downto 0)))(conv_integer(y_in(2 downto 0))); else dataxy <= '0'; end if; else dataxy <= '0'; end if; end if; end if; end process; data_out <= data_box; g_rev: for ii in 0 to 2 generate begin x_rev(ii) <= not x_char(ii) when rising_edge(clk); end generate; x_del <= x_rev when rising_edge(clk); x_z <= x_del when rising_edge(clk); pr_sw_sel2: process(clk, reset) is begin if reset = '0' then data2 <= '0'; elsif rising_edge(clk) then data2 <= data_rom2(to_integer(unsigned(x_z))); end if; end process; g_rgb2: for ii in 0 to 2 generate begin rgb(ii) <= data2 and color2(ii); end generate; end cl_mines;
mit
57869a0cc350e4f12e85ad6c266b353e
0.571789
2.707328
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/sim/sram16.vhd
1
2,363
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: sram16 -- File: sram16.vhd -- Author: Jiri Gaisler Gaisler Research -- Description: Simulation model of generic 16-bit async SRAM ------------------------------------------------------------------------------ -- pragma translate_off library ieee; use ieee.std_logic_1164.all; use std.textio.all; library gaisler; use gaisler.sim.all; library grlib; use grlib.stdlib.all; entity sram16 is generic ( index : integer := 0; -- Byte lane (0 - 3) abits: Positive := 10; -- Default 10 address bits (1 Kbyte) echk : integer := 0; -- Generate EDAC checksum tacc : integer := 10; -- access time (ns) fname : string := "ram.dat"; -- File to read from clear : integer := 0); -- clear memory port ( a : in std_logic_vector(abits-1 downto 0); d : inout std_logic_vector(15 downto 0); lb : in std_logic; ub : in std_logic; ce : in std_logic; we : in std_ulogic; oe : in std_ulogic); end; architecture sim of sram16 is signal cex : std_logic_vector(0 to 1); begin cex(0) <= ce or lb; cex(1) <= ce or ub; sr0 : sram generic map (index+1, abits, tacc, fname, clear) port map (a, d(7 downto 0), cex(0), we, oe); sr1 : sram generic map (index, abits, tacc, fname, clear) port map (a, d(15 downto 8), cex(1), we, oe); end sim; -- pragma translate_on
gpl-2.0
db65b9216324ee8013024cf1d59dcb36
0.606009
3.727129
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/ddr/ahb2mig_series7.vhd
1
28,712
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: ahb2mig -- File: ahb2mig.vhd -- Author: Fredrik Ringhage - Aeroflex Gaisler AB -- -- This is a AHB-2.0 interface for the Xilinx Virtex-7 MIG. -- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library gaisler; use gaisler.all; use gaisler.ahb2mig_series7_pkg.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; use grlib.config_types.all; use grlib.config.all; library std; use std.textio.all; entity ahb2mig_series7 is generic( hindex : integer := 0; haddr : integer := 0; hmask : integer := 16#f00#; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; maxwriteburst : integer := 8; maxreadburst : integer := 8; SIM_BYPASS_INIT_CAL : string := "OFF"; SIMULATION : string := "FALSE"; USE_MIG_INTERFACE_MODEL : boolean := false ); port( ddr3_dq : inout std_logic_vector(63 downto 0); ddr3_dqs_p : inout std_logic_vector(7 downto 0); ddr3_dqs_n : inout std_logic_vector(7 downto 0); ddr3_addr : out std_logic_vector(13 downto 0); ddr3_ba : out std_logic_vector(2 downto 0); ddr3_ras_n : out std_logic; ddr3_cas_n : out std_logic; ddr3_we_n : out std_logic; ddr3_reset_n : out std_logic; ddr3_ck_p : out std_logic_vector(0 downto 0); ddr3_ck_n : out std_logic_vector(0 downto 0); ddr3_cke : out std_logic_vector(0 downto 0); ddr3_cs_n : out std_logic_vector(0 downto 0); ddr3_dm : out std_logic_vector(7 downto 0); ddr3_odt : out std_logic_vector(0 downto 0); ahbso : out ahb_slv_out_type; ahbsi : in ahb_slv_in_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; calib_done : out std_logic; rst_n_syn : in std_logic; rst_n_async : in std_logic; clk_amba : in std_logic; sys_clk_p : in std_logic; sys_clk_n : in std_logic; clk_ref_i : in std_logic; ui_clk : out std_logic; ui_clk_sync_rst : out std_logic ); end ; architecture rtl of ahb2mig_series7 is type bstate_type is (idle, start, read_cmd, read_data, read_wait, read_output, write_cmd, write_burst); constant AHBDW : integer := CFG_AHBDW; constant maxburst : integer := 8; constant maxmigcmds : integer := nbrmaxmigcmds(AHBDW); constant wrsteps : integer := log2(32); constant wrmask : integer := log2(32/8); constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIG_SERIES7, 0, 0, 0), 4 => ahb_membar(haddr, '1', '1', hmask), others => zero32); constant pconfig : apb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIG_SERIES7, 0, 0, 0), 1 => apb_iobar(paddr, pmask)); type reg_type is record bstate : bstate_type; cmd : std_logic_vector(2 downto 0); cmd_en : std_logic; wr_en : std_logic; wr_end : std_logic; cmd_count : unsigned(31 downto 0); wr_count : unsigned(31 downto 0); rd_count : unsigned(31 downto 0); hready : std_logic; hwrite : std_logic; hwdata_burst : std_logic_vector(512*maxmigcmds-1 downto 0); mask_burst : std_logic_vector(64*maxmigcmds-1 downto 0); htrans : std_logic_vector(1 downto 0); hburst : std_logic_vector(2 downto 0); hsize : std_logic_vector(2 downto 0); hrdata : std_logic_vector(AHBDW-1 downto 0); haddr : std_logic_vector(31 downto 0); haddr_start : std_logic_vector(31 downto 0); haddr_offset : std_logic_vector(31 downto 0); hmaster : std_logic_vector(3 downto 0); int_buffer : unsigned(512*maxmigcmds-1 downto 0); rd_buffer : unsigned(512*maxmigcmds-1 downto 0); wdf_data_buffer : std_logic_vector(511 downto 0); wdf_mask_buffer : std_logic_vector(63 downto 0); migcommands : integer; nxt : std_logic; end record; type mig_in_type is record app_addr : std_logic_vector(27 downto 0); app_cmd : std_logic_vector(2 downto 0); app_en : std_logic; app_wdf_data : std_logic_vector(511 downto 0); app_wdf_end : std_logic; app_wdf_mask : std_logic_vector(63 downto 0); app_wdf_wren : std_logic; end record; type mig_out_type is record app_rd_data : std_logic_vector(511 downto 0); app_rd_data_end : std_logic; app_rd_data_valid : std_logic; app_rdy : std_logic; app_wdf_rdy : std_logic; end record; signal rin, r, rnxt, rnxtin : reg_type; signal migin : mig_in_type; signal migout,migoutraw : mig_out_type; signal debug : std_logic := '0'; signal size_to_watch : std_logic_vector(2 downto 0) := HSIZE_4WORD; component mig is generic( SIM_BYPASS_INIT_CAL : string := "OFF"; SIMULATION : string := "FALSE" ); port ( ddr3_dq : inout std_logic_vector(63 downto 0); ddr3_addr : out std_logic_vector(13 downto 0); ddr3_ba : out std_logic_vector(2 downto 0); ddr3_ras_n : out std_logic; ddr3_cas_n : out std_logic; ddr3_we_n : out std_logic; ddr3_reset_n : out std_logic; ddr3_dqs_n : inout std_logic_vector(7 downto 0); ddr3_dqs_p : inout std_logic_vector(7 downto 0); ddr3_ck_p : out std_logic_vector(0 downto 0); ddr3_ck_n : out std_logic_vector(0 downto 0); ddr3_cke : out std_logic_vector(0 downto 0); ddr3_cs_n : out std_logic_vector(0 downto 0); ddr3_dm : out std_logic_vector(7 downto 0); ddr3_odt : out std_logic_vector(0 downto 0); sys_clk_p : in std_logic; sys_clk_n : in std_logic; clk_ref_i : in std_logic; app_addr : in std_logic_vector(27 downto 0); app_cmd : in std_logic_vector(2 downto 0); app_en : in std_logic; app_wdf_data : in std_logic_vector(511 downto 0); app_wdf_end : in std_logic; app_wdf_mask : in std_logic_vector(63 downto 0); app_wdf_wren : in std_logic; app_rd_data : out std_logic_vector(511 downto 0); app_rd_data_end : out std_logic; app_rd_data_valid : out std_logic; app_rdy : out std_logic; app_wdf_rdy : out std_logic; app_sr_req : in std_logic; app_ref_req : in std_logic; app_zq_req : in std_logic; app_sr_active : out std_logic; app_ref_ack : out std_logic; app_zq_ack : out std_logic; ui_clk : out std_logic; ui_clk_sync_rst : out std_logic; init_calib_complete : out std_logic; sys_rst : in std_logic ); end component mig; component mig_interface_model is port ( app_addr : in std_logic_vector(27 downto 0); app_cmd : in std_logic_vector(2 downto 0); app_en : in std_logic; app_wdf_data : in std_logic_vector(511 downto 0); app_wdf_end : in std_logic; app_wdf_mask : in std_logic_vector(63 downto 0); app_wdf_wren : in std_logic; app_rd_data : out std_logic_vector(511 downto 0); app_rd_data_end : out std_logic; app_rd_data_valid : out std_logic; app_rdy : out std_logic; app_wdf_rdy : out std_logic; ui_clk : out std_logic; ui_clk_sync_rst : out std_logic; init_calib_complete : out std_logic; sys_rst : in std_logic ); end component mig_interface_model; begin comb: process( rst_n_syn, r, rin, ahbsi, migout ) -- Design temp variables variable v,vnxt : reg_type; variable writedata : std_logic_vector(255 downto 0); variable wmask : std_logic_vector(AHBDW/4-1 downto 0); variable shift_steps : natural; variable hrdata_shift_steps : natural; variable steps_write : unsigned(31 downto 0); variable shift_steps_write : natural; variable shift_steps_write_mask : natural; variable startaddress : unsigned(v.haddr'length-1 downto 0); variable start_address : std_logic_vector(v.haddr'length-1 downto 0); variable step_offset : unsigned(steps_write'length-1 downto 0); variable haddr_offset : unsigned(steps_write'length-1 downto 0); begin -- Make all register visible for the statemachine v := r; vnxt := rnxt; -- workout the start address in AHB2MIG buffer based upon startaddress := resize(unsigned(unsigned(ahbsi.haddr(ahbsi.haddr'left-3 downto 8)) & "00000"),startaddress'length); -- Adjust offset in memory buffer startaddress := resize(startaddress + unsigned(unsigned(ahbsi.haddr(7 downto 6))&"000"),startaddress'length); start_address := std_logic_vector(startaddress); -- Workout local offset to be able to adust for warp-around haddr_offset := unsigned(r.haddr_start) - unsigned(unsigned(r.haddr_offset(r.haddr_offset'length-1 downto 6))&"000000"); step_offset := resize(unsigned(haddr_offset(7 downto 6)&"0000"),step_offset'length); -- Fetch AMBA Commands if (( ahbsi.hsel(hindex) and ahbsi.htrans(1) and ahbsi.hready and not ahbsi.htrans(0)) = '1' and (ahbsi.hwrite = '0' or ahbsi.hwrite = '1' )) then vnxt.cmd_count:= (others => '0'); vnxt.wr_count := (others => '0'); vnxt.rd_count := (others => '0'); vnxt.hrdata := (others => '0'); -- Clear old pointers and MIG command signals vnxt.cmd := (others => '0'); vnxt.cmd_en := '0'; vnxt.wr_en := '0'; vnxt.wr_end := '0'; vnxt.hwrite := '0'; vnxt.hwdata_burst := (others => '0'); vnxt.mask_burst := (others => '0'); -- Hold info regarding transaction and execute vnxt.hburst := ahbsi.hburst; vnxt.hwrite := ahbsi.hwrite; vnxt.hsize := ahbsi.hsize; vnxt.hmaster := ahbsi.hmaster; vnxt.hready := '0'; vnxt.htrans := ahbsi.htrans; vnxt.bstate := start; vnxt.haddr := start_address; vnxt.haddr_start := ahbsi.haddr; vnxt.haddr_offset := ahbsi.haddr; vnxt.cmd(2 downto 0) := (others => '0'); vnxt.cmd(0) := not ahbsi.hwrite; if (r.bstate = idle) then vnxt.nxt := '0'; else vnxt.nxt := '1'; end if; -- Clear some old stuff vnxt.int_buffer := (others => '0'); vnxt.rd_buffer := (others => '0'); vnxt.wdf_data_buffer := (others => '0'); vnxt.wdf_mask_buffer := (others => '0'); end if; case r.bstate is when idle => -- Clear old pointers and MIG command signals v.cmd := (others => '0'); v.cmd_en := '0'; v.wr_en := '0'; v.wr_end := '0'; v.hready := '1'; v.hwrite := '0'; v.hwdata_burst := (others => '0'); v.mask_burst := (others => '0'); v.rd_count := (others => '0'); vnxt.cmd := (others => '0'); vnxt.cmd_en := '0'; vnxt.wr_en := '0'; vnxt.wr_end := '0'; vnxt.hready := '1'; vnxt.hwrite := '0'; vnxt.hwdata_burst := (others => '0'); vnxt.mask_burst := (others => '0'); vnxt.rd_count := (others => '0'); vnxt.wr_count := (others => '0'); vnxt.cmd_count := (others => '0'); -- Check if this is a single or burst transfer (and not a BUSY transfer) if (( ahbsi.hsel(hindex) and ahbsi.htrans(1) and ahbsi.hready) = '1' and (ahbsi.hwrite = '0' or ahbsi.hwrite = '1' )) then -- Hold info regarding transaction and execute v.hburst := ahbsi.hburst; v.hwrite := ahbsi.hwrite; v.hsize := ahbsi.hsize; v.hmaster := ahbsi.hmaster; v.hready := '0'; v.htrans := ahbsi.htrans; v.bstate := start; v.haddr := start_address; v.haddr_start := ahbsi.haddr; v.haddr_offset := ahbsi.haddr; v.cmd := (others => '0'); v.cmd(0) := not ahbsi.hwrite; end if; when start => v.migcommands := nbrmigcmds(r.hwrite,r.hsize,ahbsi.htrans,step_offset,AHBDW); -- Check if a write command shall be issued to the DDR3 memory if r.hwrite = '1' then wmask := (others => '0'); writedata := (others => '0'); if ((ahbsi.htrans /= HTRANS_SEQ) or ((ahbsi.htrans = HTRANS_SEQ) and (r.rd_count > 0) and (r.rd_count <= maxburst))) then -- work out how many steps we need to shift the input steps_write := ahbselectdatanoreplicastep(r.haddr_start(7 downto 2),r.hsize(2 downto 0)) + step_offset; shift_steps_write := to_integer(shift_left(steps_write,wrsteps)); shift_steps_write_mask := to_integer(shift_left(steps_write,wrmask)); -- generate mask for complete burst (only need to use addr[3:0]) wmask := ahbselectdatanoreplicamask(r.haddr_start(6 downto 0),r.hsize(2 downto 0)); v.mask_burst := r.mask_burst or std_logic_vector(shift_left(resize(unsigned(wmask), r.mask_burst'length),shift_steps_write_mask)); -- fetch all wdata before write to memory can begin (only supports upto 128bits i.e. addr[4:0] writedata(AHBDW-1 downto 0) := ahbselectdatanoreplica(ahbsi.hwdata(AHBDW-1 downto 0),r.haddr_start(4 downto 0),r.hsize(2 downto 0)); v.hwdata_burst := r.hwdata_burst or std_logic_vector(shift_left(resize(unsigned(writedata),v.hwdata_burst'length),shift_steps_write)); v.haddr_start := ahbsi.haddr; end if; -- Check if this is a cont burst longer than internal buffer if (ahbsi.htrans = HTRANS_SEQ) then if (r.rd_count < maxburst-1) then v.hready := '1'; else v.hready := '0'; end if; if (r.rd_count >= maxburst) then if (r.htrans = HTRANS_SEQ) then v.bstate := write_cmd; end if; v.htrans := ahbsi.htrans; end if; else v.bstate := write_cmd; v.htrans := ahbsi.htrans; end if; -- Else issue a read command when ready else if migout.app_rdy = '1' and migout.app_wdf_rdy = '1' then v.cmd := "001"; v.bstate := read_cmd; v.htrans := ahbsi.htrans; v.cmd_count := to_unsigned(0,v.cmd_count'length); end if; end if; when write_cmd => -- Check if burst has ended due to max size burst if (ahbsi.htrans /= HTRANS_SEQ) then v.htrans := (others => '0'); end if; -- Stop when addr and write command is accepted by mig if (r.wr_count >= r.migcommands) and (r.cmd_count >= r.migcommands) then if (r.htrans /= HTRANS_SEQ) then -- Check if we have a pending transaction if (vnxt.nxt = '1') then v := vnxt; vnxt.nxt := '0'; else v.bstate := idle; end if; else -- Cont burst and work out new offset for next write command v.bstate := write_burst; v.hready := '1'; end if; end if; when write_burst => v.bstate := start; v.hready := '0'; v.hwdata_burst := (others => '0'); v.mask_burst := (others => '0'); v.haddr := start_address; v.haddr_offset := ahbsi.haddr; -- Check if we have a pending transaction if (vnxt.nxt = '1') then v := vnxt; vnxt.nxt := '0'; end if; when read_cmd => v.hready := '0'; v.rd_count := (others => '0'); -- stop when read command is accepted ny mig. if (r.cmd_count >= r.migcommands) then v.bstate := read_data; --v.int_buffer := (others => '0'); end if; when read_data => -- We are not ready yet so issue a read command to the memory controller v.hready := '0'; -- If read data is valid store data in buffers if (migout.app_rd_data_valid = '1') then v.rd_count := r.rd_count + 1; -- Viviado seems to misinterpet the following shift construct and -- therefore changed to a if-else statement --v.int_buffer := r.int_buffer or shift_left( resize(unsigned(migout.app_rd_data),r.int_buffer'length), -- to_integer(shift_left(r.rd_count,9))); if (r.rd_count = 0) then v.int_buffer(511 downto 0) := unsigned(migout.app_rd_data); elsif (r.rd_count = 1) then v.int_buffer(1023 downto 512) := unsigned(migout.app_rd_data); elsif (AHBDW > 64) then if (r.rd_count = 2) then v.int_buffer(1535 downto 1024) := unsigned(migout.app_rd_data); else v.int_buffer(2047 downto 1536) := unsigned(migout.app_rd_data); end if; end if; end if; if (r.rd_count >= r.migcommands) then v.rd_buffer := r.int_buffer; v.bstate := read_output; v.rd_count := to_unsigned(0,v.rd_count'length); end if; when read_output => -- Data is fetched from memory and ready to be transfered v.hready := '1'; -- uses the "wr_count" signal to keep track of number of bytes output'd to AHB -- Select correct 32bit/64bit/128bit to output v.hrdata := ahbselectdatanoreplicaoutput(r.haddr_start(7 downto 0),r.wr_count,r.hsize,r.rd_buffer,r.wr_count,true); -- Count number of bytes send v.wr_count := r.wr_count + 1; -- Check if this was the last transaction if (r.wr_count >= maxburst-1) then v.bstate := read_wait; end if; -- Check if transfer was interrupted or no burst if (ahbsi.htrans = HTRANS_IDLE) or ((ahbsi.htrans = HTRANS_NONSEQ) and (r.wr_count < maxburst)) then v.bstate := read_wait; v.wr_count := (others => '0'); v.rd_count := (others => '0'); v.cmd_count := (others => '0'); -- Check if we have a pending transaction if (vnxt.nxt = '1') then v := vnxt; vnxt.nxt := '0'; v.bstate := start; end if; end if; when read_wait => if ((r.wr_count >= maxburst) and (ahbsi.htrans = HTRANS_SEQ)) then v.hready := '0'; v.bstate := start; v.haddr_start := ahbsi.haddr; v.haddr := start_address; v.haddr_offset := ahbsi.haddr; else -- Check if we have a pending transaction if (vnxt.nxt = '1') then v := vnxt; vnxt.nxt := '0'; v.bstate := start; else v.bstate := idle; v.hready := '1'; end if; end if; when others => v.bstate := idle; end case; if ((ahbsi.htrans /= HTRANS_SEQ) and (r.bstate = start)) then v.hready := '0'; end if; if rst_n_syn = '0' then v.bstate := idle; v.hready := '1'; v.cmd_en := '0'; v.wr_en := '0'; v.wr_end := '0'; --v.wdf_mask_buffer := (others => '0'); v.wdf_data_buffer := (others => '0'); v.haddr := (others => '0'); end if; rin <= v; rnxtin <= vnxt; end process; ahbso.hready <= r.hready; ahbso.hresp <= "00"; --r.hresp; ahbso.hrdata <= ahbdrivedata(r.hrdata); migin.app_addr <= r.haddr(27 downto 2) & "00"; migin.app_cmd <= r.cmd; migin.app_en <= r.cmd_en; migin.app_wdf_data <= r.wdf_data_buffer; migin.app_wdf_end <= r.wr_end; migin.app_wdf_mask <= r.wdf_mask_buffer; migin.app_wdf_wren <= r.wr_en; ahbso.hconfig <= hconfig; ahbso.hirq <= (others => '0'); ahbso.hindex <= hindex; ahbso.hsplit <= (others => '0'); apbo.pindex <= pindex; apbo.pconfig <= pconfig; apbo.pirq <= (others => '0'); apbo.prdata <= (others => '0'); regs : process(clk_amba) begin if rising_edge(clk_amba) then -- Copy variables into registers (Default values) r <= rin; rnxt <= rnxtin; -- add extra pipe-stage for read data migout <= migoutraw; -- IDLE Clear if ((r.bstate = idle) or (r.bstate = read_wait)) then r.cmd_count <= (others => '0'); r.wr_count <= (others => '0'); r.rd_count <= (others => '0'); end if; if (r.bstate = write_burst) then r.cmd_count <= (others => '0'); r.wr_count <= (others => '0'); r.rd_count <= to_unsigned(1,r.rd_count'length); end if; -- Read AHB write data if (r.bstate = start) and (r.hwrite = '1') then r.rd_count <= r.rd_count + 1; end if; -- Write command repsonse if r.bstate = write_cmd then if (r.cmd_count < 1) then r.cmd_en <= '1'; end if; if (migoutraw.app_rdy = '1') and (r.cmd_en = '1' ) then r.cmd_count <= r.cmd_count + 1; if (r.cmd_count < r.migcommands-1 ) then r.haddr <= r.haddr + 8; end if; if (r.cmd_count >= r.migcommands-1) then r.cmd_en <= '0'; end if; end if; if (r.wr_count < 1 ) then r.wr_en <= '1'; r.wr_end <= '1'; r.wdf_mask_buffer <= not r.mask_burst(63 downto 0); r.wdf_data_buffer <= r.hwdata_burst(511 downto 0); end if; if (migoutraw.app_wdf_rdy = '1') and (r.wr_en = '1' ) then if (r.wr_count = 0) then r.wdf_mask_buffer <= not r.mask_burst(127 downto 64); r.wdf_data_buffer <= r.hwdata_burst(1023 downto 512); elsif (AHBDW > 64) then if (r.wr_count = 1) then r.wdf_mask_buffer <= not r.mask_burst(191 downto 128); r.wdf_data_buffer <= r.hwdata_burst(1535 downto 1024); else r.wdf_mask_buffer <= not r.mask_burst(255 downto 192); r.wdf_data_buffer <= r.hwdata_burst(2047 downto 1536); end if; else r.wdf_mask_buffer <= not r.mask_burst(127 downto 64); r.wdf_data_buffer <= r.hwdata_burst(1023 downto 512); end if; r.wr_count <= r.wr_count + 1; if (r.wr_count >= r.migcommands - 1) then r.wr_en <= '0'; r.wr_end <= '0'; end if; end if; end if; -- Burst Write Wait if r.bstate = write_burst then r.cmd_count <= (others => '0'); r.wr_count <= (others => '0'); r.rd_count <= (others => '0'); end if; -- Read command repsonse if r.bstate = read_cmd then if (r.cmd_count < 1) then r.cmd_en <= '1'; end if; if (migoutraw.app_rdy = '1') and (r.cmd_en = '1' ) then r.cmd_count <= r.cmd_count + 1; if (r.cmd_count < r.migcommands-1 ) then r.haddr <= r.haddr + 8; end if; if (r.cmd_count >= r.migcommands-1) then r.cmd_en <= '0'; end if; end if; end if; end if; end process; gen_mig : if (USE_MIG_INTERFACE_MODEL /= true) generate MCB_inst : mig generic map( SIM_BYPASS_INIT_CAL => SIM_BYPASS_INIT_CAL, SIMULATION => SIMULATION) port map ( ddr3_dq => ddr3_dq, ddr3_dqs_p => ddr3_dqs_p, ddr3_dqs_n => ddr3_dqs_n, ddr3_addr => ddr3_addr, ddr3_ba => ddr3_ba, ddr3_ras_n => ddr3_ras_n, ddr3_cas_n => ddr3_cas_n, ddr3_we_n => ddr3_we_n, ddr3_reset_n => ddr3_reset_n, ddr3_ck_p => ddr3_ck_p, ddr3_ck_n => ddr3_ck_n, ddr3_cke => ddr3_cke, ddr3_cs_n => ddr3_cs_n, ddr3_dm => ddr3_dm, ddr3_odt => ddr3_odt, sys_clk_p => sys_clk_p, sys_clk_n => sys_clk_n, clk_ref_i => clk_ref_i, app_addr => migin.app_addr, app_cmd => migin.app_cmd, app_en => migin.app_en, app_rdy => migoutraw.app_rdy, app_wdf_data => migin.app_wdf_data, app_wdf_end => migin.app_wdf_end, app_wdf_mask => migin.app_wdf_mask, app_wdf_wren => migin.app_wdf_wren, app_wdf_rdy => migoutraw.app_wdf_rdy, app_rd_data => migoutraw.app_rd_data, app_rd_data_end => migoutraw.app_rd_data_end, app_rd_data_valid => migoutraw.app_rd_data_valid, app_sr_req => '0', app_ref_req => '0', app_zq_req => '0', app_sr_active => open, app_ref_ack => open, app_zq_ack => open, ui_clk => ui_clk, ui_clk_sync_rst => ui_clk_sync_rst, init_calib_complete => calib_done, sys_rst => rst_n_async ); end generate gen_mig; gen_mig_model : if (USE_MIG_INTERFACE_MODEL = true) generate MCB_model_inst : mig_interface_model port map ( -- user interface signals app_addr => migin.app_addr, app_cmd => migin.app_cmd, app_en => migin.app_en, app_rdy => migoutraw.app_rdy, app_wdf_data => migin.app_wdf_data, app_wdf_end => migin.app_wdf_end, app_wdf_mask => migin.app_wdf_mask, app_wdf_wren => migin.app_wdf_wren, app_wdf_rdy => migoutraw.app_wdf_rdy, app_rd_data => migoutraw.app_rd_data, app_rd_data_end => migoutraw.app_rd_data_end, app_rd_data_valid => migoutraw.app_rd_data_valid, ui_clk => ui_clk, ui_clk_sync_rst => ui_clk_sync_rst, init_calib_complete => calib_done, sys_rst => rst_n_async ); ddr3_dq <= (others => 'Z'); ddr3_dqs_p <= (others => 'Z'); ddr3_dqs_n <= (others => 'Z'); ddr3_addr <= (others => '0'); ddr3_ba <= (others => '0'); ddr3_ras_n <= '0'; ddr3_cas_n <= '0'; ddr3_we_n <= '0'; ddr3_reset_n <= '1'; ddr3_ck_p <= (others => '0'); ddr3_ck_n <= (others => '0'); ddr3_cke <= (others => '0'); ddr3_cs_n <= (others => '0'); ddr3_dm <= (others => '0'); ddr3_odt <= (others => '0'); end generate gen_mig_model; end;
gpl-2.0
a1f70a523e268b9a8178e6a24bcaf546
0.517136
3.431576
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml50x/ahb2mig_ml50x.vhd
2
23,773
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahb2mig -- File: ahb2mig.vhd -- Author: Jiri Gaisler, Gaisler Research -- Description: AHB wrapper for Xilinx Virtex5 DDR2/3 MIG ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; package ml50x is constant BANK_WIDTH : integer := 2; -- # of memory bank addr bits. constant CKE_WIDTH : integer := 2; -- # of memory clock enable outputs. constant CLK_WIDTH : integer := 2; -- # of clock outputs. constant COL_WIDTH : integer := 10; -- # of memory column bits. constant CS_NUM : integer := 1; --2; -- # of separate memory chip selects. constant CS_WIDTH : integer := 1; --2; -- # of total memory chip selects. constant CS_BITS : integer := 0; --1; -- set to log2(CS_NUM) (rounded up). constant DM_WIDTH : integer := 8; -- # of data mask bits. constant DQ_WIDTH : integer := 64; -- # of data width. constant DQ_PER_DQS : integer := 8; -- # of DQ data bits per strobe. constant DQS_WIDTH : integer := 8; -- # of DQS strobes. constant DQ_BITS : integer := 6; -- set to log2(DQS_WIDTH*DQ_PER_DQS). constant DQS_BITS : integer := 3; -- set to log2(DQS_WIDTH). constant ODT_WIDTH : integer := 1; -- # of memory on-die term enables. constant ROW_WIDTH : integer := 13; -- # of memory row and # of addr bits. constant APPDATA_WIDTH : integer := 128; -- # of usr read/write data bus bits. constant ADDR_WIDTH : integer := 31; -- # of memory row and # of addr bits. constant MIGHMASK : integer := 16#F00#; -- AHB mask for 256 Mbyte memory -- constant MIGHMASK : integer := 16#E00#; -- AHB mask for 512 Mbyte memory -- constant MIGHMASK : integer := 16#C00#; -- AHB mask for 1024 Mbyte memory type mig_app_in_type is record app_wdf_wren : std_logic; app_wdf_data : std_logic_vector(APPDATA_WIDTH-1 downto 0); app_wdf_mask : std_logic_vector(APPDATA_WIDTH/8-1 downto 0); app_addr : std_logic_vector(ADDR_WIDTH-1 downto 0); app_cmd : std_logic_vector(2 downto 0); app_en : std_logic; end record; type mig_app_out_type is record app_af_afull : std_logic; app_wdf_afull : std_logic; app_rd_data : std_logic_vector(APPDATA_WIDTH-1 downto 0); app_rd_data_valid : std_logic; end record; component mig_36_1 generic( BANK_WIDTH : integer := 2; -- # of memory bank addr bits. CKE_WIDTH : integer := 1; -- # of memory clock enable outputs. CLK_WIDTH : integer := 2; -- # of clock outputs. COL_WIDTH : integer := 10; -- # of memory column bits. CS_NUM : integer := 1; -- # of separate memory chip selects. CS_WIDTH : integer := 1; -- # of total memory chip selects. CS_BITS : integer := 0; -- set to log2(CS_NUM) (rounded up). DM_WIDTH : integer := 8; -- # of data mask bits. DQ_WIDTH : integer := 64; -- # of data width. DQ_PER_DQS : integer := 8; -- # of DQ data bits per strobe. DQS_WIDTH : integer := 8; -- # of DQS strobes. DQ_BITS : integer := 6; -- set to log2(DQS_WIDTH*DQ_PER_DQS). DQS_BITS : integer := 3; -- set to log2(DQS_WIDTH). ODT_WIDTH : integer := 1; -- # of memory on-die term enables. ROW_WIDTH : integer := 13; -- # of memory row and # of addr bits. ADDITIVE_LAT : integer := 0; -- additive write latency. BURST_LEN : integer := 4; -- burst length (in double words). BURST_TYPE : integer := 0; -- burst type (=0 seq; =1 interleaved). CAS_LAT : integer := 3; -- CAS latency. ECC_ENABLE : integer := 0; -- enable ECC (=1 enable). APPDATA_WIDTH : integer := 128; -- # of usr read/write data bus bits. MULTI_BANK_EN : integer := 1; -- Keeps multiple banks open. (= 1 enable). TWO_T_TIME_EN : integer := 1; -- 2t timing for unbuffered dimms. ODT_TYPE : integer := 1; -- ODT (=0(none),=1(75),=2(150),=3(50)). REDUCE_DRV : integer := 0; -- reduced strength mem I/O (=1 yes). REG_ENABLE : integer := 0; -- registered addr/ctrl (=1 yes). TREFI_NS : integer := 7800; -- auto refresh interval (ns). TRAS : integer := 40000; -- active->precharge delay. TRCD : integer := 15000; -- active->read/write delay. TRFC : integer := 105000; -- refresh->refresh, refresh->active delay. TRP : integer := 15000; -- precharge->command delay. TRTP : integer := 7500; -- read->precharge delay. TWR : integer := 15000; -- used to determine write->precharge. TWTR : integer := 10000; -- write->read delay. HIGH_PERFORMANCE_MODE : boolean := TRUE; -- # = TRUE, the IODELAY performance mode is set -- to high. -- # = FALSE, the IODELAY performance mode is set -- to low. SIM_ONLY : integer := 0; -- = 1 to skip SDRAM power up delay. DEBUG_EN : integer := 0; -- Enable debug signals/controls. -- When this parameter is changed from 0 to 1, -- make sure to uncomment the coregen commands -- in ise_flow.bat or create_ise.bat files in -- par folder. CLK_PERIOD : integer := 5000; -- Core/Memory clock period (in ps). DLL_FREQ_MODE : string := "HIGH"; -- DCM Frequency range. CLK_TYPE : string := "SINGLE_ENDED"; -- # = "DIFFERENTIAL " ->; Differential input clocks , -- # = "SINGLE_ENDED" -> Single ended input clocks. NOCLK200 : boolean := FALSE; -- clk200 enable and disable RST_ACT_LOW : integer := 1 -- =1 for active low reset, =0 for active high. ); port( ddr2_dq : inout std_logic_vector((DQ_WIDTH-1) downto 0); ddr2_a : out std_logic_vector((ROW_WIDTH-1) downto 0); ddr2_ba : out std_logic_vector((BANK_WIDTH-1) downto 0); ddr2_ras_n : out std_logic; ddr2_cas_n : out std_logic; ddr2_we_n : out std_logic; ddr2_cs_n : out std_logic_vector((CS_WIDTH-1) downto 0); ddr2_odt : out std_logic_vector((ODT_WIDTH-1) downto 0); ddr2_cke : out std_logic_vector((CKE_WIDTH-1) downto 0); ddr2_dm : out std_logic_vector((DM_WIDTH-1) downto 0); sys_clk : in std_logic; idly_clk_200 : in std_logic; sys_rst_n : in std_logic; phy_init_done : out std_logic; rst0_tb : out std_logic; clk0_tb : out std_logic; app_wdf_afull : out std_logic; app_af_afull : out std_logic; rd_data_valid : out std_logic; app_wdf_wren : in std_logic; app_af_wren : in std_logic; app_af_addr : in std_logic_vector(30 downto 0); app_af_cmd : in std_logic_vector(2 downto 0); rd_data_fifo_out : out std_logic_vector((APPDATA_WIDTH-1) downto 0); app_wdf_data : in std_logic_vector((APPDATA_WIDTH-1) downto 0); app_wdf_mask_data : in std_logic_vector((APPDATA_WIDTH/8-1) downto 0); ddr2_dqs : inout std_logic_vector((DQS_WIDTH-1) downto 0); ddr2_dqs_n : inout std_logic_vector((DQS_WIDTH-1) downto 0); ddr2_ck : out std_logic_vector((CLK_WIDTH-1) downto 0); ddr2_ck_n : out std_logic_vector((CLK_WIDTH-1) downto 0) ); end component ; end package; library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library gaisler; use grlib.devices.all; use gaisler.memctrl.all; library techmap; use techmap.gencomp.all; use work.ml50x.all; entity ahb2mig_ml50x is generic ( memtech : integer := 0; hindex : integer := 0; haddr : integer := 0; hmask : integer := 16#e00#; MHz : integer := 100; Mbyte : integer := 512; nosync : integer := 0 ); port ( rst_ddr : in std_ulogic; rst_ahb : in std_ulogic; clk_ddr : in std_ulogic; clk_ahb : in std_ulogic; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; migi : out mig_app_in_type; migo : in mig_app_out_type ); end; architecture rtl of ahb2mig_ml50x is constant REVISION : integer := 0; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIGDDR2, 0, REVISION, 0), 4 => ahb_membar(haddr, '1', '1', hmask), others => zero32); type ahb_state_type is (midle, rhold, dread, dwrite, whold1, whold2); type ddr_state_type is (midle, rhold, dread, dwrite, whold1, whold2); constant abuf : integer := 6; type access_param is record haddr : std_logic_vector(31 downto 0); size : std_logic_vector(2 downto 0); hwrite : std_ulogic; end record; -- local registers type mem is array(0 to 7) of std_logic_vector(31 downto 0); type wrm is array(0 to 7) of std_logic_vector(3 downto 0); type ahb_reg_type is record hready : std_ulogic; hsel : std_ulogic; startsd : std_ulogic; state : ahb_state_type; haddr : std_logic_vector(31 downto 0); hrdata : std_logic_vector(127 downto 0); hwrite : std_ulogic; htrans : std_logic_vector(1 downto 0); hresp : std_logic_vector(1 downto 0); raddr : std_logic_vector(abuf-1 downto 0); size : std_logic_vector(2 downto 0); acc : access_param; sync : std_ulogic; hwdata : mem; write : wrm; end record; type ddr_reg_type is record startsd : std_ulogic; hrdata : std_logic_vector(255 downto 0); sync : std_ulogic; dstate : ahb_state_type; end record; signal vcc, clk_ahb1, clk_ahb2 : std_ulogic; signal r, ri : ddr_reg_type; signal ra, rai : ahb_reg_type; signal rbdrive, ribdrive : std_logic_vector(31 downto 0); signal hwdata, hwdatab : std_logic_vector(127 downto 0); begin vcc <= '1'; ahb_ctrl : process(rst_ahb, ahbsi, r, ra, migo, hwdata) variable va : ahb_reg_type; -- local variables for registers variable startsd : std_ulogic; variable ready : std_logic; variable tmp : std_logic_vector(3 downto 0); variable waddr : integer; variable rdata : std_logic_vector(127 downto 0); begin va := ra; va.hresp := HRESP_OKAY; tmp := (others => '0'); case ra.raddr(2 downto 2) is when "0" => rdata := r.hrdata(127 downto 0); when others => rdata := r.hrdata(255 downto 128); end case; if AHBDW > 64 and ra.size = HSIZE_4WORD then va.hrdata := rdata(63 downto 0) & rdata(127 downto 64); elsif AHBDW > 32 and ra.size = HSIZE_DWORD then if ra.raddr(1) = '1' then va.hrdata(63 downto 0) := rdata(127 downto 64); else va.hrdata(63 downto 0) := rdata(63 downto 0); end if; va.hrdata(127 downto 64) := va.hrdata(63 downto 0); else case ra.raddr(1 downto 0) is when "00" => va.hrdata(31 downto 0) := rdata(63 downto 32); when "01" => va.hrdata(31 downto 0) := rdata(31 downto 0); when "10" => va.hrdata(31 downto 0) := rdata(127 downto 96); when others => va.hrdata(31 downto 0) := rdata(95 downto 64); end case; va.hrdata(127 downto 32) := va.hrdata(31 downto 0) & va.hrdata(31 downto 0) & va.hrdata(31 downto 0); end if; if nosync = 0 then va.sync := r.startsd; if ra.startsd = ra.sync then ready := '1'; else ready := '0'; end if; else if ra.startsd = r.startsd then ready := '1'; else ready := '0'; end if; end if; if ((ahbsi.hready and ahbsi.hsel(hindex)) = '1') then va.htrans := ahbsi.htrans; va.haddr := ahbsi.haddr; va.size := ahbsi.hsize(2 downto 0); va.hwrite := ahbsi.hwrite; if ahbsi.htrans(1) = '1' then va.hsel := '1'; va.hready := '0'; end if; end if; if ahbsi.hready = '1' then va.hsel := ahbsi.hsel(hindex); end if; case ra.state is when midle => va.write := (others => "0000"); if ((va.hsel and va.htrans(1)) = '1') then if va.hwrite = '0' then va.state := rhold; va.startsd := not ra.startsd; else va.state := dwrite; va.hready := '1'; end if; end if; va.raddr := ra.haddr(7 downto 2); if ((ahbsi.hready and ahbsi.hsel(hindex)) = '1') then va.acc := (va.haddr, va.size, va.hwrite); end if; when rhold => va.raddr := ra.haddr(7 downto 2); if ready = '1' then va.state := dread; va.hready := '1'; if AHBDW > 64 and ra.size(2) = '1' then va.raddr := ra.raddr + 4; elsif AHBDW > 32 and andv(ra.size(1 downto 0)) = '1' then va.raddr := ra.raddr + 2; else va.raddr := ra.raddr + 1; end if; end if; when dread => va.hready := '1'; if AHBDW > 64 and ra.size(2) = '1' then va.raddr := ra.raddr + 4; elsif AHBDW > 32 and andv(ra.size(1 downto 0)) = '1' then va.raddr := ra.raddr + 2; else va.raddr := ra.raddr + 1; end if; if ((va.hsel and va.htrans(1) and va.htrans(0)) = '0') or (ra.raddr(2 downto 0) = "000") then va.state := midle; va.hready := '0'; end if; va.acc := (va.haddr, va.size, va.hwrite); when dwrite => va.raddr := ra.haddr(7 downto 2); va.hready := '1'; if (((va.hsel and va.htrans(1) and va.htrans(0)) = '0') or (ra.haddr(4 downto 2) = "111") or (AHBDW > 32 and ra.haddr(5 downto 2) = "1110" and andv(ra.size(1 downto 0)) = '1') or (AHBDW > 64 and ra.haddr(5 downto 2) = "1100" and ra.size(2) = '1')) then va.startsd := not ra.startsd; va.state := whold1; va.hready := '0'; end if; tmp := decode(ra.haddr(1 downto 0)); waddr := conv_integer(ra.haddr(4 downto 2)); va.hwdata(waddr) := hwdata(31 downto 0); case ra.size is when "000" => va.write(waddr) := tmp(0) & tmp(1) & tmp(2) & tmp(3); when "001" => va.write(waddr) := tmp(0) & tmp(0) & tmp(2) & tmp(2); when "010" => va.write(waddr) := "1111"; when "011" => va.write(waddr) := "1111"; va.write(waddr+1) := "1111"; va.hwdata(waddr+1) := hwdata((63 mod AHBDW) downto (32 mod AHBDW)); when others => va.write(waddr) := "1111"; va.write(waddr+1) := "1111"; va.write(waddr+2) := "1111"; va.write(waddr+3) := "1111"; va.hwdata(waddr+1) := hwdata((63 mod AHBDW) downto (32 mod AHBDW)); va.hwdata(waddr+2) := hwdata((95 mod AHBDW) downto (64 mod AHBDW)); va.hwdata(waddr+3) := hwdata((127 mod AHBDW) downto (96 mod AHBDW)); end case; when whold1 => va.state := whold2; when whold2 => if ready = '1' then va.state := midle; va.acc := (va.haddr, va.size, va.hwrite); end if; end case; if (ahbsi.hready and ahbsi.hsel(hindex) ) = '1' then if ahbsi.htrans(1) = '0' then va.hready := '1'; end if; end if; if rst_ahb = '0' then va.hsel := '0'; va.hready := '1'; va.state := midle; va.startsd := '0'; va.acc.hwrite := '0'; va.acc.haddr := (others => '0'); end if; rai <= va; end process; ahbso.hready <= ra.hready; ahbso.hresp <= ra.hresp; ahbso.hrdata <= ahbdrivedata(ra.hrdata); -- migi.app_addr <= '0' & ra.acc.haddr(28 downto 6) & "000"; migi.app_addr <= "00000" & ra.acc.haddr(28 downto 5) & "00"; ddr_ctrl : process(rst_ddr, r, ra, migo) variable v : ddr_reg_type; -- local variables for registers variable startsd : std_ulogic; variable raddr : std_logic_vector(13 downto 0); variable adec : std_ulogic; variable haddr : std_logic_vector(31 downto 0); variable hsize : std_logic_vector(1 downto 0); variable hwrite : std_ulogic; variable htrans : std_logic_vector(1 downto 0); variable hready : std_ulogic; variable app_en : std_ulogic; variable app_cmd : std_logic_vector(2 downto 0); variable app_wdf_mask : std_logic_vector(APPDATA_WIDTH/8-1 downto 0); variable app_wdf_wren : std_ulogic; variable app_wdf_data : std_logic_vector(APPDATA_WIDTH-1 downto 0); begin -- Variable default settings to avoid latches v := r; app_en := '0'; app_cmd := "000"; app_wdf_wren := '0'; app_wdf_mask := (others => '0'); app_wdf_mask(15 downto 0) := ra.write(2) & ra.write(3) & ra.write(0) & ra.write(1); app_wdf_data := (others => '0'); app_wdf_data(127 downto 0) := ra.hwdata(2) & ra.hwdata(3) & ra.hwdata(0) & ra.hwdata(1); if ra.acc.hwrite = '0' then app_cmd(0) := '1'; else app_cmd(0) := '0'; end if; v.sync := ra.startsd; if nosync = 0 then if r.startsd /= r.sync then startsd := '1'; else startsd := '0'; end if; else if ra.startsd /= r.startsd then startsd := '1'; else startsd := '0'; end if; end if; case r.dstate is when midle => if (startsd = '1') and (migo.app_af_afull = '0') then if ra.acc.hwrite = '0' then v.dstate := dread; app_en := '1'; elsif migo.app_wdf_afull = '0' then v.dstate := dwrite; app_en := '1'; app_wdf_wren := '1'; end if; end if; when dread => if migo.app_rd_data_valid = '1' then v.hrdata(127 downto 0) := migo.app_rd_data(127 downto 0); v.dstate := rhold; end if; when rhold => v.hrdata(255 downto 128) := migo.app_rd_data(127 downto 0); v.dstate := midle; v.startsd := not r.startsd; when dwrite => app_wdf_wren := '1'; app_wdf_mask(15 downto 0) := ra.write(6) & ra.write(7) & ra.write(4) & ra.write(5); app_wdf_data(127 downto 0) := ra.hwdata(6) & ra.hwdata(7) & ra.hwdata(4) & ra.hwdata(5); v.startsd := not r.startsd; v.dstate := midle; when others => end case; -- reset if rst_ddr = '0' then v.startsd := '0'; app_en := '0'; v.dstate := midle; end if; ri <= v; migi.app_cmd <= app_cmd; migi.app_en <= app_en; migi.app_wdf_wren <= app_wdf_wren; migi.app_wdf_mask <= not app_wdf_mask; migi.app_wdf_data <= app_wdf_data; end process; ahbso.hconfig <= hconfig; ahbso.hirq <= (others => '0'); ahbso.hindex <= hindex; ahbso.hsplit <= (others => '0'); clk_ahb1 <= clk_ahb; clk_ahb2 <= clk_ahb1; -- sync clock deltas ahbregs : process(clk_ahb2) begin if rising_edge(clk_ahb2) then ra <= rai; end if; end process; ddrregs : process(clk_ddr) begin if rising_edge(clk_ddr) then r <= ri; end if; end process; -- Write data selection. AHB32: if AHBDW = 32 generate hwdata <= ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0); end generate AHB32; AHB64: if AHBDW = 64 generate -- With CORE_ACDM set to 0 hwdata will always be ahbsi.hwdata(63 downto 0) -- otherwise the valid data slice will be selected, and possibly uplicated, -- from ahbsi.hwdata. hwdatab(63 downto 0) <= ahbreaddword(ahbsi.hwdata, ra.haddr(4 downto 2)) when (CORE_ACDM = 0 or ra.size(1 downto 0) = "11") else (ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2)) & ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2))); hwdata <= hwdatab(31 downto 0) & hwdatab(63 downto 32) & hwdatab(31 downto 0) & hwdatab(63 downto 32); end generate AHB64; AHBWIDE: if AHBDW > 64 generate -- With CORE_ACDM set to 0 hwdata will always be ahbsi.hwdata(127 downto 0) -- otherwise the valid data slice will be selected, and possibly uplicated, -- from ahbsi.hwdata. hwdatab <= ahbread4word(ahbsi.hwdata, ra.haddr(4 downto 2)) when (CORE_ACDM = 0 or ra.size(2) = '1') else (ahbreaddword(ahbsi.hwdata, ra.haddr(4 downto 2)) & ahbreaddword(ahbsi.hwdata, ra.haddr(4 downto 2))) when (ra.size = "011") else (ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2)) & ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2)) & ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2)) & ahbreadword(ahbsi.hwdata, ra.haddr(4 downto 2))); hwdata <= hwdatab(31 downto 0) & hwdatab(63 downto 32) & hwdatab(95 downto 64) & hwdatab(127 downto 96); end generate AHBWIDE; -- pragma translate_off bootmsg : report_version generic map ( msg1 => "ahb2mig" & tost(hindex) & ": 64-bit DDR2/3 controller rev " & tost(REVISION) & ", " & tost(Mbyte) & " Mbyte, " & tost(MHz) & " MHz DDR clock"); -- pragma translate_on end;
gpl-2.0
cea4e596d67fd25baec550e09dda5d8f
0.524629
3.594889
false
false
false
false
Luisda199824/ProcesadorMonociclo
TB_Mux32B.vhd
1
1,277
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY TB_Mux32B IS END TB_Mux32B; ARCHITECTURE behavior OF TB_Mux32B IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT Mux32B PORT( A : IN std_logic_vector(31 downto 0); B : IN std_logic_vector(31 downto 0); Sc : IN std_logic; MuxOut : OUT std_logic_vector(31 downto 0) ); END COMPONENT; --Inputs signal A : std_logic_vector(31 downto 0) := (others => '0'); signal B : std_logic_vector(31 downto 0) := (others => '0'); signal Sc : std_logic := '0'; --Outputs signal MuxOut : std_logic_vector(31 downto 0); BEGIN -- Instantiate the Unit Under Test (UUT) uut: Mux32B PORT MAP ( A => A, B => B, Sc => Sc, MuxOut => MuxOut ); -- Stimulus process stim_proc: process begin A <= "00000000000000000000000000000000"; B <= "10000000000000000000000000000000"; Sc <= '0'; wait for 20 ns; Sc <= '1'; wait for 20 ns; A <= "11100000000000000000000000000000"; B <= "00000000000000000000000000000000"; Sc <= '0'; wait for 20 ns; Sc <= '1'; wait; end process; END;
mit
539c7deca30cddee019f912b63b002e0
0.586531
3.479564
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/cycloneiii/cycloneiii_ddr_phy.vhd
1
22,014
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: cycloneiii_ddr_phy -- File: cycloneiii_ddr_phy.vhd -- Author: Jiri Gaisler, Gaisler Research -- Description: DDR PHY for Altera FPGAs ------------------------------------------------------------------------------ LIBRARY cycloneiii; USE cycloneiii.all; LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY altdqs_cyciii_adqs_n7i2 IS generic (width : integer := 2; period : string := "10000ps"); PORT ( dll_delayctrlout : OUT STD_LOGIC_VECTOR (5 DOWNTO 0); dqinclk : OUT STD_LOGIC_VECTOR (width-1 downto 0); dqs_datain_h : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_datain_l : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_padio : INOUT STD_LOGIC_VECTOR (width-1 downto 0); dqsundelayedout : OUT STD_LOGIC_VECTOR (width-1 downto 0); inclk : IN STD_LOGIC := '0'; oe : IN STD_LOGIC_VECTOR (width-1 downto 0) := (OTHERS => '1'); outclk : IN STD_LOGIC_VECTOR (width-1 downto 0); outclkena : IN STD_LOGIC_VECTOR (width-1 downto 0) := (OTHERS => '1') ); END altdqs_cyciii_adqs_n7i2; ARCHITECTURE RTL OF altdqs_cyciii_adqs_n7i2 IS -- ATTRIBUTE synthesis_clearbox : boolean; -- ATTRIBUTE synthesis_clearbox OF RTL : ARCHITECTURE IS true; SIGNAL wire_cyciii_dll1_delayctrlout : STD_LOGIC_VECTOR (5 DOWNTO 0); SIGNAL wire_cyciii_dll1_dqsupdate : STD_LOGIC; SIGNAL wire_cyciii_dll1_offsetctrlout : STD_LOGIC_VECTOR (5 DOWNTO 0); SIGNAL wire_cyciii_io2a_combout : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_datain : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_ddiodatain : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_dqsbusout : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_oe : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_outclk : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL wire_cyciii_io2a_outclkena : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL delay_ctrl : STD_LOGIC_VECTOR (5 DOWNTO 0); SIGNAL dqs_update : STD_LOGIC; SIGNAL offset_ctrl : STD_LOGIC_VECTOR (5 DOWNTO 0); COMPONENT cycloneiii_dll GENERIC ( DELAY_BUFFER_MODE : STRING := "low"; DELAY_CHAIN_LENGTH : NATURAL := 12; DELAYCTRLOUT_MODE : STRING := "normal"; INPUT_FREQUENCY : STRING; JITTER_REDUCTION : STRING := "false"; OFFSETCTRLOUT_MODE : STRING := "static"; SIM_LOOP_DELAY_INCREMENT : NATURAL := 0; SIM_LOOP_INTRINSIC_DELAY : NATURAL := 0; SIM_VALID_LOCK : NATURAL := 5; SIM_VALID_LOCKCOUNT : NATURAL := 0; STATIC_DELAY_CTRL : NATURAL := 0; STATIC_OFFSET : STRING; USE_UPNDNIN : STRING := "false"; USE_UPNDNINCLKENA : STRING := "false"; lpm_type : STRING := "cycloneiii_dll" ); PORT ( addnsub : IN STD_LOGIC := '1'; aload : IN STD_LOGIC := '0'; clk : IN STD_LOGIC; delayctrlout : OUT STD_LOGIC_VECTOR(5 DOWNTO 0); dqsupdate : OUT STD_LOGIC; offset : IN STD_LOGIC_VECTOR(5 DOWNTO 0) := (OTHERS => '0'); offsetctrlout : OUT STD_LOGIC_VECTOR(5 DOWNTO 0); upndnin : IN STD_LOGIC := '0'; upndninclkena : IN STD_LOGIC := '1'; upndnout : OUT STD_LOGIC ); END COMPONENT; COMPONENT cycloneiii_io GENERIC ( BUS_HOLD : STRING := "false"; DDIO_MODE : STRING := "none"; DDIOINCLK_INPUT : STRING := "negated_inclk"; DQS_CTRL_LATCHES_ENABLE : STRING := "false"; DQS_DELAY_BUFFER_MODE : STRING := "none"; DQS_EDGE_DETECT_ENABLE : STRING := "false"; DQS_INPUT_FREQUENCY : STRING := "unused"; DQS_OFFSETCTRL_ENABLE : STRING := "false"; DQS_OUT_MODE : STRING := "none"; DQS_PHASE_SHIFT : NATURAL := 0; EXTEND_OE_DISABLE : STRING := "false"; GATED_DQS : STRING := "false"; INCLK_INPUT : STRING := "normal"; INPUT_ASYNC_RESET : STRING := "none"; INPUT_POWER_UP : STRING := "low"; INPUT_REGISTER_MODE : STRING := "none"; INPUT_SYNC_RESET : STRING := "none"; OE_ASYNC_RESET : STRING := "none"; OE_POWER_UP : STRING := "low"; OE_REGISTER_MODE : STRING := "none"; OE_SYNC_RESET : STRING := "none"; OPEN_DRAIN_OUTPUT : STRING := "false"; OPERATION_MODE : STRING; OUTPUT_ASYNC_RESET : STRING := "none"; OUTPUT_POWER_UP : STRING := "low"; OUTPUT_REGISTER_MODE : STRING := "none"; OUTPUT_SYNC_RESET : STRING := "none"; SIM_DQS_DELAY_INCREMENT : NATURAL := 0; SIM_DQS_INTRINSIC_DELAY : NATURAL := 0; SIM_DQS_OFFSET_INCREMENT : NATURAL := 0; TIE_OFF_OE_CLOCK_ENABLE : STRING := "false"; TIE_OFF_OUTPUT_CLOCK_ENABLE : STRING := "false"; lpm_type : STRING := "cycloneiii_io" ); PORT ( areset : IN STD_LOGIC := '0'; combout : OUT STD_LOGIC; datain : IN STD_LOGIC := '0'; ddiodatain : IN STD_LOGIC := '0'; ddioinclk : IN STD_LOGIC := '0'; ddioregout : OUT STD_LOGIC; delayctrlin : IN STD_LOGIC_VECTOR(5 DOWNTO 0) := (OTHERS => '0'); dqsbusout : OUT STD_LOGIC; dqsupdateen : IN STD_LOGIC := '1'; inclk : IN STD_LOGIC := '0'; inclkena : IN STD_LOGIC := '1'; linkin : IN STD_LOGIC := '0'; linkout : OUT STD_LOGIC; oe : IN STD_LOGIC := '1'; offsetctrlin : IN STD_LOGIC_VECTOR(5 DOWNTO 0) := (OTHERS => '0'); outclk : IN STD_LOGIC := '0'; outclkena : IN STD_LOGIC := '1'; padio : INOUT STD_LOGIC; regout : OUT STD_LOGIC; sreset : IN STD_LOGIC := '0'; terminationcontrol : IN STD_LOGIC_VECTOR(13 DOWNTO 0) := (OTHERS => '0') ); END COMPONENT; BEGIN delay_ctrl <= wire_cyciii_dll1_delayctrlout; dll_delayctrlout <= delay_ctrl; dqinclk <= wire_cyciii_io2a_dqsbusout; dqs_update <= wire_cyciii_dll1_dqsupdate; dqsundelayedout <= wire_cyciii_io2a_combout; offset_ctrl <= wire_cyciii_dll1_offsetctrlout; cyciii_dll1 : cycloneiii_dll GENERIC MAP ( DELAY_BUFFER_MODE => "low", DELAY_CHAIN_LENGTH => 12, DELAYCTRLOUT_MODE => "normal", INPUT_FREQUENCY => period, --"10000ps", JITTER_REDUCTION => "false", OFFSETCTRLOUT_MODE => "static", SIM_LOOP_DELAY_INCREMENT => 132, SIM_LOOP_INTRINSIC_DELAY => 3840, SIM_VALID_LOCK => 1, SIM_VALID_LOCKCOUNT => 46, STATIC_OFFSET => "0", USE_UPNDNIN => "false", USE_UPNDNINCLKENA => "false" ) PORT MAP ( clk => inclk, delayctrlout => wire_cyciii_dll1_delayctrlout, dqsupdate => wire_cyciii_dll1_dqsupdate, offsetctrlout => wire_cyciii_dll1_offsetctrlout ); wire_cyciii_io2a_datain <= dqs_datain_h; wire_cyciii_io2a_ddiodatain <= dqs_datain_l; wire_cyciii_io2a_oe <= oe; wire_cyciii_io2a_outclk <= outclk; wire_cyciii_io2a_outclkena <= outclkena; loop0 : FOR i IN 0 TO width-1 GENERATE cyciii_io2a : cycloneiii_io GENERIC MAP ( DDIO_MODE => "output", DQS_CTRL_LATCHES_ENABLE => "true", DQS_DELAY_BUFFER_MODE => "low", DQS_EDGE_DETECT_ENABLE => "false", DQS_INPUT_FREQUENCY => period, --"10000ps", DQS_OFFSETCTRL_ENABLE => "true", DQS_OUT_MODE => "delay_chain3", DQS_PHASE_SHIFT => 9000, EXTEND_OE_DISABLE => "false", GATED_DQS => "false", OE_ASYNC_RESET => "none", OE_POWER_UP => "low", OE_REGISTER_MODE => "register", OE_SYNC_RESET => "none", OPEN_DRAIN_OUTPUT => "false", OPERATION_MODE => "bidir", OUTPUT_ASYNC_RESET => "none", OUTPUT_POWER_UP => "low", OUTPUT_REGISTER_MODE => "register", OUTPUT_SYNC_RESET => "none", SIM_DQS_DELAY_INCREMENT => 22, SIM_DQS_INTRINSIC_DELAY => 960, SIM_DQS_OFFSET_INCREMENT => 11, TIE_OFF_OE_CLOCK_ENABLE => "false", TIE_OFF_OUTPUT_CLOCK_ENABLE => "false" ) PORT MAP ( combout => wire_cyciii_io2a_combout(i), datain => wire_cyciii_io2a_datain(i), ddiodatain => wire_cyciii_io2a_ddiodatain(i), delayctrlin => delay_ctrl, dqsbusout => wire_cyciii_io2a_dqsbusout(i), dqsupdateen => dqs_update, oe => wire_cyciii_io2a_oe(i), offsetctrlin => offset_ctrl, outclk => wire_cyciii_io2a_outclk(i), outclkena => wire_cyciii_io2a_outclkena(i), padio => dqs_padio(i) ); END GENERATE loop0; END RTL; --altdqs_cyciii_adqs_n7i2 LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY altdqs_cyciii IS generic (width : integer := 2; period : string := "10000ps"); PORT ( dqs_datain_h : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_datain_l : IN STD_LOGIC_VECTOR (width-1 downto 0); inclk : IN STD_LOGIC ; oe : IN STD_LOGIC_VECTOR (width-1 downto 0); outclk : IN STD_LOGIC_VECTOR (width-1 downto 0); dll_delayctrlout : OUT STD_LOGIC_VECTOR (5 DOWNTO 0); dqinclk : OUT STD_LOGIC_VECTOR (width-1 downto 0); dqs_padio : INOUT STD_LOGIC_VECTOR (width-1 downto 0); dqsundelayedout : OUT STD_LOGIC_VECTOR (width-1 downto 0) ); END; ARCHITECTURE RTL OF altdqs_cyciii IS -- ATTRIBUTE synthesis_clearbox: boolean; -- ATTRIBUTE synthesis_clearbox OF RTL: ARCHITECTURE IS TRUE; SIGNAL sub_wire0 : STD_LOGIC_VECTOR (5 DOWNTO 0); SIGNAL sub_wire1 : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL sub_wire2 : STD_LOGIC_VECTOR (width-1 downto 0); SIGNAL sub_wire3_bv : BIT_VECTOR (width-1 downto 0); SIGNAL sub_wire3 : STD_LOGIC_VECTOR (width-1 downto 0); COMPONENT altdqs_cyciii_adqs_n7i2 generic (width : integer := 2; period : string := "10000ps"); PORT ( outclk : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_padio : INOUT STD_LOGIC_VECTOR (width-1 downto 0); outclkena : IN STD_LOGIC_VECTOR (width-1 downto 0); oe : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_datain_h : IN STD_LOGIC_VECTOR (width-1 downto 0); inclk : IN STD_LOGIC ; dqs_datain_l : IN STD_LOGIC_VECTOR (width-1 downto 0); dll_delayctrlout : OUT STD_LOGIC_VECTOR (5 DOWNTO 0); dqinclk : OUT STD_LOGIC_VECTOR (width-1 downto 0); dqsundelayedout : OUT STD_LOGIC_VECTOR (width-1 downto 0) ); END COMPONENT; BEGIN sub_wire3_bv(width-1 downto 0) <= (others => '1'); sub_wire3 <= To_stdlogicvector(sub_wire3_bv); dll_delayctrlout <= sub_wire0(5 DOWNTO 0); dqinclk <= not sub_wire1(width-1 downto 0); dqsundelayedout <= sub_wire2(width-1 downto 0); altdqs_cyciii_adqs_n7i2_component : altdqs_cyciii_adqs_n7i2 generic map (width, period) PORT MAP ( outclk => outclk, outclkena => sub_wire3, oe => oe, dqs_datain_h => dqs_datain_h, inclk => inclk, dqs_datain_l => dqs_datain_l, dll_delayctrlout => sub_wire0, dqinclk => sub_wire1, dqsundelayedout => sub_wire2, dqs_padio => dqs_padio ); END RTL; library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library altera_mf; use altera_mf.altera_mf_components.all; ------------------------------------------------------------------ -- CYCLONEIII DDR PHY -------------------------------------------- ------------------------------------------------------------------ entity cycloneiii_ddr_phy is generic (MHz : integer := 100; rstdelay : integer := 200; dbits : integer := 16; clk_mul : integer := 2 ; clk_div : integer := 2); port ( rst : in std_ulogic; clk : in std_logic; -- input clock clkout : out std_ulogic; -- system clock lock : out std_ulogic; -- DCM locked ddr_clk : out std_logic_vector(2 downto 0); ddr_clkb : out std_logic_vector(2 downto 0); ddr_clk_fb_out : out std_logic; ddr_clk_fb : in std_logic; ddr_cke : out std_logic_vector(1 downto 0); ddr_csb : out std_logic_vector(1 downto 0); ddr_web : out std_ulogic; -- ddr write enable ddr_rasb : out std_ulogic; -- ddr ras ddr_casb : out std_ulogic; -- ddr cas ddr_dm : out std_logic_vector (dbits/8-1 downto 0); -- ddr dm ddr_dqs : inout std_logic_vector (dbits/8-1 downto 0); -- ddr dqs ddr_ad : out std_logic_vector (13 downto 0); -- ddr address ddr_ba : out std_logic_vector (1 downto 0); -- ddr bank address ddr_dq : inout std_logic_vector (dbits-1 downto 0); -- ddr data addr : in std_logic_vector (13 downto 0); -- data mask ba : in std_logic_vector ( 1 downto 0); -- data mask dqin : out std_logic_vector (dbits*2-1 downto 0); -- ddr input data dqout : in std_logic_vector (dbits*2-1 downto 0); -- ddr input data dm : in std_logic_vector (dbits/4-1 downto 0); -- data mask oen : in std_ulogic; dqs : in std_ulogic; dqsoen : in std_ulogic; rasn : in std_ulogic; casn : in std_ulogic; wen : in std_ulogic; csn : in std_logic_vector(1 downto 0); cke : in std_logic_vector(1 downto 0) ); end; architecture rtl of cycloneiii_ddr_phy is signal vcc, gnd, dqsn, oe, lockl : std_logic; signal ddr_clk_fb_outr : std_ulogic; signal ddr_clk_fbl, fbclk : std_ulogic; signal ddr_rasnr, ddr_casnr, ddr_wenr : std_ulogic; signal ddr_clkl, ddr_clkbl : std_logic_vector(2 downto 0); signal ddr_csnr, ddr_ckenr, ckel : std_logic_vector(1 downto 0); signal clk_0ro, clk_90ro, clk_180ro, clk_270ro : std_ulogic; signal clk_0r, clk_90r, clk_180r, clk_270r : std_ulogic; signal clk0r, clk90r, clk180r, clk270r : std_ulogic; signal locked, vlockl, ddrclkfbl : std_ulogic; signal clk4, clk5 : std_logic; signal ddr_dqin : std_logic_vector (dbits-1 downto 0); -- ddr data signal ddr_dqout : std_logic_vector (dbits-1 downto 0); -- ddr data signal ddr_dqoen : std_logic_vector (dbits-1 downto 0); -- ddr data signal ddr_adr : std_logic_vector (13 downto 0); -- ddr address signal ddr_bar : std_logic_vector (1 downto 0); -- ddr address signal ddr_dmr : std_logic_vector (dbits/8-1 downto 0); -- ddr address signal ddr_dqsin : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal ddr_dqsoen : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal ddr_dqsoutl : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal dqsdel, dqsclk : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal da : std_logic_vector (dbits-1 downto 0); -- ddr data signal dqinl : std_logic_vector (dbits-1 downto 0); -- ddr data signal dllrst : std_logic_vector(0 to 3); signal dll0rst : std_logic_vector(0 to 3); signal mlock, mclkfb, mclk, mclkfx, mclk0 : std_ulogic; signal gndv : std_logic_vector (dbits-1 downto 0); -- ddr dqs signal pclkout : std_logic_vector (5 downto 1); signal ddr_clkin : std_logic_vector(0 to 2); signal dqinclk : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal dqsoclk : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs signal dqsnv : std_logic_vector (dbits/8-1 downto 0); -- ddr dqs constant DDR_FREQ : integer := (MHz * clk_mul) / clk_div; component altdqs_cyciii generic (width : integer := 2; period : string := "10000ps"); PORT ( dqs_datain_h : IN STD_LOGIC_VECTOR (width-1 downto 0); dqs_datain_l : IN STD_LOGIC_VECTOR (width-1 downto 0); inclk : IN STD_LOGIC ; oe : IN STD_LOGIC_VECTOR (width-1 downto 0); outclk : IN STD_LOGIC_VECTOR (width-1 downto 0); dll_delayctrlout : OUT STD_LOGIC_VECTOR (5 DOWNTO 0); dqinclk : OUT STD_LOGIC_VECTOR (width-1 downto 0); dqs_padio : INOUT STD_LOGIC_VECTOR (width-1 downto 0); dqsundelayedout : OUT STD_LOGIC_VECTOR (width-1 downto 0) ); END component; type phasevec is array (1 to 3) of string(1 to 4); type phasevecarr is array (10 to 13) of phasevec; constant phasearr : phasevecarr := ( ("2500", "5000", "7500"), ("2273", "4545", "6818"), -- 100 & 110 MHz ("2083", "4167", "6250"), ("1923", "3846", "5769")); -- 120 & 130 MHz type periodtype is array (10 to 13) of string(1 to 6); constant periodstr : periodtype := ("9999ps", "9090ps", "8333ps", "7692ps"); begin oe <= not oen; vcc <= '1'; gnd <= '0'; gndv <= (others => '0'); mclk <= clk; -- clkout <= clk_270r; -- clkout <= clk_0r when DDR_FREQ >= 110 else clk_270r; clkout <= clk_90r when DDR_FREQ > 120 else clk_0r; clk0r <= clk_270r; clk90r <= clk_0r; clk180r <= clk_90r; clk270r <= clk_180r; dll : altpll generic map ( intended_device_family => "CycloneIII", operation_mode => "NORMAL", inclk0_input_frequency => 1000000/MHz, inclk1_input_frequency => 1000000/MHz, clk4_multiply_by => clk_mul, clk4_divide_by => clk_div, clk3_multiply_by => clk_mul, clk3_divide_by => clk_div, clk2_multiply_by => clk_mul, clk2_divide_by => clk_div, clk1_multiply_by => clk_mul, clk1_divide_by => clk_div, clk0_multiply_by => clk_mul, clk0_divide_by => clk_div, clk3_phase_shift => phasearr(DDR_FREQ/10)(3), clk2_phase_shift => phasearr(DDR_FREQ/10)(2), clk1_phase_shift => phasearr(DDR_FREQ/10)(1) -- clk3_phase_shift => "6250", clk2_phase_shift => "4167", clk1_phase_shift => "2083" -- clk3_phase_shift => "7500", clk2_phase_shift => "5000", clk1_phase_shift => "2500" ) port map ( inclk(0) => mclk, inclk(1) => gnd, clk(0) => clk_0r, clk(1) => clk_90r, clk(2) => clk_180r, clk(3) => clk_270r, clk(4) => clk4, clk(5) => clk5, locked => lockl); rstdel : process (mclk, rst, lockl) begin if rst = '0' then dllrst <= (others => '1'); elsif rising_edge(mclk) then dllrst <= dllrst(1 to 3) & '0'; end if; end process; rdel : if rstdelay /= 0 generate rcnt : process (clk_0r) variable cnt : std_logic_vector(15 downto 0); variable vlock, co : std_ulogic; begin if rising_edge(clk_0r) then co := cnt(15); vlockl <= vlock; if lockl = '0' then cnt := conv_std_logic_vector(rstdelay*DDR_FREQ, 16); vlock := '0'; else if vlock = '0' then cnt := cnt -1; vlock := cnt(15) and not co; end if; end if; end if; if lockl = '0' then vlock := '0'; end if; end process; end generate; locked <= lockl when rstdelay = 0 else vlockl; lock <= locked; -- Generate external DDR clock -- fbclkpad : altddio_out generic map (width => 1) -- port map ( datain_h(0) => vcc, datain_l(0) => gnd, -- outclock => clk90r, dataout(0) => ddr_clk_fb_out); ddrclocks : for i in 0 to 2 generate clkpad : altddio_out generic map (width => 1, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h(0) => vcc, datain_l(0) => gnd, outclock => clk90r, dataout(0) => ddr_clk(i)); clknpad : altddio_out generic map (width => 1, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h(0) => gnd, datain_l(0) => vcc, outclock => clk90r, dataout(0) => ddr_clkb(i)); end generate; csnpads : altddio_out generic map (width => 2, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h => csn(1 downto 0), datain_l => csn(1 downto 0), outclock => clk0r, dataout => ddr_csb(1 downto 0)); ckepads : altddio_out generic map (width => 2, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h => ckel(1 downto 0), datain_l => ckel(1 downto 0), outclock => clk0r, dataout => ddr_cke(1 downto 0)); ddrbanks : for i in 0 to 1 generate ckel(i) <= cke(i) and locked; end generate; rasnpad : altddio_out generic map (width => 1, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h(0) => rasn, datain_l(0) => rasn, outclock => clk0r, dataout(0) => ddr_rasb); casnpad : altddio_out generic map (width => 1, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h(0) => casn, datain_l(0) => casn, outclock => clk0r, dataout(0) => ddr_casb); wenpad : altddio_out generic map (width => 1, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h(0) => wen, datain_l(0) => wen, outclock => clk0r, dataout(0) => ddr_web); dmpads : altddio_out generic map (width => dbits/8, INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_h => dm(dbits/8*2-1 downto dbits/8), datain_l => dm(dbits/8-1 downto 0), outclock => clk0r, dataout => ddr_dm ); bapads : altddio_out generic map (width => 2) port map ( datain_h => ba, datain_l => ba, outclock => clk0r, dataout => ddr_ba ); addrpads : altddio_out generic map (width => 14) port map ( datain_h => addr, datain_l => addr, outclock => clk0r, dataout => ddr_ad ); -- DQS generation dqsnv <= (others => dqsn); dqsoclk <= (others => clk90r); altdqs0 : altdqs_cyciii generic map (dbits/8, periodstr(DDR_FREQ/10)) port map (dqs_datain_h => dqsnv, dqs_datain_l => gndv(dbits/8-1 downto 0), inclk => clk270r, oe => ddr_dqsoen, outclk => dqsoclk, dll_delayctrlout => open, dqinclk => dqinclk, dqs_padio => ddr_dqs, dqsundelayedout => open ); -- Data bus dqgen : for i in 0 to dbits/8-1 generate qi : altddio_bidir generic map (width => 8, oe_reg =>"REGISTERED", INTENDED_DEVICE_FAMILY => "CYCLONEIII") port map ( datain_l => dqout(i*8+7 downto i*8), datain_h => dqout(i*8+7+dbits downto dbits+i*8), inclock => dqinclk(i), --clk270r, outclock => clk0r, oe => oe, dataout_h => dqin(i*8+7 downto i*8), dataout_l => dqin(i*8+7+dbits downto dbits+i*8), --dqinl(i*8+7 downto i*8), padio => ddr_dq(i*8+7 downto i*8)); end generate; dqsreg : process(clk180r) begin if rising_edge(clk180r) then dqsn <= oe; end if; end process; oereg : process(clk0r) begin if rising_edge(clk0r) then ddr_dqsoen(dbits/8-1 downto 0) <= (others => not dqsoen); end if; end process; end;
gpl-2.0
fede31cc03321d012268a644faebcbe2
0.629599
2.971251
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/charrom.vhd
1
119,223
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: charrom -- File: charrom.vhd -- Author: Marcus Hellqvist -- Description: Character ROM for video controller ----------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; library grlib; use grlib.stdlib.all; entity charrom is port( clk : in std_ulogic; addr : in std_logic_vector(11 downto 0); data : out std_logic_vector(7 downto 0) ); end entity; architecture rtl of charrom is signal romdata : std_logic_vector(7 downto 0); signal romaddr : std_logic_vector(11 downto 0); begin data <= romdata; p0: process(clk) begin if rising_edge(clk) then romaddr <= addr; end if; end process; p1: process(romaddr) begin case conv_integer(romaddr) is when 16#000# => romdata <= X"00"; -- when 16#100# => romdata <= X"00"; -- when 16#200# => romdata <= X"00"; -- when 16#300# => romdata <= X"00"; -- when 16#400# => romdata <= X"00"; -- when 16#500# => romdata <= X"00"; -- when 16#600# => romdata <= X"00"; -- when 16#700# => romdata <= X"00"; -- when 16#800# => romdata <= X"00"; -- when 16#900# => romdata <= X"00"; -- when 16#a00# => romdata <= X"00"; -- when 16#b00# => romdata <= X"00"; -- when 16#c00# => romdata <= X"00"; -- when 16#020# => romdata <= X"00"; -- when 16#120# => romdata <= X"00"; -- when 16#220# => romdata <= X"00"; -- when 16#320# => romdata <= X"00"; -- when 16#420# => romdata <= X"00"; -- when 16#520# => romdata <= X"00"; -- when 16#620# => romdata <= X"00"; -- when 16#720# => romdata <= X"00"; -- when 16#820# => romdata <= X"00"; -- when 16#920# => romdata <= X"00"; -- when 16#a20# => romdata <= X"00"; -- when 16#b20# => romdata <= X"00"; -- when 16#c20# => romdata <= X"00"; -- when 16#021# => romdata <= X"00"; -- ! when 16#121# => romdata <= X"00"; -- ! when 16#221# => romdata <= X"10"; -- ! when 16#321# => romdata <= X"10"; -- ! when 16#421# => romdata <= X"10"; -- ! when 16#521# => romdata <= X"10"; -- ! when 16#621# => romdata <= X"10"; -- ! when 16#721# => romdata <= X"10"; -- ! when 16#821# => romdata <= X"10"; -- ! when 16#921# => romdata <= X"00"; -- ! when 16#a21# => romdata <= X"10"; -- ! when 16#b21# => romdata <= X"00"; -- ! when 16#c21# => romdata <= X"00"; -- ! when 16#022# => romdata <= X"00"; -- " when 16#122# => romdata <= X"00"; -- " when 16#222# => romdata <= X"24"; -- " when 16#322# => romdata <= X"24"; -- " when 16#422# => romdata <= X"24"; -- " when 16#522# => romdata <= X"00"; -- " when 16#622# => romdata <= X"00"; -- " when 16#722# => romdata <= X"00"; -- " when 16#822# => romdata <= X"00"; -- " when 16#922# => romdata <= X"00"; -- " when 16#a22# => romdata <= X"00"; -- " when 16#b22# => romdata <= X"00"; -- " when 16#c22# => romdata <= X"00"; -- " when 16#023# => romdata <= X"00"; -- # when 16#123# => romdata <= X"00"; -- # when 16#223# => romdata <= X"00"; -- # when 16#323# => romdata <= X"24"; -- # when 16#423# => romdata <= X"24"; -- # when 16#523# => romdata <= X"7e"; -- # when 16#623# => romdata <= X"24"; -- # when 16#723# => romdata <= X"7e"; -- # when 16#823# => romdata <= X"24"; -- # when 16#923# => romdata <= X"24"; -- # when 16#a23# => romdata <= X"00"; -- # when 16#b23# => romdata <= X"00"; -- # when 16#c23# => romdata <= X"00"; -- # when 16#024# => romdata <= X"00"; -- $ when 16#124# => romdata <= X"00"; -- $ when 16#224# => romdata <= X"10"; -- $ when 16#324# => romdata <= X"3c"; -- $ when 16#424# => romdata <= X"50"; -- $ when 16#524# => romdata <= X"50"; -- $ when 16#624# => romdata <= X"38"; -- $ when 16#724# => romdata <= X"14"; -- $ when 16#824# => romdata <= X"14"; -- $ when 16#924# => romdata <= X"78"; -- $ when 16#a24# => romdata <= X"10"; -- $ when 16#b24# => romdata <= X"00"; -- $ when 16#c24# => romdata <= X"00"; -- $ when 16#025# => romdata <= X"00"; -- % when 16#125# => romdata <= X"00"; -- % when 16#225# => romdata <= X"22"; -- % when 16#325# => romdata <= X"52"; -- % when 16#425# => romdata <= X"24"; -- % when 16#525# => romdata <= X"08"; -- % when 16#625# => romdata <= X"08"; -- % when 16#725# => romdata <= X"10"; -- % when 16#825# => romdata <= X"24"; -- % when 16#925# => romdata <= X"2a"; -- % when 16#a25# => romdata <= X"44"; -- % when 16#b25# => romdata <= X"00"; -- % when 16#c25# => romdata <= X"00"; -- % when 16#026# => romdata <= X"00"; -- & when 16#126# => romdata <= X"00"; -- & when 16#226# => romdata <= X"00"; -- & when 16#326# => romdata <= X"00"; -- & when 16#426# => romdata <= X"30"; -- & when 16#526# => romdata <= X"48"; -- & when 16#626# => romdata <= X"48"; -- & when 16#726# => romdata <= X"30"; -- & when 16#826# => romdata <= X"4a"; -- & when 16#926# => romdata <= X"44"; -- & when 16#a26# => romdata <= X"3a"; -- & when 16#b26# => romdata <= X"00"; -- & when 16#c26# => romdata <= X"00"; -- & when 16#027# => romdata <= X"00"; -- ' when 16#127# => romdata <= X"00"; -- ' when 16#227# => romdata <= X"10"; -- ' when 16#327# => romdata <= X"10"; -- ' when 16#427# => romdata <= X"10"; -- ' when 16#527# => romdata <= X"00"; -- ' when 16#627# => romdata <= X"00"; -- ' when 16#727# => romdata <= X"00"; -- ' when 16#827# => romdata <= X"00"; -- ' when 16#927# => romdata <= X"00"; -- ' when 16#a27# => romdata <= X"00"; -- ' when 16#b27# => romdata <= X"00"; -- ' when 16#c27# => romdata <= X"00"; -- ' when 16#028# => romdata <= X"00"; -- ( when 16#128# => romdata <= X"00"; -- ( when 16#228# => romdata <= X"04"; -- ( when 16#328# => romdata <= X"08"; -- ( when 16#428# => romdata <= X"08"; -- ( when 16#528# => romdata <= X"10"; -- ( when 16#628# => romdata <= X"10"; -- ( when 16#728# => romdata <= X"10"; -- ( when 16#828# => romdata <= X"08"; -- ( when 16#928# => romdata <= X"08"; -- ( when 16#a28# => romdata <= X"04"; -- ( when 16#b28# => romdata <= X"00"; -- ( when 16#c28# => romdata <= X"00"; -- ( when 16#029# => romdata <= X"00"; -- ) when 16#129# => romdata <= X"00"; -- ) when 16#229# => romdata <= X"20"; -- ) when 16#329# => romdata <= X"10"; -- ) when 16#429# => romdata <= X"10"; -- ) when 16#529# => romdata <= X"08"; -- ) when 16#629# => romdata <= X"08"; -- ) when 16#729# => romdata <= X"08"; -- ) when 16#829# => romdata <= X"10"; -- ) when 16#929# => romdata <= X"10"; -- ) when 16#a29# => romdata <= X"20"; -- ) when 16#b29# => romdata <= X"00"; -- ) when 16#c29# => romdata <= X"00"; -- ) when 16#02a# => romdata <= X"00"; -- * when 16#12a# => romdata <= X"00"; -- * when 16#22a# => romdata <= X"24"; -- * when 16#32a# => romdata <= X"18"; -- * when 16#42a# => romdata <= X"7e"; -- * when 16#52a# => romdata <= X"18"; -- * when 16#62a# => romdata <= X"24"; -- * when 16#72a# => romdata <= X"00"; -- * when 16#82a# => romdata <= X"00"; -- * when 16#92a# => romdata <= X"00"; -- * when 16#a2a# => romdata <= X"00"; -- * when 16#b2a# => romdata <= X"00"; -- * when 16#c2a# => romdata <= X"00"; -- * when 16#02b# => romdata <= X"00"; -- + when 16#12b# => romdata <= X"00"; -- + when 16#22b# => romdata <= X"00"; -- + when 16#32b# => romdata <= X"00"; -- + when 16#42b# => romdata <= X"10"; -- + when 16#52b# => romdata <= X"10"; -- + when 16#62b# => romdata <= X"7c"; -- + when 16#72b# => romdata <= X"10"; -- + when 16#82b# => romdata <= X"10"; -- + when 16#92b# => romdata <= X"00"; -- + when 16#a2b# => romdata <= X"00"; -- + when 16#b2b# => romdata <= X"00"; -- + when 16#c2b# => romdata <= X"00"; -- + when 16#02c# => romdata <= X"00"; -- , when 16#12c# => romdata <= X"00"; -- , when 16#22c# => romdata <= X"00"; -- , when 16#32c# => romdata <= X"00"; -- , when 16#42c# => romdata <= X"00"; -- , when 16#52c# => romdata <= X"00"; -- , when 16#62c# => romdata <= X"00"; -- , when 16#72c# => romdata <= X"00"; -- , when 16#82c# => romdata <= X"00"; -- , when 16#92c# => romdata <= X"38"; -- , when 16#a2c# => romdata <= X"30"; -- , when 16#b2c# => romdata <= X"40"; -- , when 16#c2c# => romdata <= X"00"; -- , when 16#02d# => romdata <= X"00"; -- - when 16#12d# => romdata <= X"00"; -- - when 16#22d# => romdata <= X"00"; -- - when 16#32d# => romdata <= X"00"; -- - when 16#42d# => romdata <= X"00"; -- - when 16#52d# => romdata <= X"00"; -- - when 16#62d# => romdata <= X"7c"; -- - when 16#72d# => romdata <= X"00"; -- - when 16#82d# => romdata <= X"00"; -- - when 16#92d# => romdata <= X"00"; -- - when 16#a2d# => romdata <= X"00"; -- - when 16#b2d# => romdata <= X"00"; -- - when 16#c2d# => romdata <= X"00"; -- - when 16#02e# => romdata <= X"00"; -- . when 16#12e# => romdata <= X"00"; -- . when 16#22e# => romdata <= X"00"; -- . when 16#32e# => romdata <= X"00"; -- . when 16#42e# => romdata <= X"00"; -- . when 16#52e# => romdata <= X"00"; -- . when 16#62e# => romdata <= X"00"; -- . when 16#72e# => romdata <= X"00"; -- . when 16#82e# => romdata <= X"00"; -- . when 16#92e# => romdata <= X"10"; -- . when 16#a2e# => romdata <= X"38"; -- . when 16#b2e# => romdata <= X"10"; -- . when 16#c2e# => romdata <= X"00"; -- . when 16#02f# => romdata <= X"00"; -- / when 16#12f# => romdata <= X"00"; -- / when 16#22f# => romdata <= X"02"; -- / when 16#32f# => romdata <= X"02"; -- / when 16#42f# => romdata <= X"04"; -- / when 16#52f# => romdata <= X"08"; -- / when 16#62f# => romdata <= X"10"; -- / when 16#72f# => romdata <= X"20"; -- / when 16#82f# => romdata <= X"40"; -- / when 16#92f# => romdata <= X"80"; -- / when 16#a2f# => romdata <= X"80"; -- / when 16#b2f# => romdata <= X"00"; -- / when 16#c2f# => romdata <= X"00"; -- / when 16#030# => romdata <= X"00"; -- 0 when 16#130# => romdata <= X"00"; -- 0 when 16#230# => romdata <= X"18"; -- 0 when 16#330# => romdata <= X"24"; -- 0 when 16#430# => romdata <= X"42"; -- 0 when 16#530# => romdata <= X"42"; -- 0 when 16#630# => romdata <= X"42"; -- 0 when 16#730# => romdata <= X"42"; -- 0 when 16#830# => romdata <= X"42"; -- 0 when 16#930# => romdata <= X"24"; -- 0 when 16#a30# => romdata <= X"18"; -- 0 when 16#b30# => romdata <= X"00"; -- 0 when 16#c30# => romdata <= X"00"; -- 0 when 16#031# => romdata <= X"00"; -- 1 when 16#131# => romdata <= X"00"; -- 1 when 16#231# => romdata <= X"10"; -- 1 when 16#331# => romdata <= X"30"; -- 1 when 16#431# => romdata <= X"50"; -- 1 when 16#531# => romdata <= X"10"; -- 1 when 16#631# => romdata <= X"10"; -- 1 when 16#731# => romdata <= X"10"; -- 1 when 16#831# => romdata <= X"10"; -- 1 when 16#931# => romdata <= X"10"; -- 1 when 16#a31# => romdata <= X"7c"; -- 1 when 16#b31# => romdata <= X"00"; -- 1 when 16#c31# => romdata <= X"00"; -- 1 when 16#032# => romdata <= X"00"; -- 2 when 16#132# => romdata <= X"00"; -- 2 when 16#232# => romdata <= X"3c"; -- 2 when 16#332# => romdata <= X"42"; -- 2 when 16#432# => romdata <= X"42"; -- 2 when 16#532# => romdata <= X"02"; -- 2 when 16#632# => romdata <= X"04"; -- 2 when 16#732# => romdata <= X"18"; -- 2 when 16#832# => romdata <= X"20"; -- 2 when 16#932# => romdata <= X"40"; -- 2 when 16#a32# => romdata <= X"7e"; -- 2 when 16#b32# => romdata <= X"00"; -- 2 when 16#c32# => romdata <= X"00"; -- 2 when 16#033# => romdata <= X"00"; -- 3 when 16#133# => romdata <= X"00"; -- 3 when 16#233# => romdata <= X"7e"; -- 3 when 16#333# => romdata <= X"02"; -- 3 when 16#433# => romdata <= X"04"; -- 3 when 16#533# => romdata <= X"08"; -- 3 when 16#633# => romdata <= X"1c"; -- 3 when 16#733# => romdata <= X"02"; -- 3 when 16#833# => romdata <= X"02"; -- 3 when 16#933# => romdata <= X"42"; -- 3 when 16#a33# => romdata <= X"3c"; -- 3 when 16#b33# => romdata <= X"00"; -- 3 when 16#c33# => romdata <= X"00"; -- 3 when 16#034# => romdata <= X"00"; -- 4 when 16#134# => romdata <= X"00"; -- 4 when 16#234# => romdata <= X"04"; -- 4 when 16#334# => romdata <= X"0c"; -- 4 when 16#434# => romdata <= X"14"; -- 4 when 16#534# => romdata <= X"24"; -- 4 when 16#634# => romdata <= X"44"; -- 4 when 16#734# => romdata <= X"44"; -- 4 when 16#834# => romdata <= X"7e"; -- 4 when 16#934# => romdata <= X"04"; -- 4 when 16#a34# => romdata <= X"04"; -- 4 when 16#b34# => romdata <= X"00"; -- 4 when 16#c34# => romdata <= X"00"; -- 4 when 16#035# => romdata <= X"00"; -- 5 when 16#135# => romdata <= X"00"; -- 5 when 16#235# => romdata <= X"7e"; -- 5 when 16#335# => romdata <= X"40"; -- 5 when 16#435# => romdata <= X"40"; -- 5 when 16#535# => romdata <= X"5c"; -- 5 when 16#635# => romdata <= X"62"; -- 5 when 16#735# => romdata <= X"02"; -- 5 when 16#835# => romdata <= X"02"; -- 5 when 16#935# => romdata <= X"42"; -- 5 when 16#a35# => romdata <= X"3c"; -- 5 when 16#b35# => romdata <= X"00"; -- 5 when 16#c35# => romdata <= X"00"; -- 5 when 16#036# => romdata <= X"00"; -- 6 when 16#136# => romdata <= X"00"; -- 6 when 16#236# => romdata <= X"1c"; -- 6 when 16#336# => romdata <= X"20"; -- 6 when 16#436# => romdata <= X"40"; -- 6 when 16#536# => romdata <= X"40"; -- 6 when 16#636# => romdata <= X"5c"; -- 6 when 16#736# => romdata <= X"62"; -- 6 when 16#836# => romdata <= X"42"; -- 6 when 16#936# => romdata <= X"42"; -- 6 when 16#a36# => romdata <= X"3c"; -- 6 when 16#b36# => romdata <= X"00"; -- 6 when 16#c36# => romdata <= X"00"; -- 6 when 16#037# => romdata <= X"00"; -- 7 when 16#137# => romdata <= X"00"; -- 7 when 16#237# => romdata <= X"7e"; -- 7 when 16#337# => romdata <= X"02"; -- 7 when 16#437# => romdata <= X"04"; -- 7 when 16#537# => romdata <= X"08"; -- 7 when 16#637# => romdata <= X"08"; -- 7 when 16#737# => romdata <= X"10"; -- 7 when 16#837# => romdata <= X"10"; -- 7 when 16#937# => romdata <= X"20"; -- 7 when 16#a37# => romdata <= X"20"; -- 7 when 16#b37# => romdata <= X"00"; -- 7 when 16#c37# => romdata <= X"00"; -- 7 when 16#038# => romdata <= X"00"; -- 8 when 16#138# => romdata <= X"00"; -- 8 when 16#238# => romdata <= X"3c"; -- 8 when 16#338# => romdata <= X"42"; -- 8 when 16#438# => romdata <= X"42"; -- 8 when 16#538# => romdata <= X"42"; -- 8 when 16#638# => romdata <= X"3c"; -- 8 when 16#738# => romdata <= X"42"; -- 8 when 16#838# => romdata <= X"42"; -- 8 when 16#938# => romdata <= X"42"; -- 8 when 16#a38# => romdata <= X"3c"; -- 8 when 16#b38# => romdata <= X"00"; -- 8 when 16#c38# => romdata <= X"00"; -- 8 when 16#039# => romdata <= X"00"; -- 9 when 16#139# => romdata <= X"00"; -- 9 when 16#239# => romdata <= X"3c"; -- 9 when 16#339# => romdata <= X"42"; -- 9 when 16#439# => romdata <= X"42"; -- 9 when 16#539# => romdata <= X"46"; -- 9 when 16#639# => romdata <= X"3a"; -- 9 when 16#739# => romdata <= X"02"; -- 9 when 16#839# => romdata <= X"02"; -- 9 when 16#939# => romdata <= X"04"; -- 9 when 16#a39# => romdata <= X"38"; -- 9 when 16#b39# => romdata <= X"00"; -- 9 when 16#c39# => romdata <= X"00"; -- 9 when 16#03a# => romdata <= X"00"; -- : when 16#13a# => romdata <= X"00"; -- : when 16#23a# => romdata <= X"00"; -- : when 16#33a# => romdata <= X"00"; -- : when 16#43a# => romdata <= X"10"; -- : when 16#53a# => romdata <= X"38"; -- : when 16#63a# => romdata <= X"10"; -- : when 16#73a# => romdata <= X"00"; -- : when 16#83a# => romdata <= X"00"; -- : when 16#93a# => romdata <= X"10"; -- : when 16#a3a# => romdata <= X"38"; -- : when 16#b3a# => romdata <= X"10"; -- : when 16#c3a# => romdata <= X"00"; -- : when 16#03b# => romdata <= X"00"; -- ; when 16#13b# => romdata <= X"00"; -- ; when 16#23b# => romdata <= X"00"; -- ; when 16#33b# => romdata <= X"00"; -- ; when 16#43b# => romdata <= X"10"; -- ; when 16#53b# => romdata <= X"38"; -- ; when 16#63b# => romdata <= X"10"; -- ; when 16#73b# => romdata <= X"00"; -- ; when 16#83b# => romdata <= X"00"; -- ; when 16#93b# => romdata <= X"38"; -- ; when 16#a3b# => romdata <= X"30"; -- ; when 16#b3b# => romdata <= X"40"; -- ; when 16#c3b# => romdata <= X"00"; -- ; when 16#03c# => romdata <= X"00"; -- < when 16#13c# => romdata <= X"00"; -- < when 16#23c# => romdata <= X"02"; -- < when 16#33c# => romdata <= X"04"; -- < when 16#43c# => romdata <= X"08"; -- < when 16#53c# => romdata <= X"10"; -- < when 16#63c# => romdata <= X"20"; -- < when 16#73c# => romdata <= X"10"; -- < when 16#83c# => romdata <= X"08"; -- < when 16#93c# => romdata <= X"04"; -- < when 16#a3c# => romdata <= X"02"; -- < when 16#b3c# => romdata <= X"00"; -- < when 16#c3c# => romdata <= X"00"; -- < when 16#03d# => romdata <= X"00"; -- = when 16#13d# => romdata <= X"00"; -- = when 16#23d# => romdata <= X"00"; -- = when 16#33d# => romdata <= X"00"; -- = when 16#43d# => romdata <= X"00"; -- = when 16#53d# => romdata <= X"7e"; -- = when 16#63d# => romdata <= X"00"; -- = when 16#73d# => romdata <= X"00"; -- = when 16#83d# => romdata <= X"7e"; -- = when 16#93d# => romdata <= X"00"; -- = when 16#a3d# => romdata <= X"00"; -- = when 16#b3d# => romdata <= X"00"; -- = when 16#c3d# => romdata <= X"00"; -- = when 16#03e# => romdata <= X"00"; -- > when 16#13e# => romdata <= X"00"; -- > when 16#23e# => romdata <= X"40"; -- > when 16#33e# => romdata <= X"20"; -- > when 16#43e# => romdata <= X"10"; -- > when 16#53e# => romdata <= X"08"; -- > when 16#63e# => romdata <= X"04"; -- > when 16#73e# => romdata <= X"08"; -- > when 16#83e# => romdata <= X"10"; -- > when 16#93e# => romdata <= X"20"; -- > when 16#a3e# => romdata <= X"40"; -- > when 16#b3e# => romdata <= X"00"; -- > when 16#c3e# => romdata <= X"00"; -- > when 16#03f# => romdata <= X"00"; -- ? when 16#13f# => romdata <= X"00"; -- ? when 16#23f# => romdata <= X"3c"; -- ? when 16#33f# => romdata <= X"42"; -- ? when 16#43f# => romdata <= X"42"; -- ? when 16#53f# => romdata <= X"02"; -- ? when 16#63f# => romdata <= X"04"; -- ? when 16#73f# => romdata <= X"08"; -- ? when 16#83f# => romdata <= X"08"; -- ? when 16#93f# => romdata <= X"00"; -- ? when 16#a3f# => romdata <= X"08"; -- ? when 16#b3f# => romdata <= X"00"; -- ? when 16#c3f# => romdata <= X"00"; -- ? when 16#040# => romdata <= X"00"; -- @ when 16#140# => romdata <= X"00"; -- @ when 16#240# => romdata <= X"3c"; -- @ when 16#340# => romdata <= X"42"; -- @ when 16#440# => romdata <= X"42"; -- @ when 16#540# => romdata <= X"4e"; -- @ when 16#640# => romdata <= X"52"; -- @ when 16#740# => romdata <= X"56"; -- @ when 16#840# => romdata <= X"4a"; -- @ when 16#940# => romdata <= X"40"; -- @ when 16#a40# => romdata <= X"3c"; -- @ when 16#b40# => romdata <= X"00"; -- @ when 16#c40# => romdata <= X"00"; -- @ when 16#041# => romdata <= X"00"; -- A when 16#141# => romdata <= X"00"; -- A when 16#241# => romdata <= X"18"; -- A when 16#341# => romdata <= X"24"; -- A when 16#441# => romdata <= X"42"; -- A when 16#541# => romdata <= X"42"; -- A when 16#641# => romdata <= X"42"; -- A when 16#741# => romdata <= X"7e"; -- A when 16#841# => romdata <= X"42"; -- A when 16#941# => romdata <= X"42"; -- A when 16#a41# => romdata <= X"42"; -- A when 16#b41# => romdata <= X"00"; -- A when 16#c41# => romdata <= X"00"; -- A when 16#042# => romdata <= X"00"; -- B when 16#142# => romdata <= X"00"; -- B when 16#242# => romdata <= X"78"; -- B when 16#342# => romdata <= X"44"; -- B when 16#442# => romdata <= X"42"; -- B when 16#542# => romdata <= X"44"; -- B when 16#642# => romdata <= X"78"; -- B when 16#742# => romdata <= X"44"; -- B when 16#842# => romdata <= X"42"; -- B when 16#942# => romdata <= X"44"; -- B when 16#a42# => romdata <= X"78"; -- B when 16#b42# => romdata <= X"00"; -- B when 16#c42# => romdata <= X"00"; -- B when 16#043# => romdata <= X"00"; -- C when 16#143# => romdata <= X"00"; -- C when 16#243# => romdata <= X"3c"; -- C when 16#343# => romdata <= X"42"; -- C when 16#443# => romdata <= X"40"; -- C when 16#543# => romdata <= X"40"; -- C when 16#643# => romdata <= X"40"; -- C when 16#743# => romdata <= X"40"; -- C when 16#843# => romdata <= X"40"; -- C when 16#943# => romdata <= X"42"; -- C when 16#a43# => romdata <= X"3c"; -- C when 16#b43# => romdata <= X"00"; -- C when 16#c43# => romdata <= X"00"; -- C when 16#044# => romdata <= X"00"; -- D when 16#144# => romdata <= X"00"; -- D when 16#244# => romdata <= X"78"; -- D when 16#344# => romdata <= X"44"; -- D when 16#444# => romdata <= X"42"; -- D when 16#544# => romdata <= X"42"; -- D when 16#644# => romdata <= X"42"; -- D when 16#744# => romdata <= X"42"; -- D when 16#844# => romdata <= X"42"; -- D when 16#944# => romdata <= X"44"; -- D when 16#a44# => romdata <= X"78"; -- D when 16#b44# => romdata <= X"00"; -- D when 16#c44# => romdata <= X"00"; -- D when 16#045# => romdata <= X"00"; -- E when 16#145# => romdata <= X"00"; -- E when 16#245# => romdata <= X"7e"; -- E when 16#345# => romdata <= X"40"; -- E when 16#445# => romdata <= X"40"; -- E when 16#545# => romdata <= X"40"; -- E when 16#645# => romdata <= X"78"; -- E when 16#745# => romdata <= X"40"; -- E when 16#845# => romdata <= X"40"; -- E when 16#945# => romdata <= X"40"; -- E when 16#a45# => romdata <= X"7e"; -- E when 16#b45# => romdata <= X"00"; -- E when 16#c45# => romdata <= X"00"; -- E when 16#046# => romdata <= X"00"; -- F when 16#146# => romdata <= X"00"; -- F when 16#246# => romdata <= X"7e"; -- F when 16#346# => romdata <= X"40"; -- F when 16#446# => romdata <= X"40"; -- F when 16#546# => romdata <= X"40"; -- F when 16#646# => romdata <= X"78"; -- F when 16#746# => romdata <= X"40"; -- F when 16#846# => romdata <= X"40"; -- F when 16#946# => romdata <= X"40"; -- F when 16#a46# => romdata <= X"40"; -- F when 16#b46# => romdata <= X"00"; -- F when 16#c46# => romdata <= X"00"; -- F when 16#047# => romdata <= X"00"; -- G when 16#147# => romdata <= X"00"; -- G when 16#247# => romdata <= X"3c"; -- G when 16#347# => romdata <= X"42"; -- G when 16#447# => romdata <= X"40"; -- G when 16#547# => romdata <= X"40"; -- G when 16#647# => romdata <= X"40"; -- G when 16#747# => romdata <= X"4e"; -- G when 16#847# => romdata <= X"42"; -- G when 16#947# => romdata <= X"46"; -- G when 16#a47# => romdata <= X"3a"; -- G when 16#b47# => romdata <= X"00"; -- G when 16#c47# => romdata <= X"00"; -- G when 16#048# => romdata <= X"00"; -- H when 16#148# => romdata <= X"00"; -- H when 16#248# => romdata <= X"42"; -- H when 16#348# => romdata <= X"42"; -- H when 16#448# => romdata <= X"42"; -- H when 16#548# => romdata <= X"42"; -- H when 16#648# => romdata <= X"7e"; -- H when 16#748# => romdata <= X"42"; -- H when 16#848# => romdata <= X"42"; -- H when 16#948# => romdata <= X"42"; -- H when 16#a48# => romdata <= X"42"; -- H when 16#b48# => romdata <= X"00"; -- H when 16#c48# => romdata <= X"00"; -- H when 16#049# => romdata <= X"00"; -- I when 16#149# => romdata <= X"00"; -- I when 16#249# => romdata <= X"7c"; -- I when 16#349# => romdata <= X"10"; -- I when 16#449# => romdata <= X"10"; -- I when 16#549# => romdata <= X"10"; -- I when 16#649# => romdata <= X"10"; -- I when 16#749# => romdata <= X"10"; -- I when 16#849# => romdata <= X"10"; -- I when 16#949# => romdata <= X"10"; -- I when 16#a49# => romdata <= X"7c"; -- I when 16#b49# => romdata <= X"00"; -- I when 16#c49# => romdata <= X"00"; -- I when 16#04a# => romdata <= X"00"; -- J when 16#14a# => romdata <= X"00"; -- J when 16#24a# => romdata <= X"1f"; -- J when 16#34a# => romdata <= X"04"; -- J when 16#44a# => romdata <= X"04"; -- J when 16#54a# => romdata <= X"04"; -- J when 16#64a# => romdata <= X"04"; -- J when 16#74a# => romdata <= X"04"; -- J when 16#84a# => romdata <= X"04"; -- J when 16#94a# => romdata <= X"44"; -- J when 16#a4a# => romdata <= X"38"; -- J when 16#b4a# => romdata <= X"00"; -- J when 16#c4a# => romdata <= X"00"; -- J when 16#04b# => romdata <= X"00"; -- K when 16#14b# => romdata <= X"00"; -- K when 16#24b# => romdata <= X"42"; -- K when 16#34b# => romdata <= X"44"; -- K when 16#44b# => romdata <= X"48"; -- K when 16#54b# => romdata <= X"50"; -- K when 16#64b# => romdata <= X"60"; -- K when 16#74b# => romdata <= X"50"; -- K when 16#84b# => romdata <= X"48"; -- K when 16#94b# => romdata <= X"44"; -- K when 16#a4b# => romdata <= X"42"; -- K when 16#b4b# => romdata <= X"00"; -- K when 16#c4b# => romdata <= X"00"; -- K when 16#04c# => romdata <= X"00"; -- L when 16#14c# => romdata <= X"00"; -- L when 16#24c# => romdata <= X"40"; -- L when 16#34c# => romdata <= X"40"; -- L when 16#44c# => romdata <= X"40"; -- L when 16#54c# => romdata <= X"40"; -- L when 16#64c# => romdata <= X"40"; -- L when 16#74c# => romdata <= X"40"; -- L when 16#84c# => romdata <= X"40"; -- L when 16#94c# => romdata <= X"40"; -- L when 16#a4c# => romdata <= X"7e"; -- L when 16#b4c# => romdata <= X"00"; -- L when 16#c4c# => romdata <= X"00"; -- L when 16#04d# => romdata <= X"00"; -- M when 16#14d# => romdata <= X"00"; -- M when 16#24d# => romdata <= X"82"; -- M when 16#34d# => romdata <= X"82"; -- M when 16#44d# => romdata <= X"c6"; -- M when 16#54d# => romdata <= X"aa"; -- M when 16#64d# => romdata <= X"92"; -- M when 16#74d# => romdata <= X"92"; -- M when 16#84d# => romdata <= X"82"; -- M when 16#94d# => romdata <= X"82"; -- M when 16#a4d# => romdata <= X"82"; -- M when 16#b4d# => romdata <= X"00"; -- M when 16#c4d# => romdata <= X"00"; -- M when 16#04e# => romdata <= X"00"; -- N when 16#14e# => romdata <= X"00"; -- N when 16#24e# => romdata <= X"42"; -- N when 16#34e# => romdata <= X"42"; -- N when 16#44e# => romdata <= X"62"; -- N when 16#54e# => romdata <= X"52"; -- N when 16#64e# => romdata <= X"4a"; -- N when 16#74e# => romdata <= X"46"; -- N when 16#84e# => romdata <= X"42"; -- N when 16#94e# => romdata <= X"42"; -- N when 16#a4e# => romdata <= X"42"; -- N when 16#b4e# => romdata <= X"00"; -- N when 16#c4e# => romdata <= X"00"; -- N when 16#04f# => romdata <= X"00"; -- O when 16#14f# => romdata <= X"00"; -- O when 16#24f# => romdata <= X"3c"; -- O when 16#34f# => romdata <= X"42"; -- O when 16#44f# => romdata <= X"42"; -- O when 16#54f# => romdata <= X"42"; -- O when 16#64f# => romdata <= X"42"; -- O when 16#74f# => romdata <= X"42"; -- O when 16#84f# => romdata <= X"42"; -- O when 16#94f# => romdata <= X"42"; -- O when 16#a4f# => romdata <= X"3c"; -- O when 16#b4f# => romdata <= X"00"; -- O when 16#c4f# => romdata <= X"00"; -- O when 16#050# => romdata <= X"00"; -- P when 16#150# => romdata <= X"00"; -- P when 16#250# => romdata <= X"7c"; -- P when 16#350# => romdata <= X"42"; -- P when 16#450# => romdata <= X"42"; -- P when 16#550# => romdata <= X"42"; -- P when 16#650# => romdata <= X"7c"; -- P when 16#750# => romdata <= X"40"; -- P when 16#850# => romdata <= X"40"; -- P when 16#950# => romdata <= X"40"; -- P when 16#a50# => romdata <= X"40"; -- P when 16#b50# => romdata <= X"00"; -- P when 16#c50# => romdata <= X"00"; -- P when 16#051# => romdata <= X"00"; -- Q when 16#151# => romdata <= X"00"; -- Q when 16#251# => romdata <= X"3c"; -- Q when 16#351# => romdata <= X"42"; -- Q when 16#451# => romdata <= X"42"; -- Q when 16#551# => romdata <= X"42"; -- Q when 16#651# => romdata <= X"42"; -- Q when 16#751# => romdata <= X"42"; -- Q when 16#851# => romdata <= X"52"; -- Q when 16#951# => romdata <= X"4a"; -- Q when 16#a51# => romdata <= X"3c"; -- Q when 16#b51# => romdata <= X"02"; -- Q when 16#c51# => romdata <= X"00"; -- Q when 16#052# => romdata <= X"00"; -- R when 16#152# => romdata <= X"00"; -- R when 16#252# => romdata <= X"7c"; -- R when 16#352# => romdata <= X"42"; -- R when 16#452# => romdata <= X"42"; -- R when 16#552# => romdata <= X"42"; -- R when 16#652# => romdata <= X"7c"; -- R when 16#752# => romdata <= X"50"; -- R when 16#852# => romdata <= X"48"; -- R when 16#952# => romdata <= X"44"; -- R when 16#a52# => romdata <= X"42"; -- R when 16#b52# => romdata <= X"00"; -- R when 16#c52# => romdata <= X"00"; -- R when 16#053# => romdata <= X"00"; -- S when 16#153# => romdata <= X"00"; -- S when 16#253# => romdata <= X"3c"; -- S when 16#353# => romdata <= X"42"; -- S when 16#453# => romdata <= X"40"; -- S when 16#553# => romdata <= X"40"; -- S when 16#653# => romdata <= X"3c"; -- S when 16#753# => romdata <= X"02"; -- S when 16#853# => romdata <= X"02"; -- S when 16#953# => romdata <= X"42"; -- S when 16#a53# => romdata <= X"3c"; -- S when 16#b53# => romdata <= X"00"; -- S when 16#c53# => romdata <= X"00"; -- S when 16#054# => romdata <= X"00"; -- T when 16#154# => romdata <= X"00"; -- T when 16#254# => romdata <= X"fe"; -- T when 16#354# => romdata <= X"10"; -- T when 16#454# => romdata <= X"10"; -- T when 16#554# => romdata <= X"10"; -- T when 16#654# => romdata <= X"10"; -- T when 16#754# => romdata <= X"10"; -- T when 16#854# => romdata <= X"10"; -- T when 16#954# => romdata <= X"10"; -- T when 16#a54# => romdata <= X"10"; -- T when 16#b54# => romdata <= X"00"; -- T when 16#c54# => romdata <= X"00"; -- T when 16#055# => romdata <= X"00"; -- U when 16#155# => romdata <= X"00"; -- U when 16#255# => romdata <= X"42"; -- U when 16#355# => romdata <= X"42"; -- U when 16#455# => romdata <= X"42"; -- U when 16#555# => romdata <= X"42"; -- U when 16#655# => romdata <= X"42"; -- U when 16#755# => romdata <= X"42"; -- U when 16#855# => romdata <= X"42"; -- U when 16#955# => romdata <= X"42"; -- U when 16#a55# => romdata <= X"3c"; -- U when 16#b55# => romdata <= X"00"; -- U when 16#c55# => romdata <= X"00"; -- U when 16#056# => romdata <= X"00"; -- V when 16#156# => romdata <= X"00"; -- V when 16#256# => romdata <= X"82"; -- V when 16#356# => romdata <= X"82"; -- V when 16#456# => romdata <= X"44"; -- V when 16#556# => romdata <= X"44"; -- V when 16#656# => romdata <= X"44"; -- V when 16#756# => romdata <= X"28"; -- V when 16#856# => romdata <= X"28"; -- V when 16#956# => romdata <= X"28"; -- V when 16#a56# => romdata <= X"10"; -- V when 16#b56# => romdata <= X"00"; -- V when 16#c56# => romdata <= X"00"; -- V when 16#057# => romdata <= X"00"; -- W when 16#157# => romdata <= X"00"; -- W when 16#257# => romdata <= X"82"; -- W when 16#357# => romdata <= X"82"; -- W when 16#457# => romdata <= X"82"; -- W when 16#557# => romdata <= X"82"; -- W when 16#657# => romdata <= X"92"; -- W when 16#757# => romdata <= X"92"; -- W when 16#857# => romdata <= X"92"; -- W when 16#957# => romdata <= X"aa"; -- W when 16#a57# => romdata <= X"44"; -- W when 16#b57# => romdata <= X"00"; -- W when 16#c57# => romdata <= X"00"; -- W when 16#058# => romdata <= X"00"; -- X when 16#158# => romdata <= X"00"; -- X when 16#258# => romdata <= X"82"; -- X when 16#358# => romdata <= X"82"; -- X when 16#458# => romdata <= X"44"; -- X when 16#558# => romdata <= X"28"; -- X when 16#658# => romdata <= X"10"; -- X when 16#758# => romdata <= X"28"; -- X when 16#858# => romdata <= X"44"; -- X when 16#958# => romdata <= X"82"; -- X when 16#a58# => romdata <= X"82"; -- X when 16#b58# => romdata <= X"00"; -- X when 16#c58# => romdata <= X"00"; -- X when 16#059# => romdata <= X"00"; -- Y when 16#159# => romdata <= X"00"; -- Y when 16#259# => romdata <= X"82"; -- Y when 16#359# => romdata <= X"82"; -- Y when 16#459# => romdata <= X"44"; -- Y when 16#559# => romdata <= X"28"; -- Y when 16#659# => romdata <= X"10"; -- Y when 16#759# => romdata <= X"10"; -- Y when 16#859# => romdata <= X"10"; -- Y when 16#959# => romdata <= X"10"; -- Y when 16#a59# => romdata <= X"10"; -- Y when 16#b59# => romdata <= X"00"; -- Y when 16#c59# => romdata <= X"00"; -- Y when 16#05a# => romdata <= X"00"; -- Z when 16#15a# => romdata <= X"00"; -- Z when 16#25a# => romdata <= X"7e"; -- Z when 16#35a# => romdata <= X"02"; -- Z when 16#45a# => romdata <= X"04"; -- Z when 16#55a# => romdata <= X"08"; -- Z when 16#65a# => romdata <= X"10"; -- Z when 16#75a# => romdata <= X"20"; -- Z when 16#85a# => romdata <= X"40"; -- Z when 16#95a# => romdata <= X"40"; -- Z when 16#a5a# => romdata <= X"7e"; -- Z when 16#b5a# => romdata <= X"00"; -- Z when 16#c5a# => romdata <= X"00"; -- Z when 16#05b# => romdata <= X"00"; -- [ when 16#15b# => romdata <= X"00"; -- [ when 16#25b# => romdata <= X"3c"; -- [ when 16#35b# => romdata <= X"20"; -- [ when 16#45b# => romdata <= X"20"; -- [ when 16#55b# => romdata <= X"20"; -- [ when 16#65b# => romdata <= X"20"; -- [ when 16#75b# => romdata <= X"20"; -- [ when 16#85b# => romdata <= X"20"; -- [ when 16#95b# => romdata <= X"20"; -- [ when 16#a5b# => romdata <= X"3c"; -- [ when 16#b5b# => romdata <= X"00"; -- [ when 16#c5b# => romdata <= X"00"; -- [ when 16#05c# => romdata <= X"00"; -- \ when 16#15c# => romdata <= X"00"; -- \ when 16#25c# => romdata <= X"80"; -- \ when 16#35c# => romdata <= X"80"; -- \ when 16#45c# => romdata <= X"40"; -- \ when 16#55c# => romdata <= X"20"; -- \ when 16#65c# => romdata <= X"10"; -- \ when 16#75c# => romdata <= X"08"; -- \ when 16#85c# => romdata <= X"04"; -- \ when 16#95c# => romdata <= X"02"; -- \ when 16#a5c# => romdata <= X"02"; -- \ when 16#b5c# => romdata <= X"00"; -- \ when 16#c5c# => romdata <= X"00"; -- \ when 16#05d# => romdata <= X"00"; -- ] when 16#15d# => romdata <= X"00"; -- ] when 16#25d# => romdata <= X"78"; -- ] when 16#35d# => romdata <= X"08"; -- ] when 16#45d# => romdata <= X"08"; -- ] when 16#55d# => romdata <= X"08"; -- ] when 16#65d# => romdata <= X"08"; -- ] when 16#75d# => romdata <= X"08"; -- ] when 16#85d# => romdata <= X"08"; -- ] when 16#95d# => romdata <= X"08"; -- ] when 16#a5d# => romdata <= X"78"; -- ] when 16#b5d# => romdata <= X"00"; -- ] when 16#c5d# => romdata <= X"00"; -- ] when 16#05e# => romdata <= X"00"; -- ^ when 16#15e# => romdata <= X"00"; -- ^ when 16#25e# => romdata <= X"10"; -- ^ when 16#35e# => romdata <= X"28"; -- ^ when 16#45e# => romdata <= X"44"; -- ^ when 16#55e# => romdata <= X"00"; -- ^ when 16#65e# => romdata <= X"00"; -- ^ when 16#75e# => romdata <= X"00"; -- ^ when 16#85e# => romdata <= X"00"; -- ^ when 16#95e# => romdata <= X"00"; -- ^ when 16#a5e# => romdata <= X"00"; -- ^ when 16#b5e# => romdata <= X"00"; -- ^ when 16#c5e# => romdata <= X"00"; -- ^ when 16#05f# => romdata <= X"00"; -- _ when 16#15f# => romdata <= X"00"; -- _ when 16#25f# => romdata <= X"00"; -- _ when 16#35f# => romdata <= X"00"; -- _ when 16#45f# => romdata <= X"00"; -- _ when 16#55f# => romdata <= X"00"; -- _ when 16#65f# => romdata <= X"00"; -- _ when 16#75f# => romdata <= X"00"; -- _ when 16#85f# => romdata <= X"00"; -- _ when 16#95f# => romdata <= X"00"; -- _ when 16#a5f# => romdata <= X"00"; -- _ when 16#b5f# => romdata <= X"fe"; -- _ when 16#c5f# => romdata <= X"00"; -- _ when 16#060# => romdata <= X"00"; -- ` when 16#160# => romdata <= X"10"; -- ` when 16#260# => romdata <= X"08"; -- ` when 16#360# => romdata <= X"00"; -- ` when 16#460# => romdata <= X"00"; -- ` when 16#560# => romdata <= X"00"; -- ` when 16#660# => romdata <= X"00"; -- ` when 16#760# => romdata <= X"00"; -- ` when 16#860# => romdata <= X"00"; -- ` when 16#960# => romdata <= X"00"; -- ` when 16#a60# => romdata <= X"00"; -- ` when 16#b60# => romdata <= X"00"; -- ` when 16#c60# => romdata <= X"00"; -- ` when 16#061# => romdata <= X"00"; -- a when 16#161# => romdata <= X"00"; -- a when 16#261# => romdata <= X"00"; -- a when 16#361# => romdata <= X"00"; -- a when 16#461# => romdata <= X"00"; -- a when 16#561# => romdata <= X"3c"; -- a when 16#661# => romdata <= X"02"; -- a when 16#761# => romdata <= X"3e"; -- a when 16#861# => romdata <= X"42"; -- a when 16#961# => romdata <= X"46"; -- a when 16#a61# => romdata <= X"3a"; -- a when 16#b61# => romdata <= X"00"; -- a when 16#c61# => romdata <= X"00"; -- a when 16#062# => romdata <= X"00"; -- b when 16#162# => romdata <= X"00"; -- b when 16#262# => romdata <= X"40"; -- b when 16#362# => romdata <= X"40"; -- b when 16#462# => romdata <= X"40"; -- b when 16#562# => romdata <= X"5c"; -- b when 16#662# => romdata <= X"62"; -- b when 16#762# => romdata <= X"42"; -- b when 16#862# => romdata <= X"42"; -- b when 16#962# => romdata <= X"62"; -- b when 16#a62# => romdata <= X"5c"; -- b when 16#b62# => romdata <= X"00"; -- b when 16#c62# => romdata <= X"00"; -- b when 16#063# => romdata <= X"00"; -- c when 16#163# => romdata <= X"00"; -- c when 16#263# => romdata <= X"00"; -- c when 16#363# => romdata <= X"00"; -- c when 16#463# => romdata <= X"00"; -- c when 16#563# => romdata <= X"3c"; -- c when 16#663# => romdata <= X"42"; -- c when 16#763# => romdata <= X"40"; -- c when 16#863# => romdata <= X"40"; -- c when 16#963# => romdata <= X"42"; -- c when 16#a63# => romdata <= X"3c"; -- c when 16#b63# => romdata <= X"00"; -- c when 16#c63# => romdata <= X"00"; -- c when 16#064# => romdata <= X"00"; -- d when 16#164# => romdata <= X"00"; -- d when 16#264# => romdata <= X"02"; -- d when 16#364# => romdata <= X"02"; -- d when 16#464# => romdata <= X"02"; -- d when 16#564# => romdata <= X"3a"; -- d when 16#664# => romdata <= X"46"; -- d when 16#764# => romdata <= X"42"; -- d when 16#864# => romdata <= X"42"; -- d when 16#964# => romdata <= X"46"; -- d when 16#a64# => romdata <= X"3a"; -- d when 16#b64# => romdata <= X"00"; -- d when 16#c64# => romdata <= X"00"; -- d when 16#065# => romdata <= X"00"; -- e when 16#165# => romdata <= X"00"; -- e when 16#265# => romdata <= X"00"; -- e when 16#365# => romdata <= X"00"; -- e when 16#465# => romdata <= X"00"; -- e when 16#565# => romdata <= X"3c"; -- e when 16#665# => romdata <= X"42"; -- e when 16#765# => romdata <= X"7e"; -- e when 16#865# => romdata <= X"40"; -- e when 16#965# => romdata <= X"42"; -- e when 16#a65# => romdata <= X"3c"; -- e when 16#b65# => romdata <= X"00"; -- e when 16#c65# => romdata <= X"00"; -- e when 16#066# => romdata <= X"00"; -- f when 16#166# => romdata <= X"00"; -- f when 16#266# => romdata <= X"1c"; -- f when 16#366# => romdata <= X"22"; -- f when 16#466# => romdata <= X"20"; -- f when 16#566# => romdata <= X"20"; -- f when 16#666# => romdata <= X"7c"; -- f when 16#766# => romdata <= X"20"; -- f when 16#866# => romdata <= X"20"; -- f when 16#966# => romdata <= X"20"; -- f when 16#a66# => romdata <= X"20"; -- f when 16#b66# => romdata <= X"00"; -- f when 16#c66# => romdata <= X"00"; -- f when 16#067# => romdata <= X"00"; -- g when 16#167# => romdata <= X"00"; -- g when 16#267# => romdata <= X"00"; -- g when 16#367# => romdata <= X"00"; -- g when 16#467# => romdata <= X"00"; -- g when 16#567# => romdata <= X"3a"; -- g when 16#667# => romdata <= X"44"; -- g when 16#767# => romdata <= X"44"; -- g when 16#867# => romdata <= X"38"; -- g when 16#967# => romdata <= X"40"; -- g when 16#a67# => romdata <= X"3c"; -- g when 16#b67# => romdata <= X"42"; -- g when 16#c67# => romdata <= X"3c"; -- g when 16#068# => romdata <= X"00"; -- h when 16#168# => romdata <= X"00"; -- h when 16#268# => romdata <= X"40"; -- h when 16#368# => romdata <= X"40"; -- h when 16#468# => romdata <= X"40"; -- h when 16#568# => romdata <= X"5c"; -- h when 16#668# => romdata <= X"62"; -- h when 16#768# => romdata <= X"42"; -- h when 16#868# => romdata <= X"42"; -- h when 16#968# => romdata <= X"42"; -- h when 16#a68# => romdata <= X"42"; -- h when 16#b68# => romdata <= X"00"; -- h when 16#c68# => romdata <= X"00"; -- h when 16#069# => romdata <= X"00"; -- i when 16#169# => romdata <= X"00"; -- i when 16#269# => romdata <= X"00"; -- i when 16#369# => romdata <= X"10"; -- i when 16#469# => romdata <= X"00"; -- i when 16#569# => romdata <= X"30"; -- i when 16#669# => romdata <= X"10"; -- i when 16#769# => romdata <= X"10"; -- i when 16#869# => romdata <= X"10"; -- i when 16#969# => romdata <= X"10"; -- i when 16#a69# => romdata <= X"7c"; -- i when 16#b69# => romdata <= X"00"; -- i when 16#c69# => romdata <= X"00"; -- i when 16#06a# => romdata <= X"00"; -- j when 16#16a# => romdata <= X"00"; -- j when 16#26a# => romdata <= X"00"; -- j when 16#36a# => romdata <= X"04"; -- j when 16#46a# => romdata <= X"00"; -- j when 16#56a# => romdata <= X"0c"; -- j when 16#66a# => romdata <= X"04"; -- j when 16#76a# => romdata <= X"04"; -- j when 16#86a# => romdata <= X"04"; -- j when 16#96a# => romdata <= X"04"; -- j when 16#a6a# => romdata <= X"44"; -- j when 16#b6a# => romdata <= X"44"; -- j when 16#c6a# => romdata <= X"38"; -- j when 16#06b# => romdata <= X"00"; -- k when 16#16b# => romdata <= X"00"; -- k when 16#26b# => romdata <= X"40"; -- k when 16#36b# => romdata <= X"40"; -- k when 16#46b# => romdata <= X"40"; -- k when 16#56b# => romdata <= X"44"; -- k when 16#66b# => romdata <= X"48"; -- k when 16#76b# => romdata <= X"70"; -- k when 16#86b# => romdata <= X"48"; -- k when 16#96b# => romdata <= X"44"; -- k when 16#a6b# => romdata <= X"42"; -- k when 16#b6b# => romdata <= X"00"; -- k when 16#c6b# => romdata <= X"00"; -- k when 16#06c# => romdata <= X"00"; -- l when 16#16c# => romdata <= X"00"; -- l when 16#26c# => romdata <= X"30"; -- l when 16#36c# => romdata <= X"10"; -- l when 16#46c# => romdata <= X"10"; -- l when 16#56c# => romdata <= X"10"; -- l when 16#66c# => romdata <= X"10"; -- l when 16#76c# => romdata <= X"10"; -- l when 16#86c# => romdata <= X"10"; -- l when 16#96c# => romdata <= X"10"; -- l when 16#a6c# => romdata <= X"7c"; -- l when 16#b6c# => romdata <= X"00"; -- l when 16#c6c# => romdata <= X"00"; -- l when 16#06d# => romdata <= X"00"; -- m when 16#16d# => romdata <= X"00"; -- m when 16#26d# => romdata <= X"00"; -- m when 16#36d# => romdata <= X"00"; -- m when 16#46d# => romdata <= X"00"; -- m when 16#56d# => romdata <= X"ec"; -- m when 16#66d# => romdata <= X"92"; -- m when 16#76d# => romdata <= X"92"; -- m when 16#86d# => romdata <= X"92"; -- m when 16#96d# => romdata <= X"92"; -- m when 16#a6d# => romdata <= X"82"; -- m when 16#b6d# => romdata <= X"00"; -- m when 16#c6d# => romdata <= X"00"; -- m when 16#06e# => romdata <= X"00"; -- n when 16#16e# => romdata <= X"00"; -- n when 16#26e# => romdata <= X"00"; -- n when 16#36e# => romdata <= X"00"; -- n when 16#46e# => romdata <= X"00"; -- n when 16#56e# => romdata <= X"5c"; -- n when 16#66e# => romdata <= X"62"; -- n when 16#76e# => romdata <= X"42"; -- n when 16#86e# => romdata <= X"42"; -- n when 16#96e# => romdata <= X"42"; -- n when 16#a6e# => romdata <= X"42"; -- n when 16#b6e# => romdata <= X"00"; -- n when 16#c6e# => romdata <= X"00"; -- n when 16#06f# => romdata <= X"00"; -- o when 16#16f# => romdata <= X"00"; -- o when 16#26f# => romdata <= X"00"; -- o when 16#36f# => romdata <= X"00"; -- o when 16#46f# => romdata <= X"00"; -- o when 16#56f# => romdata <= X"3c"; -- o when 16#66f# => romdata <= X"42"; -- o when 16#76f# => romdata <= X"42"; -- o when 16#86f# => romdata <= X"42"; -- o when 16#96f# => romdata <= X"42"; -- o when 16#a6f# => romdata <= X"3c"; -- o when 16#b6f# => romdata <= X"00"; -- o when 16#c6f# => romdata <= X"00"; -- o when 16#070# => romdata <= X"00"; -- p when 16#170# => romdata <= X"00"; -- p when 16#270# => romdata <= X"00"; -- p when 16#370# => romdata <= X"00"; -- p when 16#470# => romdata <= X"00"; -- p when 16#570# => romdata <= X"5c"; -- p when 16#670# => romdata <= X"62"; -- p when 16#770# => romdata <= X"42"; -- p when 16#870# => romdata <= X"62"; -- p when 16#970# => romdata <= X"5c"; -- p when 16#a70# => romdata <= X"40"; -- p when 16#b70# => romdata <= X"40"; -- p when 16#c70# => romdata <= X"40"; -- p when 16#071# => romdata <= X"00"; -- q when 16#171# => romdata <= X"00"; -- q when 16#271# => romdata <= X"00"; -- q when 16#371# => romdata <= X"00"; -- q when 16#471# => romdata <= X"00"; -- q when 16#571# => romdata <= X"3a"; -- q when 16#671# => romdata <= X"46"; -- q when 16#771# => romdata <= X"42"; -- q when 16#871# => romdata <= X"46"; -- q when 16#971# => romdata <= X"3a"; -- q when 16#a71# => romdata <= X"02"; -- q when 16#b71# => romdata <= X"02"; -- q when 16#c71# => romdata <= X"02"; -- q when 16#072# => romdata <= X"00"; -- r when 16#172# => romdata <= X"00"; -- r when 16#272# => romdata <= X"00"; -- r when 16#372# => romdata <= X"00"; -- r when 16#472# => romdata <= X"00"; -- r when 16#572# => romdata <= X"5c"; -- r when 16#672# => romdata <= X"22"; -- r when 16#772# => romdata <= X"20"; -- r when 16#872# => romdata <= X"20"; -- r when 16#972# => romdata <= X"20"; -- r when 16#a72# => romdata <= X"20"; -- r when 16#b72# => romdata <= X"00"; -- r when 16#c72# => romdata <= X"00"; -- r when 16#073# => romdata <= X"00"; -- s when 16#173# => romdata <= X"00"; -- s when 16#273# => romdata <= X"00"; -- s when 16#373# => romdata <= X"00"; -- s when 16#473# => romdata <= X"00"; -- s when 16#573# => romdata <= X"3c"; -- s when 16#673# => romdata <= X"42"; -- s when 16#773# => romdata <= X"30"; -- s when 16#873# => romdata <= X"0c"; -- s when 16#973# => romdata <= X"42"; -- s when 16#a73# => romdata <= X"3c"; -- s when 16#b73# => romdata <= X"00"; -- s when 16#c73# => romdata <= X"00"; -- s when 16#074# => romdata <= X"00"; -- t when 16#174# => romdata <= X"00"; -- t when 16#274# => romdata <= X"00"; -- t when 16#374# => romdata <= X"20"; -- t when 16#474# => romdata <= X"20"; -- t when 16#574# => romdata <= X"7c"; -- t when 16#674# => romdata <= X"20"; -- t when 16#774# => romdata <= X"20"; -- t when 16#874# => romdata <= X"20"; -- t when 16#974# => romdata <= X"22"; -- t when 16#a74# => romdata <= X"1c"; -- t when 16#b74# => romdata <= X"00"; -- t when 16#c74# => romdata <= X"00"; -- t when 16#075# => romdata <= X"00"; -- u when 16#175# => romdata <= X"00"; -- u when 16#275# => romdata <= X"00"; -- u when 16#375# => romdata <= X"00"; -- u when 16#475# => romdata <= X"00"; -- u when 16#575# => romdata <= X"44"; -- u when 16#675# => romdata <= X"44"; -- u when 16#775# => romdata <= X"44"; -- u when 16#875# => romdata <= X"44"; -- u when 16#975# => romdata <= X"44"; -- u when 16#a75# => romdata <= X"3a"; -- u when 16#b75# => romdata <= X"00"; -- u when 16#c75# => romdata <= X"00"; -- u when 16#076# => romdata <= X"00"; -- v when 16#176# => romdata <= X"00"; -- v when 16#276# => romdata <= X"00"; -- v when 16#376# => romdata <= X"00"; -- v when 16#476# => romdata <= X"00"; -- v when 16#576# => romdata <= X"44"; -- v when 16#676# => romdata <= X"44"; -- v when 16#776# => romdata <= X"44"; -- v when 16#876# => romdata <= X"28"; -- v when 16#976# => romdata <= X"28"; -- v when 16#a76# => romdata <= X"10"; -- v when 16#b76# => romdata <= X"00"; -- v when 16#c76# => romdata <= X"00"; -- v when 16#077# => romdata <= X"00"; -- w when 16#177# => romdata <= X"00"; -- w when 16#277# => romdata <= X"00"; -- w when 16#377# => romdata <= X"00"; -- w when 16#477# => romdata <= X"00"; -- w when 16#577# => romdata <= X"82"; -- w when 16#677# => romdata <= X"82"; -- w when 16#777# => romdata <= X"92"; -- w when 16#877# => romdata <= X"92"; -- w when 16#977# => romdata <= X"aa"; -- w when 16#a77# => romdata <= X"44"; -- w when 16#b77# => romdata <= X"00"; -- w when 16#c77# => romdata <= X"00"; -- w when 16#078# => romdata <= X"00"; -- x when 16#178# => romdata <= X"00"; -- x when 16#278# => romdata <= X"00"; -- x when 16#378# => romdata <= X"00"; -- x when 16#478# => romdata <= X"00"; -- x when 16#578# => romdata <= X"42"; -- x when 16#678# => romdata <= X"24"; -- x when 16#778# => romdata <= X"18"; -- x when 16#878# => romdata <= X"18"; -- x when 16#978# => romdata <= X"24"; -- x when 16#a78# => romdata <= X"42"; -- x when 16#b78# => romdata <= X"00"; -- x when 16#c78# => romdata <= X"00"; -- x when 16#079# => romdata <= X"00"; -- y when 16#179# => romdata <= X"00"; -- y when 16#279# => romdata <= X"00"; -- y when 16#379# => romdata <= X"00"; -- y when 16#479# => romdata <= X"00"; -- y when 16#579# => romdata <= X"42"; -- y when 16#679# => romdata <= X"42"; -- y when 16#779# => romdata <= X"42"; -- y when 16#879# => romdata <= X"46"; -- y when 16#979# => romdata <= X"3a"; -- y when 16#a79# => romdata <= X"02"; -- y when 16#b79# => romdata <= X"42"; -- y when 16#c79# => romdata <= X"3c"; -- y when 16#07a# => romdata <= X"00"; -- z when 16#17a# => romdata <= X"00"; -- z when 16#27a# => romdata <= X"00"; -- z when 16#37a# => romdata <= X"00"; -- z when 16#47a# => romdata <= X"00"; -- z when 16#57a# => romdata <= X"7e"; -- z when 16#67a# => romdata <= X"04"; -- z when 16#77a# => romdata <= X"08"; -- z when 16#87a# => romdata <= X"10"; -- z when 16#97a# => romdata <= X"20"; -- z when 16#a7a# => romdata <= X"7e"; -- z when 16#b7a# => romdata <= X"00"; -- z when 16#c7a# => romdata <= X"00"; -- z when 16#07b# => romdata <= X"00"; -- { when 16#17b# => romdata <= X"00"; -- { when 16#27b# => romdata <= X"0e"; -- { when 16#37b# => romdata <= X"10"; -- { when 16#47b# => romdata <= X"10"; -- { when 16#57b# => romdata <= X"08"; -- { when 16#67b# => romdata <= X"30"; -- { when 16#77b# => romdata <= X"08"; -- { when 16#87b# => romdata <= X"10"; -- { when 16#97b# => romdata <= X"10"; -- { when 16#a7b# => romdata <= X"0e"; -- { when 16#b7b# => romdata <= X"00"; -- { when 16#c7b# => romdata <= X"00"; -- { when 16#07c# => romdata <= X"00"; -- | when 16#17c# => romdata <= X"00"; -- | when 16#27c# => romdata <= X"10"; -- | when 16#37c# => romdata <= X"10"; -- | when 16#47c# => romdata <= X"10"; -- | when 16#57c# => romdata <= X"10"; -- | when 16#67c# => romdata <= X"10"; -- | when 16#77c# => romdata <= X"10"; -- | when 16#87c# => romdata <= X"10"; -- | when 16#97c# => romdata <= X"10"; -- | when 16#a7c# => romdata <= X"10"; -- | when 16#b7c# => romdata <= X"00"; -- | when 16#c7c# => romdata <= X"00"; -- | when 16#07d# => romdata <= X"00"; -- } when 16#17d# => romdata <= X"00"; -- } when 16#27d# => romdata <= X"70"; -- } when 16#37d# => romdata <= X"08"; -- } when 16#47d# => romdata <= X"08"; -- } when 16#57d# => romdata <= X"10"; -- } when 16#67d# => romdata <= X"0c"; -- } when 16#77d# => romdata <= X"10"; -- } when 16#87d# => romdata <= X"08"; -- } when 16#97d# => romdata <= X"08"; -- } when 16#a7d# => romdata <= X"70"; -- } when 16#b7d# => romdata <= X"00"; -- } when 16#c7d# => romdata <= X"00"; -- } when 16#07e# => romdata <= X"00"; -- ~ when 16#17e# => romdata <= X"00"; -- ~ when 16#27e# => romdata <= X"24"; -- ~ when 16#37e# => romdata <= X"54"; -- ~ when 16#47e# => romdata <= X"48"; -- ~ when 16#57e# => romdata <= X"00"; -- ~ when 16#67e# => romdata <= X"00"; -- ~ when 16#77e# => romdata <= X"00"; -- ~ when 16#87e# => romdata <= X"00"; -- ~ when 16#97e# => romdata <= X"00"; -- ~ when 16#a7e# => romdata <= X"00"; -- ~ when 16#b7e# => romdata <= X"00"; -- ~ when 16#c7e# => romdata <= X"00"; -- ~ when 16#0a0# => romdata <= X"00"; --   when 16#1a0# => romdata <= X"00"; --   when 16#2a0# => romdata <= X"00"; --   when 16#3a0# => romdata <= X"00"; --   when 16#4a0# => romdata <= X"00"; --   when 16#5a0# => romdata <= X"00"; --   when 16#6a0# => romdata <= X"00"; --   when 16#7a0# => romdata <= X"00"; --   when 16#8a0# => romdata <= X"00"; --   when 16#9a0# => romdata <= X"00"; --   when 16#aa0# => romdata <= X"00"; --   when 16#ba0# => romdata <= X"00"; --   when 16#ca0# => romdata <= X"00"; --   when 16#0a1# => romdata <= X"00"; -- ¡ when 16#1a1# => romdata <= X"00"; -- ¡ when 16#2a1# => romdata <= X"10"; -- ¡ when 16#3a1# => romdata <= X"00"; -- ¡ when 16#4a1# => romdata <= X"10"; -- ¡ when 16#5a1# => romdata <= X"10"; -- ¡ when 16#6a1# => romdata <= X"10"; -- ¡ when 16#7a1# => romdata <= X"10"; -- ¡ when 16#8a1# => romdata <= X"10"; -- ¡ when 16#9a1# => romdata <= X"10"; -- ¡ when 16#aa1# => romdata <= X"10"; -- ¡ when 16#ba1# => romdata <= X"00"; -- ¡ when 16#ca1# => romdata <= X"00"; -- ¡ when 16#0a2# => romdata <= X"00"; -- ¢ when 16#1a2# => romdata <= X"00"; -- ¢ when 16#2a2# => romdata <= X"10"; -- ¢ when 16#3a2# => romdata <= X"38"; -- ¢ when 16#4a2# => romdata <= X"54"; -- ¢ when 16#5a2# => romdata <= X"50"; -- ¢ when 16#6a2# => romdata <= X"50"; -- ¢ when 16#7a2# => romdata <= X"54"; -- ¢ when 16#8a2# => romdata <= X"38"; -- ¢ when 16#9a2# => romdata <= X"10"; -- ¢ when 16#aa2# => romdata <= X"00"; -- ¢ when 16#ba2# => romdata <= X"00"; -- ¢ when 16#ca2# => romdata <= X"00"; -- ¢ when 16#0a3# => romdata <= X"00"; -- £ when 16#1a3# => romdata <= X"00"; -- £ when 16#2a3# => romdata <= X"1c"; -- £ when 16#3a3# => romdata <= X"22"; -- £ when 16#4a3# => romdata <= X"20"; -- £ when 16#5a3# => romdata <= X"70"; -- £ when 16#6a3# => romdata <= X"20"; -- £ when 16#7a3# => romdata <= X"20"; -- £ when 16#8a3# => romdata <= X"20"; -- £ when 16#9a3# => romdata <= X"62"; -- £ when 16#aa3# => romdata <= X"dc"; -- £ when 16#ba3# => romdata <= X"00"; -- £ when 16#ca3# => romdata <= X"00"; -- £ when 16#0a4# => romdata <= X"00"; -- ¤ when 16#1a4# => romdata <= X"00"; -- ¤ when 16#2a4# => romdata <= X"00"; -- ¤ when 16#3a4# => romdata <= X"00"; -- ¤ when 16#4a4# => romdata <= X"42"; -- ¤ when 16#5a4# => romdata <= X"3c"; -- ¤ when 16#6a4# => romdata <= X"24"; -- ¤ when 16#7a4# => romdata <= X"24"; -- ¤ when 16#8a4# => romdata <= X"3c"; -- ¤ when 16#9a4# => romdata <= X"42"; -- ¤ when 16#aa4# => romdata <= X"00"; -- ¤ when 16#ba4# => romdata <= X"00"; -- ¤ when 16#ca4# => romdata <= X"00"; -- ¤ when 16#0a5# => romdata <= X"00"; -- ¥ when 16#1a5# => romdata <= X"00"; -- ¥ when 16#2a5# => romdata <= X"82"; -- ¥ when 16#3a5# => romdata <= X"82"; -- ¥ when 16#4a5# => romdata <= X"44"; -- ¥ when 16#5a5# => romdata <= X"28"; -- ¥ when 16#6a5# => romdata <= X"7c"; -- ¥ when 16#7a5# => romdata <= X"10"; -- ¥ when 16#8a5# => romdata <= X"7c"; -- ¥ when 16#9a5# => romdata <= X"10"; -- ¥ when 16#aa5# => romdata <= X"10"; -- ¥ when 16#ba5# => romdata <= X"00"; -- ¥ when 16#ca5# => romdata <= X"00"; -- ¥ when 16#0a6# => romdata <= X"00"; -- ¦ when 16#1a6# => romdata <= X"00"; -- ¦ when 16#2a6# => romdata <= X"10"; -- ¦ when 16#3a6# => romdata <= X"10"; -- ¦ when 16#4a6# => romdata <= X"10"; -- ¦ when 16#5a6# => romdata <= X"10"; -- ¦ when 16#6a6# => romdata <= X"00"; -- ¦ when 16#7a6# => romdata <= X"10"; -- ¦ when 16#8a6# => romdata <= X"10"; -- ¦ when 16#9a6# => romdata <= X"10"; -- ¦ when 16#aa6# => romdata <= X"10"; -- ¦ when 16#ba6# => romdata <= X"00"; -- ¦ when 16#ca6# => romdata <= X"00"; -- ¦ when 16#0a7# => romdata <= X"00"; -- § when 16#1a7# => romdata <= X"18"; -- § when 16#2a7# => romdata <= X"24"; -- § when 16#3a7# => romdata <= X"20"; -- § when 16#4a7# => romdata <= X"18"; -- § when 16#5a7# => romdata <= X"24"; -- § when 16#6a7# => romdata <= X"24"; -- § when 16#7a7# => romdata <= X"18"; -- § when 16#8a7# => romdata <= X"04"; -- § when 16#9a7# => romdata <= X"24"; -- § when 16#aa7# => romdata <= X"18"; -- § when 16#ba7# => romdata <= X"00"; -- § when 16#ca7# => romdata <= X"00"; -- § when 16#0a8# => romdata <= X"00"; -- ¨ when 16#1a8# => romdata <= X"24"; -- ¨ when 16#2a8# => romdata <= X"24"; -- ¨ when 16#3a8# => romdata <= X"00"; -- ¨ when 16#4a8# => romdata <= X"00"; -- ¨ when 16#5a8# => romdata <= X"00"; -- ¨ when 16#6a8# => romdata <= X"00"; -- ¨ when 16#7a8# => romdata <= X"00"; -- ¨ when 16#8a8# => romdata <= X"00"; -- ¨ when 16#9a8# => romdata <= X"00"; -- ¨ when 16#aa8# => romdata <= X"00"; -- ¨ when 16#ba8# => romdata <= X"00"; -- ¨ when 16#ca8# => romdata <= X"00"; -- ¨ when 16#0a9# => romdata <= X"00"; -- © when 16#1a9# => romdata <= X"38"; -- © when 16#2a9# => romdata <= X"44"; -- © when 16#3a9# => romdata <= X"92"; -- © when 16#4a9# => romdata <= X"aa"; -- © when 16#5a9# => romdata <= X"a2"; -- © when 16#6a9# => romdata <= X"aa"; -- © when 16#7a9# => romdata <= X"92"; -- © when 16#8a9# => romdata <= X"44"; -- © when 16#9a9# => romdata <= X"38"; -- © when 16#aa9# => romdata <= X"00"; -- © when 16#ba9# => romdata <= X"00"; -- © when 16#ca9# => romdata <= X"00"; -- © when 16#0aa# => romdata <= X"00"; -- ª when 16#1aa# => romdata <= X"00"; -- ª when 16#2aa# => romdata <= X"38"; -- ª when 16#3aa# => romdata <= X"04"; -- ª when 16#4aa# => romdata <= X"3c"; -- ª when 16#5aa# => romdata <= X"44"; -- ª when 16#6aa# => romdata <= X"3c"; -- ª when 16#7aa# => romdata <= X"00"; -- ª when 16#8aa# => romdata <= X"7c"; -- ª when 16#9aa# => romdata <= X"00"; -- ª when 16#aaa# => romdata <= X"00"; -- ª when 16#baa# => romdata <= X"00"; -- ª when 16#caa# => romdata <= X"00"; -- ª when 16#0ab# => romdata <= X"00"; -- « when 16#1ab# => romdata <= X"00"; -- « when 16#2ab# => romdata <= X"00"; -- « when 16#3ab# => romdata <= X"12"; -- « when 16#4ab# => romdata <= X"24"; -- « when 16#5ab# => romdata <= X"48"; -- « when 16#6ab# => romdata <= X"90"; -- « when 16#7ab# => romdata <= X"48"; -- « when 16#8ab# => romdata <= X"24"; -- « when 16#9ab# => romdata <= X"12"; -- « when 16#aab# => romdata <= X"00"; -- « when 16#bab# => romdata <= X"00"; -- « when 16#cab# => romdata <= X"00"; -- « when 16#0ac# => romdata <= X"00"; -- ¬ when 16#1ac# => romdata <= X"00"; -- ¬ when 16#2ac# => romdata <= X"00"; -- ¬ when 16#3ac# => romdata <= X"00"; -- ¬ when 16#4ac# => romdata <= X"00"; -- ¬ when 16#5ac# => romdata <= X"00"; -- ¬ when 16#6ac# => romdata <= X"7e"; -- ¬ when 16#7ac# => romdata <= X"02"; -- ¬ when 16#8ac# => romdata <= X"02"; -- ¬ when 16#9ac# => romdata <= X"02"; -- ¬ when 16#aac# => romdata <= X"00"; -- ¬ when 16#bac# => romdata <= X"00"; -- ¬ when 16#cac# => romdata <= X"00"; -- ¬ when 16#0ad# => romdata <= X"00"; -- ­ when 16#1ad# => romdata <= X"00"; -- ­ when 16#2ad# => romdata <= X"00"; -- ­ when 16#3ad# => romdata <= X"00"; -- ­ when 16#4ad# => romdata <= X"00"; -- ­ when 16#5ad# => romdata <= X"00"; -- ­ when 16#6ad# => romdata <= X"3c"; -- ­ when 16#7ad# => romdata <= X"00"; -- ­ when 16#8ad# => romdata <= X"00"; -- ­ when 16#9ad# => romdata <= X"00"; -- ­ when 16#aad# => romdata <= X"00"; -- ­ when 16#bad# => romdata <= X"00"; -- ­ when 16#cad# => romdata <= X"00"; -- ­ when 16#0ae# => romdata <= X"00"; -- ® when 16#1ae# => romdata <= X"38"; -- ® when 16#2ae# => romdata <= X"44"; -- ® when 16#3ae# => romdata <= X"92"; -- ® when 16#4ae# => romdata <= X"aa"; -- ® when 16#5ae# => romdata <= X"aa"; -- ® when 16#6ae# => romdata <= X"b2"; -- ® when 16#7ae# => romdata <= X"aa"; -- ® when 16#8ae# => romdata <= X"44"; -- ® when 16#9ae# => romdata <= X"38"; -- ® when 16#aae# => romdata <= X"00"; -- ® when 16#bae# => romdata <= X"00"; -- ® when 16#cae# => romdata <= X"00"; -- ® when 16#0af# => romdata <= X"00"; -- ¯ when 16#1af# => romdata <= X"00"; -- ¯ when 16#2af# => romdata <= X"7e"; -- ¯ when 16#3af# => romdata <= X"00"; -- ¯ when 16#4af# => romdata <= X"00"; -- ¯ when 16#5af# => romdata <= X"00"; -- ¯ when 16#6af# => romdata <= X"00"; -- ¯ when 16#7af# => romdata <= X"00"; -- ¯ when 16#8af# => romdata <= X"00"; -- ¯ when 16#9af# => romdata <= X"00"; -- ¯ when 16#aaf# => romdata <= X"00"; -- ¯ when 16#baf# => romdata <= X"00"; -- ¯ when 16#caf# => romdata <= X"00"; -- ¯ when 16#0b0# => romdata <= X"00"; -- ° when 16#1b0# => romdata <= X"00"; -- ° when 16#2b0# => romdata <= X"18"; -- ° when 16#3b0# => romdata <= X"24"; -- ° when 16#4b0# => romdata <= X"24"; -- ° when 16#5b0# => romdata <= X"18"; -- ° when 16#6b0# => romdata <= X"00"; -- ° when 16#7b0# => romdata <= X"00"; -- ° when 16#8b0# => romdata <= X"00"; -- ° when 16#9b0# => romdata <= X"00"; -- ° when 16#ab0# => romdata <= X"00"; -- ° when 16#bb0# => romdata <= X"00"; -- ° when 16#cb0# => romdata <= X"00"; -- ° when 16#0b1# => romdata <= X"00"; -- ± when 16#1b1# => romdata <= X"00"; -- ± when 16#2b1# => romdata <= X"00"; -- ± when 16#3b1# => romdata <= X"10"; -- ± when 16#4b1# => romdata <= X"10"; -- ± when 16#5b1# => romdata <= X"7c"; -- ± when 16#6b1# => romdata <= X"10"; -- ± when 16#7b1# => romdata <= X"10"; -- ± when 16#8b1# => romdata <= X"00"; -- ± when 16#9b1# => romdata <= X"7c"; -- ± when 16#ab1# => romdata <= X"00"; -- ± when 16#bb1# => romdata <= X"00"; -- ± when 16#cb1# => romdata <= X"00"; -- ± when 16#0b2# => romdata <= X"00"; -- ² when 16#1b2# => romdata <= X"30"; -- ² when 16#2b2# => romdata <= X"48"; -- ² when 16#3b2# => romdata <= X"08"; -- ² when 16#4b2# => romdata <= X"30"; -- ² when 16#5b2# => romdata <= X"40"; -- ² when 16#6b2# => romdata <= X"78"; -- ² when 16#7b2# => romdata <= X"00"; -- ² when 16#8b2# => romdata <= X"00"; -- ² when 16#9b2# => romdata <= X"00"; -- ² when 16#ab2# => romdata <= X"00"; -- ² when 16#bb2# => romdata <= X"00"; -- ² when 16#cb2# => romdata <= X"00"; -- ² when 16#0b3# => romdata <= X"00"; -- ³ when 16#1b3# => romdata <= X"30"; -- ³ when 16#2b3# => romdata <= X"48"; -- ³ when 16#3b3# => romdata <= X"10"; -- ³ when 16#4b3# => romdata <= X"08"; -- ³ when 16#5b3# => romdata <= X"48"; -- ³ when 16#6b3# => romdata <= X"30"; -- ³ when 16#7b3# => romdata <= X"00"; -- ³ when 16#8b3# => romdata <= X"00"; -- ³ when 16#9b3# => romdata <= X"00"; -- ³ when 16#ab3# => romdata <= X"00"; -- ³ when 16#bb3# => romdata <= X"00"; -- ³ when 16#cb3# => romdata <= X"00"; -- ³ when 16#0b4# => romdata <= X"00"; -- ´ when 16#1b4# => romdata <= X"08"; -- ´ when 16#2b4# => romdata <= X"10"; -- ´ when 16#3b4# => romdata <= X"00"; -- ´ when 16#4b4# => romdata <= X"00"; -- ´ when 16#5b4# => romdata <= X"00"; -- ´ when 16#6b4# => romdata <= X"00"; -- ´ when 16#7b4# => romdata <= X"00"; -- ´ when 16#8b4# => romdata <= X"00"; -- ´ when 16#9b4# => romdata <= X"00"; -- ´ when 16#ab4# => romdata <= X"00"; -- ´ when 16#bb4# => romdata <= X"00"; -- ´ when 16#cb4# => romdata <= X"00"; -- ´ when 16#0b5# => romdata <= X"00"; -- µ when 16#1b5# => romdata <= X"00"; -- µ when 16#2b5# => romdata <= X"00"; -- µ when 16#3b5# => romdata <= X"00"; -- µ when 16#4b5# => romdata <= X"00"; -- µ when 16#5b5# => romdata <= X"42"; -- µ when 16#6b5# => romdata <= X"42"; -- µ when 16#7b5# => romdata <= X"42"; -- µ when 16#8b5# => romdata <= X"42"; -- µ when 16#9b5# => romdata <= X"66"; -- µ when 16#ab5# => romdata <= X"5a"; -- µ when 16#bb5# => romdata <= X"40"; -- µ when 16#cb5# => romdata <= X"00"; -- µ when 16#0b6# => romdata <= X"00"; -- ¶ when 16#1b6# => romdata <= X"00"; -- ¶ when 16#2b6# => romdata <= X"3e"; -- ¶ when 16#3b6# => romdata <= X"74"; -- ¶ when 16#4b6# => romdata <= X"74"; -- ¶ when 16#5b6# => romdata <= X"74"; -- ¶ when 16#6b6# => romdata <= X"34"; -- ¶ when 16#7b6# => romdata <= X"14"; -- ¶ when 16#8b6# => romdata <= X"14"; -- ¶ when 16#9b6# => romdata <= X"14"; -- ¶ when 16#ab6# => romdata <= X"14"; -- ¶ when 16#bb6# => romdata <= X"00"; -- ¶ when 16#cb6# => romdata <= X"00"; -- ¶ when 16#0b7# => romdata <= X"00"; -- · when 16#1b7# => romdata <= X"00"; -- · when 16#2b7# => romdata <= X"00"; -- · when 16#3b7# => romdata <= X"00"; -- · when 16#4b7# => romdata <= X"00"; -- · when 16#5b7# => romdata <= X"00"; -- · when 16#6b7# => romdata <= X"18"; -- · when 16#7b7# => romdata <= X"00"; -- · when 16#8b7# => romdata <= X"00"; -- · when 16#9b7# => romdata <= X"00"; -- · when 16#ab7# => romdata <= X"00"; -- · when 16#bb7# => romdata <= X"00"; -- · when 16#cb7# => romdata <= X"00"; -- · when 16#0b8# => romdata <= X"00"; -- ¸ when 16#1b8# => romdata <= X"00"; -- ¸ when 16#2b8# => romdata <= X"00"; -- ¸ when 16#3b8# => romdata <= X"00"; -- ¸ when 16#4b8# => romdata <= X"00"; -- ¸ when 16#5b8# => romdata <= X"00"; -- ¸ when 16#6b8# => romdata <= X"00"; -- ¸ when 16#7b8# => romdata <= X"00"; -- ¸ when 16#8b8# => romdata <= X"00"; -- ¸ when 16#9b8# => romdata <= X"00"; -- ¸ when 16#ab8# => romdata <= X"00"; -- ¸ when 16#bb8# => romdata <= X"08"; -- ¸ when 16#cb8# => romdata <= X"18"; -- ¸ when 16#0b9# => romdata <= X"00"; -- ¹ when 16#1b9# => romdata <= X"20"; -- ¹ when 16#2b9# => romdata <= X"60"; -- ¹ when 16#3b9# => romdata <= X"20"; -- ¹ when 16#4b9# => romdata <= X"20"; -- ¹ when 16#5b9# => romdata <= X"20"; -- ¹ when 16#6b9# => romdata <= X"70"; -- ¹ when 16#7b9# => romdata <= X"00"; -- ¹ when 16#8b9# => romdata <= X"00"; -- ¹ when 16#9b9# => romdata <= X"00"; -- ¹ when 16#ab9# => romdata <= X"00"; -- ¹ when 16#bb9# => romdata <= X"00"; -- ¹ when 16#cb9# => romdata <= X"00"; -- ¹ when 16#0ba# => romdata <= X"00"; -- º when 16#1ba# => romdata <= X"00"; -- º when 16#2ba# => romdata <= X"30"; -- º when 16#3ba# => romdata <= X"48"; -- º when 16#4ba# => romdata <= X"48"; -- º when 16#5ba# => romdata <= X"30"; -- º when 16#6ba# => romdata <= X"00"; -- º when 16#7ba# => romdata <= X"78"; -- º when 16#8ba# => romdata <= X"00"; -- º when 16#9ba# => romdata <= X"00"; -- º when 16#aba# => romdata <= X"00"; -- º when 16#bba# => romdata <= X"00"; -- º when 16#cba# => romdata <= X"00"; -- º when 16#0bb# => romdata <= X"00"; -- » when 16#1bb# => romdata <= X"00"; -- » when 16#2bb# => romdata <= X"00"; -- » when 16#3bb# => romdata <= X"90"; -- » when 16#4bb# => romdata <= X"48"; -- » when 16#5bb# => romdata <= X"24"; -- » when 16#6bb# => romdata <= X"12"; -- » when 16#7bb# => romdata <= X"24"; -- » when 16#8bb# => romdata <= X"48"; -- » when 16#9bb# => romdata <= X"90"; -- » when 16#abb# => romdata <= X"00"; -- » when 16#bbb# => romdata <= X"00"; -- » when 16#cbb# => romdata <= X"00"; -- » when 16#0bc# => romdata <= X"00"; -- ¼ when 16#1bc# => romdata <= X"40"; -- ¼ when 16#2bc# => romdata <= X"c0"; -- ¼ when 16#3bc# => romdata <= X"40"; -- ¼ when 16#4bc# => romdata <= X"40"; -- ¼ when 16#5bc# => romdata <= X"42"; -- ¼ when 16#6bc# => romdata <= X"e6"; -- ¼ when 16#7bc# => romdata <= X"0a"; -- ¼ when 16#8bc# => romdata <= X"12"; -- ¼ when 16#9bc# => romdata <= X"1a"; -- ¼ when 16#abc# => romdata <= X"06"; -- ¼ when 16#bbc# => romdata <= X"00"; -- ¼ when 16#cbc# => romdata <= X"00"; -- ¼ when 16#0bd# => romdata <= X"00"; -- ½ when 16#1bd# => romdata <= X"40"; -- ½ when 16#2bd# => romdata <= X"c0"; -- ½ when 16#3bd# => romdata <= X"40"; -- ½ when 16#4bd# => romdata <= X"40"; -- ½ when 16#5bd# => romdata <= X"4c"; -- ½ when 16#6bd# => romdata <= X"f2"; -- ½ when 16#7bd# => romdata <= X"02"; -- ½ when 16#8bd# => romdata <= X"0c"; -- ½ when 16#9bd# => romdata <= X"10"; -- ½ when 16#abd# => romdata <= X"1e"; -- ½ when 16#bbd# => romdata <= X"00"; -- ½ when 16#cbd# => romdata <= X"00"; -- ½ when 16#0be# => romdata <= X"00"; -- ¾ when 16#1be# => romdata <= X"60"; -- ¾ when 16#2be# => romdata <= X"90"; -- ¾ when 16#3be# => romdata <= X"20"; -- ¾ when 16#4be# => romdata <= X"10"; -- ¾ when 16#5be# => romdata <= X"92"; -- ¾ when 16#6be# => romdata <= X"66"; -- ¾ when 16#7be# => romdata <= X"0a"; -- ¾ when 16#8be# => romdata <= X"12"; -- ¾ when 16#9be# => romdata <= X"1a"; -- ¾ when 16#abe# => romdata <= X"06"; -- ¾ when 16#bbe# => romdata <= X"00"; -- ¾ when 16#cbe# => romdata <= X"00"; -- ¾ when 16#0bf# => romdata <= X"00"; -- ¿ when 16#1bf# => romdata <= X"00"; -- ¿ when 16#2bf# => romdata <= X"10"; -- ¿ when 16#3bf# => romdata <= X"00"; -- ¿ when 16#4bf# => romdata <= X"10"; -- ¿ when 16#5bf# => romdata <= X"10"; -- ¿ when 16#6bf# => romdata <= X"20"; -- ¿ when 16#7bf# => romdata <= X"40"; -- ¿ when 16#8bf# => romdata <= X"42"; -- ¿ when 16#9bf# => romdata <= X"42"; -- ¿ when 16#abf# => romdata <= X"3c"; -- ¿ when 16#bbf# => romdata <= X"00"; -- ¿ when 16#cbf# => romdata <= X"00"; -- ¿ when 16#0c0# => romdata <= X"00"; -- À when 16#1c0# => romdata <= X"10"; -- À when 16#2c0# => romdata <= X"08"; -- À when 16#3c0# => romdata <= X"00"; -- À when 16#4c0# => romdata <= X"18"; -- À when 16#5c0# => romdata <= X"24"; -- À when 16#6c0# => romdata <= X"42"; -- À when 16#7c0# => romdata <= X"42"; -- À when 16#8c0# => romdata <= X"7e"; -- À when 16#9c0# => romdata <= X"42"; -- À when 16#ac0# => romdata <= X"42"; -- À when 16#bc0# => romdata <= X"00"; -- À when 16#cc0# => romdata <= X"00"; -- À when 16#0c1# => romdata <= X"00"; -- Á when 16#1c1# => romdata <= X"08"; -- Á when 16#2c1# => romdata <= X"10"; -- Á when 16#3c1# => romdata <= X"00"; -- Á when 16#4c1# => romdata <= X"18"; -- Á when 16#5c1# => romdata <= X"24"; -- Á when 16#6c1# => romdata <= X"42"; -- Á when 16#7c1# => romdata <= X"42"; -- Á when 16#8c1# => romdata <= X"7e"; -- Á when 16#9c1# => romdata <= X"42"; -- Á when 16#ac1# => romdata <= X"42"; -- Á when 16#bc1# => romdata <= X"00"; -- Á when 16#cc1# => romdata <= X"00"; -- Á when 16#0c2# => romdata <= X"00"; -- Â when 16#1c2# => romdata <= X"18"; -- Â when 16#2c2# => romdata <= X"24"; -- Â when 16#3c2# => romdata <= X"00"; -- Â when 16#4c2# => romdata <= X"18"; -- Â when 16#5c2# => romdata <= X"24"; -- Â when 16#6c2# => romdata <= X"42"; -- Â when 16#7c2# => romdata <= X"42"; -- Â when 16#8c2# => romdata <= X"7e"; -- Â when 16#9c2# => romdata <= X"42"; -- Â when 16#ac2# => romdata <= X"42"; -- Â when 16#bc2# => romdata <= X"00"; -- Â when 16#cc2# => romdata <= X"00"; -- Â when 16#0c3# => romdata <= X"00"; -- Ã when 16#1c3# => romdata <= X"32"; -- Ã when 16#2c3# => romdata <= X"4c"; -- Ã when 16#3c3# => romdata <= X"00"; -- Ã when 16#4c3# => romdata <= X"18"; -- Ã when 16#5c3# => romdata <= X"24"; -- Ã when 16#6c3# => romdata <= X"42"; -- Ã when 16#7c3# => romdata <= X"42"; -- Ã when 16#8c3# => romdata <= X"7e"; -- Ã when 16#9c3# => romdata <= X"42"; -- Ã when 16#ac3# => romdata <= X"42"; -- Ã when 16#bc3# => romdata <= X"00"; -- Ã when 16#cc3# => romdata <= X"00"; -- Ã when 16#0c4# => romdata <= X"00"; -- Ä when 16#1c4# => romdata <= X"24"; -- Ä when 16#2c4# => romdata <= X"24"; -- Ä when 16#3c4# => romdata <= X"00"; -- Ä when 16#4c4# => romdata <= X"18"; -- Ä when 16#5c4# => romdata <= X"24"; -- Ä when 16#6c4# => romdata <= X"42"; -- Ä when 16#7c4# => romdata <= X"42"; -- Ä when 16#8c4# => romdata <= X"7e"; -- Ä when 16#9c4# => romdata <= X"42"; -- Ä when 16#ac4# => romdata <= X"42"; -- Ä when 16#bc4# => romdata <= X"00"; -- Ä when 16#cc4# => romdata <= X"00"; -- Ä when 16#0c5# => romdata <= X"00"; -- Å when 16#1c5# => romdata <= X"18"; -- Å when 16#2c5# => romdata <= X"24"; -- Å when 16#3c5# => romdata <= X"18"; -- Å when 16#4c5# => romdata <= X"18"; -- Å when 16#5c5# => romdata <= X"24"; -- Å when 16#6c5# => romdata <= X"42"; -- Å when 16#7c5# => romdata <= X"42"; -- Å when 16#8c5# => romdata <= X"7e"; -- Å when 16#9c5# => romdata <= X"42"; -- Å when 16#ac5# => romdata <= X"42"; -- Å when 16#bc5# => romdata <= X"00"; -- Å when 16#cc5# => romdata <= X"00"; -- Å when 16#0c6# => romdata <= X"00"; -- Æ when 16#1c6# => romdata <= X"00"; -- Æ when 16#2c6# => romdata <= X"6e"; -- Æ when 16#3c6# => romdata <= X"90"; -- Æ when 16#4c6# => romdata <= X"90"; -- Æ when 16#5c6# => romdata <= X"90"; -- Æ when 16#6c6# => romdata <= X"9c"; -- Æ when 16#7c6# => romdata <= X"f0"; -- Æ when 16#8c6# => romdata <= X"90"; -- Æ when 16#9c6# => romdata <= X"90"; -- Æ when 16#ac6# => romdata <= X"9e"; -- Æ when 16#bc6# => romdata <= X"00"; -- Æ when 16#cc6# => romdata <= X"00"; -- Æ when 16#0c7# => romdata <= X"00"; -- Ç when 16#1c7# => romdata <= X"00"; -- Ç when 16#2c7# => romdata <= X"3c"; -- Ç when 16#3c7# => romdata <= X"42"; -- Ç when 16#4c7# => romdata <= X"40"; -- Ç when 16#5c7# => romdata <= X"40"; -- Ç when 16#6c7# => romdata <= X"40"; -- Ç when 16#7c7# => romdata <= X"40"; -- Ç when 16#8c7# => romdata <= X"40"; -- Ç when 16#9c7# => romdata <= X"42"; -- Ç when 16#ac7# => romdata <= X"3c"; -- Ç when 16#bc7# => romdata <= X"08"; -- Ç when 16#cc7# => romdata <= X"10"; -- Ç when 16#0c8# => romdata <= X"00"; -- È when 16#1c8# => romdata <= X"10"; -- È when 16#2c8# => romdata <= X"08"; -- È when 16#3c8# => romdata <= X"00"; -- È when 16#4c8# => romdata <= X"7e"; -- È when 16#5c8# => romdata <= X"40"; -- È when 16#6c8# => romdata <= X"40"; -- È when 16#7c8# => romdata <= X"78"; -- È when 16#8c8# => romdata <= X"40"; -- È when 16#9c8# => romdata <= X"40"; -- È when 16#ac8# => romdata <= X"7e"; -- È when 16#bc8# => romdata <= X"00"; -- È when 16#cc8# => romdata <= X"00"; -- È when 16#0c9# => romdata <= X"00"; -- É when 16#1c9# => romdata <= X"08"; -- É when 16#2c9# => romdata <= X"10"; -- É when 16#3c9# => romdata <= X"00"; -- É when 16#4c9# => romdata <= X"7e"; -- É when 16#5c9# => romdata <= X"40"; -- É when 16#6c9# => romdata <= X"40"; -- É when 16#7c9# => romdata <= X"78"; -- É when 16#8c9# => romdata <= X"40"; -- É when 16#9c9# => romdata <= X"40"; -- É when 16#ac9# => romdata <= X"7e"; -- É when 16#bc9# => romdata <= X"00"; -- É when 16#cc9# => romdata <= X"00"; -- É when 16#0ca# => romdata <= X"00"; -- Ê when 16#1ca# => romdata <= X"18"; -- Ê when 16#2ca# => romdata <= X"24"; -- Ê when 16#3ca# => romdata <= X"00"; -- Ê when 16#4ca# => romdata <= X"7e"; -- Ê when 16#5ca# => romdata <= X"40"; -- Ê when 16#6ca# => romdata <= X"40"; -- Ê when 16#7ca# => romdata <= X"78"; -- Ê when 16#8ca# => romdata <= X"40"; -- Ê when 16#9ca# => romdata <= X"40"; -- Ê when 16#aca# => romdata <= X"7e"; -- Ê when 16#bca# => romdata <= X"00"; -- Ê when 16#cca# => romdata <= X"00"; -- Ê when 16#0cb# => romdata <= X"00"; -- Ë when 16#1cb# => romdata <= X"24"; -- Ë when 16#2cb# => romdata <= X"24"; -- Ë when 16#3cb# => romdata <= X"00"; -- Ë when 16#4cb# => romdata <= X"7e"; -- Ë when 16#5cb# => romdata <= X"40"; -- Ë when 16#6cb# => romdata <= X"40"; -- Ë when 16#7cb# => romdata <= X"78"; -- Ë when 16#8cb# => romdata <= X"40"; -- Ë when 16#9cb# => romdata <= X"40"; -- Ë when 16#acb# => romdata <= X"7e"; -- Ë when 16#bcb# => romdata <= X"00"; -- Ë when 16#ccb# => romdata <= X"00"; -- Ë when 16#0cc# => romdata <= X"00"; -- Ì when 16#1cc# => romdata <= X"20"; -- Ì when 16#2cc# => romdata <= X"10"; -- Ì when 16#3cc# => romdata <= X"00"; -- Ì when 16#4cc# => romdata <= X"7c"; -- Ì when 16#5cc# => romdata <= X"10"; -- Ì when 16#6cc# => romdata <= X"10"; -- Ì when 16#7cc# => romdata <= X"10"; -- Ì when 16#8cc# => romdata <= X"10"; -- Ì when 16#9cc# => romdata <= X"10"; -- Ì when 16#acc# => romdata <= X"7c"; -- Ì when 16#bcc# => romdata <= X"00"; -- Ì when 16#ccc# => romdata <= X"00"; -- Ì when 16#0cd# => romdata <= X"00"; -- Í when 16#1cd# => romdata <= X"08"; -- Í when 16#2cd# => romdata <= X"10"; -- Í when 16#3cd# => romdata <= X"00"; -- Í when 16#4cd# => romdata <= X"7c"; -- Í when 16#5cd# => romdata <= X"10"; -- Í when 16#6cd# => romdata <= X"10"; -- Í when 16#7cd# => romdata <= X"10"; -- Í when 16#8cd# => romdata <= X"10"; -- Í when 16#9cd# => romdata <= X"10"; -- Í when 16#acd# => romdata <= X"7c"; -- Í when 16#bcd# => romdata <= X"00"; -- Í when 16#ccd# => romdata <= X"00"; -- Í when 16#0ce# => romdata <= X"00"; -- Î when 16#1ce# => romdata <= X"18"; -- Î when 16#2ce# => romdata <= X"24"; -- Î when 16#3ce# => romdata <= X"00"; -- Î when 16#4ce# => romdata <= X"7c"; -- Î when 16#5ce# => romdata <= X"10"; -- Î when 16#6ce# => romdata <= X"10"; -- Î when 16#7ce# => romdata <= X"10"; -- Î when 16#8ce# => romdata <= X"10"; -- Î when 16#9ce# => romdata <= X"10"; -- Î when 16#ace# => romdata <= X"7c"; -- Î when 16#bce# => romdata <= X"00"; -- Î when 16#cce# => romdata <= X"00"; -- Î when 16#0cf# => romdata <= X"00"; -- Ï when 16#1cf# => romdata <= X"44"; -- Ï when 16#2cf# => romdata <= X"44"; -- Ï when 16#3cf# => romdata <= X"00"; -- Ï when 16#4cf# => romdata <= X"7c"; -- Ï when 16#5cf# => romdata <= X"10"; -- Ï when 16#6cf# => romdata <= X"10"; -- Ï when 16#7cf# => romdata <= X"10"; -- Ï when 16#8cf# => romdata <= X"10"; -- Ï when 16#9cf# => romdata <= X"10"; -- Ï when 16#acf# => romdata <= X"7c"; -- Ï when 16#bcf# => romdata <= X"00"; -- Ï when 16#ccf# => romdata <= X"00"; -- Ï when 16#0d0# => romdata <= X"00"; -- Ð when 16#1d0# => romdata <= X"00"; -- Ð when 16#2d0# => romdata <= X"78"; -- Ð when 16#3d0# => romdata <= X"44"; -- Ð when 16#4d0# => romdata <= X"42"; -- Ð when 16#5d0# => romdata <= X"42"; -- Ð when 16#6d0# => romdata <= X"e2"; -- Ð when 16#7d0# => romdata <= X"42"; -- Ð when 16#8d0# => romdata <= X"42"; -- Ð when 16#9d0# => romdata <= X"44"; -- Ð when 16#ad0# => romdata <= X"78"; -- Ð when 16#bd0# => romdata <= X"00"; -- Ð when 16#cd0# => romdata <= X"00"; -- Ð when 16#0d1# => romdata <= X"00"; -- Ñ when 16#1d1# => romdata <= X"64"; -- Ñ when 16#2d1# => romdata <= X"98"; -- Ñ when 16#3d1# => romdata <= X"00"; -- Ñ when 16#4d1# => romdata <= X"82"; -- Ñ when 16#5d1# => romdata <= X"c2"; -- Ñ when 16#6d1# => romdata <= X"a2"; -- Ñ when 16#7d1# => romdata <= X"92"; -- Ñ when 16#8d1# => romdata <= X"8a"; -- Ñ when 16#9d1# => romdata <= X"86"; -- Ñ when 16#ad1# => romdata <= X"82"; -- Ñ when 16#bd1# => romdata <= X"00"; -- Ñ when 16#cd1# => romdata <= X"00"; -- Ñ when 16#0d2# => romdata <= X"00"; -- Ò when 16#1d2# => romdata <= X"20"; -- Ò when 16#2d2# => romdata <= X"10"; -- Ò when 16#3d2# => romdata <= X"00"; -- Ò when 16#4d2# => romdata <= X"7c"; -- Ò when 16#5d2# => romdata <= X"82"; -- Ò when 16#6d2# => romdata <= X"82"; -- Ò when 16#7d2# => romdata <= X"82"; -- Ò when 16#8d2# => romdata <= X"82"; -- Ò when 16#9d2# => romdata <= X"82"; -- Ò when 16#ad2# => romdata <= X"7c"; -- Ò when 16#bd2# => romdata <= X"00"; -- Ò when 16#cd2# => romdata <= X"00"; -- Ò when 16#0d3# => romdata <= X"00"; -- Ó when 16#1d3# => romdata <= X"08"; -- Ó when 16#2d3# => romdata <= X"10"; -- Ó when 16#3d3# => romdata <= X"00"; -- Ó when 16#4d3# => romdata <= X"7c"; -- Ó when 16#5d3# => romdata <= X"82"; -- Ó when 16#6d3# => romdata <= X"82"; -- Ó when 16#7d3# => romdata <= X"82"; -- Ó when 16#8d3# => romdata <= X"82"; -- Ó when 16#9d3# => romdata <= X"82"; -- Ó when 16#ad3# => romdata <= X"7c"; -- Ó when 16#bd3# => romdata <= X"00"; -- Ó when 16#cd3# => romdata <= X"00"; -- Ó when 16#0d4# => romdata <= X"00"; -- Ô when 16#1d4# => romdata <= X"18"; -- Ô when 16#2d4# => romdata <= X"24"; -- Ô when 16#3d4# => romdata <= X"00"; -- Ô when 16#4d4# => romdata <= X"7c"; -- Ô when 16#5d4# => romdata <= X"82"; -- Ô when 16#6d4# => romdata <= X"82"; -- Ô when 16#7d4# => romdata <= X"82"; -- Ô when 16#8d4# => romdata <= X"82"; -- Ô when 16#9d4# => romdata <= X"82"; -- Ô when 16#ad4# => romdata <= X"7c"; -- Ô when 16#bd4# => romdata <= X"00"; -- Ô when 16#cd4# => romdata <= X"00"; -- Ô when 16#0d5# => romdata <= X"00"; -- Õ when 16#1d5# => romdata <= X"64"; -- Õ when 16#2d5# => romdata <= X"98"; -- Õ when 16#3d5# => romdata <= X"00"; -- Õ when 16#4d5# => romdata <= X"7c"; -- Õ when 16#5d5# => romdata <= X"82"; -- Õ when 16#6d5# => romdata <= X"82"; -- Õ when 16#7d5# => romdata <= X"82"; -- Õ when 16#8d5# => romdata <= X"82"; -- Õ when 16#9d5# => romdata <= X"82"; -- Õ when 16#ad5# => romdata <= X"7c"; -- Õ when 16#bd5# => romdata <= X"00"; -- Õ when 16#cd5# => romdata <= X"00"; -- Õ when 16#0d6# => romdata <= X"00"; -- Ö when 16#1d6# => romdata <= X"44"; -- Ö when 16#2d6# => romdata <= X"44"; -- Ö when 16#3d6# => romdata <= X"00"; -- Ö when 16#4d6# => romdata <= X"7c"; -- Ö when 16#5d6# => romdata <= X"82"; -- Ö when 16#6d6# => romdata <= X"82"; -- Ö when 16#7d6# => romdata <= X"82"; -- Ö when 16#8d6# => romdata <= X"82"; -- Ö when 16#9d6# => romdata <= X"82"; -- Ö when 16#ad6# => romdata <= X"7c"; -- Ö when 16#bd6# => romdata <= X"00"; -- Ö when 16#cd6# => romdata <= X"00"; -- Ö when 16#0d7# => romdata <= X"00"; -- × when 16#1d7# => romdata <= X"00"; -- × when 16#2d7# => romdata <= X"00"; -- × when 16#3d7# => romdata <= X"00"; -- × when 16#4d7# => romdata <= X"42"; -- × when 16#5d7# => romdata <= X"24"; -- × when 16#6d7# => romdata <= X"18"; -- × when 16#7d7# => romdata <= X"18"; -- × when 16#8d7# => romdata <= X"24"; -- × when 16#9d7# => romdata <= X"42"; -- × when 16#ad7# => romdata <= X"00"; -- × when 16#bd7# => romdata <= X"00"; -- × when 16#cd7# => romdata <= X"00"; -- × when 16#0d8# => romdata <= X"00"; -- Ø when 16#1d8# => romdata <= X"02"; -- Ø when 16#2d8# => romdata <= X"3c"; -- Ø when 16#3d8# => romdata <= X"46"; -- Ø when 16#4d8# => romdata <= X"4a"; -- Ø when 16#5d8# => romdata <= X"4a"; -- Ø when 16#6d8# => romdata <= X"52"; -- Ø when 16#7d8# => romdata <= X"52"; -- Ø when 16#8d8# => romdata <= X"52"; -- Ø when 16#9d8# => romdata <= X"62"; -- Ø when 16#ad8# => romdata <= X"3c"; -- Ø when 16#bd8# => romdata <= X"40"; -- Ø when 16#cd8# => romdata <= X"00"; -- Ø when 16#0d9# => romdata <= X"00"; -- Ù when 16#1d9# => romdata <= X"20"; -- Ù when 16#2d9# => romdata <= X"10"; -- Ù when 16#3d9# => romdata <= X"00"; -- Ù when 16#4d9# => romdata <= X"42"; -- Ù when 16#5d9# => romdata <= X"42"; -- Ù when 16#6d9# => romdata <= X"42"; -- Ù when 16#7d9# => romdata <= X"42"; -- Ù when 16#8d9# => romdata <= X"42"; -- Ù when 16#9d9# => romdata <= X"42"; -- Ù when 16#ad9# => romdata <= X"3c"; -- Ù when 16#bd9# => romdata <= X"00"; -- Ù when 16#cd9# => romdata <= X"00"; -- Ù when 16#0da# => romdata <= X"00"; -- Ú when 16#1da# => romdata <= X"08"; -- Ú when 16#2da# => romdata <= X"10"; -- Ú when 16#3da# => romdata <= X"00"; -- Ú when 16#4da# => romdata <= X"42"; -- Ú when 16#5da# => romdata <= X"42"; -- Ú when 16#6da# => romdata <= X"42"; -- Ú when 16#7da# => romdata <= X"42"; -- Ú when 16#8da# => romdata <= X"42"; -- Ú when 16#9da# => romdata <= X"42"; -- Ú when 16#ada# => romdata <= X"3c"; -- Ú when 16#bda# => romdata <= X"00"; -- Ú when 16#cda# => romdata <= X"00"; -- Ú when 16#0db# => romdata <= X"00"; -- Û when 16#1db# => romdata <= X"18"; -- Û when 16#2db# => romdata <= X"24"; -- Û when 16#3db# => romdata <= X"00"; -- Û when 16#4db# => romdata <= X"42"; -- Û when 16#5db# => romdata <= X"42"; -- Û when 16#6db# => romdata <= X"42"; -- Û when 16#7db# => romdata <= X"42"; -- Û when 16#8db# => romdata <= X"42"; -- Û when 16#9db# => romdata <= X"42"; -- Û when 16#adb# => romdata <= X"3c"; -- Û when 16#bdb# => romdata <= X"00"; -- Û when 16#cdb# => romdata <= X"00"; -- Û when 16#0dc# => romdata <= X"00"; -- Ü when 16#1dc# => romdata <= X"24"; -- Ü when 16#2dc# => romdata <= X"24"; -- Ü when 16#3dc# => romdata <= X"00"; -- Ü when 16#4dc# => romdata <= X"42"; -- Ü when 16#5dc# => romdata <= X"42"; -- Ü when 16#6dc# => romdata <= X"42"; -- Ü when 16#7dc# => romdata <= X"42"; -- Ü when 16#8dc# => romdata <= X"42"; -- Ü when 16#9dc# => romdata <= X"42"; -- Ü when 16#adc# => romdata <= X"3c"; -- Ü when 16#bdc# => romdata <= X"00"; -- Ü when 16#cdc# => romdata <= X"00"; -- Ü when 16#0dd# => romdata <= X"00"; -- Ý when 16#1dd# => romdata <= X"08"; -- Ý when 16#2dd# => romdata <= X"10"; -- Ý when 16#3dd# => romdata <= X"00"; -- Ý when 16#4dd# => romdata <= X"44"; -- Ý when 16#5dd# => romdata <= X"44"; -- Ý when 16#6dd# => romdata <= X"28"; -- Ý when 16#7dd# => romdata <= X"10"; -- Ý when 16#8dd# => romdata <= X"10"; -- Ý when 16#9dd# => romdata <= X"10"; -- Ý when 16#add# => romdata <= X"10"; -- Ý when 16#bdd# => romdata <= X"00"; -- Ý when 16#cdd# => romdata <= X"00"; -- Ý when 16#0de# => romdata <= X"00"; -- Þ when 16#1de# => romdata <= X"00"; -- Þ when 16#2de# => romdata <= X"40"; -- Þ when 16#3de# => romdata <= X"7c"; -- Þ when 16#4de# => romdata <= X"42"; -- Þ when 16#5de# => romdata <= X"42"; -- Þ when 16#6de# => romdata <= X"42"; -- Þ when 16#7de# => romdata <= X"7c"; -- Þ when 16#8de# => romdata <= X"40"; -- Þ when 16#9de# => romdata <= X"40"; -- Þ when 16#ade# => romdata <= X"40"; -- Þ when 16#bde# => romdata <= X"00"; -- Þ when 16#cde# => romdata <= X"00"; -- Þ when 16#0df# => romdata <= X"00"; -- ß when 16#1df# => romdata <= X"00"; -- ß when 16#2df# => romdata <= X"38"; -- ß when 16#3df# => romdata <= X"44"; -- ß when 16#4df# => romdata <= X"44"; -- ß when 16#5df# => romdata <= X"48"; -- ß when 16#6df# => romdata <= X"50"; -- ß when 16#7df# => romdata <= X"4c"; -- ß when 16#8df# => romdata <= X"42"; -- ß when 16#9df# => romdata <= X"42"; -- ß when 16#adf# => romdata <= X"5c"; -- ß when 16#bdf# => romdata <= X"00"; -- ß when 16#cdf# => romdata <= X"00"; -- ß when 16#0e0# => romdata <= X"00"; -- à when 16#1e0# => romdata <= X"00"; -- à when 16#2e0# => romdata <= X"10"; -- à when 16#3e0# => romdata <= X"08"; -- à when 16#4e0# => romdata <= X"00"; -- à when 16#5e0# => romdata <= X"3c"; -- à when 16#6e0# => romdata <= X"02"; -- à when 16#7e0# => romdata <= X"3e"; -- à when 16#8e0# => romdata <= X"42"; -- à when 16#9e0# => romdata <= X"46"; -- à when 16#ae0# => romdata <= X"3a"; -- à when 16#be0# => romdata <= X"00"; -- à when 16#ce0# => romdata <= X"00"; -- à when 16#0e1# => romdata <= X"00"; -- á when 16#1e1# => romdata <= X"00"; -- á when 16#2e1# => romdata <= X"04"; -- á when 16#3e1# => romdata <= X"08"; -- á when 16#4e1# => romdata <= X"00"; -- á when 16#5e1# => romdata <= X"3c"; -- á when 16#6e1# => romdata <= X"02"; -- á when 16#7e1# => romdata <= X"3e"; -- á when 16#8e1# => romdata <= X"42"; -- á when 16#9e1# => romdata <= X"46"; -- á when 16#ae1# => romdata <= X"3a"; -- á when 16#be1# => romdata <= X"00"; -- á when 16#ce1# => romdata <= X"00"; -- á when 16#0e2# => romdata <= X"00"; -- â when 16#1e2# => romdata <= X"00"; -- â when 16#2e2# => romdata <= X"18"; -- â when 16#3e2# => romdata <= X"24"; -- â when 16#4e2# => romdata <= X"00"; -- â when 16#5e2# => romdata <= X"3c"; -- â when 16#6e2# => romdata <= X"02"; -- â when 16#7e2# => romdata <= X"3e"; -- â when 16#8e2# => romdata <= X"42"; -- â when 16#9e2# => romdata <= X"46"; -- â when 16#ae2# => romdata <= X"3a"; -- â when 16#be2# => romdata <= X"00"; -- â when 16#ce2# => romdata <= X"00"; -- â when 16#0e3# => romdata <= X"00"; -- ã when 16#1e3# => romdata <= X"00"; -- ã when 16#2e3# => romdata <= X"32"; -- ã when 16#3e3# => romdata <= X"4c"; -- ã when 16#4e3# => romdata <= X"00"; -- ã when 16#5e3# => romdata <= X"3c"; -- ã when 16#6e3# => romdata <= X"02"; -- ã when 16#7e3# => romdata <= X"3e"; -- ã when 16#8e3# => romdata <= X"42"; -- ã when 16#9e3# => romdata <= X"46"; -- ã when 16#ae3# => romdata <= X"3a"; -- ã when 16#be3# => romdata <= X"00"; -- ã when 16#ce3# => romdata <= X"00"; -- ã when 16#0e4# => romdata <= X"00"; -- ä when 16#1e4# => romdata <= X"00"; -- ä when 16#2e4# => romdata <= X"24"; -- ä when 16#3e4# => romdata <= X"24"; -- ä when 16#4e4# => romdata <= X"00"; -- ä when 16#5e4# => romdata <= X"3c"; -- ä when 16#6e4# => romdata <= X"02"; -- ä when 16#7e4# => romdata <= X"3e"; -- ä when 16#8e4# => romdata <= X"42"; -- ä when 16#9e4# => romdata <= X"46"; -- ä when 16#ae4# => romdata <= X"3a"; -- ä when 16#be4# => romdata <= X"00"; -- ä when 16#ce4# => romdata <= X"00"; -- ä when 16#0e5# => romdata <= X"00"; -- å when 16#1e5# => romdata <= X"18"; -- å when 16#2e5# => romdata <= X"24"; -- å when 16#3e5# => romdata <= X"18"; -- å when 16#4e5# => romdata <= X"00"; -- å when 16#5e5# => romdata <= X"3c"; -- å when 16#6e5# => romdata <= X"02"; -- å when 16#7e5# => romdata <= X"3e"; -- å when 16#8e5# => romdata <= X"42"; -- å when 16#9e5# => romdata <= X"46"; -- å when 16#ae5# => romdata <= X"3a"; -- å when 16#be5# => romdata <= X"00"; -- å when 16#ce5# => romdata <= X"00"; -- å when 16#0e6# => romdata <= X"00"; -- æ when 16#1e6# => romdata <= X"00"; -- æ when 16#2e6# => romdata <= X"00"; -- æ when 16#3e6# => romdata <= X"00"; -- æ when 16#4e6# => romdata <= X"00"; -- æ when 16#5e6# => romdata <= X"6c"; -- æ when 16#6e6# => romdata <= X"12"; -- æ when 16#7e6# => romdata <= X"7c"; -- æ when 16#8e6# => romdata <= X"90"; -- æ when 16#9e6# => romdata <= X"92"; -- æ when 16#ae6# => romdata <= X"6c"; -- æ when 16#be6# => romdata <= X"00"; -- æ when 16#ce6# => romdata <= X"00"; -- æ when 16#0e7# => romdata <= X"00"; -- ç when 16#1e7# => romdata <= X"00"; -- ç when 16#2e7# => romdata <= X"00"; -- ç when 16#3e7# => romdata <= X"00"; -- ç when 16#4e7# => romdata <= X"00"; -- ç when 16#5e7# => romdata <= X"3c"; -- ç when 16#6e7# => romdata <= X"42"; -- ç when 16#7e7# => romdata <= X"40"; -- ç when 16#8e7# => romdata <= X"40"; -- ç when 16#9e7# => romdata <= X"42"; -- ç when 16#ae7# => romdata <= X"3c"; -- ç when 16#be7# => romdata <= X"08"; -- ç when 16#ce7# => romdata <= X"10"; -- ç when 16#0e8# => romdata <= X"00"; -- è when 16#1e8# => romdata <= X"00"; -- è when 16#2e8# => romdata <= X"10"; -- è when 16#3e8# => romdata <= X"08"; -- è when 16#4e8# => romdata <= X"00"; -- è when 16#5e8# => romdata <= X"3c"; -- è when 16#6e8# => romdata <= X"42"; -- è when 16#7e8# => romdata <= X"7e"; -- è when 16#8e8# => romdata <= X"40"; -- è when 16#9e8# => romdata <= X"42"; -- è when 16#ae8# => romdata <= X"3c"; -- è when 16#be8# => romdata <= X"00"; -- è when 16#ce8# => romdata <= X"00"; -- è when 16#0e9# => romdata <= X"00"; -- é when 16#1e9# => romdata <= X"00"; -- é when 16#2e9# => romdata <= X"08"; -- é when 16#3e9# => romdata <= X"10"; -- é when 16#4e9# => romdata <= X"00"; -- é when 16#5e9# => romdata <= X"3c"; -- é when 16#6e9# => romdata <= X"42"; -- é when 16#7e9# => romdata <= X"7e"; -- é when 16#8e9# => romdata <= X"40"; -- é when 16#9e9# => romdata <= X"42"; -- é when 16#ae9# => romdata <= X"3c"; -- é when 16#be9# => romdata <= X"00"; -- é when 16#ce9# => romdata <= X"00"; -- é when 16#0ea# => romdata <= X"00"; -- ê when 16#1ea# => romdata <= X"00"; -- ê when 16#2ea# => romdata <= X"18"; -- ê when 16#3ea# => romdata <= X"24"; -- ê when 16#4ea# => romdata <= X"00"; -- ê when 16#5ea# => romdata <= X"3c"; -- ê when 16#6ea# => romdata <= X"42"; -- ê when 16#7ea# => romdata <= X"7e"; -- ê when 16#8ea# => romdata <= X"40"; -- ê when 16#9ea# => romdata <= X"42"; -- ê when 16#aea# => romdata <= X"3c"; -- ê when 16#bea# => romdata <= X"00"; -- ê when 16#cea# => romdata <= X"00"; -- ê when 16#0eb# => romdata <= X"00"; -- ë when 16#1eb# => romdata <= X"00"; -- ë when 16#2eb# => romdata <= X"24"; -- ë when 16#3eb# => romdata <= X"24"; -- ë when 16#4eb# => romdata <= X"00"; -- ë when 16#5eb# => romdata <= X"3c"; -- ë when 16#6eb# => romdata <= X"42"; -- ë when 16#7eb# => romdata <= X"7e"; -- ë when 16#8eb# => romdata <= X"40"; -- ë when 16#9eb# => romdata <= X"42"; -- ë when 16#aeb# => romdata <= X"3c"; -- ë when 16#beb# => romdata <= X"00"; -- ë when 16#ceb# => romdata <= X"00"; -- ë when 16#0ec# => romdata <= X"00"; -- ì when 16#1ec# => romdata <= X"00"; -- ì when 16#2ec# => romdata <= X"20"; -- ì when 16#3ec# => romdata <= X"10"; -- ì when 16#4ec# => romdata <= X"00"; -- ì when 16#5ec# => romdata <= X"30"; -- ì when 16#6ec# => romdata <= X"10"; -- ì when 16#7ec# => romdata <= X"10"; -- ì when 16#8ec# => romdata <= X"10"; -- ì when 16#9ec# => romdata <= X"10"; -- ì when 16#aec# => romdata <= X"7c"; -- ì when 16#bec# => romdata <= X"00"; -- ì when 16#cec# => romdata <= X"00"; -- ì when 16#0ed# => romdata <= X"00"; -- í when 16#1ed# => romdata <= X"00"; -- í when 16#2ed# => romdata <= X"10"; -- í when 16#3ed# => romdata <= X"20"; -- í when 16#4ed# => romdata <= X"00"; -- í when 16#5ed# => romdata <= X"30"; -- í when 16#6ed# => romdata <= X"10"; -- í when 16#7ed# => romdata <= X"10"; -- í when 16#8ed# => romdata <= X"10"; -- í when 16#9ed# => romdata <= X"10"; -- í when 16#aed# => romdata <= X"7c"; -- í when 16#bed# => romdata <= X"00"; -- í when 16#ced# => romdata <= X"00"; -- í when 16#0ee# => romdata <= X"00"; -- î when 16#1ee# => romdata <= X"00"; -- î when 16#2ee# => romdata <= X"30"; -- î when 16#3ee# => romdata <= X"48"; -- î when 16#4ee# => romdata <= X"00"; -- î when 16#5ee# => romdata <= X"30"; -- î when 16#6ee# => romdata <= X"10"; -- î when 16#7ee# => romdata <= X"10"; -- î when 16#8ee# => romdata <= X"10"; -- î when 16#9ee# => romdata <= X"10"; -- î when 16#aee# => romdata <= X"7c"; -- î when 16#bee# => romdata <= X"00"; -- î when 16#cee# => romdata <= X"00"; -- î when 16#0ef# => romdata <= X"00"; -- ï when 16#1ef# => romdata <= X"00"; -- ï when 16#2ef# => romdata <= X"48"; -- ï when 16#3ef# => romdata <= X"48"; -- ï when 16#4ef# => romdata <= X"00"; -- ï when 16#5ef# => romdata <= X"30"; -- ï when 16#6ef# => romdata <= X"10"; -- ï when 16#7ef# => romdata <= X"10"; -- ï when 16#8ef# => romdata <= X"10"; -- ï when 16#9ef# => romdata <= X"10"; -- ï when 16#aef# => romdata <= X"7c"; -- ï when 16#bef# => romdata <= X"00"; -- ï when 16#cef# => romdata <= X"00"; -- ï when 16#0f0# => romdata <= X"00"; -- ð when 16#1f0# => romdata <= X"24"; -- ð when 16#2f0# => romdata <= X"18"; -- ð when 16#3f0# => romdata <= X"28"; -- ð when 16#4f0# => romdata <= X"04"; -- ð when 16#5f0# => romdata <= X"3c"; -- ð when 16#6f0# => romdata <= X"42"; -- ð when 16#7f0# => romdata <= X"42"; -- ð when 16#8f0# => romdata <= X"42"; -- ð when 16#9f0# => romdata <= X"42"; -- ð when 16#af0# => romdata <= X"3c"; -- ð when 16#bf0# => romdata <= X"00"; -- ð when 16#cf0# => romdata <= X"00"; -- ð when 16#0f1# => romdata <= X"00"; -- ñ when 16#1f1# => romdata <= X"00"; -- ñ when 16#2f1# => romdata <= X"32"; -- ñ when 16#3f1# => romdata <= X"4c"; -- ñ when 16#4f1# => romdata <= X"00"; -- ñ when 16#5f1# => romdata <= X"5c"; -- ñ when 16#6f1# => romdata <= X"62"; -- ñ when 16#7f1# => romdata <= X"42"; -- ñ when 16#8f1# => romdata <= X"42"; -- ñ when 16#9f1# => romdata <= X"42"; -- ñ when 16#af1# => romdata <= X"42"; -- ñ when 16#bf1# => romdata <= X"00"; -- ñ when 16#cf1# => romdata <= X"00"; -- ñ when 16#0f2# => romdata <= X"00"; -- ò when 16#1f2# => romdata <= X"00"; -- ò when 16#2f2# => romdata <= X"20"; -- ò when 16#3f2# => romdata <= X"10"; -- ò when 16#4f2# => romdata <= X"00"; -- ò when 16#5f2# => romdata <= X"3c"; -- ò when 16#6f2# => romdata <= X"42"; -- ò when 16#7f2# => romdata <= X"42"; -- ò when 16#8f2# => romdata <= X"42"; -- ò when 16#9f2# => romdata <= X"42"; -- ò when 16#af2# => romdata <= X"3c"; -- ò when 16#bf2# => romdata <= X"00"; -- ò when 16#cf2# => romdata <= X"00"; -- ò when 16#0f3# => romdata <= X"00"; -- ó when 16#1f3# => romdata <= X"00"; -- ó when 16#2f3# => romdata <= X"08"; -- ó when 16#3f3# => romdata <= X"10"; -- ó when 16#4f3# => romdata <= X"00"; -- ó when 16#5f3# => romdata <= X"3c"; -- ó when 16#6f3# => romdata <= X"42"; -- ó when 16#7f3# => romdata <= X"42"; -- ó when 16#8f3# => romdata <= X"42"; -- ó when 16#9f3# => romdata <= X"42"; -- ó when 16#af3# => romdata <= X"3c"; -- ó when 16#bf3# => romdata <= X"00"; -- ó when 16#cf3# => romdata <= X"00"; -- ó when 16#0f4# => romdata <= X"00"; -- ô when 16#1f4# => romdata <= X"00"; -- ô when 16#2f4# => romdata <= X"18"; -- ô when 16#3f4# => romdata <= X"24"; -- ô when 16#4f4# => romdata <= X"00"; -- ô when 16#5f4# => romdata <= X"3c"; -- ô when 16#6f4# => romdata <= X"42"; -- ô when 16#7f4# => romdata <= X"42"; -- ô when 16#8f4# => romdata <= X"42"; -- ô when 16#9f4# => romdata <= X"42"; -- ô when 16#af4# => romdata <= X"3c"; -- ô when 16#bf4# => romdata <= X"00"; -- ô when 16#cf4# => romdata <= X"00"; -- ô when 16#0f5# => romdata <= X"00"; -- õ when 16#1f5# => romdata <= X"00"; -- õ when 16#2f5# => romdata <= X"32"; -- õ when 16#3f5# => romdata <= X"4c"; -- õ when 16#4f5# => romdata <= X"00"; -- õ when 16#5f5# => romdata <= X"3c"; -- õ when 16#6f5# => romdata <= X"42"; -- õ when 16#7f5# => romdata <= X"42"; -- õ when 16#8f5# => romdata <= X"42"; -- õ when 16#9f5# => romdata <= X"42"; -- õ when 16#af5# => romdata <= X"3c"; -- õ when 16#bf5# => romdata <= X"00"; -- õ when 16#cf5# => romdata <= X"00"; -- õ when 16#0f6# => romdata <= X"00"; -- ö when 16#1f6# => romdata <= X"00"; -- ö when 16#2f6# => romdata <= X"24"; -- ö when 16#3f6# => romdata <= X"24"; -- ö when 16#4f6# => romdata <= X"00"; -- ö when 16#5f6# => romdata <= X"3c"; -- ö when 16#6f6# => romdata <= X"42"; -- ö when 16#7f6# => romdata <= X"42"; -- ö when 16#8f6# => romdata <= X"42"; -- ö when 16#9f6# => romdata <= X"42"; -- ö when 16#af6# => romdata <= X"3c"; -- ö when 16#bf6# => romdata <= X"00"; -- ö when 16#cf6# => romdata <= X"00"; -- ö when 16#0f7# => romdata <= X"00"; -- ÷ when 16#1f7# => romdata <= X"00"; -- ÷ when 16#2f7# => romdata <= X"00"; -- ÷ when 16#3f7# => romdata <= X"10"; -- ÷ when 16#4f7# => romdata <= X"10"; -- ÷ when 16#5f7# => romdata <= X"00"; -- ÷ when 16#6f7# => romdata <= X"7c"; -- ÷ when 16#7f7# => romdata <= X"00"; -- ÷ when 16#8f7# => romdata <= X"10"; -- ÷ when 16#9f7# => romdata <= X"10"; -- ÷ when 16#af7# => romdata <= X"00"; -- ÷ when 16#bf7# => romdata <= X"00"; -- ÷ when 16#cf7# => romdata <= X"00"; -- ÷ when 16#0f8# => romdata <= X"00"; -- ø when 16#1f8# => romdata <= X"00"; -- ø when 16#2f8# => romdata <= X"00"; -- ø when 16#3f8# => romdata <= X"00"; -- ø when 16#4f8# => romdata <= X"02"; -- ø when 16#5f8# => romdata <= X"3c"; -- ø when 16#6f8# => romdata <= X"46"; -- ø when 16#7f8# => romdata <= X"4a"; -- ø when 16#8f8# => romdata <= X"52"; -- ø when 16#9f8# => romdata <= X"62"; -- ø when 16#af8# => romdata <= X"3c"; -- ø when 16#bf8# => romdata <= X"40"; -- ø when 16#cf8# => romdata <= X"00"; -- ø when 16#0f9# => romdata <= X"00"; -- ù when 16#1f9# => romdata <= X"00"; -- ù when 16#2f9# => romdata <= X"20"; -- ù when 16#3f9# => romdata <= X"10"; -- ù when 16#4f9# => romdata <= X"00"; -- ù when 16#5f9# => romdata <= X"44"; -- ù when 16#6f9# => romdata <= X"44"; -- ù when 16#7f9# => romdata <= X"44"; -- ù when 16#8f9# => romdata <= X"44"; -- ù when 16#9f9# => romdata <= X"44"; -- ù when 16#af9# => romdata <= X"3a"; -- ù when 16#bf9# => romdata <= X"00"; -- ù when 16#cf9# => romdata <= X"00"; -- ù when 16#0fa# => romdata <= X"00"; -- ú when 16#1fa# => romdata <= X"00"; -- ú when 16#2fa# => romdata <= X"08"; -- ú when 16#3fa# => romdata <= X"10"; -- ú when 16#4fa# => romdata <= X"00"; -- ú when 16#5fa# => romdata <= X"44"; -- ú when 16#6fa# => romdata <= X"44"; -- ú when 16#7fa# => romdata <= X"44"; -- ú when 16#8fa# => romdata <= X"44"; -- ú when 16#9fa# => romdata <= X"44"; -- ú when 16#afa# => romdata <= X"3a"; -- ú when 16#bfa# => romdata <= X"00"; -- ú when 16#cfa# => romdata <= X"00"; -- ú when 16#0fb# => romdata <= X"00"; -- û when 16#1fb# => romdata <= X"00"; -- û when 16#2fb# => romdata <= X"18"; -- û when 16#3fb# => romdata <= X"24"; -- û when 16#4fb# => romdata <= X"00"; -- û when 16#5fb# => romdata <= X"44"; -- û when 16#6fb# => romdata <= X"44"; -- û when 16#7fb# => romdata <= X"44"; -- û when 16#8fb# => romdata <= X"44"; -- û when 16#9fb# => romdata <= X"44"; -- û when 16#afb# => romdata <= X"3a"; -- û when 16#bfb# => romdata <= X"00"; -- û when 16#cfb# => romdata <= X"00"; -- û when 16#0fc# => romdata <= X"00"; -- ü when 16#1fc# => romdata <= X"00"; -- ü when 16#2fc# => romdata <= X"28"; -- ü when 16#3fc# => romdata <= X"28"; -- ü when 16#4fc# => romdata <= X"00"; -- ü when 16#5fc# => romdata <= X"44"; -- ü when 16#6fc# => romdata <= X"44"; -- ü when 16#7fc# => romdata <= X"44"; -- ü when 16#8fc# => romdata <= X"44"; -- ü when 16#9fc# => romdata <= X"44"; -- ü when 16#afc# => romdata <= X"3a"; -- ü when 16#bfc# => romdata <= X"00"; -- ü when 16#cfc# => romdata <= X"00"; -- ü when 16#0fd# => romdata <= X"00"; -- ý when 16#1fd# => romdata <= X"00"; -- ý when 16#2fd# => romdata <= X"08"; -- ý when 16#3fd# => romdata <= X"10"; -- ý when 16#4fd# => romdata <= X"00"; -- ý when 16#5fd# => romdata <= X"42"; -- ý when 16#6fd# => romdata <= X"42"; -- ý when 16#7fd# => romdata <= X"42"; -- ý when 16#8fd# => romdata <= X"46"; -- ý when 16#9fd# => romdata <= X"3a"; -- ý when 16#afd# => romdata <= X"02"; -- ý when 16#bfd# => romdata <= X"42"; -- ý when 16#cfd# => romdata <= X"3c"; -- ý when 16#0fe# => romdata <= X"00"; -- þ when 16#1fe# => romdata <= X"00"; -- þ when 16#2fe# => romdata <= X"00"; -- þ when 16#3fe# => romdata <= X"40"; -- þ when 16#4fe# => romdata <= X"40"; -- þ when 16#5fe# => romdata <= X"5c"; -- þ when 16#6fe# => romdata <= X"62"; -- þ when 16#7fe# => romdata <= X"42"; -- þ when 16#8fe# => romdata <= X"42"; -- þ when 16#9fe# => romdata <= X"62"; -- þ when 16#afe# => romdata <= X"5c"; -- þ when 16#bfe# => romdata <= X"40"; -- þ when 16#cfe# => romdata <= X"40"; -- þ when 16#0ff# => romdata <= X"00"; -- ÿ when 16#1ff# => romdata <= X"00"; -- ÿ when 16#2ff# => romdata <= X"24"; -- ÿ when 16#3ff# => romdata <= X"24"; -- ÿ when 16#4ff# => romdata <= X"00"; -- ÿ when 16#5ff# => romdata <= X"42"; -- ÿ when 16#6ff# => romdata <= X"42"; -- ÿ when 16#7ff# => romdata <= X"42"; -- ÿ when 16#8ff# => romdata <= X"46"; -- ÿ when 16#9ff# => romdata <= X"3a"; -- ÿ when 16#aff# => romdata <= X"02"; -- ÿ when 16#bff# => romdata <= X"42"; -- ÿ when 16#cff# => romdata <= X"3c"; -- ÿ when others => romdata <= (others => '0'); end case; end process; end architecture;
gpl-2.0
a3625c9ed54dc9d23057b996bf132a38
0.422083
2.935949
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/image_filter_Block_Mat_exit1222_proc1.vhd
2
17,616
-- ============================================================== -- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- =========================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter_Block_Mat_exit1222_proc1 is port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; p_read : IN STD_LOGIC_VECTOR (11 downto 0); p_read2 : IN STD_LOGIC_VECTOR (11 downto 0); p_read6 : IN STD_LOGIC_VECTOR (11 downto 0); p_read7 : IN STD_LOGIC_VECTOR (11 downto 0); src0_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); src0_data_stream_0_V_empty_n : IN STD_LOGIC; src0_data_stream_0_V_read : OUT STD_LOGIC; src0_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); src0_data_stream_1_V_empty_n : IN STD_LOGIC; src0_data_stream_1_V_read : OUT STD_LOGIC; src0_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); src0_data_stream_2_V_empty_n : IN STD_LOGIC; src0_data_stream_2_V_read : OUT STD_LOGIC; gray_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); gray_data_stream_0_V_full_n : IN STD_LOGIC; gray_data_stream_0_V_write : OUT STD_LOGIC; ap_return_0 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_1 : OUT STD_LOGIC_VECTOR (11 downto 0) ); end; architecture behav of image_filter_Block_Mat_exit1222_proc1 is constant ap_const_logic_1 : STD_LOGIC := '1'; constant ap_const_logic_0 : STD_LOGIC := '0'; constant ap_ST_st1_fsm_0 : STD_LOGIC_VECTOR (1 downto 0) := "01"; constant ap_ST_st2_fsm_1 : STD_LOGIC_VECTOR (1 downto 0) := "10"; constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000"; constant ap_const_lv1_1 : STD_LOGIC_VECTOR (0 downto 0) := "1"; constant ap_const_lv32_1 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000001"; constant ap_const_lv12_0 : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; signal ap_done_reg : STD_LOGIC := '0'; signal ap_CS_fsm : STD_LOGIC_VECTOR (1 downto 0) := "01"; attribute fsm_encoding : string; attribute fsm_encoding of ap_CS_fsm : signal is "none"; signal ap_sig_cseq_ST_st1_fsm_0 : STD_LOGIC; signal ap_sig_bdd_21 : BOOLEAN; signal ap_sig_bdd_56 : BOOLEAN; signal grp_image_filter_CvtColor_fu_67_ap_start : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_ap_done : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_ap_idle : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_ap_ready : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_rows_V_read : STD_LOGIC_VECTOR (11 downto 0); signal grp_image_filter_CvtColor_fu_67_p_src_cols_V_read : STD_LOGIC_VECTOR (11 downto 0); signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_empty_n : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_read : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_empty_n : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_read : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_empty_n : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_read : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_din : STD_LOGIC_VECTOR (7 downto 0); signal grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_full_n : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_write : STD_LOGIC; signal grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg : STD_LOGIC := '0'; signal ap_sig_cseq_ST_st2_fsm_1 : STD_LOGIC; signal ap_sig_bdd_88 : BOOLEAN; signal ap_return_0_preg : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; signal ap_return_1_preg : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; signal ap_NS_fsm : STD_LOGIC_VECTOR (1 downto 0); component image_filter_CvtColor IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; p_src_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); p_src_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); p_src_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); p_src_data_stream_0_V_empty_n : IN STD_LOGIC; p_src_data_stream_0_V_read : OUT STD_LOGIC; p_src_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); p_src_data_stream_1_V_empty_n : IN STD_LOGIC; p_src_data_stream_1_V_read : OUT STD_LOGIC; p_src_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); p_src_data_stream_2_V_empty_n : IN STD_LOGIC; p_src_data_stream_2_V_read : OUT STD_LOGIC; p_dst_data_stream_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); p_dst_data_stream_V_full_n : IN STD_LOGIC; p_dst_data_stream_V_write : OUT STD_LOGIC ); end component; begin grp_image_filter_CvtColor_fu_67 : component image_filter_CvtColor port map ( ap_clk => ap_clk, ap_rst => ap_rst, ap_start => grp_image_filter_CvtColor_fu_67_ap_start, ap_done => grp_image_filter_CvtColor_fu_67_ap_done, ap_idle => grp_image_filter_CvtColor_fu_67_ap_idle, ap_ready => grp_image_filter_CvtColor_fu_67_ap_ready, p_src_rows_V_read => grp_image_filter_CvtColor_fu_67_p_src_rows_V_read, p_src_cols_V_read => grp_image_filter_CvtColor_fu_67_p_src_cols_V_read, p_src_data_stream_0_V_dout => grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_dout, p_src_data_stream_0_V_empty_n => grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_empty_n, p_src_data_stream_0_V_read => grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_read, p_src_data_stream_1_V_dout => grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_dout, p_src_data_stream_1_V_empty_n => grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_empty_n, p_src_data_stream_1_V_read => grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_read, p_src_data_stream_2_V_dout => grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_dout, p_src_data_stream_2_V_empty_n => grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_empty_n, p_src_data_stream_2_V_read => grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_read, p_dst_data_stream_V_din => grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_din, p_dst_data_stream_V_full_n => grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_full_n, p_dst_data_stream_V_write => grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_write); -- the current state (ap_CS_fsm) of the state machine. -- ap_CS_fsm_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_CS_fsm <= ap_ST_st1_fsm_0; else ap_CS_fsm <= ap_NS_fsm; end if; end if; end process; -- ap_done_reg assign process. -- ap_done_reg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_done_reg <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_continue)) then ap_done_reg <= ap_const_logic_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_done_reg <= ap_const_logic_1; end if; end if; end if; end process; -- ap_return_0_preg assign process. -- ap_return_0_preg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_return_0_preg <= ap_const_lv12_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_return_0_preg <= p_read; end if; end if; end if; end process; -- ap_return_1_preg assign process. -- ap_return_1_preg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_return_1_preg <= ap_const_lv12_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_return_1_preg <= p_read2; end if; end if; end if; end process; -- grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg assign process. -- grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg <= ap_const_logic_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) and not(ap_sig_bdd_56))) then grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg <= ap_const_logic_1; elsif ((ap_const_logic_1 = grp_image_filter_CvtColor_fu_67_ap_ready)) then grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg <= ap_const_logic_0; end if; end if; end if; end process; -- the next state (ap_NS_fsm) of the state machine. -- ap_NS_fsm_assign_proc : process (ap_CS_fsm, ap_sig_bdd_56, grp_image_filter_CvtColor_fu_67_ap_done) begin case ap_CS_fsm is when ap_ST_st1_fsm_0 => if (not(ap_sig_bdd_56)) then ap_NS_fsm <= ap_ST_st2_fsm_1; else ap_NS_fsm <= ap_ST_st1_fsm_0; end if; when ap_ST_st2_fsm_1 => if (not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done))) then ap_NS_fsm <= ap_ST_st1_fsm_0; else ap_NS_fsm <= ap_ST_st2_fsm_1; end if; when others => ap_NS_fsm <= "XX"; end case; end process; -- ap_done assign process. -- ap_done_assign_proc : process(ap_done_reg, grp_image_filter_CvtColor_fu_67_ap_done, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_done_reg) or ((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done))))) then ap_done <= ap_const_logic_1; else ap_done <= ap_const_logic_0; end if; end process; -- ap_idle assign process. -- ap_idle_assign_proc : process(ap_start, ap_sig_cseq_ST_st1_fsm_0) begin if ((not((ap_const_logic_1 = ap_start)) and (ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0))) then ap_idle <= ap_const_logic_1; else ap_idle <= ap_const_logic_0; end if; end process; -- ap_ready assign process. -- ap_ready_assign_proc : process(grp_image_filter_CvtColor_fu_67_ap_done, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_ready <= ap_const_logic_1; else ap_ready <= ap_const_logic_0; end if; end process; -- ap_return_0 assign process. -- ap_return_0_assign_proc : process(p_read, grp_image_filter_CvtColor_fu_67_ap_done, ap_sig_cseq_ST_st2_fsm_1, ap_return_0_preg) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_return_0 <= p_read; else ap_return_0 <= ap_return_0_preg; end if; end process; -- ap_return_1 assign process. -- ap_return_1_assign_proc : process(p_read2, grp_image_filter_CvtColor_fu_67_ap_done, ap_sig_cseq_ST_st2_fsm_1, ap_return_1_preg) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((ap_const_logic_0 = grp_image_filter_CvtColor_fu_67_ap_done)))) then ap_return_1 <= p_read2; else ap_return_1 <= ap_return_1_preg; end if; end process; -- ap_sig_bdd_21 assign process. -- ap_sig_bdd_21_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_21 <= (ap_CS_fsm(0 downto 0) = ap_const_lv1_1); end process; -- ap_sig_bdd_56 assign process. -- ap_sig_bdd_56_assign_proc : process(ap_start, ap_done_reg) begin ap_sig_bdd_56 <= ((ap_start = ap_const_logic_0) or (ap_done_reg = ap_const_logic_1)); end process; -- ap_sig_bdd_88 assign process. -- ap_sig_bdd_88_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_88 <= (ap_const_lv1_1 = ap_CS_fsm(1 downto 1)); end process; -- ap_sig_cseq_ST_st1_fsm_0 assign process. -- ap_sig_cseq_ST_st1_fsm_0_assign_proc : process(ap_sig_bdd_21) begin if (ap_sig_bdd_21) then ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_1; else ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st2_fsm_1 assign process. -- ap_sig_cseq_ST_st2_fsm_1_assign_proc : process(ap_sig_bdd_88) begin if (ap_sig_bdd_88) then ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_1; else ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_0; end if; end process; gray_data_stream_0_V_din <= grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_din; -- gray_data_stream_0_V_write assign process. -- gray_data_stream_0_V_write_assign_proc : process(ap_sig_cseq_ST_st1_fsm_0, grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_write, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) or (ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1))) then gray_data_stream_0_V_write <= grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_write; else gray_data_stream_0_V_write <= ap_const_logic_0; end if; end process; grp_image_filter_CvtColor_fu_67_ap_start <= grp_image_filter_CvtColor_fu_67_ap_start_ap_start_reg; grp_image_filter_CvtColor_fu_67_p_dst_data_stream_V_full_n <= gray_data_stream_0_V_full_n; grp_image_filter_CvtColor_fu_67_p_src_cols_V_read <= p_read7; grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_dout <= src0_data_stream_0_V_dout; grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_empty_n <= src0_data_stream_0_V_empty_n; grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_dout <= src0_data_stream_1_V_dout; grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_empty_n <= src0_data_stream_1_V_empty_n; grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_dout <= src0_data_stream_2_V_dout; grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_empty_n <= src0_data_stream_2_V_empty_n; grp_image_filter_CvtColor_fu_67_p_src_rows_V_read <= p_read6; -- src0_data_stream_0_V_read assign process. -- src0_data_stream_0_V_read_assign_proc : process(ap_sig_cseq_ST_st1_fsm_0, grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_read, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) or (ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1))) then src0_data_stream_0_V_read <= grp_image_filter_CvtColor_fu_67_p_src_data_stream_0_V_read; else src0_data_stream_0_V_read <= ap_const_logic_0; end if; end process; -- src0_data_stream_1_V_read assign process. -- src0_data_stream_1_V_read_assign_proc : process(ap_sig_cseq_ST_st1_fsm_0, grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_read, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) or (ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1))) then src0_data_stream_1_V_read <= grp_image_filter_CvtColor_fu_67_p_src_data_stream_1_V_read; else src0_data_stream_1_V_read <= ap_const_logic_0; end if; end process; -- src0_data_stream_2_V_read assign process. -- src0_data_stream_2_V_read_assign_proc : process(ap_sig_cseq_ST_st1_fsm_0, grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_read, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) or (ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1))) then src0_data_stream_2_V_read <= grp_image_filter_CvtColor_fu_67_p_src_data_stream_2_V_read; else src0_data_stream_2_V_read <= ap_const_logic_0; end if; end process; end behav;
gpl-3.0
2c99d4c53022bcd4307eb1113c51448f
0.603202
2.80331
false
false
false
false
borti4938/sd2snes
verilog/sd2snes_sdd1/Serializer.vhd
2
8,192
---------------------------------------------------------------------------------- -- Company: Traducciones Magno -- Engineer: Magno -- -- Create Date: 20.03.2018 18:42:09 -- Design Name: -- Module Name: Golomb_Decoder - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx leaf cells in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Serializer is Port( clk : IN STD_LOGIC; Rst : IN STD_LOGIC; FIFO_tready : OUT STD_LOGIC; FIFO_tvalid : IN STD_LOGIC; FIFO_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0); Shift : IN STD_LOGIC; Shift_cnt : IN STD_LOGIC_VECTOR(2 downto 0); Serial_tvalid : OUT STD_LOGIC; Serial_tdata : OUT STD_LOGIC_VECTOR(7 downto 0) ); end Serializer; architecture Behavioral of Serializer is type TipoEstado is(WAIT_START, FILL_SERIALIZER, FILL_PIPELINE_0, FILL_PIPELINE_1, CHECK_PIPELINE, SHIFT_PIPELINE); signal estado : TipoEstado := WAIT_START; signal FSM_Fill_Serializer : STD_LOGIC := '0'; signal FSM_Fill_Pipeline_0 : STD_LOGIC := '0'; signal FSM_Fill_Pipeline_1 : STD_LOGIC := '0'; signal FSM_Shift_Pipeline : STD_LOGIC := '0'; signal FSM_Shift_Needed : STD_LOGIC := '0'; signal Pipe_Serializer : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal Bit_Serializer : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal Shift_Temp : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal Bit_Ptr : integer range 0 to 15 := 0; signal Bit_Ptr_Temp : integer range 0 to 15 := 0; begin -- barrel shifter with Shift_Cnt select Shift_Temp <= Pipe_Serializer(Bit_Ptr+7 downto Bit_Ptr) when "111", Pipe_Serializer(Bit_Ptr+6 downto Bit_Ptr) & Bit_Serializer(7) when "110", Pipe_Serializer(Bit_Ptr+5 downto Bit_Ptr) & Bit_Serializer(7 downto 6) when "101", Pipe_Serializer(Bit_Ptr+4 downto Bit_Ptr) & Bit_Serializer(7 downto 5) when "100", Pipe_Serializer(Bit_Ptr+3 downto Bit_Ptr) & Bit_Serializer(7 downto 4) when "011", Pipe_Serializer(Bit_Ptr+2 downto Bit_Ptr) & Bit_Serializer(7 downto 3) when "010", Pipe_Serializer(Bit_Ptr+1 downto Bit_Ptr) & Bit_Serializer(7 downto 2) when "001", Pipe_Serializer(Bit_Ptr) & Bit_Serializer(7 downto 1) when others; -- "Bit_Ptr" points to first pipeline bit to shift into output register with Shift_Cnt select Bit_Ptr_Temp <= Bit_Ptr+8 when "111", Bit_Ptr+7 when "110", Bit_Ptr+6 when "101", Bit_Ptr+5 when "100", Bit_Ptr+4 when "011", Bit_Ptr+3 when "010", Bit_Ptr+2 when "001", Bit_Ptr+1 when others; -- process for pipelining data Process( clk ) Begin if rising_edge( clk ) then -- initialize output register data from FIFO if( FSM_Fill_Serializer = '1' ) then Bit_Serializer(0) <= FIFO_tdata(7); Bit_Serializer(1) <= FIFO_tdata(6); Bit_Serializer(2) <= FIFO_tdata(5); Bit_Serializer(3) <= FIFO_tdata(4); Bit_Serializer(4) <= FIFO_tdata(3); Bit_Serializer(5) <= FIFO_tdata(2); Bit_Serializer(6) <= FIFO_tdata(1); Bit_Serializer(7) <= FIFO_tdata(0); -- update output register with shifted data elsif( Shift = '1' ) then Bit_Serializer <= Shift_Temp; end if; -- initialize pipeline register if( FSM_Fill_Pipeline_0 = '1' ) then Pipe_Serializer(0) <= FIFO_tdata(7); Pipe_Serializer(1) <= FIFO_tdata(6); Pipe_Serializer(2) <= FIFO_tdata(5); Pipe_Serializer(3) <= FIFO_tdata(4); Pipe_Serializer(4) <= FIFO_tdata(3); Pipe_Serializer(5) <= FIFO_tdata(2); Pipe_Serializer(6) <= FIFO_tdata(1); Pipe_Serializer(7) <= FIFO_tdata(0); Bit_Ptr <= 0; elsif( FSM_Fill_Pipeline_1 = '1' ) then Pipe_Serializer(8) <= FIFO_tdata(7); Pipe_Serializer(9) <= FIFO_tdata(6); Pipe_Serializer(10) <= FIFO_tdata(5); Pipe_Serializer(11) <= FIFO_tdata(4); Pipe_Serializer(12) <= FIFO_tdata(3); Pipe_Serializer(13) <= FIFO_tdata(2); Pipe_Serializer(14) <= FIFO_tdata(1); Pipe_Serializer(15) <= FIFO_tdata(0); end if; -- update pipeline with shifted data if( Shift = '1' ) then -- if bit pointer falls beyond first byte if( Bit_Ptr_Temp >= 8 ) then Pipe_Serializer(7 downto 0) <= Pipe_Serializer(15 downto 8); Bit_Ptr <= Bit_Ptr_Temp - 8; else Bit_Ptr <= Bit_Ptr_Temp; end if; end if; -- new byte to fill shifted pipeline if( FSM_Shift_Pipeline = '1' ) then Pipe_Serializer(8) <= FIFO_tdata(7); Pipe_Serializer(9) <= FIFO_tdata(6); Pipe_Serializer(10) <= FIFO_tdata(5); Pipe_Serializer(11) <= FIFO_tdata(4); Pipe_Serializer(12) <= FIFO_tdata(3); Pipe_Serializer(13) <= FIFO_tdata(2); Pipe_Serializer(14) <= FIFO_tdata(1); Pipe_Serializer(15) <= FIFO_tdata(0); end if; end if; End Process; -- control FSM Process( clk ) Begin if rising_edge( clk ) then if( Rst = '1' ) then estado <= WAIT_START; else case estado is -- wait for reset to end when WAIT_START => estado <= FILL_SERIALIZER; -- begin read FIFO to fill output register when FILL_SERIALIZER => if( FIFO_tvalid = '1' ) then estado <= FILL_PIPELINE_0; end if; -- read ahead next 2 bytes when FILL_PIPELINE_0 => if( FIFO_tvalid = '1' ) then estado <= FILL_PIPELINE_1; end if; when FILL_PIPELINE_1 => if( FIFO_tvalid = '1' ) then estado <= CHECK_PIPELINE; end if; -- when data must be shited, read byte from FIFO when CHECK_PIPELINE => if( FSM_Shift_Needed = '1' AND FIFO_tvalid = '0' ) then estado <= SHIFT_PIPELINE; end if; -- if FIFO was empty when asked, wait until it has a byte inside when SHIFT_PIPELINE => if( FIFO_tvalid = '1' ) then estado <= CHECK_PIPELINE; end if; end case; end if; end if; End Process; -- when a shift is requested and bit pointer is going to fall beyond output register, pipelined -- must be shifted too FSM_Shift_Needed <= '1' when Shift = '1' AND Bit_Ptr_Temp >= 8 else '0'; -- read FIFO data with estado select FIFO_tready <= '1' when FILL_SERIALIZER, '1' when FILL_PIPELINE_0, '1' when FILL_PIPELINE_1, FSM_Shift_Needed when CHECK_PIPELINE, '1' when SHIFT_PIPELINE, '0' when others; -- initialize output data FSM_Fill_Serializer <= FIFO_tvalid when estado = FILL_SERIALIZER else '0'; -- initialize pipeline data FSM_Fill_Pipeline_0 <= FIFO_tvalid when estado = FILL_PIPELINE_0 else '0'; FSM_Fill_Pipeline_1 <= FIFO_tvalid when estado = FILL_PIPELINE_1 else '0'; -- update pipeline data with estado select FSM_Shift_Pipeline <= FIFO_tvalid AND FSM_Shift_Needed when CHECK_PIPELINE, FIFO_tvalid when SHIFT_PIPELINE, '0' when others; -- output data ready with estado select Serial_tvalid <= '0' when WAIT_START, '0' when FILL_SERIALIZER, '0' when FILL_PIPELINE_0, '0' when FILL_PIPELINE_1, '1' when others; Serial_tdata <= Bit_Serializer; end Behavioral;
gpl-2.0
d9b29d11f3365abe72f80c689c974221
0.574585
3.197502
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_uartlite_0_0/synth/design_1_axi_uartlite_0_0.vhd
1
8,972
-- (c) Copyright 1995-2016 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- DO NOT MODIFY THIS FILE. -- IP VLNV: xilinx.com:ip:axi_uartlite:2.0 -- IP Revision: 7 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_uartlite_v2_0; USE axi_uartlite_v2_0.axi_uartlite; ENTITY design_1_axi_uartlite_0_0 IS PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; interrupt : OUT STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_araddr : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; rx : IN STD_LOGIC; tx : OUT STD_LOGIC ); END design_1_axi_uartlite_0_0; ARCHITECTURE design_1_axi_uartlite_0_0_arch OF design_1_axi_uartlite_0_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_uartlite_0_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_uartlite IS GENERIC ( C_FAMILY : STRING; C_S_AXI_ACLK_FREQ_HZ : INTEGER; C_S_AXI_ADDR_WIDTH : INTEGER; C_S_AXI_DATA_WIDTH : INTEGER; C_BAUDRATE : INTEGER; C_DATA_BITS : INTEGER; C_USE_PARITY : INTEGER; C_ODD_PARITY : INTEGER ); PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; interrupt : OUT STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_araddr : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; rx : IN STD_LOGIC; tx : OUT STD_LOGIC ); END COMPONENT axi_uartlite; ATTRIBUTE X_CORE_INFO : STRING; ATTRIBUTE X_CORE_INFO OF design_1_axi_uartlite_0_0_arch: ARCHITECTURE IS "axi_uartlite,Vivado 2014.4"; ATTRIBUTE CHECK_LICENSE_TYPE : STRING; ATTRIBUTE CHECK_LICENSE_TYPE OF design_1_axi_uartlite_0_0_arch : ARCHITECTURE IS "design_1_axi_uartlite_0_0,axi_uartlite,{}"; ATTRIBUTE CORE_GENERATION_INFO : STRING; ATTRIBUTE CORE_GENERATION_INFO OF design_1_axi_uartlite_0_0_arch: ARCHITECTURE IS "design_1_axi_uartlite_0_0,axi_uartlite,{x_ipProduct=Vivado 2014.4,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=axi_uartlite,x_ipVersion=2.0,x_ipCoreRevision=7,x_ipLanguage=VERILOG,x_ipSimLanguage=MIXED,C_FAMILY=zynq,C_S_AXI_ACLK_FREQ_HZ=100000000,C_S_AXI_ADDR_WIDTH=4,C_S_AXI_DATA_WIDTH=32,C_BAUDRATE=9600,C_DATA_BITS=8,C_USE_PARITY=0,C_ODD_PARITY=0}"; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 ACLK CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 ARESETN RST"; ATTRIBUTE X_INTERFACE_INFO OF interrupt: SIGNAL IS "xilinx.com:signal:interrupt:1.0 INTERRUPT interrupt"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awaddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wstrb: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WSTRB"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_araddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RREADY"; ATTRIBUTE X_INTERFACE_INFO OF rx: SIGNAL IS "xilinx.com:interface:uart:1.0 UART RxD"; ATTRIBUTE X_INTERFACE_INFO OF tx: SIGNAL IS "xilinx.com:interface:uart:1.0 UART TxD"; BEGIN U0 : axi_uartlite GENERIC MAP ( C_FAMILY => "zynq", C_S_AXI_ACLK_FREQ_HZ => 100000000, C_S_AXI_ADDR_WIDTH => 4, C_S_AXI_DATA_WIDTH => 32, C_BAUDRATE => 9600, C_DATA_BITS => 8, C_USE_PARITY => 0, C_ODD_PARITY => 0 ) PORT MAP ( s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, interrupt => interrupt, s_axi_awaddr => s_axi_awaddr, s_axi_awvalid => s_axi_awvalid, s_axi_awready => s_axi_awready, s_axi_wdata => s_axi_wdata, s_axi_wstrb => s_axi_wstrb, s_axi_wvalid => s_axi_wvalid, s_axi_wready => s_axi_wready, s_axi_bresp => s_axi_bresp, s_axi_bvalid => s_axi_bvalid, s_axi_bready => s_axi_bready, s_axi_araddr => s_axi_araddr, s_axi_arvalid => s_axi_arvalid, s_axi_arready => s_axi_arready, s_axi_rdata => s_axi_rdata, s_axi_rresp => s_axi_rresp, s_axi_rvalid => s_axi_rvalid, s_axi_rready => s_axi_rready, rx => rx, tx => tx ); END design_1_axi_uartlite_0_0_arch;
gpl-3.0
3256ce3116c0195bb4b7da338668580b
0.697058
3.293686
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/gr1553b/gr1553b_pads.vhd
1
4,979
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: gr1553b_pads -- File: gr1553b_pads.vhd -- Author: Magnus Hjorth - Aeroflex Gaisler -- Description: Pad instantiations for GR1553B ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.gr1553b_pkg.all; library techmap; use techmap.gencomp.all; entity gr1553b_pads is generic ( padtech: integer; outen_pol: integer range 0 to 1; level: integer := ttl; slew: integer := 0; voltage: integer := x33v; strength: integer := 12; filter: integer := 0 ); port ( txout: in gr1553b_txout_type; rxin: out gr1553b_rxin_type; busainen : out std_logic; busainp : in std_logic; busainn : in std_logic; busaoutenin : out std_logic; busaoutp : out std_logic; busaoutn : out std_logic; busbinen : out std_logic; busbinp : in std_logic; busbinn : in std_logic; busboutenin : out std_logic; busboutp : out std_logic; busboutn : out std_logic ); end; architecture rtl of gr1553b_pads is begin outin_gen: if outen_pol /= 0 generate busa_outin_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busaoutenin, txout.busA_txin); busb_outin_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busboutenin, txout.busB_txin); end generate; outen_gen: if outen_pol = 0 generate busa_outen_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busaoutenin, txout.busA_txen); busb_outen_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busboutenin, txout.busB_txen); end generate; busa_inen_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busainen, txout.busA_rxen); busa_inp_pad : inpad generic map (tech => padtech, level => level, filter => filter, voltage => voltage, strength => strength) port map (busainp, rxin.busA_rxP); busa_inn_pad : inpad generic map (tech => padtech, level => level, filter => filter, voltage => voltage, strength => strength) port map (busainn, rxin.busA_rxN); busa_outp_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busaoutp, txout.busA_txP); busa_outn_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busaoutn, txout.busA_txN); busb_inen_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busbinen, txout.busB_rxen); busb_inp_pad : inpad generic map (tech => padtech, level => level, filter => filter, voltage => voltage, strength => strength) port map (busbinp, rxin.busB_rxP); busb_inn_pad : inpad generic map (tech => padtech, level => level, filter => filter, voltage => voltage, strength => strength) port map (busbinn, rxin.busB_rxN); busb_outp_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busboutp, txout.busB_txP); busb_outn_pad : outpad generic map (tech => padtech, level => level, slew => slew, voltage => voltage, strength => strength) port map (busboutn, txout.busB_txN); end;
gpl-2.0
6f3c964f8fa117517810d0ec1364f3d6
0.600121
3.9832
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-xc3sd-1800/leon3mp.vhd
1
24,900
------------------------------------------------------------------------------ -- LEON3 Demonstration design -- Copyright (C) 2006 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.memctrl.all; use gaisler.ddrpkg.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.spi.all; use gaisler.net.all; use gaisler.jtag.all; library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( reset : in std_ulogic; reset_o1 : out std_ulogic; reset_o2 : out std_ulogic; clk_in : in std_ulogic; clk_vga : in std_ulogic; errorn : out std_ulogic; -- PROM interface address : out std_logic_vector(23 downto 0); data : inout std_logic_vector(7 downto 0); romsn : out std_ulogic; oen : out std_ulogic; writen : out std_ulogic; -- pragma translate_off iosn : out std_ulogic; testdata : inout std_logic_vector(23 downto 0); -- pragma translate_on -- DDR2 memory ddr_clk : out std_logic_vector(1 downto 0); ddr_clkb : out std_logic_vector(1 downto 0); ddr_clk_fb_out : out std_logic; ddr_clk_fb : in std_logic; ddr_cke : out std_logic; ddr_csb : out std_logic; ddr_we : out std_ulogic; -- write enable ddr_ras : out std_ulogic; -- ras ddr_cas : out std_ulogic; -- cas ddr_dm : out std_logic_vector(3 downto 0); -- dm ddr_dqs : inout std_logic_vector(3 downto 0); -- dqs ddr_dqsn : inout std_logic_vector(3 downto 0); -- dqsn ddr_ad : out std_logic_vector(12 downto 0); -- address ddr_ba : out std_logic_vector(1 downto 0); -- bank address ddr_dq : inout std_logic_vector(31 downto 0); -- data ddr_odt : out std_logic; -- Debug support unit dsubre : in std_ulogic; -- Debug Unit break (connect to button) -- AHB Uart dsurx : in std_ulogic; dsutx : out std_ulogic; -- Ethernet signals etx_clk : in std_ulogic; erx_clk : in std_ulogic; erxd : in std_logic_vector(3 downto 0); erx_dv : in std_ulogic; erx_er : in std_ulogic; erx_col : in std_ulogic; erx_crs : in std_ulogic; etxd : out std_logic_vector(3 downto 0); etx_en : out std_ulogic; etx_er : out std_ulogic; emdc : out std_ulogic; emdio : inout std_logic; -- SVGA vid_hsync : out std_logic; vid_vsync : out std_logic; vid_r : out std_logic_vector(3 downto 0); vid_g : out std_logic_vector(3 downto 0); vid_b : out std_logic_vector(3 downto 0); -- SPI flash spi_sel_n : inout std_ulogic; spi_clk : out std_ulogic; spi_mosi : out std_ulogic; -- Output signals to LEDs led : out std_logic_vector(2 downto 0) ); end; architecture rtl of leon3mp is signal vcc : std_logic; signal gnd : std_logic; signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, dui : uart_in_type; signal u1o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ethi : eth_in_type; signal etho : eth_out_type; signal gpti : gptimer_in_type; signal vgao : apbvga_out_type; signal spii : spi_in_type; signal spio : spi_out_type; signal slvsel : std_logic_vector(CFG_SPICTRL_SLVS-1 downto 0); signal spmi : spimctrl_in_type; signal spmo : spimctrl_out_type; signal lclk : std_ulogic; signal lclk_vga : std_ulogic; signal clkm, rstn, clkml : std_ulogic; signal tck, tms, tdi, tdo : std_ulogic; signal rstraw : std_logic; signal lock : std_logic; -- RS232 APB Uart signal rxd1 : std_logic; signal txd1 : std_logic; -- Used for connecting input/output signals to the DDR2 controller signal core_ddr_clk : std_logic_vector(2 downto 0); signal core_ddr_clkb : std_logic_vector(2 downto 0); signal core_ddr_cke : std_logic_vector(1 downto 0); signal core_ddr_csb : std_logic_vector(1 downto 0); signal core_ddr_ad : std_logic_vector(13 downto 0); signal core_ddr_odt : std_logic_vector(1 downto 0); attribute keep : boolean; attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of lock : signal is true; attribute syn_keep of clkml : signal is true; attribute syn_keep of clkm : signal is true; attribute syn_preserve of clkml : signal is true; attribute syn_preserve of clkm : signal is true; attribute syn_keep of lclk_vga : signal is true; attribute syn_preserve of lclk_vga : signal is true; attribute keep of lock : signal is true; attribute keep of clkml : signal is true; attribute keep of clkm : signal is true; constant BOARD_FREQ : integer := 125000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= '1'; gnd <= '0'; cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; -- Glitch free reset that can be used for the Eth Phy and flash memory reset_o1 <= rstn; reset_o2 <= rstn; rst0 : rstgen generic map (acthigh => 1) port map (reset, clkm, lock, rstn, rstraw); clk_pad : clkpad generic map (tech => padtech) port map (clk_in, lclk); -- clock generator clkgen0 : clkgen generic map (fabtech, CFG_CLKMUL, CFG_CLKDIV, 0, 0, 0, 0, 0, BOARD_FREQ, 0) port map (lclk, gnd, clkm, open, open, open, open, cgi, cgo, open, open, open); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => 1, nahbm => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+CFG_SVGA_ENABLE, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- -- LEON3 processor leon3gen : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; error_pad : odpad generic map (tech => padtech) port map (errorn, dbgo(0).error); -- LEON3 Debug Support Unit dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsui.enable <= '1'; led(2) <= dsuo.active; end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; -- Debug UART dcomgen : if CFG_AHB_UART = 1 generate dcom0 : ahbuart generic map (hindex => CFG_NCPU, pindex => 4, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (dsurx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (dsutx, duo.txd); led(0) <= not dui.rxd; led(1) <= not duo.txd; end generate; nouah : if CFG_AHB_UART = 0 generate apbo(4) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 5, pindex => 0, paddr => 0, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, rammask => 0) port map (rstn, clkm, memi, memo, ahbsi, ahbso(5), apbi, apbo(0), wpo, open); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "00"; mg0 : if (CFG_MCTRL_LEON2 = 0) generate apbo(0) <= apb_none; ahbso(5) <= ahbs_none; roms_pad : outpad generic map (tech => padtech) port map (romsn, vcc); memo.bdrive(0) <= '1'; end generate; mgpads : if (CFG_MCTRL_LEON2 /= 0) generate addr_pad : outpadv generic map (tech => padtech, width => 24) port map (address, memo.address(23 downto 0)); roms_pad : outpad generic map (tech => padtech) port map (romsn, memo.romsn(0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.oen); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.writen); -- pragma translate_off iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); tbdr : iopadv generic map (tech => padtech, width => 24) port map (testdata(23 downto 0), memo.data(23 downto 0), memo.bdrive(1), memi.data(23 downto 0)); -- pragma translate_on end generate; bdr : iopadv generic map (tech => padtech, width => 8) port map (data(7 downto 0), memo.data(31 downto 24), memo.bdrive(0), memi.data(31 downto 24)); ---------------------------------------------------------------------- --- DDR2 memory controller ------------------------------------------ ---------------------------------------------------------------------- ddr2sp0 : if (CFG_DDR2SP /= 0) generate ddrc0 : ddr2spa generic map ( fabtech => spartan3, memtech => memtech, hindex => 4, haddr => 16#400#, hmask => 16#F00#, ioaddr => 1, pwron => CFG_DDR2SP_INIT, MHz => BOARD_FREQ/1000, clkmul => 2, clkdiv => 2, TRFC => CFG_DDR2SP_TRFC, -- readdly must be 0 for simulation, but 1 for hardware --pragma translate_off readdly => 0, --pragma translate_on ahbfreq => CPU_FREQ/1000, col => CFG_DDR2SP_COL, Mbyte => CFG_DDR2SP_SIZE, ddrbits => CFG_DDR2SP_DATAWIDTH, odten => 0) port map ( cgo.clklock, rstn, lclk, clkm, vcc, lock, clkml, clkml, ahbsi, ahbso(4), core_ddr_clk, core_ddr_clkb, ddr_clk_fb_out, ddr_clk_fb, core_ddr_cke, core_ddr_csb, ddr_we, ddr_ras, ddr_cas, ddr_dm, ddr_dqs, ddr_dqsn, core_ddr_ad, ddr_ba, ddr_dq, core_ddr_odt); ddr_clk(1 downto 0) <= core_ddr_clk(1 downto 0); ddr_clkb(1 downto 0) <= core_ddr_clkb(1 downto 0); ddr_cke <= core_ddr_cke(0); ddr_csb <= core_ddr_csb(0); ddr_ad <= core_ddr_ad(12 downto 0); ddr_odt <= core_ddr_odt(0); end generate; noddr : if (CFG_DDR2SP = 0) generate lock <= '1'; end generate; ---------------------------------------------------------------------- --- SPI Memory Controller-------------------------------------------- ---------------------------------------------------------------------- spimc: if CFG_SPICTRL_ENABLE = 0 and CFG_SPIMCTRL = 1 generate spimctrl0 : spimctrl -- SPI Memory Controller generic map (hindex => 7, hirq => 11, faddr => 16#e00#, fmask => 16#ff8#, ioaddr => 16#002#, iomask => 16#fff#, spliten => CFG_SPLIT, oepol => 0, sdcard => CFG_SPIMCTRL_SDCARD, readcmd => CFG_SPIMCTRL_READCMD, dummybyte => CFG_SPIMCTRL_DUMMYBYTE, dualoutput => CFG_SPIMCTRL_DUALOUTPUT, scaler => CFG_SPIMCTRL_SCALER, altscaler => CFG_SPIMCTRL_ASCALER, pwrupcnt => CFG_SPIMCTRL_PWRUPCNT) port map (rstn, clkm, ahbsi, ahbso(7), spmi, spmo); -- MISO is shared with Flash data 0 spmi.miso <= memi.data(24); mosi_pad : outpad generic map (tech => padtech) port map (spi_mosi, spmo.mosi); sck_pad : outpad generic map (tech => padtech) port map (spi_clk, spmo.sck); slvsel0_pad : odpad generic map (tech => padtech) port map (spi_sel_n, spmo.csn); end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- -- APB Bridge apb0 : apbctrl generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo); -- Interrupt controller irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; -- Time Unit gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; -- GPIO Unit gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate grgpio0: grgpio generic map(pindex => 11, paddr => 11, imask => CFG_GRGPIO_IMASK, nbits => 12) port map(rstn, clkm, apbi, apbo(11), gpioi, gpioo); end generate; ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; serrx_pad : inpad generic map (tech => padtech) port map (dsurx, rxd1); sertx_pad : outpad generic map (tech => padtech) port map (dsutx, txd1); led(0) <= not rxd1; led(1) <= not txd1; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; -- There is no PS/2 port apbo(5) <= apb_none; spic: if CFG_SPICTRL_ENABLE = 1 generate -- SPI controller spi1 : spictrl generic map (pindex => 7, paddr => 7, pmask => 16#fff#, pirq => 11, fdepth => CFG_SPICTRL_FIFO, slvselen => CFG_SPICTRL_SLVREG, slvselsz => CFG_SPICTRL_SLVS, odmode => 0, netlist => 0, syncram => CFG_SPICTRL_SYNCRAM, ft => CFG_SPICTRL_FT) port map (rstn, clkm, apbi, apbo(7), spii, spio, slvsel); spii.spisel <= '1'; -- Master only -- MISO is shared with Flash data 0 spii.miso <= memi.data(24); mosi_pad : outpad generic map (tech => padtech) port map (spi_mosi, spio.mosi); sck_pad : outpad generic map (tech => padtech) port map (spi_clk, spio.sck); slvsel_pad : odpad generic map (tech => padtech) port map (spi_sel_n, slvsel(0)); end generate spic; nospi: if CFG_SPICTRL_ENABLE = 0 and CFG_SPIMCTRL = 0 generate apbo(7) <= apb_none; mosi_pad : outpad generic map (tech => padtech) port map (spi_mosi, gnd); sck_pad : outpad generic map (tech => padtech) port map (spi_clk, gnd); slvsel_pad : odpad generic map (tech => padtech) port map (spi_sel_n, vcc); end generate; ----------------------------------------------------------------------- --- SVGA ------------------------------------------------------------- ----------------------------------------------------------------------- svga : if CFG_SVGA_ENABLE /= 0 generate clk_vga_pad : clkpad generic map (tech => padtech) port map (clk_vga, lclk_vga); svga0 : svgactrl generic map(memtech => memtech, pindex => 6, paddr => 6, hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, clk0 => 40000,clk1 => 0, clk2 => 0, burstlen => 5) port map(rstn, clkm, lclk_vga, apbi, apbo(6), vgao, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), open); vert_sync_pad : outpad generic map (tech => padtech) port map (vid_vsync, vgao.vsync); horiz_sync_pad : outpad generic map (tech => padtech) port map (vid_hsync, vgao.hsync); video_out_r_pad : outpadv generic map (tech => padtech, width => 4) port map (vid_r, vgao.video_out_r(7 downto 4)); video_out_g_pad : outpadv generic map (tech => padtech, width => 4) port map (vid_g, vgao.video_out_g(7 downto 4)); video_out_b_pad : outpadv generic map (tech => padtech, width => 4) port map (vid_b, vgao.video_out_b(7 downto 4)); end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : grethm generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_SVGA_ENABLE, pindex => 15, paddr => 15, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, phyrstadr => 1, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL, giga => CFG_GRETH1G) port map(rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_SVGA_ENABLE), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); end generate; ethpads : if (CFG_GRETH = 1) generate -- eth pads emdio_pad : iopad generic map (tech => padtech) port map (emdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (etx_clk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (erx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (erxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (erx_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (erx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (erx_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (erx_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (etxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map (etx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (etx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (emdc, etho.mdc); end generate; ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ahbramgen : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 3, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map (rstn, clkm, ahbsi, ahbso(3)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(3) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+CFG_SVGA_ENABLE+1) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Demonstration design for Xilinx Spartan3A DSP 1800A board", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end rtl;
gpl-2.0
829ab41159316c1b4361ea410536dc0e
0.532771
3.819018
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/score/simulation/bmg_stim_gen.vhd
1
12,583
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Stimulus Generator For Single Port ROM -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: bmg_stim_gen.vhd -- -- Description: -- Stimulus Generation For SROM -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY REGISTER_LOGIC_SROM IS PORT( Q : OUT STD_LOGIC; CLK : IN STD_LOGIC; RST : IN STD_LOGIC; D : IN STD_LOGIC ); END REGISTER_LOGIC_SROM; ARCHITECTURE REGISTER_ARCH OF REGISTER_LOGIC_SROM IS SIGNAL Q_O : STD_LOGIC :='0'; BEGIN Q <= Q_O; FF_BEH: PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(RST /= '0' ) THEN Q_O <= '0'; ELSE Q_O <= D; END IF; END IF; END PROCESS; END REGISTER_ARCH; LIBRARY STD; USE STD.TEXTIO.ALL; LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; --USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY BMG_STIM_GEN IS GENERIC ( C_ROM_SYNTH : INTEGER := 0 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; ADDRA: OUT STD_LOGIC_VECTOR(13 DOWNTO 0) := (OTHERS => '0'); DATA_IN : IN STD_LOGIC_VECTOR (11 DOWNTO 0); --OUTPUT VECTOR STATUS : OUT STD_LOGIC:= '0' ); END BMG_STIM_GEN; ARCHITECTURE BEHAVIORAL OF BMG_STIM_GEN IS FUNCTION hex_to_std_logic_vector( hex_str : STRING; return_width : INTEGER) RETURN STD_LOGIC_VECTOR IS VARIABLE tmp : STD_LOGIC_VECTOR((hex_str'LENGTH*4)+return_width-1 DOWNTO 0); BEGIN tmp := (OTHERS => '0'); FOR i IN 1 TO hex_str'LENGTH LOOP CASE hex_str((hex_str'LENGTH+1)-i) IS WHEN '0' => tmp(i*4-1 DOWNTO (i-1)*4) := "0000"; WHEN '1' => tmp(i*4-1 DOWNTO (i-1)*4) := "0001"; WHEN '2' => tmp(i*4-1 DOWNTO (i-1)*4) := "0010"; WHEN '3' => tmp(i*4-1 DOWNTO (i-1)*4) := "0011"; WHEN '4' => tmp(i*4-1 DOWNTO (i-1)*4) := "0100"; WHEN '5' => tmp(i*4-1 DOWNTO (i-1)*4) := "0101"; WHEN '6' => tmp(i*4-1 DOWNTO (i-1)*4) := "0110"; WHEN '7' => tmp(i*4-1 DOWNTO (i-1)*4) := "0111"; WHEN '8' => tmp(i*4-1 DOWNTO (i-1)*4) := "1000"; WHEN '9' => tmp(i*4-1 DOWNTO (i-1)*4) := "1001"; WHEN 'a' | 'A' => tmp(i*4-1 DOWNTO (i-1)*4) := "1010"; WHEN 'b' | 'B' => tmp(i*4-1 DOWNTO (i-1)*4) := "1011"; WHEN 'c' | 'C' => tmp(i*4-1 DOWNTO (i-1)*4) := "1100"; WHEN 'd' | 'D' => tmp(i*4-1 DOWNTO (i-1)*4) := "1101"; WHEN 'e' | 'E' => tmp(i*4-1 DOWNTO (i-1)*4) := "1110"; WHEN 'f' | 'F' => tmp(i*4-1 DOWNTO (i-1)*4) := "1111"; WHEN OTHERS => tmp(i*4-1 DOWNTO (i-1)*4) := "1111"; END CASE; END LOOP; RETURN tmp(return_width-1 DOWNTO 0); END hex_to_std_logic_vector; CONSTANT ZERO : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL READ_ADDR_INT : STD_LOGIC_VECTOR(13 DOWNTO 0) := (OTHERS => '0'); SIGNAL READ_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL CHECK_READ_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL EXPECTED_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0) := (OTHERS => '0'); SIGNAL DO_READ : STD_LOGIC := '0'; SIGNAL CHECK_DATA : STD_LOGIC := '0'; SIGNAL CHECK_DATA_R : STD_LOGIC := '0'; SIGNAL CHECK_DATA_2R : STD_LOGIC := '0'; SIGNAL DO_READ_REG: STD_LOGIC_VECTOR(4 DOWNTO 0) :=(OTHERS => '0'); CONSTANT DEFAULT_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0):= hex_to_std_logic_vector("0",12); BEGIN SYNTH_COE: IF(C_ROM_SYNTH =0 ) GENERATE type mem_type is array (11999 downto 0) of std_logic_vector(11 downto 0); FUNCTION bit_to_sl(input: BIT) RETURN STD_LOGIC IS VARIABLE temp_return : STD_LOGIC; BEGIN IF (input = '0') THEN temp_return := '0'; ELSE temp_return := '1'; END IF; RETURN temp_return; END bit_to_sl; function char_to_std_logic ( char : in character) return std_logic is variable data : std_logic; begin if char = '0' then data := '0'; elsif char = '1' then data := '1'; elsif char = 'X' then data := 'X'; else assert false report "character which is not '0', '1' or 'X'." severity warning; data := 'U'; end if; return data; end char_to_std_logic; impure FUNCTION init_memory( C_USE_DEFAULT_DATA : INTEGER; C_LOAD_INIT_FILE : INTEGER ; C_INIT_FILE_NAME : STRING ; DEFAULT_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0); width : INTEGER; depth : INTEGER) RETURN mem_type IS VARIABLE init_return : mem_type := (OTHERS => (OTHERS => '0')); FILE init_file : TEXT; VARIABLE mem_vector : BIT_VECTOR(width-1 DOWNTO 0); VARIABLE bitline : LINE; variable bitsgood : boolean := true; variable bitchar : character; VARIABLE i : INTEGER; VARIABLE j : INTEGER; BEGIN --Display output message indicating that the behavioral model is being --initialized ASSERT (NOT (C_USE_DEFAULT_DATA=1 OR C_LOAD_INIT_FILE=1)) REPORT " Block Memory Generator CORE Generator module loading initial data..." SEVERITY NOTE; -- Setup the default data -- Default data is with respect to write_port_A and may be wider -- or narrower than init_return width. The following loops map -- default data into the memory IF (C_USE_DEFAULT_DATA=1) THEN FOR i IN 0 TO depth-1 LOOP init_return(i) := DEFAULT_DATA; END LOOP; END IF; -- Read in the .mif file -- The init data is formatted with respect to write port A dimensions. -- The init_return vector is formatted with respect to minimum width and -- maximum depth; the following loops map the .mif file into the memory IF (C_LOAD_INIT_FILE=1) THEN file_open(init_file, C_INIT_FILE_NAME, read_mode); i := 0; WHILE (i < depth AND NOT endfile(init_file)) LOOP mem_vector := (OTHERS => '0'); readline(init_file, bitline); -- read(file_buffer, mem_vector(file_buffer'LENGTH-1 DOWNTO 0)); FOR j IN 0 TO width-1 LOOP read(bitline,bitchar,bitsgood); init_return(i)(width-1-j) := char_to_std_logic(bitchar); END LOOP; i := i + 1; END LOOP; file_close(init_file); END IF; RETURN init_return; END FUNCTION; --*************************************************************** -- convert bit to STD_LOGIC --*************************************************************** constant c_init : mem_type := init_memory(0, 1, "score.mif", DEFAULT_DATA, 12, 12000); constant rom : mem_type := c_init; BEGIN EXPECTED_DATA <= rom(conv_integer(unsigned(check_read_addr))); CHECKER_RD_ADDR_GEN_INST:ENTITY work.ADDR_GEN GENERIC MAP( C_MAX_DEPTH =>12000 ) PORT MAP( CLK => CLK, RST => RST, EN => CHECK_DATA_2R, LOAD => '0', LOAD_VALUE => ZERO, ADDR_OUT => CHECK_READ_ADDR ); PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(CHECK_DATA_2R ='1') THEN IF(EXPECTED_DATA = DATA_IN) THEN STATUS<='0'; ELSE STATUS <= '1'; END IF; END IF; END IF; END PROCESS; END GENERATE; -- Simulatable ROM --Synthesizable ROM SYNTH_CHECKER: IF(C_ROM_SYNTH = 1) GENERATE PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(CHECK_DATA_2R='1') THEN IF(DATA_IN=DEFAULT_DATA) THEN STATUS <= '0'; ELSE STATUS <= '1'; END IF; END IF; END IF; END PROCESS; END GENERATE; READ_ADDR_INT(13 DOWNTO 0) <= READ_ADDR(13 DOWNTO 0); ADDRA <= READ_ADDR_INT ; CHECK_DATA <= DO_READ; RD_ADDR_GEN_INST:ENTITY work.ADDR_GEN GENERIC MAP( C_MAX_DEPTH => 12000 ) PORT MAP( CLK => CLK, RST => RST, EN => DO_READ, LOAD => '0', LOAD_VALUE => ZERO, ADDR_OUT => READ_ADDR ); RD_PROCESS: PROCESS (CLK) BEGIN IF (RISING_EDGE(CLK)) THEN IF(RST='1') THEN DO_READ <= '0'; ELSE DO_READ <= '1'; END IF; END IF; END PROCESS; BEGIN_SHIFT_REG: FOR I IN 0 TO 4 GENERATE BEGIN DFF_RIGHT: IF I=0 GENERATE BEGIN SHIFT_INST_0: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => DO_READ_REG(0), CLK =>CLK, RST=>RST, D =>DO_READ ); END GENERATE DFF_RIGHT; DFF_OTHERS: IF ((I>0) AND (I<=4)) GENERATE BEGIN SHIFT_INST: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => DO_READ_REG(I), CLK =>CLK, RST=>RST, D =>DO_READ_REG(I-1) ); END GENERATE DFF_OTHERS; END GENERATE BEGIN_SHIFT_REG; CHECK_DATA_REG_1: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => CHECK_DATA_2R, CLK =>CLK, RST=>RST, D =>CHECK_DATA_R ); CHECK_DATA_REG: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => CHECK_DATA_R, CLK =>CLK, RST=>RST, D =>CHECK_DATA ); END ARCHITECTURE;
mit
fbd9eacac48390dc75d3ee37e448e320
0.547882
3.687866
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_src1_rows_V.vhd
2
4,556
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_src1_rows_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_src1_rows_V_shiftReg; architecture rtl of FIFO_image_filter_src1_rows_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_src1_rows_V is generic ( MEM_STYLE : string := "shiftreg"; DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_src1_rows_V is component FIFO_image_filter_src1_rows_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_src1_rows_V_shiftReg : FIFO_image_filter_src1_rows_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
e388c822290f7531f3072bbbe13df235
0.535558
3.499232
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_cdma_v4_1/25515467/hdl/src/vhdl/axi_cdma_simple_wrap.vhd
1
63,746
------------------------------------------------------------------------------- -- axi_cdma_simple_wrap ------------------------------------------------------------------------------- -- -- ************************************************************************* -- -- (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- ************************************************************************* -- ------------------------------------------------------------------------------- -- Filename: axi_cdma_simple_wrap.vhd -- -- Description: -- -- This file is the module wrapper for the AXI CDMA core when parameterized -- for only Simple Mode DMA operations. -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- -- VHDL Libraries -- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library lib_pkg_v1_0; use lib_pkg_v1_0.lib_pkg.max2; library axi_datamover_v5_1; use axi_datamover_v5_1.axi_datamover; library axi_cdma_v4_1; use axi_cdma_v4_1.axi_cdma_pkg.all; use axi_cdma_v4_1.axi_cdma_reset; use axi_cdma_v4_1.axi_cdma_reg_module; use axi_cdma_v4_1.axi_cdma_simple_cntlr; use axi_cdma_v4_1.axi_cdma_sf; ------------------------------------------------------------------------------- entity axi_cdma_simple_wrap is generic( ----------------------------------------------------------------------- -- AXI Lite Register Interface Parameters ----------------------------------------------------------------------- C_S_AXI_LITE_ADDR_WIDTH : integer range 2 to 32 := 6; -- Address width of the AXI Lite Interface (bits) C_S_AXI_LITE_DATA_WIDTH : integer range 32 to 32 := 32; -- Data width of the AXI Lite Interface (bits) C_AXI_LITE_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the AXI Lite Register interface needs to -- be asynchronous to the CDMA data transport path clocking -- 0 = Use same clocking as data path -- 1 = Use special AXI Lite clock for the axi lite interface ----------------------------------------------------------------------- -- DataMover Memory Map Master Interface Parameters ----------------------------------------------------------------------- C_M_AXI_ADDR_WIDTH : integer range 32 to 32 := 32; -- DataMover Master AXI Memory Map Address Width (bits) C_M_AXI_DATA_WIDTH : integer range 32 to 1024 := 32; -- DataMover Master AXI Memory Map Data Width (bits) C_M_AXI_MAX_BURST_LEN : integer range 2 to 256 := 16; -- DataMover Maximum burst length to use for AXI MMAP requests -- Allowed values are 16, 32, 64, 128, and 256 (data beats) C_INCLUDE_DRE : integer range 0 to 1 := 0; -- Include or exclude DataMover Data Realignment (DRE) -- NOTE: DRE is only available for 32 and 64 bit data widths -- 0 = Exclude DRE -- 1 = Include DRE C_USE_DATAMOVER_LITE : integer range 0 to 1 := 0; -- Enable DataMover Lite mode -- NOTE: Data widths limited to 32 and 64 bits, max burst -- limited to 16, 32, and 64 data beats, no DRE, 4K address -- guarding must be done by SW programmer. -- 0 = Normal DataMover mode -- 1 = Lite dataMover mode C_READ_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 4; -- This parameter specifies the depth of the DataMover -- read address pipelining queues for the Main data transport -- channels. The effective address pipelining on the AXI4 Read -- Address Channel will be the value assigned plus 2. C_WRITE_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 4; -- This parameter specifies the depth of the DataMover -- write address pipelining queues for the Main data transport -- channel. The effective address pipelining on the AXI4 Write -- Address Channel will be the value assigned plus 2. ----------------------------------------------------------------------- -- Store and Forward Parameters ----------------------------------------------------------------------- C_INCLUDE_SF : integer range 0 to 1 := 1; -- This parameter includes includes/omits Store and Forward. C_SF_FIFO_DEPTH : Integer range 128 to 8192 := 128 ; -- This parameter sets the depth of the Store and Forward FIFO. ----------------------------------------------------------------------- -- Soft Reset Assertion Time ----------------------------------------------------------------------- C_SOFT_RST_TIME_CLKS : integer range 1 to 64 := 8; -- Specifies the time of the soft reset assertion in -- axi_aclk clock periods. ----------------------------------------------------------------------- -- Target FPGA Family Parameter ----------------------------------------------------------------------- C_FAMILY : string := "virtex7" -- Target FPGA Device Family ); port ( ----------------------------------------------------------------------- -- Primary Clock ----------------------------------------------------------------------- axi_aclk : in std_logic ; ----------------------------------------------------------------------- -- Primary Reset Input (active low) ----------------------------------------------------------------------- axi_resetn : in std_logic ; ----------------------------------------------------------------------- -- AXI Lite clock ----------------------------------------------------------------------- axi_lite_aclk : in std_logic ; ----------------------------------------------------------------------- -- AXI Lite reset ----------------------------------------------------------------------- axi_lite_resetn : in std_logic ; ----------------------------------------------------------------------- -- Interrupt output ----------------------------------------------------------------------- cdma_introut : out std_logic ; ----------------------------------------------------------------------- -- Error Discrete output ----------------------------------------------------------------------- cdma_error_out : out std_logic ; --------------------------------------------------------------------------------- -- AXI Lite Register Access Interface --------------------------------------------------------------------------------- -- AXI Lite Write Address Channel -- AXI4-Lite s_axi_lite_awready : out std_logic ;-- AXI4-Lite s_axi_lite_awvalid : in std_logic ;-- AXI4-Lite s_axi_lite_awaddr : in std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Write Data Channel -- AXI4-Lite s_axi_lite_wready : out std_logic ;-- AXI4-Lite s_axi_lite_wvalid : in std_logic ;-- AXI4-Lite s_axi_lite_wdata : in std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_DATA_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Write Response Channel -- AXI4-Lite s_axi_lite_bready : in std_logic ;-- AXI4-Lite s_axi_lite_bvalid : out std_logic ;-- AXI4-Lite s_axi_lite_bresp : out std_logic_vector(1 downto 0) ;-- AXI4-Lite -- AXI4-Lite -- AXI Lite Read Address Channel -- AXI4-Lite s_axi_lite_arready : out std_logic ;-- AXI4-Lite s_axi_lite_arvalid : in std_logic ;-- AXI4-Lite s_axi_lite_araddr : in std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Read Data Channel -- AXI4-Lite s_axi_lite_rready : in std_logic ;-- AXI4-Lite s_axi_lite_rvalid : out std_logic ;-- AXI4-Lite s_axi_lite_rdata : out std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_DATA_WIDTH-1 downto 0);-- AXI4-Lite s_axi_lite_rresp : out std_logic_vector(1 downto 0) ;-- AXI4-Lite ---------------------------------------------------------------------------- -- AXI DataMover Read Channel ---------------------------------------------------------------------------- -- DataMover MMap Read Address Channel -- AXI4 m_axi_arready : in std_logic ;-- AXI4 m_axi_arvalid : out std_logic ;-- AXI4 m_axi_araddr : out std_logic_vector -- AXI4 (C_M_AXI_ADDR_WIDTH-1 downto 0) ;-- AXI4 m_axi_arlen : out std_logic_vector(7 downto 0) ;-- AXI4 m_axi_arsize : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_arburst : out std_logic_vector(1 downto 0) ;-- AXI4 m_axi_arprot : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_arcache : out std_logic_vector(3 downto 0) ;-- AXI4 -- AXI4 -- DataMover MMap Read Data Channel -- AXI4 m_axi_rready : out std_logic ;-- AXI4 m_axi_rvalid : in std_logic ;-- AXI4 m_axi_rdata : in std_logic_vector -- AXI4 (C_M_AXI_DATA_WIDTH-1 downto 0) ;-- AXI4 m_axi_rresp : in std_logic_vector(1 downto 0) ;-- AXI4 m_axi_rlast : in std_logic ;-- AXI4 ----------------------------------------------------------------------------- -- AXI DataMover Write Channel ----------------------------------------------------------------------------- -- DataMover Write Address Channel -- AXI4 m_axi_awready : in std_logic ;-- AXI4 m_axi_awvalid : out std_logic ;-- AXI4 m_axi_awaddr : out std_logic_vector -- AXI4 (C_M_AXI_ADDR_WIDTH-1 downto 0) ;-- AXI4 m_axi_awlen : out std_logic_vector(7 downto 0) ;-- AXI4 m_axi_awsize : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_awburst : out std_logic_vector(1 downto 0) ;-- AXI4 m_axi_awprot : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_awcache : out std_logic_vector(3 downto 0) ;-- AXI4 -- AXI4 -- DataMover Write Data Channel -- AXI4 m_axi_wready : in std_logic ;-- AXI4 m_axi_wvalid : out std_logic ;-- AXI4 m_axi_wdata : out std_logic_vector -- AXI4 (C_M_AXI_DATA_WIDTH-1 downto 0) ;-- AXI4 m_axi_wstrb : out std_logic_vector -- AXI4 ((C_M_AXI_DATA_WIDTH/8)-1 downto 0);-- AXI4 m_axi_wlast : out std_logic ;-- AXI4 -- AXI4 -- DataMover Write Response Channel -- AXI4 m_axi_bready : out std_logic ;-- AXI4 m_axi_bvalid : in std_logic ;-- AXI4 m_axi_bresp : in std_logic_vector(1 downto 0) ;-- AXI4 -- Debug test vector (Xilinx use only) axi_cdma_tstvec : out std_logic_vector(31 downto 0) ); ----------------------------------------------------------------- -- End of PSFUtil MPD attributes ----------------------------------------------------------------- end axi_cdma_simple_wrap; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_cdma_simple_wrap is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- General Use Constant LOGIC_LOW : std_logic := '0'; Constant LOGIC_HIGH : std_logic := '1'; Constant ADDR_ZEROS : std_logic_vector(C_M_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); -- AXI CDMA Build Mode (Simple Only or with SG); 0 = Simple only constant CDMA_BUILD_MODE : integer := 0; -- AXI DataMover Include Status FIFO constant DM_INCLUDE_STS_FIFO : integer := 1; -- AXI DataMover Command / Status FIFO Depth constant DM_CMDSTS_FIFO_DEPTH : integer := 1; -- AXI MM2S DataMover Full mode value constant MM2S_FULL_MODE : integer := 1; -- AXI MM2S DataMover Lite mode value constant MM2S_LITE_MODE : integer := 2; -- AXI S2MM DataMover Full mode value constant S2MM_FULL_MODE : integer := 1; -- AXI S2MM DataMover Lite mode value constant S2MM_LITE_MODE : integer := 2; -- AXI DataMover clocking mode constant DM_USE_SYNC_CLOCKS : integer := 0; -- AXI DataMover BTT Used width (Set the to the max allowed) constant DM_BTT_WIDTH : integer := 23; -- AXI DataMover S2MM DRE Enable (set to disabled) constant DM_S2MM_DRE_DISABLED : integer := 0; -- AXI DataMover Include Store and Forward constant DM_OMIT_S2MM_STORE_FORWARD : integer := 0; constant DM_ENABLE_S2MM_STORE_FORWARD : integer := 1; Constant STORE_FORWARD_CNTL : integer := DM_OMIT_S2MM_STORE_FORWARD; -- AXI DataMover Stream Backend width constant DM_STREAM_DWIDTH : integer := C_M_AXI_DATA_WIDTH; -- AXI DataMover Base status vector width constant BASE_STATUS_WIDTH : integer := 8; -- AXI DataMover S2MM status stream data width delta -- if Store and Forward enabled Constant SF_ADDED_STS_WIDTH : integer := 24; -- AXI DataMover status stream data width (S2MM is based on mode of operation) constant DM_MM2S_STATUS_WIDTH : integer := BASE_STATUS_WIDTH; constant DM_S2MM_STATUS_WIDTH : integer := BASE_STATUS_WIDTH + (STORE_FORWARD_CNTL * SF_ADDED_STS_WIDTH); -- DataMover Command Stream data Width in bits constant DM_CMD_WIDTH : integer := 72; -- constant DM_CMD_WIDTH : integer := 104; -- CDMA Interupt Delay value zeroed Constant IRQ_DLY_THRESH_ZEROS : std_logic_vector(7 downto 0) := (others => '0'); -- AXI DataMover pipeline depth constants Constant DM_READ_ADDR_PIPE_DEPTH : integer := C_READ_ADDR_PIPE_DEPTH; Constant DM_WRITE_ADDR_PIPE_DEPTH : integer := C_WRITE_ADDR_PIPE_DEPTH; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_max -- -- Function Description: -- Returns the greater of two integers. -- ------------------------------------------------------------------- function funct_get_max (value_in_1 : integer; value_in_2 : integer) return integer is Variable max_value : Integer := 0; begin If (value_in_1 > value_in_2) Then max_value := value_in_1; else max_value := value_in_2; End if; Return (max_value); end function funct_get_max; -------------------------------------- ------------------------------------------------------------------- function funct_rnd2pwr_of_2 (input_value : integer) return integer is Variable temp_pwr2 : Integer := 128; begin if (input_value <= 128) then temp_pwr2 := 128; elsif (input_value <= 256) then temp_pwr2 := 256; elsif (input_value <= 512) then temp_pwr2 := 512; elsif (input_value <= 1024) then temp_pwr2 := 1024; elsif (input_value <= 2048) then temp_pwr2 := 2048; elsif (input_value <= 4096) then temp_pwr2 := 4096; else temp_pwr2 := 8192; end if; Return (temp_pwr2); end function funct_rnd2pwr_of_2; -- Calculates the minimum needed depth of the CDMA Store and Forward FIFO Constant PIPEDEPTH_BURST_LEN_PROD : integer := (funct_get_max(4, 4)+2) * C_M_AXI_MAX_BURST_LEN; -- Assigns the depth of the CDMA Store and Forward FIFO to the nearest -- power of 2 Constant SF_FIFO_DEPTH : integer range 128 to 8192 := funct_rnd2pwr_of_2(PIPEDEPTH_BURST_LEN_PROD); ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- -- Reset Module signals signal sig_rst2lite_bside_reset : std_logic := '0'; signal sig_rst2lite_cside_reset : std_logic := '0'; signal sig_rst2reg_reset : std_logic := '0'; signal sig_rst2cntlr_reset : std_logic := '0'; signal sig_rst2dm_resetn : std_logic := '0'; signal sig_rst2cntlr_halt : std_logic := '0'; signal sig_cntlr2rst_halt_cmplt : std_logic := '0'; signal sig_dm_mm2s_halt : std_logic := '0'; signal sig_dm_mm2s_halt_cmplt : std_logic := '0'; signal sig_dm_s2mm_halt : std_logic := '0'; signal sig_dm_s2mm_halt_cmplt : std_logic := '0'; -- Register Module Signals signal sig_reg2cntlr_src_addr : std_logic_vector(C_M_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_reg2cntlr_dest_addr : std_logic_vector(C_M_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_reg2cntlr_btt : std_logic_vector(C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal sig_reg2cntlr_go : std_logic := '0'; signal sig_cntlr2reg_idle_set : std_logic := '0'; signal sig_cntlr2reg_idle_clr : std_logic := '0'; signal sig_cntlr2reg_decerr_set : std_logic := '0'; signal sig_cntlr2reg_slverr_set : std_logic := '0'; signal sig_cntlr2reg_interr_set : std_logic := '0'; signal sig_cntlr2reg_ioc_set : std_logic := '0'; signal sig_cntlr2reg_iocirpt_set : std_logic := '0'; signal sig_reg2rst_soft_reset : std_logic := '0'; signal sig_rst2reg_soft_reset_clr : std_logic := '0'; signal sig_reg2cntlr_sg_mode : std_logic := '0'; -- DataMover MM2S error discrete signal sig_dm_mm2s_err : std_logic := '0'; -- DataMover MM2S command Stream signal sig_cntl2mm2s_cmd_tdata : std_logic_vector(DM_CMD_WIDTH-1 downto 0) := (others => '0'); signal sig_mm2s2cntl_cmd_tready : std_logic := '0'; signal sig_cntl2mm2s_cmd_tvalid : std_logic := '0'; -- DataMover MM2S status Stream signal sig_mm2s2cntl_sts_tdata : std_logic_vector(DM_MM2S_STATUS_WIDTH-1 downto 0) := (others => '0'); signal sig_mm2s2cntl_sts_tkeep : std_logic_vector((DM_MM2S_STATUS_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_mm2s2cntl_sts_tvalid : std_logic := '0'; signal sig_cntl2mm2s_sts_tready : std_logic := '0'; -- DataMover S2MM error discrete signal sig_dm_s2mm_err : std_logic := '0'; -- DataMover S2MM command Stream signal sig_cntl2s2mm_cmd_tdata : std_logic_vector(DM_CMD_WIDTH-1 downto 0) := (others => '0'); signal sig_cntl2s2mm_cmd_tvalid : std_logic := '0'; signal sig_s2mm2cntl_cmd_tready : std_logic := '0'; -- DataMover S2MM status Stream signal sig_s2mm2cntl_sts_tdata : std_logic_vector(BASE_STATUS_WIDTH-1 downto 0) := (others => '0'); signal sig_s2mm2cntl_sts_tkeep : std_logic_vector((BASE_STATUS_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_s2mm2cntl_sts_tvalid : std_logic := '0'; signal sig_cntl2s2mm_sts_tready : std_logic := '0'; -- DataMover stream loopback hookup signal sig_mm2s_axis_tready : std_logic := '0'; signal sig_mm2s_axis_tvalid : std_logic := '0'; signal sig_mm2s_axis_tdata : std_logic_vector(DM_STREAM_DWIDTH-1 downto 0) := (others => '0'); signal sig_mm2s_axis_tkeep : std_logic_vector((DM_STREAM_DWIDTH/8)-1 downto 0) := (others => '0'); signal sig_mm2s_axis_tlast : std_logic := '0'; signal sig_s2mm_axis_tready : std_logic := '0'; signal sig_s2mm_axis_tvalid : std_logic := '0'; signal sig_s2mm_axis_tdata : std_logic_vector(DM_STREAM_DWIDTH-1 downto 0) := (others => '0'); signal sig_s2mm_axis_tkeep : std_logic_vector((DM_STREAM_DWIDTH/8)-1 downto 0) := (others => '0'); signal sig_s2mm_axis_tlast : std_logic := '0'; signal sig_dm_s2mm_sts_tdata : std_logic_vector(DM_S2MM_STATUS_WIDTH-1 downto 0) := (others => '0'); -- fullfull Store and forward status data width signal sig_dm_s2mm_sts_tkeep : std_logic_vector((DM_S2MM_STATUS_WIDTH/8)-1 downto 0) := (others => '0'); -- Store and forward status strobe width -- DataMover Address Pipe Controls signal sig_mm2s_allow_addr_req : std_logic := '0'; signal sig_mm2s_addr_req_posted : std_logic := '0'; signal sig_mm2s_rd_xfer_cmplt : std_logic := '0'; signal sig_s2mm_allow_addr_req : std_logic := '0'; signal sig_s2mm_addr_req_posted : std_logic := '0'; signal sig_s2mm_wr_xfer_cmplt : std_logic := '0'; signal sig_s2mm_ld_nxt_len : std_logic := '0'; signal sig_s2mm_wr_len : std_logic_vector(7 downto 0) := (others => '0'); -- store and Forward module Reset signal sig_sf_reset : std_logic := '0'; signal burst_type : std_logic; signal dma_keyhole_write : std_logic; signal dma_keyhole_read : std_logic; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- AXI CDMA Test Vector (For Xilinx Internal Use Only) ------------------------------------------------------------------------------- -- Simple Mode axi_cdma_tstvec(0) <= sig_reg2cntlr_go ; axi_cdma_tstvec(1) <= sig_cntlr2reg_idle_set ; axi_cdma_tstvec(2) <= sig_cntlr2reg_idle_clr ; axi_cdma_tstvec(3) <= sig_cntlr2reg_iocirpt_set ; axi_cdma_tstvec(4) <= sig_cntlr2reg_decerr_set ; axi_cdma_tstvec(5) <= sig_cntlr2reg_slverr_set ; axi_cdma_tstvec(6) <= sig_cntlr2reg_interr_set ; axi_cdma_tstvec(31 downto 7) <= (others => '0') ; -- Create a postive reset for the Store and Forward module -- from the inverted DataMover active low reset. -- CR591254 change -- sig_sf_reset <= not(sig_rst2dm_resetn) ; sig_sf_reset <= sig_rst2cntlr_reset ; ------------------------------------------------------------------------------- -- Module Instances ------------------------------------------------------------------------------- ------------------------------------------------------------ -- Instance: I_SIMPLE_RST_MODULE -- -- Description: -- Instance for the Reset Module used with Simple Mode -- operation. It manages both hard and soft reset generation -- and synchronization when the AXI Lite clock and reset are -- asynchronous to the Primary clock and reset. -- ------------------------------------------------------------ I_SIMPLE_RST_MODULE : entity axi_cdma_v4_1.axi_cdma_reset generic map( C_AXI_LITE_IS_ASYNC => C_AXI_LITE_IS_ASYNC , C_SOFT_RST_TIME_CLKS => C_SOFT_RST_TIME_CLKS ) port map( -- Primary Clock and Reset Sources axi_aclk => axi_aclk , axi_resetn => axi_resetn , -- AXI Lite Clock and Reset Sources axi_lite_aclk => axi_lite_aclk , axi_lite_resetn => axi_lite_resetn , -- CDMA Module hard reset outputs rst2lite_bside_reset => sig_rst2lite_bside_reset , rst2lite_cside_reset => sig_rst2lite_cside_reset , rst2reg_reset => sig_rst2reg_reset , rst2cntlr_reset => sig_rst2cntlr_reset , rst2dm_resetn => sig_rst2dm_resetn , -- Soft Reset Request from Register module reg2rst_soft_reset_in => sig_reg2rst_soft_reset , rst2reg_soft_reset_clr => sig_rst2reg_soft_reset_clr , -- CDMA Controller halt rst2cntlr_halt => sig_rst2cntlr_halt , cntlr2rst_halt_cmplt => sig_cntlr2rst_halt_cmplt , -- CDMA SG halt rst2sg_halt => open , sg2rst_halt_cmplt => LOGIC_HIGH , -- CDMA DatMover MM2S Halt rst2dm_mm2s_halt => sig_dm_mm2s_halt , dm2rst_mm2s_halt_cmplt => sig_dm_mm2s_halt_cmplt , -- CDMA DatMover S2MM Halt rst2dm_s2mm_halt => sig_dm_s2mm_halt , dm2rst_s2mm_halt_cmplt => sig_dm_s2mm_halt_cmplt ); ------------------------------------------------------------ -- Instance: I_SIMPLE_REG_MODULE -- -- Description: -- Instance for the Register Module used with Simple Mode -- operation. -- ------------------------------------------------------------ I_SIMPLE_REG_MODULE : entity axi_cdma_v4_1.axi_cdma_reg_module generic map( C_CDMA_BUILD_MODE => CDMA_BUILD_MODE , C_S_AXI_LITE_ADDR_WIDTH => C_S_AXI_LITE_ADDR_WIDTH , C_S_AXI_LITE_DATA_WIDTH => C_S_AXI_LITE_DATA_WIDTH , C_AXI_LITE_IS_ASYNC => C_AXI_LITE_IS_ASYNC , C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH ) port map( -- AXI Lite Bus Side Clock and Reset axi_lite_aclk => axi_lite_aclk , axi_lite_reset => sig_rst2lite_bside_reset , -- AXI Lite Core side Reset axi_lite_cside_reset => sig_rst2lite_cside_reset , -- AXI Lite Write Address Channel s_axi_lite_awvalid => s_axi_lite_awvalid , s_axi_lite_awready => s_axi_lite_awready , s_axi_lite_awaddr => s_axi_lite_awaddr , -- AXI Lite Write Data Channel s_axi_lite_wvalid => s_axi_lite_wvalid , s_axi_lite_wready => s_axi_lite_wready , s_axi_lite_wdata => s_axi_lite_wdata , -- AXI Lite Write Response Channel s_axi_lite_bresp => s_axi_lite_bresp , s_axi_lite_bvalid => s_axi_lite_bvalid , s_axi_lite_bready => s_axi_lite_bready , -- AXI Lite Read Address Channel s_axi_lite_arvalid => s_axi_lite_arvalid , s_axi_lite_arready => s_axi_lite_arready , s_axi_lite_araddr => s_axi_lite_araddr , -- AXI Lite Read Data Channel s_axi_lite_rvalid => s_axi_lite_rvalid , s_axi_lite_rready => s_axi_lite_rready , s_axi_lite_rdata => s_axi_lite_rdata , s_axi_lite_rresp => s_axi_lite_rresp , -- Register Clock and Reset axi_aclk => axi_aclk , axi_reg_reset => sig_rst2reg_reset , -- Composite Interrupt Output reg_introut => cdma_introut , -- Composite error Output reg_error_out => cdma_error_out , -- Soft Reset Control reg_soft_reset_request => sig_reg2rst_soft_reset , reg_soft_reset_clr => sig_rst2reg_soft_reset_clr , -- DMA Go Control reg_dma_go => sig_reg2cntlr_go , -- SG Mode control reg_dma_sg_mode => sig_reg2cntlr_sg_mode , -- Key Hole write dma_keyhole_write => dma_keyhole_write , -- Key Hole read dma_keyhole_read => dma_keyhole_read , -- CDMASR Control reg_idle_set => sig_cntlr2reg_idle_set , reg_idle_clr => sig_cntlr2reg_idle_clr , reg_ioc_irq_set => sig_cntlr2reg_iocirpt_set , reg_dly_irq_set => LOGIC_LOW , reg_irqdelay_status => IRQ_DLY_THRESH_ZEROS , reg_irqthresh_status => IRQ_DLY_THRESH_ZEROS , reg_irqthresh_wren => open , reg_irqdelay_wren => open , -- DataMover Errors reg_dma_decerr_set => sig_cntlr2reg_decerr_set , reg_dma_slverr_set => sig_cntlr2reg_slverr_set , reg_dma_interr_set => sig_cntlr2reg_interr_set , -- SG Descriptor Fetch errors reg_ftch_interr_set => LOGIC_LOW , reg_ftch_slverr_set => LOGIC_LOW , reg_ftch_decerr_set => LOGIC_LOW , reg_ftch_error_addr => ADDR_ZEROS , -- SG Descriptor Update errors reg_updt_interr_set => LOGIC_LOW , reg_updt_slverr_set => LOGIC_LOW , reg_updt_decerr_set => LOGIC_LOW , reg_updt_error_addr => ADDR_ZEROS , -- SG CURDESC Update reg_new_curdesc_wren => LOGIC_LOW , reg_new_curdesc => ADDR_ZEROS , -- SG Detected SW Register Update reg_tailpntr_updated => open , reg_currdesc_updated => open , -- Register State Out reg_dmacr => open , reg_dmasr => open , reg_curdesc => open , reg_taildesc => open , reg_src_addr => sig_reg2cntlr_src_addr , reg_dest_addr => sig_reg2cntlr_dest_addr , reg_btt => sig_reg2cntlr_btt ); ------------------------------------------------------------ -- Instance: I_SIMPLE_DMA_CNTLR -- -- Description: -- -- Control Logic module for the Simple Mode CDMA operation. -- ------------------------------------------------------------ I_SIMPLE_DMA_CNTLR : entity axi_cdma_v4_1.axi_cdma_simple_cntlr generic map( C_DM_CMD_WIDTH => DM_CMD_WIDTH , C_DM_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_DM_MM2S_STATUS_WIDTH => DM_MM2S_STATUS_WIDTH , C_DM_S2MM_STATUS_WIDTH => BASE_STATUS_WIDTH , C_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_BTT_WIDTH => DM_BTT_WIDTH , C_FAMILY => C_FAMILY ) port map( -- Clock and reset axi_aclk => axi_aclk , axi_reset => sig_rst2cntlr_reset , -- Halt request rst2cntlr_halt => sig_rst2cntlr_halt , cntlr2rst_halt_cmplt => sig_cntlr2rst_halt_cmplt , -- Register Module Start and Mode Controls reg2cntlr_go => sig_reg2cntlr_go , reg2cntlr_sg_mode => sig_reg2cntlr_sg_mode , burst_type_write => dma_keyhole_write , burst_type_read => dma_keyhole_read , -- Register Module command qualifiers reg2cntlr_src_addr => sig_reg2cntlr_src_addr , reg2cntlr_dest_addr => sig_reg2cntlr_dest_addr , reg2cntlr_btt => sig_reg2cntlr_btt(DM_BTT_WIDTH-1 downto 0) , -- General Status Bit controls cntlr2reg_idle_set => sig_cntlr2reg_idle_set , cntlr2reg_idle_clr => sig_cntlr2reg_idle_clr , cntlr2reg_iocirpt_set => sig_cntlr2reg_iocirpt_set , -- DataMover Error Status bit controls cntlr2reg_decerr_set => sig_cntlr2reg_decerr_set , cntlr2reg_slverr_set => sig_cntlr2reg_slverr_set , cntlr2reg_interr_set => sig_cntlr2reg_interr_set , -- DataMover MM2S Command Interface Ports (AXI Stream) mm2s2cntl_cmd_tready => sig_mm2s2cntl_cmd_tready , cntl2mm2s_cmd_tvalid => sig_cntl2mm2s_cmd_tvalid , cntl2mm2s_cmd_tdata => sig_cntl2mm2s_cmd_tdata , -- DataMover MM2S Status Interface Ports (AXI Stream) cntl2mm2s_sts_tready => sig_cntl2mm2s_sts_tready , mm2s2cntl_sts_tvalid => sig_mm2s2cntl_sts_tvalid , mm2s2cntl_sts_tdata => sig_mm2s2cntl_sts_tdata , mm2s2cntl_sts_tstrb => sig_mm2s2cntl_sts_tkeep , -- DataMover MM2S error discrete mm2s2cntl_err => sig_dm_mm2s_err , -- DataMover S2MM Command Interface Ports (AXI Stream) cntl2s2mm_cmd_tdata => sig_cntl2s2mm_cmd_tdata , cntl2s2mm_cmd_tvalid => sig_cntl2s2mm_cmd_tvalid , s2mm2cntl_cmd_tready => sig_s2mm2cntl_cmd_tready , -- DataMover S2MM Status Interface Ports (AXI Stream) s2mm2cntl_sts_tdata => sig_s2mm2cntl_sts_tdata , s2mm2cntl_sts_tstrb => sig_s2mm2cntl_sts_tkeep , s2mm2cntl_sts_tvalid => sig_s2mm2cntl_sts_tvalid , cntl2s2mm_sts_tready => sig_cntl2s2mm_sts_tready , -- DataMover S2MM error discrete s2mm2cntl_err => sig_dm_s2mm_err ); ------------------------------------------------------------ -- If Generate -- -- Label: GEN_DM_LITE -- -- If Generate Description: -- Instantiates the AXI DataMover in the Lite configuration. -- -- ------------------------------------------------------------ GEN_DM_LITE : if (C_USE_DATAMOVER_LITE = 1) generate begin ------------------------------------------------------------ -- Instance: I_DATAMOVER -- -- Description: -- -- Data Path DataMover -- Reads data from the AXI MMAP Read Channel and Writes the data -- to the AXI MMAP Write Channel via commands from the Controller -- Module. -- -- ------------------------------------------------------------ I_DATAMOVER_LITE : entity axi_datamover_v5_1.axi_datamover generic map( C_INCLUDE_MM2S => MM2S_LITE_MODE , C_M_AXI_MM2S_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_MM2S_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_M_AXIS_MM2S_TDATA_WIDTH => DM_STREAM_DWIDTH , C_INCLUDE_MM2S_STSFIFO => DM_INCLUDE_STS_FIFO , C_MM2S_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => DM_USE_SYNC_CLOCKS , C_INCLUDE_MM2S_DRE => C_INCLUDE_DRE , C_MM2S_BURST_SIZE => C_M_AXI_MAX_BURST_LEN , C_MM2S_BTT_USED => DM_BTT_WIDTH , C_MM2S_ADDR_PIPE_DEPTH => DM_READ_ADDR_PIPE_DEPTH , C_MM2S_INCLUDE_SF => 0 , C_ENABLE_CACHE_USER => 0, C_ENABLE_SKID_BUF => "11000" , C_INCLUDE_S2MM => S2MM_LITE_MODE , C_M_AXI_S2MM_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_S2MM_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_S_AXIS_S2MM_TDATA_WIDTH => DM_STREAM_DWIDTH , C_INCLUDE_S2MM_STSFIFO => DM_INCLUDE_STS_FIFO , C_S2MM_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => DM_USE_SYNC_CLOCKS , C_INCLUDE_S2MM_DRE => DM_S2MM_DRE_DISABLED , C_S2MM_BURST_SIZE => C_M_AXI_MAX_BURST_LEN , C_S2MM_BTT_USED => DM_BTT_WIDTH , C_S2MM_SUPPORT_INDET_BTT => STORE_FORWARD_CNTL , C_S2MM_ADDR_PIPE_DEPTH => DM_WRITE_ADDR_PIPE_DEPTH , C_S2MM_INCLUDE_SF => 0 , C_FAMILY => C_FAMILY ) port map( -- MM2S Primary Clock / Reset input m_axi_mm2s_aclk => axi_aclk , m_axi_mm2s_aresetn => sig_rst2dm_resetn , -- MM2S Soft Shutdown mm2s_halt => sig_dm_mm2s_halt , mm2s_halt_cmplt => sig_dm_mm2s_halt_cmplt , -- MM2S Error output discrete mm2s_err => sig_dm_mm2s_err , -- Memory Map to Stream Command FIFO and Status FIFO Async CLK/RST -------------- m_axis_mm2s_cmdsts_aclk => LOGIC_LOW , m_axis_mm2s_cmdsts_aresetn => LOGIC_HIGH , -- User Command Interface Ports (AXI Stream) s_axis_mm2s_cmd_tvalid => sig_cntl2mm2s_cmd_tvalid , s_axis_mm2s_cmd_tready => sig_mm2s2cntl_cmd_tready , s_axis_mm2s_cmd_tdata => sig_cntl2mm2s_cmd_tdata , -- User Status Interface Ports (AXI Stream) m_axis_mm2s_sts_tvalid => sig_mm2s2cntl_sts_tvalid , m_axis_mm2s_sts_tready => sig_cntl2mm2s_sts_tready , m_axis_mm2s_sts_tdata => sig_mm2s2cntl_sts_tdata , m_axis_mm2s_sts_tkeep => sig_mm2s2cntl_sts_tkeep , -- Address Posting contols mm2s_allow_addr_req => sig_mm2s_allow_addr_req , mm2s_addr_req_posted => sig_mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => sig_mm2s_rd_xfer_cmplt , -- MM2S AXI Address Channel I/O -------------------------------------- m_axi_mm2s_arid => open , m_axi_mm2s_araddr => m_axi_araddr , m_axi_mm2s_arlen => m_axi_arlen , m_axi_mm2s_arsize => m_axi_arsize , m_axi_mm2s_arburst => m_axi_arburst , m_axi_mm2s_arprot => m_axi_arprot , m_axi_mm2s_arcache => m_axi_arcache , m_axi_mm2s_aruser => open, --m_axi_mm2s_aruser , m_axi_mm2s_arvalid => m_axi_arvalid , m_axi_mm2s_arready => m_axi_arready , -- MM2S AXI MMap Read Data Channel I/O ------------------------------- m_axi_mm2s_rdata => m_axi_rdata , m_axi_mm2s_rresp => m_axi_rresp , m_axi_mm2s_rlast => m_axi_rlast , m_axi_mm2s_rvalid => m_axi_rvalid , m_axi_mm2s_rready => m_axi_rready , -- MM2S AXI Master Stream Channel I/O -------------------------------- m_axis_mm2s_tdata => sig_mm2s_axis_tdata , m_axis_mm2s_tkeep => sig_mm2s_axis_tkeep , m_axis_mm2s_tlast => sig_mm2s_axis_tlast , m_axis_mm2s_tvalid => sig_mm2s_axis_tvalid , m_axis_mm2s_tready => sig_mm2s_axis_tready , -- Testing Support I/O mm2s_dbg_sel => (others => '0') , mm2s_dbg_data => open , -- S2MM Primary Clock/Reset input m_axi_s2mm_aclk => axi_aclk , m_axi_s2mm_aresetn => sig_rst2dm_resetn , -- S2MM Soft Shutdown s2mm_halt => sig_dm_s2mm_halt , s2mm_halt_cmplt => sig_dm_s2mm_halt_cmplt , -- S2MM Error output discrete s2mm_err => sig_dm_s2mm_err , -- Stream to Memory Map Command FIFO and Status FIFO I/O -------------- m_axis_s2mm_cmdsts_awclk => LOGIC_LOW , m_axis_s2mm_cmdsts_aresetn => LOGIC_HIGH , -- User Command Interface Ports (AXI Stream) s_axis_s2mm_cmd_tvalid => sig_cntl2s2mm_cmd_tvalid , s_axis_s2mm_cmd_tready => sig_s2mm2cntl_cmd_tready , s_axis_s2mm_cmd_tdata => sig_cntl2s2mm_cmd_tdata , -- User Status Interface Ports (AXI Stream) m_axis_s2mm_sts_tvalid => sig_s2mm2cntl_sts_tvalid , m_axis_s2mm_sts_tready => sig_cntl2s2mm_sts_tready , m_axis_s2mm_sts_tdata => sig_s2mm2cntl_sts_tdata , m_axis_s2mm_sts_tkeep => sig_s2mm2cntl_sts_tkeep , -- Address posting controls s2mm_allow_addr_req => sig_s2mm_allow_addr_req , s2mm_addr_req_posted => sig_s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => sig_s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => sig_s2mm_ld_nxt_len , s2mm_wr_len => sig_s2mm_wr_len , -- S2MM AXI Address Channel I/O -------------------------------------- m_axi_s2mm_awid => open , m_axi_s2mm_awaddr => m_axi_awaddr , m_axi_s2mm_awlen => m_axi_awlen , m_axi_s2mm_awsize => m_axi_awsize , m_axi_s2mm_awburst => m_axi_awburst , m_axi_s2mm_awprot => m_axi_awprot , m_axi_s2mm_awcache => m_axi_awcache , m_axi_s2mm_awuser => open, --m_axi_s2mm_awuser , m_axi_s2mm_awvalid => m_axi_awvalid , m_axi_s2mm_awready => m_axi_awready , -- S2MM AXI MMap Write Data Channel I/O ------------------------------ m_axi_s2mm_wdata => m_axi_wdata , m_axi_s2mm_wstrb => m_axi_wstrb , m_axi_s2mm_wlast => m_axi_wlast , m_axi_s2mm_wvalid => m_axi_wvalid , m_axi_s2mm_wready => m_axi_wready , -- S2MM AXI MMap Write response Channel I/O -------------------------- m_axi_s2mm_bresp => m_axi_bresp , m_axi_s2mm_bvalid => m_axi_bvalid , m_axi_s2mm_bready => m_axi_bready , -- S2MM AXI Slave Stream Channel I/O --------------------------------- s_axis_s2mm_tdata => sig_s2mm_axis_tdata , s_axis_s2mm_tkeep => sig_s2mm_axis_tkeep , s_axis_s2mm_tlast => sig_s2mm_axis_tlast , s_axis_s2mm_tvalid => sig_s2mm_axis_tvalid , s_axis_s2mm_tready => sig_s2mm_axis_tready , -- Testing Support I/O s2mm_dbg_sel => (others => '0') , s2mm_dbg_data => open ); end generate GEN_DM_LITE; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_DM_FULL -- -- If Generate Description: -- Instance for FULL mode DataMover -- -- ------------------------------------------------------------ GEN_DM_FULL : if (C_USE_DATAMOVER_LITE = 0) generate begin -- Rip the basic status output from the DataMover S2MM status reply stream sig_s2mm2cntl_sts_tdata <= sig_dm_s2mm_sts_tdata(BASE_STATUS_WIDTH-1 downto 0); sig_s2mm2cntl_sts_tkeep <= sig_dm_s2mm_sts_tkeep((BASE_STATUS_WIDTH/8)-1 downto 0); ------------------------------------------------------------ -- Instance: I_DATAMOVER -- -- Description: -- -- Data Path DataMover -- Reads data from the AXI MMAP Read Channel and Writes the data -- to the AXI MMAP Write Channel via commands from the Controller -- Module. -- -- ------------------------------------------------------------ I_DATAMOVER_FULL : entity axi_datamover_v5_1.axi_datamover generic map( C_INCLUDE_MM2S => MM2S_FULL_MODE , C_M_AXI_MM2S_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_MM2S_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_M_AXIS_MM2S_TDATA_WIDTH => DM_STREAM_DWIDTH , C_INCLUDE_MM2S_STSFIFO => DM_INCLUDE_STS_FIFO , C_MM2S_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => DM_USE_SYNC_CLOCKS , C_INCLUDE_MM2S_DRE => C_INCLUDE_DRE , C_MM2S_BURST_SIZE => C_M_AXI_MAX_BURST_LEN , C_MM2S_BTT_USED => DM_BTT_WIDTH , C_MM2S_ADDR_PIPE_DEPTH => DM_READ_ADDR_PIPE_DEPTH , C_MM2S_INCLUDE_SF => 0 , C_ENABLE_CACHE_USER => 0, C_ENABLE_SKID_BUF => "11000" , C_INCLUDE_S2MM => S2MM_FULL_MODE , C_M_AXI_S2MM_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_S2MM_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_S_AXIS_S2MM_TDATA_WIDTH => DM_STREAM_DWIDTH , C_INCLUDE_S2MM_STSFIFO => DM_INCLUDE_STS_FIFO , C_S2MM_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => DM_USE_SYNC_CLOCKS , C_INCLUDE_S2MM_DRE => DM_S2MM_DRE_DISABLED , C_S2MM_BURST_SIZE => C_M_AXI_MAX_BURST_LEN , C_S2MM_BTT_USED => DM_BTT_WIDTH , C_S2MM_SUPPORT_INDET_BTT => STORE_FORWARD_CNTL , C_S2MM_ADDR_PIPE_DEPTH => DM_WRITE_ADDR_PIPE_DEPTH , C_S2MM_INCLUDE_SF => 0 , C_FAMILY => C_FAMILY ) port map( -- MM2S Primary Clock / Reset input m_axi_mm2s_aclk => axi_aclk , m_axi_mm2s_aresetn => sig_rst2dm_resetn , -- MM2S Soft Shutdown mm2s_halt => sig_dm_mm2s_halt , mm2s_halt_cmplt => sig_dm_mm2s_halt_cmplt , -- MM2S Error output discrete mm2s_err => sig_dm_mm2s_err , -- Memory Map to Stream Command FIFO and Status FIFO Async CLK/RST -------------- m_axis_mm2s_cmdsts_aclk => LOGIC_LOW , m_axis_mm2s_cmdsts_aresetn => LOGIC_HIGH , -- User Command Interface Ports (AXI Stream) s_axis_mm2s_cmd_tvalid => sig_cntl2mm2s_cmd_tvalid , s_axis_mm2s_cmd_tready => sig_mm2s2cntl_cmd_tready , s_axis_mm2s_cmd_tdata => sig_cntl2mm2s_cmd_tdata , -- User Status Interface Ports (AXI Stream) m_axis_mm2s_sts_tvalid => sig_mm2s2cntl_sts_tvalid , m_axis_mm2s_sts_tready => sig_cntl2mm2s_sts_tready , m_axis_mm2s_sts_tdata => sig_mm2s2cntl_sts_tdata , m_axis_mm2s_sts_tkeep => sig_mm2s2cntl_sts_tkeep , -- Address Posting contols mm2s_allow_addr_req => sig_mm2s_allow_addr_req , mm2s_addr_req_posted => sig_mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => sig_mm2s_rd_xfer_cmplt , -- MM2S AXI Address Channel I/O -------------------------------------- m_axi_mm2s_arid => open , m_axi_mm2s_araddr => m_axi_araddr , m_axi_mm2s_arlen => m_axi_arlen , m_axi_mm2s_arsize => m_axi_arsize , m_axi_mm2s_arburst => m_axi_arburst , m_axi_mm2s_arprot => m_axi_arprot , m_axi_mm2s_arcache => m_axi_arcache , m_axi_mm2s_aruser => open, --m_axi_arcache , m_axi_mm2s_arvalid => m_axi_arvalid , m_axi_mm2s_arready => m_axi_arready , -- MM2S AXI MMap Read Data Channel I/O ------------------------------- m_axi_mm2s_rdata => m_axi_rdata , m_axi_mm2s_rresp => m_axi_rresp , m_axi_mm2s_rlast => m_axi_rlast , m_axi_mm2s_rvalid => m_axi_rvalid , m_axi_mm2s_rready => m_axi_rready , -- MM2S AXI Master Stream Channel I/O -------------------------------- m_axis_mm2s_tdata => sig_mm2s_axis_tdata , m_axis_mm2s_tkeep => sig_mm2s_axis_tkeep , m_axis_mm2s_tlast => sig_mm2s_axis_tlast , m_axis_mm2s_tvalid => sig_mm2s_axis_tvalid , m_axis_mm2s_tready => sig_mm2s_axis_tready , -- Testing Support I/O mm2s_dbg_sel => (others => '0') , mm2s_dbg_data => open , -- S2MM Primary Clock/Reset input m_axi_s2mm_aclk => axi_aclk , m_axi_s2mm_aresetn => sig_rst2dm_resetn , -- S2MM Soft Shutdown s2mm_halt => sig_dm_s2mm_halt , s2mm_halt_cmplt => sig_dm_s2mm_halt_cmplt , -- S2MM Error output discrete s2mm_err => sig_dm_s2mm_err , -- Stream to Memory Map Command FIFO and Status FIFO I/O -------------- m_axis_s2mm_cmdsts_awclk => LOGIC_LOW , m_axis_s2mm_cmdsts_aresetn => LOGIC_HIGH , -- User Command Interface Ports (AXI Stream) s_axis_s2mm_cmd_tvalid => sig_cntl2s2mm_cmd_tvalid , s_axis_s2mm_cmd_tready => sig_s2mm2cntl_cmd_tready , s_axis_s2mm_cmd_tdata => sig_cntl2s2mm_cmd_tdata , -- User Status Interface Ports (AXI Stream) m_axis_s2mm_sts_tvalid => sig_s2mm2cntl_sts_tvalid , m_axis_s2mm_sts_tready => sig_cntl2s2mm_sts_tready , -- m_axis_s2mm_sts_tdata => sig_s2mm2cntl_sts_tdata , m_axis_s2mm_sts_tdata => sig_dm_s2mm_sts_tdata , -- m_axis_s2mm_sts_tkeep => sig_s2mm2cntl_sts_tstrb , m_axis_s2mm_sts_tkeep => sig_dm_s2mm_sts_tkeep , -- Address posting controls s2mm_allow_addr_req => sig_s2mm_allow_addr_req , s2mm_addr_req_posted => sig_s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => sig_s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => sig_s2mm_ld_nxt_len , s2mm_wr_len => sig_s2mm_wr_len , -- S2MM AXI Address Channel I/O -------------------------------------- m_axi_s2mm_awid => open , m_axi_s2mm_awaddr => m_axi_awaddr , m_axi_s2mm_awlen => m_axi_awlen , m_axi_s2mm_awsize => m_axi_awsize , m_axi_s2mm_awburst => m_axi_awburst , m_axi_s2mm_awprot => m_axi_awprot , m_axi_s2mm_awcache => m_axi_awcache , m_axi_s2mm_awuser => open, --m_axi_awcache , m_axi_s2mm_awvalid => m_axi_awvalid , m_axi_s2mm_awready => m_axi_awready , -- S2MM AXI MMap Write Data Channel I/O ------------------------------ m_axi_s2mm_wdata => m_axi_wdata , m_axi_s2mm_wstrb => m_axi_wstrb , m_axi_s2mm_wlast => m_axi_wlast , m_axi_s2mm_wvalid => m_axi_wvalid , m_axi_s2mm_wready => m_axi_wready , -- S2MM AXI MMap Write response Channel I/O -------------------------- m_axi_s2mm_bresp => m_axi_bresp , m_axi_s2mm_bvalid => m_axi_bvalid , m_axi_s2mm_bready => m_axi_bready , -- S2MM AXI Slave Stream Channel I/O --------------------------------- s_axis_s2mm_tdata => sig_s2mm_axis_tdata , s_axis_s2mm_tkeep => sig_s2mm_axis_tkeep , s_axis_s2mm_tlast => sig_s2mm_axis_tlast , s_axis_s2mm_tvalid => sig_s2mm_axis_tvalid , s_axis_s2mm_tready => sig_s2mm_axis_tready , -- Testing Support I/O s2mm_dbg_sel => (others => '0') , s2mm_dbg_data => open ); end generate GEN_DM_FULL; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_INCLUDE_SF -- -- If Generate Description: -- This IfGen includes the Store and Forward module -- -- ------------------------------------------------------------ GEN_INCLUDE_SF : if (C_INCLUDE_SF = 1) generate begin ------------------------------------------------------------ -- Instance: I_STORE_FORWARD -- -- Description: -- This is the instance for the AXI CDMA Store and Forward -- Module. -- ------------------------------------------------------------ I_STORE_FORWARD : entity axi_cdma_v4_1.axi_cdma_sf generic map ( C_WR_ADDR_PIPE_DEPTH => DM_WRITE_ADDR_PIPE_DEPTH, C_SF_FIFO_DEPTH => SF_FIFO_DEPTH , C_MAX_BURST_LEN => C_M_AXI_MAX_BURST_LEN , C_DRE_IS_USED => C_INCLUDE_DRE , C_STREAM_DWIDTH => C_M_AXI_DATA_WIDTH , C_FAMILY => C_FAMILY ) port map ( -- Clock input aclk => axi_aclk , -- Reset input reset => sig_sf_reset , -- DataMover Read Side Address Pipelining control Interface ---- ok_to_post_rd_addr => sig_mm2s_allow_addr_req , rd_addr_posted => sig_mm2s_addr_req_posted , rd_xfer_cmplt => sig_mm2s_rd_xfer_cmplt , -- Read Side Stream In from DataMover MM2S --------------------- sf2sin_tready => sig_mm2s_axis_tready , sin2sf_tvalid => sig_mm2s_axis_tvalid , sin2sf_tdata => sig_mm2s_axis_tdata , sin2sf_tkeep => sig_mm2s_axis_tkeep , sin2sf_tlast => sig_mm2s_axis_tlast , -- DataMover Write Side Address Pipelining control Interface --- ok_to_post_wr_addr => sig_s2mm_allow_addr_req , wr_addr_posted => sig_s2mm_addr_req_posted , wr_xfer_cmplt => sig_s2mm_wr_xfer_cmplt , wr_ld_nxt_len => sig_s2mm_ld_nxt_len , wr_len => sig_s2mm_wr_len , -- Write Side Stream Out to DataMover S2MM --------------------- sout2sf_tready => sig_s2mm_axis_tready , sf2sout_tvalid => sig_s2mm_axis_tvalid , sf2sout_tdata => sig_s2mm_axis_tdata , sf2sout_tkeep => sig_s2mm_axis_tkeep , sf2sout_tlast => sig_s2mm_axis_tlast ); end generate GEN_INCLUDE_SF; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_OMIT_SF -- -- If Generate Description: -- This IfGen includes the Store and Forward module -- -- ------------------------------------------------------------ GEN_OMIT_SF : if (C_INCLUDE_SF = 0) generate begin sig_mm2s_allow_addr_req <= LOGIC_HIGH; sig_s2mm_allow_addr_req <= LOGIC_HIGH; sig_mm2s_axis_tready <= sig_s2mm_axis_tready ; sig_s2mm_axis_tvalid <= sig_mm2s_axis_tvalid ; sig_s2mm_axis_tdata <= sig_mm2s_axis_tdata ; sig_s2mm_axis_tkeep <= sig_mm2s_axis_tkeep ; sig_s2mm_axis_tlast <= sig_mm2s_axis_tlast ; end generate GEN_OMIT_SF; end implementation;
gpl-3.0
1a68a9c21a024878b7acce51dc732434
0.44122
4.050709
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/srmmu/mmuconfig.vhd
1
22,410
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: mmuconfig -- File: mmuconfig.vhd -- Author: Konrad Eisele, Jiri Gaisler, Gaisler Research -- Description: MMU types and constants ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; library gaisler; package mmuconfig is constant M_CTX_SZ : integer := 8; constant M_ENT_MAX : integer := 64; constant XM_ENT_MAX_LOG : integer := log2(M_ENT_MAX); constant M_ENT_MAX_LOG : integer := XM_ENT_MAX_LOG; type mmu_idcache is (id_icache, id_dcache); -- ############################################################## -- 1.0 virtual address [sparc V8: p.243,Appx.H,Figure H-4] -- +--------+--------+--------+---------------+ -- a) | INDEX1 | INDEX2 | INDEX3 | OFFSET | -- +--------+--------+--------+---------------+ -- 31 24 23 18 17 12 11 0 constant VA_I1_SZ : integer := 8; constant VA_I2_SZ : integer := 6; constant VA_I3_SZ : integer := 6; constant VA_I_SZ : integer := VA_I1_SZ+VA_I2_SZ+VA_I3_SZ; constant VA_I_MAX : integer := 8; constant VA_I1_U : integer := 31; constant VA_I1_D : integer := 32-VA_I1_SZ; constant VA_I2_U : integer := 31-VA_I1_SZ; constant VA_I2_D : integer := 32-VA_I1_SZ-VA_I2_SZ; constant VA_I3_U : integer := 31-VA_I1_SZ-VA_I2_SZ; constant VA_I3_D : integer := 32-VA_I_SZ; constant VA_I_U : integer := 31; constant VA_I_D : integer := 32-VA_I_SZ; constant VA_OFF_U : integer := 31-VA_I_SZ; constant VA_OFF_D : integer := 0; constant VA_OFFCTX_U : integer := 31; constant VA_OFFCTX_D : integer := 0; constant VA_OFFREG_U : integer := 31-VA_I1_SZ; constant VA_OFFREG_D : integer := 0; constant VA_OFFSEG_U : integer := 31-VA_I1_SZ-VA_I2_SZ; constant VA_OFFSEG_D : integer := 0; constant VA_OFFPAG_U : integer := 31-VA_I_SZ; constant VA_OFFPAG_D : integer := 0; -- 8k pages -- 7 6 6 13 -- +--------+--------+--------+---------------+ -- a) | INDEX1 | INDEX2 | INDEX3 | OFFSET | -- +--------+--------+--------+---------------+ -- 31 25 24 19 18 13 12 0 constant P8K_VA_I1_SZ : integer := 7; constant P8K_VA_I2_SZ : integer := 6; constant P8K_VA_I3_SZ : integer := 6; constant P8K_VA_I_SZ : integer := P8K_VA_I1_SZ+P8K_VA_I2_SZ+P8K_VA_I3_SZ; constant P8K_VA_I_MAX : integer := 7; constant P8K_VA_I1_U : integer := 31; constant P8K_VA_I1_D : integer := 32-P8K_VA_I1_SZ; constant P8K_VA_I2_U : integer := 31-P8K_VA_I1_SZ; constant P8K_VA_I2_D : integer := 32-P8K_VA_I1_SZ-P8K_VA_I2_SZ; constant P8K_VA_I3_U : integer := 31-P8K_VA_I1_SZ-P8K_VA_I2_SZ; constant P8K_VA_I3_D : integer := 32-P8K_VA_I_SZ; constant P8K_VA_I_U : integer := 31; constant P8K_VA_I_D : integer := 32-P8K_VA_I_SZ; constant P8K_VA_OFF_U : integer := 31-P8K_VA_I_SZ; constant P8K_VA_OFF_D : integer := 0; constant P8K_VA_OFFCTX_U : integer := 31; constant P8K_VA_OFFCTX_D : integer := 0; constant P8K_VA_OFFREG_U : integer := 31-P8K_VA_I1_SZ; constant P8K_VA_OFFREG_D : integer := 0; constant P8K_VA_OFFSEG_U : integer := 31-P8K_VA_I1_SZ-P8K_VA_I2_SZ; constant P8K_VA_OFFSEG_D : integer := 0; constant P8K_VA_OFFPAG_U : integer := 31-P8K_VA_I_SZ; constant P8K_VA_OFFPAG_D : integer := 0; -- 16k pages -- 6 6 6 14 -- +--------+--------+--------+---------------+ -- a) | INDEX1 | INDEX2 | INDEX3 | OFFSET | -- +--------+--------+--------+---------------+ -- 31 26 25 20 19 14 13 0 constant P16K_VA_I1_SZ : integer := 6; constant P16K_VA_I2_SZ : integer := 6; constant P16K_VA_I3_SZ : integer := 6; constant P16K_VA_I_SZ : integer := P16K_VA_I1_SZ+P16K_VA_I2_SZ+P16K_VA_I3_SZ; constant P16K_VA_I_MAX : integer := 6; constant P16K_VA_I1_U : integer := 31; constant P16K_VA_I1_D : integer := 32-P16K_VA_I1_SZ; constant P16K_VA_I2_U : integer := 31-P16K_VA_I1_SZ; constant P16K_VA_I2_D : integer := 32-P16K_VA_I1_SZ-P16K_VA_I2_SZ; constant P16K_VA_I3_U : integer := 31-P16K_VA_I1_SZ-P16K_VA_I2_SZ; constant P16K_VA_I3_D : integer := 32-P16K_VA_I_SZ; constant P16K_VA_I_U : integer := 31; constant P16K_VA_I_D : integer := 32-P16K_VA_I_SZ; constant P16K_VA_OFF_U : integer := 31-P16K_VA_I_SZ; constant P16K_VA_OFF_D : integer := 0; constant P16K_VA_OFFCTX_U : integer := 31; constant P16K_VA_OFFCTX_D : integer := 0; constant P16K_VA_OFFREG_U : integer := 31-P16K_VA_I1_SZ; constant P16K_VA_OFFREG_D : integer := 0; constant P16K_VA_OFFSEG_U : integer := 31-P16K_VA_I1_SZ-P16K_VA_I2_SZ; constant P16K_VA_OFFSEG_D : integer := 0; constant P16K_VA_OFFPAG_U : integer := 31-P16K_VA_I_SZ; constant P16K_VA_OFFPAG_D : integer := 0; -- 32k pages -- 4 7 6 15 -- +--------+--------+--------+---------------+ -- a) | INDEX1 | INDEX2 | INDEX3 | OFFSET | -- +--------+--------+--------+---------------+ -- 31 28 27 21 20 15 14 0 constant P32K_VA_I1_SZ : integer := 4; constant P32K_VA_I2_SZ : integer := 7; constant P32K_VA_I3_SZ : integer := 6; constant P32K_VA_I_SZ : integer := P32K_VA_I1_SZ+P32K_VA_I2_SZ+P32K_VA_I3_SZ; constant P32K_VA_I_MAX : integer := 7; constant P32K_VA_I1_U : integer := 31; constant P32K_VA_I1_D : integer := 32-P32K_VA_I1_SZ; constant P32K_VA_I2_U : integer := 31-P32K_VA_I1_SZ; constant P32K_VA_I2_D : integer := 32-P32K_VA_I1_SZ-P32K_VA_I2_SZ; constant P32K_VA_I3_U : integer := 31-P32K_VA_I1_SZ-P32K_VA_I2_SZ; constant P32K_VA_I3_D : integer := 32-P32K_VA_I_SZ; constant P32K_VA_I_U : integer := 31; constant P32K_VA_I_D : integer := 32-P32K_VA_I_SZ; constant P32K_VA_OFF_U : integer := 31-P32K_VA_I_SZ; constant P32K_VA_OFF_D : integer := 0; constant P32K_VA_OFFCTX_U : integer := 31; constant P32K_VA_OFFCTX_D : integer := 0; constant P32K_VA_OFFREG_U : integer := 31-P32K_VA_I1_SZ; constant P32K_VA_OFFREG_D : integer := 0; constant P32K_VA_OFFSEG_U : integer := 31-P32K_VA_I1_SZ-P32K_VA_I2_SZ; constant P32K_VA_OFFSEG_D : integer := 0; constant P32K_VA_OFFPAG_U : integer := 31-P32K_VA_I_SZ; constant P32K_VA_OFFPAG_D : integer := 0; -- ############################################################## -- 2.0 PAGE TABE DESCRIPTOR (PTD) [sparc V8: p.247,Appx.H,Figure H-7] -- -- +-------------------------------------------------+---+---+ -- | Page Table Pointer (PTP) | 0 | 0 | -- +-------------------------------------------------+---+---+ -- 31 2 1 0 -- -- 2.1 PAGE TABE ENTRY (PTE) [sparc V8: p.247,Appx.H,Figure H-8] -- -- +-----------------------------+---+---+---+-----------+---+ -- |Physical Page Number (PPN) | C | M | R | ACC | ET¦ -- +-----------------------------+---+---+---+-----------+---+ -- 31 8 7 6 5 4 2 1 0 -- constant PTD_PTP_U : integer := 31; -- PTD: page table pointer constant PTD_PTP_D : integer := 2; constant PTD_PTP32_U : integer := 27; -- PTD: page table pointer 32 bit constant PTD_PTP32_D : integer := 2; constant PTE_PPN_U : integer := 31; -- PTE: physical page number constant PTE_PPN_D : integer := 8; constant PTE_PPN_S : integer := (PTE_PPN_U+1)-PTE_PPN_D; -- PTE: pysical page number size constant PTE_PPN32_U : integer := 27; -- PTE: physical page number 32 bit addr constant PTE_PPN32_D : integer := 8; constant PTE_PPN32_S : integer := (PTE_PPN32_U+1)-PTE_PPN32_D; -- PTE: pysical page number 32 bit size constant PTE_PPN32REG_U : integer := PTE_PPN32_U; -- PTE: pte part of merged result address constant PTE_PPN32REG_D : integer := PTE_PPN32_U+1-VA_I1_SZ; constant PTE_PPN32SEG_U : integer := PTE_PPN32_U; constant PTE_PPN32SEG_D : integer := PTE_PPN32_U+1-VA_I1_SZ-VA_I2_SZ; constant PTE_PPN32PAG_U : integer := PTE_PPN32_U; constant PTE_PPN32PAG_D : integer := PTE_PPN32_U+1-VA_I_SZ; -- 8k pages constant P8K_PTE_PPN32REG_U : integer := PTE_PPN32_U; -- PTE: pte part of merged result address constant P8K_PTE_PPN32REG_D : integer := PTE_PPN32_U+1-P8K_VA_I1_SZ; constant P8K_PTE_PPN32SEG_U : integer := PTE_PPN32_U; constant P8K_PTE_PPN32SEG_D : integer := PTE_PPN32_U+1-P8K_VA_I1_SZ-P8K_VA_I2_SZ; constant P8K_PTE_PPN32PAG_U : integer := PTE_PPN32_U; constant P8K_PTE_PPN32PAG_D : integer := PTE_PPN32_U+1-P8K_VA_I_SZ; -- 16k pages constant P16K_PTE_PPN32REG_U : integer := PTE_PPN32_U; -- PTE: pte part of merged result address constant P16K_PTE_PPN32REG_D : integer := PTE_PPN32_U+1-P16K_VA_I1_SZ; constant P16K_PTE_PPN32SEG_U : integer := PTE_PPN32_U; constant P16K_PTE_PPN32SEG_D : integer := PTE_PPN32_U+1-P16K_VA_I1_SZ-P16K_VA_I2_SZ; constant P16K_PTE_PPN32PAG_U : integer := PTE_PPN32_U; constant P16K_PTE_PPN32PAG_D : integer := PTE_PPN32_U+1-P16K_VA_I_SZ; -- 32k pages constant P32K_PTE_PPN32REG_U : integer := PTE_PPN32_U; -- PTE: pte part of merged result address constant P32K_PTE_PPN32REG_D : integer := PTE_PPN32_U+1-P32K_VA_I1_SZ; constant P32K_PTE_PPN32SEG_U : integer := PTE_PPN32_U; constant P32K_PTE_PPN32SEG_D : integer := PTE_PPN32_U+1-P32K_VA_I1_SZ-P32K_VA_I2_SZ; constant P32K_PTE_PPN32PAG_U : integer := PTE_PPN32_U; constant P32K_PTE_PPN32PAG_D : integer := PTE_PPN32_U+1-P32K_VA_I_SZ; constant PTE_C : integer := 7; -- PTE: Cacheable bit constant PTE_M : integer := 6; -- PTE: Modified bit constant PTE_R : integer := 5; -- PTE: Reference Bit - a "1" indicates an PTE constant PTE_ACC_U : integer := 4; -- PTE: Access field constant PTE_ACC_D : integer := 2; constant ACC_W : integer := 2; -- PTE::ACC : write permission constant ACC_E : integer := 3; -- PTE::ACC : exec permission constant ACC_SU : integer := 4; -- PTE::ACC : privileged constant PT_ET_U : integer := 1; -- PTD/PTE: PTE Type constant PT_ET_D : integer := 0; constant ET_INV : std_logic_vector(1 downto 0) := "00"; constant ET_PTD : std_logic_vector(1 downto 0) := "01"; constant ET_PTE : std_logic_vector(1 downto 0) := "10"; constant ET_RVD : std_logic_vector(1 downto 0) := "11"; constant PADDR_PTD_U : integer := 31; constant PADDR_PTD_D : integer := 6; -- ############################################################## -- 3.0 TLBCAM TAG hardware representation (TTG) -- type tlbcam_reg is record ET : std_logic_vector(1 downto 0); -- et field ACC : std_logic_vector(2 downto 0); -- on flush/probe this will become FPTY M : std_logic; -- modified R : std_logic; -- referenced SU : std_logic; -- equal ACC >= 6 VALID : std_logic; LVL : std_logic_vector(1 downto 0); -- level in pth I1 : std_logic_vector(7 downto 0); -- vaddr I2 : std_logic_vector(5 downto 0); I3 : std_logic_vector(5 downto 0); CTX : std_logic_vector(M_CTX_SZ-1 downto 0); -- ctx number PPN : std_logic_vector(PTE_PPN_S-1 downto 0); -- physical page number C : std_logic; -- cachable end record; constant tlbcam_reg_none : tlbcam_reg := ("00", "000", '0', '0', '0', '0', "00", "00000000", "000000", "000000", "00000000", (others => '0'), '0'); -- tlbcam_reg::LVL constant LVL_PAGE : std_logic_vector(1 downto 0) := "00"; -- equal tlbcam_tfp::TYP FPTY_PAGE constant LVL_SEGMENT : std_logic_vector(1 downto 0) := "01"; -- equal tlbcam_tfp::TYP FPTY_SEGMENT constant LVL_REGION : std_logic_vector(1 downto 0) := "10"; -- equal tlbcam_tfp::TYP FPTY_REGION constant LVL_CTX : std_logic_vector(1 downto 0) := "11"; -- equal tlbcam_tfp::TYP FPTY_CTX -- ############################################################## -- 4.0 TLBCAM tag i/o for translation/flush/(probe) -- type tlbcam_tfp is record TYP : std_logic_vector(2 downto 0); -- f/(p) type I1 : std_logic_vector(7 downto 0); -- vaddr I2 : std_logic_vector(5 downto 0); I3 : std_logic_vector(5 downto 0); CTX : std_logic_vector(M_CTX_SZ-1 downto 0); -- ctx number M : std_logic; end record; constant tlbcam_tfp_none : tlbcam_tfp := ("000", "00000000", "000000", "000000", "00000000", '0'); --tlbcam_tfp::TYP constant FPTY_PAGE : std_logic_vector(2 downto 0) := "000"; -- level 3 PTE match I1+I2+I3 constant FPTY_SEGMENT : std_logic_vector(2 downto 0) := "001"; -- level 2/3 PTE/PTD match I1+I2 constant FPTY_REGION : std_logic_vector(2 downto 0) := "010"; -- level 1/2/3 PTE/PTD match I1 constant FPTY_CTX : std_logic_vector(2 downto 0) := "011"; -- level 0/1/2/3 PTE/PTD ctx constant FPTY_N : std_logic_vector(2 downto 0) := "100"; -- entire tlb -- ############################################################## -- 5.0 MMU Control Register [sparc V8: p.253,Appx.H,Figure H-10] -- -- +-------+-----+------------------+-----+-------+--+--+ -- | IMPL | VER | SC | PSO | resvd |NF|E | -- +-------+-----+------------------+-----+-------+--+--+ -- 31 28 27 24 23 8 7 6 2 1 0 -- -- MMU Context Pointer [sparc V8: p.254,Appx.H,Figure H-11] -- +-------------------------------------------+--------+ -- | Context Table Pointer | resvd | -- +-------------------------------------------+--------+ -- 31 2 1 0 -- -- MMU Context Number [sparc V8: p.255,Appx.H,Figure H-12] -- +----------------------------------------------------+ -- | Context Table Pointer | -- +----------------------------------------------------+ -- 31 0 -- -- fault status/address register [sparc V8: p.256,Appx.H,Table H-13/14] -- +------------+-----+---+----+----+-----+----+ -- | reserved | EBE | L | AT | FT | FAV | OW | -- +------------+-----+---+----+----+-----+----+ -- 31 18 17 10 9 8 7 5 4 2 1 0 -- -- +----------------------------------------------------+ -- | fault address register | -- +----------------------------------------------------+ -- 31 0 constant MMCTRL_CTXP_SZ : integer := 30; constant MMCTRL_PTP32_U : integer := 25; constant MMCTRL_PTP32_D : integer := 0; constant MMCTRL_E : integer := 0; constant MMCTRL_NF : integer := 1; constant MMCTRL_PSO : integer := 7; constant MMCTRL_SC_U : integer := 23; constant MMCTRL_SC_D : integer := 8; constant MMCTRL_PGSZ_U : integer := 17; constant MMCTRL_PGSZ_D : integer := 16; constant MMCTRL_VER_U : integer := 27; constant MMCTRL_VER_D : integer := 24; constant MMCTRL_IMPL_U : integer := 31; constant MMCTRL_IMPL_D : integer := 28; constant MMCTRL_TLBDIS : integer := 15; constant MMCTRL_TLBSEP : integer := 14; constant MMCTXP_U : integer := 31; constant MMCTXP_D : integer := 2; constant MMCTXNR_U : integer := M_CTX_SZ-1; constant MMCTXNR_D : integer := 0; constant FS_SZ : integer := 18; -- fault status size constant FS_EBE_U : integer := 17; constant FS_EBE_D : integer := 10; constant FS_L_U : integer := 9; constant FS_L_D : integer := 8; constant FS_L_CTX : std_logic_vector(1 downto 0) := "00"; constant FS_L_L1 : std_logic_vector(1 downto 0) := "01"; constant FS_L_L2 : std_logic_vector(1 downto 0) := "10"; constant FS_L_L3 : std_logic_vector(1 downto 0) := "11"; constant FS_AT_U : integer := 7; constant FS_AT_D : integer := 5; constant FS_AT_LS : natural := 7; --L=0 S=1 constant FS_AT_ID : natural := 6; --D=0 I=1 constant FS_AT_SU : natural := 5; --U=0 SU=1 constant FS_AT_LUDS : std_logic_vector(2 downto 0) := "000"; constant FS_AT_LSDS : std_logic_vector(2 downto 0) := "001"; constant FS_AT_LUIS : std_logic_vector(2 downto 0) := "010"; constant FS_AT_LSIS : std_logic_vector(2 downto 0) := "011"; constant FS_AT_SUDS : std_logic_vector(2 downto 0) := "100"; constant FS_AT_SSDS : std_logic_vector(2 downto 0) := "101"; constant FS_AT_SUIS : std_logic_vector(2 downto 0) := "110"; constant FS_AT_SSIS : std_logic_vector(2 downto 0) := "111"; constant FS_FT_U : integer := 4; constant FS_FT_D : integer := 2; constant FS_FT_NONE : std_logic_vector(2 downto 0) := "000"; constant FS_FT_INV : std_logic_vector(2 downto 0) := "001"; constant FS_FT_PRO : std_logic_vector(2 downto 0) := "010"; constant FS_FT_PRI : std_logic_vector(2 downto 0) := "011"; constant FS_FT_TRANS : std_logic_vector(2 downto 0):= "110"; constant FS_FT_BUS : std_logic_vector(2 downto 0) := "101"; constant FS_FT_INT : std_logic_vector(2 downto 0) := "110"; constant FS_FT_RVD : std_logic_vector(2 downto 0) := "111"; constant FS_FAV : natural := 1; constant FS_OW : natural := 0; --# mmu ctrl reg type mmctrl_type1 is record e : std_logic; -- enable nf : std_logic; -- no fault pso : std_logic; -- partial store order -- pre : std_logic; -- pretranslation source -- pri : std_logic; -- i/d priority pagesize : std_logic_vector(1 downto 0);-- page size ctx : std_logic_vector(M_CTX_SZ-1 downto 0);-- context nr ctxp : std_logic_vector(MMCTRL_CTXP_SZ-1 downto 0); -- context table pointer tlbdis : std_logic; -- tlb disabled bar : std_logic_vector(1 downto 0); -- preplace barrier end record; constant mmctrl_type1_none : mmctrl_type1 := ('0', '0', '0', (others => '0'), (others => '0'), (others => '0'), '0', (others => '0')); --# fault status reg type mmctrl_fs_type is record ow : std_logic; fav : std_logic; ft : std_logic_vector(2 downto 0); -- fault type at_ls : std_logic; -- access type, load/store at_id : std_logic; -- access type, i/dcache at_su : std_logic; -- access type, su/user l : std_logic_vector(1 downto 0); -- level ebe : std_logic_vector(7 downto 0); end record; constant mmctrl_fs_zero : mmctrl_fs_type := ('0', '0', "000", '0', '0', '0', "00", "00000000"); type mmctrl_type2 is record fs : mmctrl_fs_type; valid : std_logic; fa : std_logic_vector(VA_I_SZ-1 downto 0); -- fault address register end record; constant mmctrl2_zero : mmctrl_type2 := (mmctrl_fs_zero, '0', zero32(VA_I_SZ-1 downto 0)); -- ############################################################## -- 6. Virtual Flush/Probe address [sparc V8: p.249,Appx.H,Figure H-9] -- +---------------------------------------+--------+-------+ -- | VIRTUAL FLUSH&Probe Address (VFPA) | type | rvd | -- +---------------------------------------+--------+-------+ -- 31 12 11 8 7 0 -- -- subtype FPA is natural range 31 downto 12; constant FPA_I1_U : integer := 31; constant FPA_I1_D : integer := 24; constant FPA_I2_U : integer := 23; constant FPA_I2_D : integer := 18; constant FPA_I3_U : integer := 17; constant FPA_I3_D : integer := 12; constant FPTY_U : integer := 10; -- only 3 bits constant FPTY_D : integer := 8; -- ############################################################## -- 7. control register virtual address [sparc V8: p.253,Appx.H,Table H-5] -- +---------------------------------+-----+--------+ -- | | CNR | rsvd | -- +---------------------------------+-----+--------+ -- 31 10 8 7 0 constant CNR_U : integer := 10; constant CNR_D : integer := 8; constant CNR_CTRL : std_logic_vector(2 downto 0) := "000"; constant CNR_CTXP : std_logic_vector(2 downto 0) := "001"; constant CNR_CTX : std_logic_vector(2 downto 0) := "010"; constant CNR_F : std_logic_vector(2 downto 0) := "011"; constant CNR_FADDR : std_logic_vector(2 downto 0) := "100"; -- ############################################################## -- 8. Precise flush (ASI 0x10-14) [sparc V8: p.266,Appx.I] -- supported: ASI_FLUSH_PAGE -- ASI_FLUSH_CTX constant PFLUSH_PAGE : std_logic := '0'; constant PFLUSH_CTX : std_logic := '1'; -- ############################################################## -- 9. Diagnostic access -- constant DIAGF_LVL_U : integer := 1; constant DIAGF_LVL_D : integer := 0; constant DIAGF_WR : integer := 3; constant DIAGF_HIT : integer := 4; constant DIAGF_CTX_U : integer := 12; constant DIAGF_CTX_D : integer := 5; constant DIAGF_VALID : integer := 13; end mmuconfig;
gpl-2.0
6af299699cb752dbdfe7c3b73bce4ce0
0.522579
3.058968
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_ise/hw/xps_proj/pcores/clk_detect_v1_00_a/hdl/vhdl/clk_detect.vhd
1
16,804
-- *************************************************************************** -- ** DISCLAIMER OF LIABILITY ** -- ** ** -- ** This file contains proprietary and confidential information of ** -- ** Xilinx, Inc. ("Xilinx"), that is distributed under a license ** -- ** from Xilinx, and may be used, copied and/or disclosed only ** -- ** pursuant to the terms of a valid license agreement with Xilinx. ** -- ** ** -- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION ** -- ** ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER ** -- ** EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT ** -- ** LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT, ** -- ** MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx ** -- ** does not warrant that functions included in the Materials will ** -- ** meet the requirements of Licensee, or that the operation of the ** -- ** Materials will be uninterrupted or error-free, or that defects ** -- ** in the Materials will be corrected. Furthermore, Xilinx does ** -- ** not warrant or make any representations regarding use, or the ** -- ** results of the use, of the Materials in terms of correctness, ** -- ** accuracy, reliability or otherwise. ** -- ** ** -- ** Xilinx products are not designed or intended to be fail-safe, ** -- ** or for use in any application requiring fail-safe performance, ** -- ** such as life-support or safety devices or systems, Class III ** -- ** medical devices, nuclear facilities, applications related to ** -- ** the deployment of airbags, or any other applications that could ** -- ** lead to death, personal injury or severe property or ** -- ** environmental damage (individually and collectively, "critical ** -- ** applications"). Customer assumes the sole risk and liability ** -- ** of any use of Xilinx products in critical applications, ** -- ** subject only to applicable laws and regulations governing ** -- ** limitations on product liability. ** -- ** ** -- ** Copyright 2010 Xilinx, Inc. ** -- ** All rights reserved. ** -- ** ** -- ** This disclaimer and copyright notice must be retained as part ** -- ** of this file at all times. ** -- *************************************************************************** ------------------------------------------------------------------------------ -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_com" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port: "*_i" -- device pins: "*_pin" -- ports: "- Names begin with Uppercase" -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC>" ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; library proc_common_v3_00_a; use proc_common_v3_00_a.proc_common_pkg.all; use proc_common_v3_00_a.ipif_pkg.all; library axi_lite_ipif_v1_01_a; use axi_lite_ipif_v1_01_a.axi_lite_ipif; library clk_detect_v1_00_a; use clk_detect_v1_00_a.user_logic; ------------------------------------------------------------------------------ -- Entity section ------------------------------------------------------------------------------ -- Definition of Generics: -- C_S_AXI_DATA_WIDTH -- -- C_S_AXI_ADDR_WIDTH -- -- C_S_AXI_MIN_SIZE -- -- C_USE_WSTRB -- -- C_DPHASE_TIMEOUT -- -- C_BASEADDR -- AXI4LITE slave: base address -- C_HIGHADDR -- AXI4LITE slave: high address -- C_FAMILY -- -- C_NUM_REG -- Number of software accessible registers -- C_NUM_MEM -- Number of address-ranges -- C_SLV_AWIDTH -- Slave interface address bus width -- C_SLV_DWIDTH -- Slave interface data bus width -- -- Definition of Ports: -- S_AXI_ACLK -- -- S_AXI_ARESETN -- -- S_AXI_AWADDR -- -- S_AXI_AWVALID -- -- S_AXI_WDATA -- -- S_AXI_WSTRB -- -- S_AXI_WVALID -- -- S_AXI_BREADY -- -- S_AXI_ARADDR -- -- S_AXI_ARVALID -- -- S_AXI_RREADY -- -- S_AXI_ARREADY -- -- S_AXI_RDATA -- -- S_AXI_RRESP -- -- S_AXI_RVALID -- -- S_AXI_WREADY -- -- S_AXI_BRESP -- -- S_AXI_BVALID -- -- S_AXI_AWREADY -- ------------------------------------------------------------------------------ entity clk_detect is generic ( -- ADD USER GENERICS BELOW THIS LINE --------------- --USER generics added here -- ADD USER GENERICS ABOVE THIS LINE --------------- -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol parameters, do not add to or delete C_S_AXI_DATA_WIDTH : integer := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector := X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer := 8; C_BASEADDR : std_logic_vector := X"40000000"; C_HIGHADDR : std_logic_vector := X"40000FFF"; C_FAMILY : string := "virtex6"; C_NUM_REG : integer := 1; C_NUM_MEM : integer := 1; C_SLV_AWIDTH : integer := 32; C_SLV_DWIDTH : integer := 32 -- DO NOT EDIT ABOVE THIS LINE --------------------- ); port ( -- ADD USER PORTS BELOW THIS LINE ------------------ -- User logic ports DUT_CLK : in std_logic; -- ADD USER PORTS ABOVE THIS LINE ------------------ -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol ports, do not add to or delete S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_WDATA : in std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_RREADY : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_AWREADY : out std_logic -- DO NOT EDIT ABOVE THIS LINE --------------------- ); attribute MAX_FANOUT : string; attribute SIGIS : string; attribute MAX_FANOUT of S_AXI_ACLK : signal is "10000"; attribute MAX_FANOUT of S_AXI_ARESETN : signal is "10000"; attribute SIGIS of S_AXI_ACLK : signal is "Clk"; attribute SIGIS of S_AXI_ARESETN : signal is "Rst"; end entity clk_detect; ------------------------------------------------------------------------------ -- Architecture section ------------------------------------------------------------------------------ architecture IMP of clk_detect is constant USER_SLV_DWIDTH : integer := C_S_AXI_DATA_WIDTH; constant IPIF_SLV_DWIDTH : integer := C_S_AXI_DATA_WIDTH; constant ZERO_ADDR_PAD : std_logic_vector(0 to 31) := (others => '0'); constant USER_SLV_BASEADDR : std_logic_vector := C_BASEADDR; constant USER_SLV_HIGHADDR : std_logic_vector := C_BASEADDR or X"0000001F"; constant IPIF_ARD_ADDR_RANGE_ARRAY : SLV64_ARRAY_TYPE := ( ZERO_ADDR_PAD & USER_SLV_BASEADDR, -- user logic slave space base address ZERO_ADDR_PAD & USER_SLV_HIGHADDR -- user logic slave space high address ); constant USER_SLV_NUM_REG : integer := 8; constant USER_NUM_REG : integer := USER_SLV_NUM_REG; constant TOTAL_IPIF_CE : integer := USER_NUM_REG; constant IPIF_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := ( 0 => (USER_SLV_NUM_REG) -- number of ce for user logic slave space ); ------------------------------------------ -- Index for CS/CE ------------------------------------------ constant USER_SLV_CS_INDEX : integer := 0; constant USER_SLV_CE_INDEX : integer := calc_start_ce_index(IPIF_ARD_NUM_CE_ARRAY, USER_SLV_CS_INDEX); constant USER_CE_INDEX : integer := USER_SLV_CE_INDEX; ------------------------------------------ -- IP Interconnect (IPIC) signal declarations ------------------------------------------ signal ipif_Bus2IP_Clk : std_logic; signal ipif_Bus2IP_Resetn : std_logic; signal ipif_Bus2IP_Addr : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); signal ipif_Bus2IP_RNW : std_logic; signal ipif_Bus2IP_BE : std_logic_vector(IPIF_SLV_DWIDTH/8-1 downto 0); signal ipif_Bus2IP_CS : std_logic_vector((IPIF_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1 downto 0); signal ipif_Bus2IP_RdCE : std_logic_vector(calc_num_ce(IPIF_ARD_NUM_CE_ARRAY)-1 downto 0); signal ipif_Bus2IP_WrCE : std_logic_vector(calc_num_ce(IPIF_ARD_NUM_CE_ARRAY)-1 downto 0); signal ipif_Bus2IP_Data : std_logic_vector(IPIF_SLV_DWIDTH-1 downto 0); signal ipif_IP2Bus_WrAck : std_logic; signal ipif_IP2Bus_RdAck : std_logic; signal ipif_IP2Bus_Error : std_logic; signal ipif_IP2Bus_Data : std_logic_vector(IPIF_SLV_DWIDTH-1 downto 0); signal user_Bus2IP_RdCE : std_logic_vector(USER_NUM_REG-1 downto 0); signal user_Bus2IP_WrCE : std_logic_vector(USER_NUM_REG-1 downto 0); signal user_IP2Bus_Data : std_logic_vector(USER_SLV_DWIDTH-1 downto 0); signal user_IP2Bus_RdAck : std_logic; signal user_IP2Bus_WrAck : std_logic; signal user_IP2Bus_Error : std_logic; begin ------------------------------------------ -- instantiate axi_lite_ipif ------------------------------------------ AXI_LITE_IPIF_I : entity axi_lite_ipif_v1_01_a.axi_lite_ipif generic map ( C_S_AXI_DATA_WIDTH => IPIF_SLV_DWIDTH, C_S_AXI_ADDR_WIDTH => C_S_AXI_ADDR_WIDTH, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_ARD_ADDR_RANGE_ARRAY => IPIF_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => IPIF_ARD_NUM_CE_ARRAY, C_FAMILY => C_FAMILY ) port map ( S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_RREADY => S_AXI_RREADY, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_AWREADY => S_AXI_AWREADY, Bus2IP_Clk => ipif_Bus2IP_Clk, Bus2IP_Resetn => ipif_Bus2IP_Resetn, Bus2IP_Addr => ipif_Bus2IP_Addr, Bus2IP_RNW => ipif_Bus2IP_RNW, Bus2IP_BE => ipif_Bus2IP_BE, Bus2IP_CS => ipif_Bus2IP_CS, Bus2IP_RdCE => ipif_Bus2IP_RdCE, Bus2IP_WrCE => ipif_Bus2IP_WrCE, Bus2IP_Data => ipif_Bus2IP_Data, IP2Bus_WrAck => ipif_IP2Bus_WrAck, IP2Bus_RdAck => ipif_IP2Bus_RdAck, IP2Bus_Error => ipif_IP2Bus_Error, IP2Bus_Data => ipif_IP2Bus_Data ); ------------------------------------------ -- instantiate User Logic ------------------------------------------ USER_LOGIC_I : entity clk_detect_v1_00_a.user_logic generic map ( -- MAP USER GENERICS BELOW THIS LINE --------------- --USER generics mapped here -- MAP USER GENERICS ABOVE THIS LINE --------------- C_NUM_REG => USER_NUM_REG, C_SLV_DWIDTH => USER_SLV_DWIDTH ) port map ( -- MAP USER PORTS BELOW THIS LINE ------------------ -- User logic ports dut_clk => dut_CLK, -- MAP USER PORTS ABOVE THIS LINE ------------------ Bus2IP_Clk => ipif_Bus2IP_Clk, Bus2IP_Resetn => ipif_Bus2IP_Resetn, Bus2IP_Data => ipif_Bus2IP_Data, Bus2IP_BE => ipif_Bus2IP_BE, Bus2IP_RdCE => user_Bus2IP_RdCE, Bus2IP_WrCE => user_Bus2IP_WrCE, IP2Bus_Data => user_IP2Bus_Data, IP2Bus_RdAck => user_IP2Bus_RdAck, IP2Bus_WrAck => user_IP2Bus_WrAck, IP2Bus_Error => user_IP2Bus_Error ); ------------------------------------------ -- connect internal signals ------------------------------------------ ipif_IP2Bus_Data <= user_IP2Bus_Data; ipif_IP2Bus_WrAck <= user_IP2Bus_WrAck; ipif_IP2Bus_RdAck <= user_IP2Bus_RdAck; ipif_IP2Bus_Error <= user_IP2Bus_Error; user_Bus2IP_RdCE <= ipif_Bus2IP_RdCE(USER_NUM_REG-1 downto 0); user_Bus2IP_WrCE <= ipif_Bus2IP_WrCE(USER_NUM_REG-1 downto 0); end IMP;
gpl-3.0
2ad23e50a7d4e0b849cf5f95d5b99695
0.438408
4.16456
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/tech/virage/simprims/virage_simprims.vhd
1
18,532
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: virage_simprims -- File: virage_simprims.vhd -- Author: Jiri Gaisler, Gaisler Research -- Description: Simple simulation models for VIRAGE RAMs ----------------------------------------------------------------------------- -- pragma translate_off library ieee; use ieee.std_logic_1164.all; package virage_simprims is component virage_syncram_sim generic ( abits : integer := 10; dbits : integer := 8 ); port ( addr : in std_logic_vector((abits -1) downto 0); clk : in std_logic; di : in std_logic_vector((dbits -1) downto 0); do : out std_logic_vector((dbits -1) downto 0); me : in std_logic; oe : in std_logic; we : in std_logic ); end component; -- synchronous 2-port ram component virage_2pram_sim generic ( abits : integer := 8; dbits : integer := 32; words : integer := 256 ); port ( addra, addrb : in std_logic_vector((abits -1) downto 0); clka, clkb : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); mea, wea, meb, oeb : in std_logic ); end component; component virage_dpram_sim generic ( abits : integer := 8; dbits : integer := 32 ); port ( addra : in std_logic_vector((abits -1) downto 0); clka : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); doa : out std_logic_vector((dbits -1) downto 0); mea, oea, wea : in std_logic; addrb : in std_logic_vector((abits -1) downto 0); clkb : in std_logic; dib : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); meb, oeb, web : in std_logic ); end component; end; -- 1-port syncronous ram library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity virage_syncram_sim is generic ( abits : integer := 10; dbits : integer := 8 ); port ( addr : in std_logic_vector((abits -1) downto 0); clk : in std_logic; di : in std_logic_vector((dbits -1) downto 0); do : out std_logic_vector((dbits -1) downto 0); me : in std_logic; oe : in std_logic; we : in std_logic ); end; architecture behavioral of virage_syncram_sim is subtype word is std_logic_vector((dbits -1) downto 0); type mem is array(0 to (2**abits -1)) of word; begin main : process(clk, oe, me) variable memarr : mem;-- := (others => (others => '0')); variable doint : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clk) and (me = '1') and not is_x(addr) then if (we = '1') then memarr(to_integer(unsigned(addr))) := di; end if; doint := memarr(to_integer(unsigned(addr))); end if; -- if (me and oe) = '1' then do <= doint; if oe = '1' then do <= doint; else do <= (others => 'Z'); end if; end process; end behavioral; -- synchronous 2-port ram library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity virage_2pram_sim is generic ( abits : integer := 10; dbits : integer := 8; words : integer := 1024 ); port ( addra, addrb : in std_logic_vector((abits -1) downto 0); clka, clkb : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); mea, wea, meb, oeb : in std_logic ); end; architecture behavioral of virage_2pram_sim is subtype word is std_logic_vector((dbits -1) downto 0); type mem is array(0 to (words-1)) of word; begin main : process(clka, clkb, oeb, mea, meb, wea) variable memarr : mem; variable doint : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clka) and (mea = '1') and not is_x(addra) then if (wea = '1') then memarr(to_integer(unsigned(addra)) mod words) := dia; end if; end if; if rising_edge(clkb) and (meb = '1') and not is_x(addrb) then doint := memarr(to_integer(unsigned(addrb)) mod words); end if; if oeb = '1' then dob <= doint; else dob <= (others => 'Z'); end if; end process; end behavioral; -- synchronous dual-port ram library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity virage_dpram_sim is generic ( abits : integer := 10; dbits : integer := 8 ); port ( addra : in std_logic_vector((abits -1) downto 0); clka : in std_logic; dia : in std_logic_vector((dbits -1) downto 0); doa : out std_logic_vector((dbits -1) downto 0); mea, oea, wea : in std_logic; addrb : in std_logic_vector((abits -1) downto 0); clkb : in std_logic; dib : in std_logic_vector((dbits -1) downto 0); dob : out std_logic_vector((dbits -1) downto 0); meb, oeb, web : in std_logic ); end; architecture behavioral of virage_dpram_sim is subtype word is std_logic_vector((dbits -1) downto 0); type mem is array(0 to (2**abits -1)) of word; begin main : process(clka, oea, mea, clkb, oeb, meb) variable memarr : mem; variable dointa, dointb : std_logic_vector((dbits -1) downto 0); begin if rising_edge(clka) and (mea = '1') and not is_x(addra) then if (wea = '1') then memarr(to_integer(unsigned(addra))) := dia; end if; dointa := memarr(to_integer(unsigned(addra))); end if; if oea = '1' then doa <= dointa; else doa <= (others => 'Z'); end if; if rising_edge(clkb) and (meb = '1') and not is_x(addrb) then if (web = '1') then memarr(to_integer(unsigned(addrb))) := dib; end if; dointb := memarr(to_integer(unsigned(addrb))); end if; if oeb = '1' then dob <= dointb; else dob <= (others => 'Z'); end if; end process; end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_128x32cm4sw0ab is port ( addr, taddr : in std_logic_vector(6 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_128x32cm4sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 7, dbits => 32) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_256x32cm4sw0ab is port ( addr, taddr : in std_logic_vector(7 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_256x32cm4sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 8, dbits => 32) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_512x32cm4sw0ab is port ( addr, taddr : in std_logic_vector(8 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_512x32cm4sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 9, dbits => 32) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_512x38cm4sw0ab is port ( addr, taddr : in std_logic_vector(8 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(37 downto 0); do : out std_logic_vector(37 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_512x38cm4sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 9, dbits => 38) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_1024x32cm4sw0ab is port ( addr, taddr : in std_logic_vector(9 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_1024x32cm4sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 10, dbits => 32) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_2048x32cm8sw0ab is port ( addr, taddr : in std_logic_vector(10 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(31 downto 0); do : out std_logic_vector(31 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_2048x32cm8sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 11, dbits => 32) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_4096x36cm8sw0ab is port ( addr, taddr : in std_logic_vector(11 downto 0); clk : in std_logic; di, tdi : in std_logic_vector(35 downto 0); do : out std_logic_vector(35 downto 0); me, oe, we, tme, twe, awt, biste, toe : in std_logic ); end; architecture behavioral of hdss1_4096x36cm8sw0ab is begin syncram0 : virage_syncram_sim generic map ( abits => 12, dbits => 36) port map ( addr, clk, di, do, me, oe, we); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss1_16384x8cm16sw0 is port ( addr : in std_logic_vector(13 downto 0); clk : in std_logic; di : in std_logic_vector(7 downto 0); do : out std_logic_vector(7 downto 0); me, oe, we : in std_logic ); end; architecture behavioral of hdss1_16384x8cm16sw0 is begin syncram0 : virage_syncram_sim generic map ( abits => 14, dbits => 8) port map ( addr, clk, di, do, me, oe, we); end behavioral; -- 2-port syncronous ram library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity rfss2_136x32cm2sw0ab is port ( addra, taddra : in std_logic_vector(7 downto 0); addrb, taddrb : in std_logic_vector(7 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dob : out std_logic_vector(31 downto 0); mea, wea, tmea, twea, bistea : in std_logic; meb, oeb, tmeb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of rfss2_136x32cm2sw0ab is begin syncram0 : virage_2pram_sim generic map ( abits => 8, dbits => 32, words => 136) port map ( addra, addrb, clka, clkb, dia, dob, mea, wea, meb, oeb); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity rfss2_136x40cm2sw0ab is port ( addra, taddra : in std_logic_vector(7 downto 0); addrb, taddrb : in std_logic_vector(7 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(39 downto 0); dob : out std_logic_vector(39 downto 0); mea, wea, tmea, twea, bistea : in std_logic; meb, oeb, tmeb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of rfss2_136x40cm2sw0ab is begin syncram0 : virage_2pram_sim generic map ( abits => 8, dbits => 40, words => 136) port map ( addra, addrb, clka, clkb, dia, dob, mea, wea, meb, oeb); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity rfss2_168x32cm2sw0ab is port ( addra, taddra : in std_logic_vector(7 downto 0); addrb, taddrb : in std_logic_vector(7 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dob : out std_logic_vector(31 downto 0); mea, wea, tmea, twea, bistea : in std_logic; meb, oeb, tmeb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of rfss2_168x32cm2sw0ab is begin syncram0 : virage_2pram_sim generic map ( abits => 8, dbits => 32, words => 168) port map ( addra, addrb, clka, clkb, dia, dob, mea, wea, meb, oeb); end behavioral; -- dual-port syncronous ram library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_64x32cm4sw0ab is port ( addra, taddra : in std_logic_vector(5 downto 0); addrb, taddrb : in std_logic_vector(5 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dib, tdib : in std_logic_vector(31 downto 0); doa, dob : out std_logic_vector(31 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_64x32cm4sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 6, dbits => 32) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_128x32cm4sw0ab is port ( addra, taddra : in std_logic_vector(6 downto 0); addrb, taddrb : in std_logic_vector(6 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dib, tdib : in std_logic_vector(31 downto 0); doa, dob : out std_logic_vector(31 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_128x32cm4sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 7, dbits => 32) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_256x32cm4sw0ab is port ( addra, taddra : in std_logic_vector(7 downto 0); addrb, taddrb : in std_logic_vector(7 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dib, tdib : in std_logic_vector(31 downto 0); doa, dob : out std_logic_vector(31 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_256x32cm4sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 8, dbits => 32) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_512x32cm4sw0ab is port ( addra, taddra : in std_logic_vector(8 downto 0); addrb, taddrb : in std_logic_vector(8 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(31 downto 0); dib, tdib : in std_logic_vector(31 downto 0); doa, dob : out std_logic_vector(31 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_512x32cm4sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 9, dbits => 32) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_512x38cm4sw0ab is port ( addra, taddra : in std_logic_vector(8 downto 0); addrb, taddrb : in std_logic_vector(8 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(37 downto 0); dib, tdib : in std_logic_vector(37 downto 0); doa, dob : out std_logic_vector(37 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_512x38cm4sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 9, dbits => 38) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; library ieee; use ieee.std_logic_1164.all; library virage; use virage.virage_simprims.all; entity hdss2_8192x8cm16sw0ab is port ( addra, taddra : in std_logic_vector(12 downto 0); addrb, taddrb : in std_logic_vector(12 downto 0); clka, clkb : in std_logic; dia, tdia : in std_logic_vector(7 downto 0); dib, tdib : in std_logic_vector(7 downto 0); doa, dob : out std_logic_vector(7 downto 0); mea, oea, wea, tmea, twea, awta, bistea, toea : in std_logic; meb, oeb, web, tmeb, tweb, awtb, bisteb, toeb : in std_logic ); end; architecture behavioral of hdss2_8192x8cm16sw0ab is begin syncram0 : virage_dpram_sim generic map ( abits => 13, dbits => 8) port map ( addra, clka, dia, doa, mea, oea, wea, addrb, clkb, dib, dob, meb, oeb, web); end behavioral; -- pragma translate_on
gpl-2.0
2a1d7aea7d6bde2e1ff0d5a1671a4619
0.634092
3.167322
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/sdram_phy.vhd
1
7,900
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: sdram_phy -- File: sdram_phy.vhd -- Author: Jan Andersson - Aeroflex Gaisler -- Description: SDRAM PHY with tech mapping, includes pads and can be -- implemented with registers on all signals. ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; use techmap.allpads.all; entity sdram_phy is generic ( tech : integer := spartan3; oepol : integer := 0; level : integer := 0; voltage : integer := x33v; strength : integer := 12; aw : integer := 15; -- # address bits dw : integer := 32; -- # data bits ncs : integer := 2; reg : integer := 0); -- 1: include registers on all signals port ( -- SDRAM interface addr : out std_logic_vector(aw-1 downto 0); dq : inout std_logic_vector(dw-1 downto 0); cke : out std_logic_vector(ncs-1 downto 0); sn : out std_logic_vector(ncs-1 downto 0); wen : out std_ulogic; rasn : out std_ulogic; casn : out std_ulogic; dqm : out std_logic_vector(dw/8-1 downto 0); -- Interface toward memory controller laddr : in std_logic_vector(aw-1 downto 0); ldq_din : out std_logic_vector(dw-1 downto 0); ldq_dout : in std_logic_vector(dw-1 downto 0); ldq_oen : in std_logic_vector(dw-1 downto 0); lcke : in std_logic_vector(ncs-1 downto 0); lsn : in std_logic_vector(ncs-1 downto 0); lwen : in std_ulogic; lrasn : in std_ulogic; lcasn : in std_ulogic; ldqm : in std_logic_vector(dw/8-1 downto 0); -- Only used when reg generic is non-zero rstn : in std_ulogic; -- Registered pads reset clk : in std_ulogic; -- SDRAM clock for registered pads -- Optional pad configuration inputs cfgi_cmd : in std_logic_vector(19 downto 0) := "00000000000000000000"; -- CMD pads cfgi_dq : in std_logic_vector(19 downto 0) := "00000000000000000000" -- DQ pads ); end; architecture rtl of sdram_phy is signal laddrx : std_logic_vector(aw-1 downto 0); signal ldq_dinx : std_logic_vector(dw-1 downto 0); signal ldq_doutx : std_logic_vector(dw-1 downto 0); signal ldq_oenx : std_logic_vector(dw-1 downto 0); signal lckex : std_logic_vector(ncs-1 downto 0); signal lsnx : std_logic_vector(ncs-1 downto 0); signal lwenx : std_ulogic; signal lrasnx : std_ulogic; signal lcasnx : std_ulogic; signal ldqmx : std_logic_vector(dw/8-1 downto 0); signal oen : std_ulogic; signal voen : std_logic_vector(dw-1 downto 0); -- Determines if there is a customized phy available for target tech, -- otherwise a generic PHY will be built constant has_sdram_phy : tech_ability_type := (easic45 => 1, others => 0); -- Determines if target tech has pads with built in registers (or rather if -- target technology requires special pad instantiations in order to get -- registers into pad ring). constant tech_has_padregs : tech_ability_type := (easic45 => 1, others => 0); begin oen <= not ldq_oen(0) when padoen_polarity(tech) /= oepol else ldq_oen(0); voen <= not ldq_oen when padoen_polarity(tech) /= oepol else ldq_oen; nopadregs : if (reg = 0) or (tech_has_padregs(tech) /= 0) generate laddrx <= laddr; ldq_din <= ldq_dinx; ldq_doutx <= ldq_dout; ldq_oenx <= voen; lckex <= lcke; lsnx <= lsn; lwenx <= lwen; lrasnx <= lrasn; lcasnx <= lcasn; ldqmx <= ldqm; end generate; padregs : if (reg /= 0) and (tech_has_padregs(tech) = 0) generate regproc : process(clk, rstn) begin if rising_edge(clk) then laddrx <= laddr; ldq_din <= ldq_dinx; ldq_doutx <= ldq_dout; ldq_oenx <= (others => oen); lckex <= lcke; lsnx <= lsn; lwenx <= lwen; lrasnx <= lrasn; lcasnx <= lcasn; ldqmx <= ldqm; end if; if rstn = '0' then lsnx <= (others => '1'); for i in ldq_oenx'range loop ldq_oenx(i) <= conv_std_logic(padoen_polarity(tech) = 0); end loop; end if; end process; end generate; gen : if has_sdram_phy(tech) = 0 generate -- SDRAM address sa_pad : outpadv generic map ( width => aw, tech => tech, level => level, voltage => voltage, strength => strength) port map (addr, laddrx, cfgi_cmd); -- SDRAM data sd_pad : iopadvv generic map ( width => dw, tech => tech, level => level, voltage => voltage, strength => strength, oepol => padoen_polarity(tech)) port map (dq, ldq_doutx, ldq_oenx, ldq_dinx, cfgi_dq); -- SDRAM clock enable sdcke_pad : outpadv generic map ( width => ncs, tech => tech, level => level, voltage => voltage, strength => strength) port map (cke, lckex, cfgi_cmd); -- SDRAM write enable sdwen_pad : outpad generic map ( tech => tech, level => level, voltage => voltage, strength => strength) port map (wen, lwenx, cfgi_cmd); -- SDRAM chip select sdcsn_pad : outpadv generic map ( width => ncs, tech => tech, level => level, voltage => voltage, strength => strength) port map (sn, lsnx, cfgi_cmd); -- SDRAM ras sdras_pad : outpad generic map ( tech => tech, level => level, voltage => voltage, strength => strength) port map (rasn, lrasnx, cfgi_cmd); -- SDRAM cas sdcas_pad : outpad generic map ( tech => tech, level => level, voltage => voltage, strength => strength) port map (casn, lcasnx, cfgi_cmd); -- SDRAM dqm sddqm_pad : outpadv generic map ( width => dw/8, level => level, voltage => voltage, tech => tech, strength => strength) port map (dqm, ldqmx, cfgi_cmd); end generate; n2x : if (tech = easic45) generate phy0 : n2x_sdram_phy generic map ( level => level, voltage => voltage, strength => strength, aw => aw, dw => dw, ncs => ncs, reg => reg) port map ( addr, dq, cke, sn, wen, rasn, casn, dqm, laddrx, ldq_dinx, ldq_doutx, ldq_oenx, lckex, lsnx, lwenx, lrasnx, lcasnx, ldqmx, rstn, clk, cfgi_cmd, cfgi_dq); end generate; end;
gpl-2.0
b6eed04c0c4dc352cec66d4d13237a32
0.554937
3.695042
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/digit/simulation/digit_tb.vhd
1
4,337
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Top File for the Example Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- Filename: digit_tb.vhd -- Description: -- Testbench Top -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.ALL; ENTITY digit_tb IS END ENTITY; ARCHITECTURE digit_tb_ARCH OF digit_tb IS SIGNAL STATUS : STD_LOGIC_VECTOR(8 DOWNTO 0); SIGNAL CLK : STD_LOGIC := '1'; SIGNAL RESET : STD_LOGIC; BEGIN CLK_GEN: PROCESS BEGIN CLK <= NOT CLK; WAIT FOR 100 NS; CLK <= NOT CLK; WAIT FOR 100 NS; END PROCESS; RST_GEN: PROCESS BEGIN RESET <= '1'; WAIT FOR 1000 NS; RESET <= '0'; WAIT; END PROCESS; --STOP_SIM: PROCESS BEGIN -- WAIT FOR 200 US; -- STOP SIMULATION AFTER 1 MS -- ASSERT FALSE -- REPORT "END SIMULATION TIME REACHED" -- SEVERITY FAILURE; --END PROCESS; -- PROCESS BEGIN WAIT UNTIL STATUS(8)='1'; IF( STATUS(7 downto 0)/="0") THEN ASSERT false REPORT "Test Completed Successfully" SEVERITY NOTE; REPORT "Simulation Failed" SEVERITY FAILURE; ELSE ASSERT false REPORT "TEST PASS" SEVERITY NOTE; REPORT "Test Completed Successfully" SEVERITY FAILURE; END IF; END PROCESS; digit_synth_inst:ENTITY work.digit_synth GENERIC MAP (C_ROM_SYNTH => 0) PORT MAP( CLK_IN => CLK, RESET_IN => RESET, STATUS => STATUS ); END ARCHITECTURE;
mit
6c8b8348d8d932b9bafb4ac29542e3c9
0.618861
4.663441
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/amba/ahbmst.vhd
1
5,731
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahbmst -- File: ahbmst.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Generic AHB master interface ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.config_types.all; use grlib.config.all; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; entity ahbmst is generic ( hindex : integer := 0; hirq : integer := 0; venid : integer := VENDOR_GAISLER; devid : integer := 0; version : integer := 0; chprot : integer := 3; incaddr : integer := 0); port ( rst : in std_ulogic; clk : in std_ulogic; dmai : in ahb_dma_in_type; dmao : out ahb_dma_out_type; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type ); end; architecture rtl of ahbmst is constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( venid, devid, 0, version, 0), others => zero32); type reg_type is record start : std_ulogic; retry : std_ulogic; grant : std_ulogic; active : std_ulogic; end record; constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; constant RES : reg_type := ('0', '0', '0', '0'); signal r, rin : reg_type; begin comb : process(ahbi, dmai, rst, r) variable v : reg_type; variable ready : std_ulogic; variable retry : std_ulogic; variable mexc : std_ulogic; variable inc : std_logic_vector(5 downto 0); -- address increment variable haddr : std_logic_vector(31 downto 0); -- AHB address variable hwdata : std_logic_vector(AHBDW-1 downto 0); -- AHB write data variable htrans : std_logic_vector(1 downto 0); -- transfer type variable hwrite : std_ulogic; -- read/write variable hburst : std_logic_vector(2 downto 0); -- burst type variable newaddr : std_logic_vector(9 downto 0); -- next sequential address variable hbusreq : std_ulogic; -- bus request variable hprot : std_logic_vector(3 downto 0); -- transfer type variable xhirq : std_logic_vector(NAHBIRQ-1 downto 0); begin v := r; ready := '0'; mexc := '0'; retry := '0'; inc := (others => '0'); hprot := conv_std_logic_vector(chprot, 4); -- non-cached supervisor data xhirq := (others => '0'); xhirq(hirq) := dmai.irq; haddr := dmai.address; hbusreq := dmai.start; hwdata := dmai.wdata; newaddr := dmai.address(9 downto 0); if INCADDR > 0 then inc(conv_integer(dmai.size)) := '1'; newaddr := haddr(9 downto 0) + inc; end if; if dmai.burst = '0' then hburst := HBURST_SINGLE; else hburst := HBURST_INCR; end if; if dmai.start = '1' then if (r.active and dmai.burst and not r.retry) = '1' then haddr(9 downto 0) := newaddr; if dmai.busy = '1' then htrans := HTRANS_BUSY; else htrans := HTRANS_SEQ; end if; hburst := HBURST_INCR; else htrans := HTRANS_NONSEQ; end if; else htrans := HTRANS_IDLE; end if; if r.active = '1' then if ahbi.hready = '1' then case ahbi.hresp is when HRESP_OKAY => ready := '1'; when HRESP_RETRY | HRESP_SPLIT=> retry := '1'; when others => ready := '1'; mexc := '1'; end case; end if; if ((ahbi.hresp = HRESP_RETRY) or (ahbi.hresp = HRESP_SPLIT)) then v.retry := not ahbi.hready; else v.retry := '0'; end if; end if; if r.retry = '1' then htrans := HTRANS_IDLE; end if; v.start := '0'; if ahbi.hready = '1' then v.grant := ahbi.hgrant(hindex); if (htrans = HTRANS_NONSEQ) or (htrans = HTRANS_SEQ) or (htrans = HTRANS_BUSY) then v.active := r.grant; v.start := r.grant; else v.active := '0'; end if; end if; if (not RESET_ALL) and (rst = '0') then v.retry := RES.retry; v.active := RES.active; end if; rin <= v; ahbo.haddr <= haddr; ahbo.htrans <= htrans; ahbo.hbusreq <= hbusreq; ahbo.hwdata <= hwdata; ahbo.hconfig <= hconfig; ahbo.hlock <= '0'; ahbo.hwrite <= dmai.write; ahbo.hsize <= dmai.size; ahbo.hburst <= hburst; ahbo.hprot <= hprot; ahbo.hirq <= xhirq; ahbo.hindex <= hindex; dmao.start <= r.start; dmao.active <= r.active; dmao.ready <= ready; dmao.mexc <= mexc; dmao.retry <= retry; dmao.haddr <= newaddr; dmao.rdata <= ahbi.hrdata; end process; regs : process(clk) begin if rising_edge(clk) then r <= rin; if RESET_ALL and rst = '0' then r <= RES; end if; end if; end process; end;
gpl-2.0
26760aeb0387ab9357880c872d64d246
0.579655
3.599874
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_dma_v7_1/2a047f91/hdl/src/vhdl/axi_dma_sofeof_gen.vhd
3
19,868
-- (c) Copyright 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------ ------------------------------------------------------------------------------- -- Filename: axi_dma_sofeof_gen.vhd -- Description: This entity manages -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library unisim; use unisim.vcomponents.all; library lib_cdc_v1_0; library axi_dma_v7_1; use axi_dma_v7_1.axi_dma_pkg.all; ------------------------------------------------------------------------------- entity axi_dma_sofeof_gen is generic ( C_PRMRY_IS_ACLK_ASYNC : integer range 0 to 1 := 0 -- Primary MM2S/S2MM sync/async mode -- 0 = synchronous mode - all clocks are synchronous -- 1 = asynchronous mode - Primary data path channels (MM2S and S2MM) -- run asynchronous to AXI Lite, DMA Control, -- and SG. ); port ( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- axi_prmry_aclk : in std_logic ; -- p_reset_n : in std_logic ; -- -- m_axi_sg_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- -- axis_tready : in std_logic ; -- axis_tvalid : in std_logic ; -- axis_tlast : in std_logic ; -- -- packet_sof : out std_logic ; -- packet_eof : out std_logic -- -- ); end axi_dma_sofeof_gen; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_dma_sofeof_gen is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ATTRIBUTE async_reg : STRING; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- No Constants Declared ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal p_ready : std_logic := '0'; signal p_valid : std_logic := '0'; signal p_valid_d1 : std_logic := '0'; signal p_valid_re : std_logic := '0'; signal p_last : std_logic := '0'; signal p_last_d1 : std_logic := '0'; signal p_last_re : std_logic := '0'; signal s_ready : std_logic := '0'; signal s_valid : std_logic := '0'; signal s_valid_d1 : std_logic := '0'; signal s_valid_re : std_logic := '0'; signal s_last : std_logic := '0'; signal s_last_d1 : std_logic := '0'; signal s_last_re : std_logic := '0'; signal s_sof_d1_cdc_tig : std_logic := '0'; signal s_sof_d2 : std_logic := '0'; --ATTRIBUTE async_reg OF s_sof_d1_cdc_tig : SIGNAL IS "true"; --ATTRIBUTE async_reg OF s_sof_d2 : SIGNAL IS "true"; signal s_sof_d3 : std_logic := '0'; signal s_sof_re : std_logic := '0'; signal s_sof : std_logic := '0'; signal p_sof : std_logic := '0'; signal s_eof_d1_cdc_tig : std_logic := '0'; signal s_eof_d2 : std_logic := '0'; --ATTRIBUTE async_reg OF s_eof_d1_cdc_tig : SIGNAL IS "true"; --ATTRIBUTE async_reg OF s_eof_d2 : SIGNAL IS "true"; signal s_eof_d3 : std_logic := '0'; signal s_eof_re : std_logic := '0'; signal p_eof : std_logic := '0'; signal p_eof_d1_cdc_tig : std_logic := '0'; signal p_eof_d2 : std_logic := '0'; --ATTRIBUTE async_reg OF p_eof_d1_cdc_tig : SIGNAL IS "true"; --ATTRIBUTE async_reg OF p_eof_d2 : SIGNAL IS "true"; signal p_eof_d3 : std_logic := '0'; signal p_eof_clr : std_logic := '0'; signal s_sof_generated : std_logic := '0'; signal sof_generated_fe : std_logic := '0'; signal s_eof_re_latch : std_logic := '0'; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin -- pass internal version out packet_sof <= s_sof_re; packet_eof <= s_eof_re; -- Generate for when primary clock is asynchronous GEN_FOR_ASYNC : if C_PRMRY_IS_ACLK_ASYNC = 1 generate begin --------------------------------------------------------------------------- -- Generate Packet SOF --------------------------------------------------------------------------- -- Register stream control in to isolate wrt clock -- for timing closure REG_STRM_IN : process(axi_prmry_aclk) begin if(axi_prmry_aclk'EVENT and axi_prmry_aclk = '1')then if(p_reset_n = '0')then p_valid <= '0'; p_last <= '0'; p_ready <= '0'; else p_valid <= axis_tvalid; p_last <= axis_tlast ; p_ready <= axis_tready; end if; end if; end process REG_STRM_IN; -- Generate rising edge pulse on valid to use for -- smaple and hold register REG_FOR_RE : process(axi_prmry_aclk) begin if(axi_prmry_aclk'EVENT and axi_prmry_aclk = '1')then if(p_reset_n = '0')then p_valid_d1 <= '0'; p_last_d1 <= '0'; p_last_re <= '0'; else p_valid_d1 <= p_valid and p_ready; p_last_d1 <= p_last and p_valid and p_ready; -- register to aligne with setting of p_sof p_last_re <= p_ready and p_valid and p_last and not p_last_d1; end if; end if; end process REG_FOR_RE; p_valid_re <= p_ready and p_valid and not p_valid_d1; -- Sample and hold valid re to create sof SOF_SMPL_N_HOLD : process(axi_prmry_aclk) begin if(axi_prmry_aclk'EVENT and axi_prmry_aclk = '1')then -- clear at end of packet if(p_reset_n = '0' or p_eof_clr = '1')then p_sof <= '0'; -- assert at beginning of packet hold to allow -- clock crossing to slower secondary clk elsif(p_valid_re = '1')then p_sof <= '1'; end if; end if; end process SOF_SMPL_N_HOLD; -- Register p_sof into secondary clock domain to -- generate packet_sof and also to clear sample and held p_sof SOF_REG2SCNDRY : entity lib_cdc_v1_0.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => p_sof, prmry_vect_in => (others => '0'), scndry_aclk => m_axi_sg_aclk, scndry_resetn => '0', scndry_out => s_sof_d2, scndry_vect_out => open ); SOF_REG2SCNDRY1 : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then -- s_sof_d1_cdc_tig <= '0'; -- s_sof_d2 <= '0'; s_sof_d3 <= '0'; else -- s_sof_d1_cdc_tig <= p_sof; -- s_sof_d2 <= s_sof_d1_cdc_tig; s_sof_d3 <= s_sof_d2; end if; end if; end process SOF_REG2SCNDRY1; s_sof_re <= s_sof_d2 and not s_sof_d3; --------------------------------------------------------------------------- -- Generate Packet EOF --------------------------------------------------------------------------- -- Sample and hold valid re to create sof EOF_SMPL_N_HOLD : process(axi_prmry_aclk) begin if(axi_prmry_aclk'EVENT and axi_prmry_aclk = '1')then if(p_reset_n = '0' or p_eof_clr = '1')then p_eof <= '0'; -- if p_last but p_sof not set then it means between pkt -- gap was too small to catch new sof. therefor do not -- generate eof elsif(p_last_re = '1' and p_sof = '0')then p_eof <= '0'; elsif(p_last_re = '1')then p_eof <= '1'; end if; end if; end process EOF_SMPL_N_HOLD; -- Register p_sof into secondary clock domain to -- generate packet_sof and also to clear sample and held p_sof -- CDC register has to be a pure flop EOF_REG2SCNDRY : entity lib_cdc_v1_0.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => p_eof, prmry_vect_in => (others => '0'), scndry_aclk => m_axi_sg_aclk, scndry_resetn => '0', scndry_out => s_eof_d2, scndry_vect_out => open ); EOF_REG2SCNDRY1 : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then -- s_eof_d1_cdc_tig <= '0'; -- s_eof_d2 <= '0'; s_eof_d3 <= '0'; -- CR605883 else -- s_eof_d1_cdc_tig <= p_eof; -- s_eof_d2 <= s_eof_d1_cdc_tig; s_eof_d3 <= s_eof_d2; -- CR605883 end if; end if; end process EOF_REG2SCNDRY1; s_eof_re <= s_eof_d2 and not s_eof_d3; EOF_latch : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then s_eof_re_latch <= '0'; elsif (s_eof_re = '1') then s_eof_re_latch <= not s_eof_re_latch; end if; end if; end process EOF_latch; -- Register s_sof_re back into primary clock domain to use -- as clear of p_sof. EOF_REG2PRMRY : entity lib_cdc_v1_0.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => s_eof_re_latch, prmry_vect_in => (others => '0'), scndry_aclk => axi_prmry_aclk, scndry_resetn => '0', scndry_out => p_eof_d2, scndry_vect_out => open ); EOF_REG2PRMRY1 : process(axi_prmry_aclk) begin if(axi_prmry_aclk'EVENT and axi_prmry_aclk = '1')then if(p_reset_n = '0')then -- p_eof_d1_cdc_tig <= '0'; -- p_eof_d2 <= '0'; p_eof_d3 <= '0'; else -- p_eof_d1_cdc_tig <= s_eof_re_latch; -- p_eof_d2 <= p_eof_d1_cdc_tig; p_eof_d3 <= p_eof_d2; end if; end if; end process EOF_REG2PRMRY1; -- p_eof_clr <= p_eof_d2 and not p_eof_d3;-- CR565366 -- drive eof clear for minimum of 2 scndry clocks -- to guarentee secondary capture. this allows -- new valid assertions to not be missed in -- creating next sof. p_eof_clr <= p_eof_d2 xor p_eof_d3; end generate GEN_FOR_ASYNC; -- Generate for when primary clock is synchronous GEN_FOR_SYNC : if C_PRMRY_IS_ACLK_ASYNC = 0 generate begin --------------------------------------------------------------------------- -- Generate Packet EOF and SOF --------------------------------------------------------------------------- -- Register stream control in to isolate wrt clock -- for timing closure REG_STRM_IN : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then s_valid <= '0'; s_last <= '0'; s_ready <= '0'; else s_valid <= axis_tvalid; s_last <= axis_tlast ; s_ready <= axis_tready; end if; end if; end process REG_STRM_IN; -- Generate rising edge pulse on valid to use for -- smaple and hold register REG_FOR_RE : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then s_valid_d1 <= '0'; s_last_d1 <= '0'; else s_valid_d1 <= s_valid and s_ready; s_last_d1 <= s_last and s_valid and s_ready; end if; end if; end process REG_FOR_RE; -- CR565366 investigating delay interurpt issue discovered -- this coding issue. -- s_valid_re <= s_ready and s_valid and not s_last_d1; s_valid_re <= s_ready and s_valid and not s_valid_d1; s_last_re <= s_ready and s_valid and s_last and not s_last_d1; -- Sample and hold valid re to create sof SOF_SMPL_N_HOLD : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(p_reset_n = '0' or s_eof_re = '1')then s_sof_generated <= '0'; -- new elsif((s_valid_re = '1') or (sof_generated_fe = '1' and s_ready = '1' and s_valid = '1'))then s_sof_generated <= '1'; end if; end if; end process SOF_SMPL_N_HOLD; -- Register p_sof into secondary clock domain to -- generate packet_sof and also to clear sample and held p_sof SOF_REG2SCNDRY : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then s_sof_d1_cdc_tig <= '0'; else s_sof_d1_cdc_tig <= s_sof_generated; end if; end if; end process SOF_REG2SCNDRY; -- generate falling edge pulse on end of packet for use if -- need to generate an immediate sof. sof_generated_fe <= not s_sof_generated and s_sof_d1_cdc_tig; -- generate SOF on rising edge of valid if not already in a packet OR... s_sof_re <= '1' when (s_valid_re = '1' and s_sof_generated = '0') or (sof_generated_fe = '1' -- If end of previous packet and s_ready = '1' -- and ready asserted and s_valid = '1') -- and valid asserted else '0'; -- generate eof on rising edge of valid last assertion OR... s_eof_re <= '1' when (s_last_re = '1') or (sof_generated_fe = '1' -- If end of previous packet and s_ready = '1' -- and ready asserted and s_valid = '1' -- and valid asserted and s_last = '1') -- and last asserted else '0'; end generate GEN_FOR_SYNC; end implementation;
gpl-3.0
643bab06d273ea6e1a70c7d4e1e09ead
0.443477
4.088066
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/ahbtrace_mmb.vhd
1
16,020
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahbtrace_mmb -- File: ahbtrace_mmb.vhd -- Author: Jiri Gaisler - Gaisler Research -- Modified: Jan Andersson - Aeroflex Gaisler -- Description: AHB trace unit that can have registers on a separate bus and -- select between several trace buses. ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; entity ahbtrace_mmb is generic ( hindex : integer := 0; ioaddr : integer := 16#000#; iomask : integer := 16#E00#; tech : integer := DEFMEMTECH; irq : integer := 0; kbytes : integer := 1; ahbfilt : integer := 0; ntrace : integer range 1 to 8 := 1); port ( rst : in std_ulogic; clk : in std_ulogic; ahbsi : in ahb_slv_in_type; -- Register interface ahbso : out ahb_slv_out_type; tahbmiv : in ahb_mst_in_vector_type(0 to ntrace-1); -- Trace tahbsiv : in ahb_slv_in_vector_type(0 to ntrace-1) ); end; architecture rtl of ahbtrace_mmb is constant TBUFABITS : integer := log2(kbytes) + 6; constant TIMEBITS : integer := 32; constant FILTEN : boolean := ahbfilt /= 0; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_AHBTRACE, 0, 0, irq), 4 => ahb_iobar (ioaddr, iomask), others => zero32); type tracebuf_in_type is record addr : std_logic_vector(TBUFABITS-1 downto 0); data : std_logic_vector(127 downto 0); enable : std_logic; write : std_logic_vector(3 downto 0); end record; type tracebuf_out_type is record data : std_logic_vector(127 downto 0); end record; type trace_break_reg is record addr : std_logic_vector(31 downto 2); mask : std_logic_vector(31 downto 2); read : std_logic; write : std_logic; end record; type regtype is record thaddr : std_logic_vector(31 downto 0); thwrite : std_logic; thtrans : std_logic_vector(1 downto 0); thsize : std_logic_vector(2 downto 0); thburst : std_logic_vector(2 downto 0); thmaster : std_logic_vector(3 downto 0); thmastlock : std_logic; ahbactive : std_logic; timer : std_logic_vector(TIMEBITS-1 downto 0); aindex : std_logic_vector(TBUFABITS - 1 downto 0); -- buffer index hready : std_logic; hready2 : std_logic; hready3 : std_logic; hsel : std_logic; hwrite : std_logic; haddr : std_logic_vector(TBUFABITS+3 downto 2); hrdata : std_logic_vector(31 downto 0); regacc : std_logic; enable : std_logic; -- trace enable bahb : std_logic; -- break on AHB watchpoint hit bhit : std_logic; -- breakpoint hit dcnten : std_logic; -- delay counter enable delaycnt : std_logic_vector(TBUFABITS - 1 downto 0); -- delay counter tbreg1 : trace_break_reg; tbreg2 : trace_break_reg; end record; type fregtype is record shsel : std_logic_vector(0 to NAHBSLV-1); af : std_ulogic; -- Address filtering fr : std_ulogic; -- Filter reads fw : std_ulogic; -- Filter writes smask : std_logic_vector(15 downto 0); mmask : std_logic_vector(15 downto 0); rf : std_ulogic; -- Retry filtering end record; type bregtype is record bsel : std_logic_vector(log2(ntrace) downto 0); end record; function ahb_filt_hit ( r : regtype; rf : fregtype; hresp : std_logic_vector(1 downto 0)) return boolean is variable hit : boolean; begin -- filter hit -> inhibit hit := false; -- Filter on read/write if ((rf.fw and r.thwrite) or (rf.fr and not r.thwrite)) = '1' then hit := true; end if; -- Filter on address range if (((r.tbreg2.addr xor r.thaddr(31 downto 2)) and r.tbreg2.mask) /= zero32(29 downto 0)) then if rf.af = '1' then hit := true; end if; end if; -- Filter on master mask for i in rf.mmask'range loop if i > NAHBMST-1 then exit; end if; if i = conv_integer(r.thmaster) and rf.mmask(i) = '1' then hit := true; end if; end loop; -- Filter on slave mask for i in rf.smask'range loop if i > NAHBSLV-1 then exit; end if; if (rf.shsel(i) and rf.smask(i)) /= '0' then hit := true; end if; end loop; -- Filter on retry response if (rf.rf = '1' and hresp = HRESP_RETRY) then hit := true; end if; return hit; end function ahb_filt_hit; signal tbi : tracebuf_in_type; signal tbo : tracebuf_out_type; signal enable : std_logic_vector(1 downto 0); signal r, rin : regtype; signal rf, rfin : fregtype; signal rb, rbin : bregtype; begin ctrl : process(rst, ahbsi, tahbmiv, tahbsiv, r, rf, rb, tbo) variable v : regtype; variable vabufi : tracebuf_in_type; variable regsd : std_logic_vector(31 downto 0); -- data from registers variable aindex : std_logic_vector(TBUFABITS - 1 downto 0); -- buffer index variable bphit : std_logic; variable bufdata : std_logic_vector(127 downto 0); variable hirq : std_logic_vector(NAHBIRQ-1 downto 0); variable tahbmi : ahb_mst_in_type; variable tahbsi : ahb_slv_in_type; variable vf : fregtype; variable vb : bregtype; variable regaddr : std_logic_vector(4 downto 2); variable tbaddr : std_logic_vector(3 downto 2); begin v := r; regsd := (others => '0'); vabufi.enable := '0'; vabufi.data := (others => '0'); vabufi.addr := (others => '0'); vabufi.write := (others => '0'); bphit := '0'; v.hready := r.hready2; v.hready2 := r.hready3; v.hready3 := '0'; bufdata := tbo.data; hirq := (others => '0'); hirq(irq) := r.bhit; vf := rf; vb := rb; if ntrace = 1 then tahbmi := tahbmiv(0); tahbsi := tahbsiv(0); else tahbmi := tahbmiv(conv_integer(rb.bsel)); tahbsi := tahbsiv(conv_integer(rb.bsel)); end if; regaddr := r.haddr(4 downto 2); tbaddr := r.haddr(3 downto 2); -- trace buffer index and delay counters if r.enable = '1' then v.timer := r.timer + 1; end if; aindex := r.aindex + 1; -- check for AHB watchpoints if (tahbsi.hready and r.ahbactive ) = '1' then if ((((r.tbreg1.addr xor r.thaddr(31 downto 2)) and r.tbreg1.mask) = zero32(29 downto 0)) and (((r.tbreg1.read and not r.thwrite) or (r.tbreg1.write and r.thwrite)) = '1')) or ((((r.tbreg2.addr xor r.thaddr(31 downto 2)) and r.tbreg2.mask) = zero32(29 downto 0)) and (((r.tbreg2.read and not r.thwrite) or (r.tbreg2.write and r.thwrite)) = '1')) then if (r.enable = '1') and (r.dcnten = '0') and (r.delaycnt /= zero32(TBUFABITS-1 downto 0)) then v.dcnten := '1'; bphit := '1'; --else bphit := '1'; v.enable := '0'; end if; elsif (r.enable = '1') and (r.dcnten = '0') then bphit := '1'; v.enable := '0'; end if; end if; end if; -- generate buffer inputs vabufi.write := "0000"; if r.enable = '1' then vabufi.addr(TBUFABITS-1 downto 0) := r.aindex; vabufi.data(127 downto 96) := r.timer; vabufi.data(95) := bphit; vabufi.data(94 downto 80) := tahbmi.hirq(15 downto 1); vabufi.data(79) := r.thwrite; vabufi.data(78 downto 77) := r.thtrans; vabufi.data(76 downto 74) := r.thsize; vabufi.data(73 downto 71) := r.thburst; vabufi.data(70 downto 67) := r.thmaster; vabufi.data(66) := r.thmastlock; vabufi.data(65 downto 64) := tahbmi.hresp; if r.thwrite = '1' then vabufi.data(63 downto 32) := tahbsi.hwdata(31 downto 0); else vabufi.data(63 downto 32) := tahbmi.hrdata(31 downto 0); end if; vabufi.data(31 downto 0) := r.thaddr; else vabufi.addr(TBUFABITS-1 downto 0) := r.haddr(TBUFABITS+3 downto 4); vabufi.data := ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0) & ahbsi.hwdata(31 downto 0); end if; -- write trace buffer if r.enable = '1' then if (r.ahbactive and tahbsi.hready) = '1' then if not (FILTEN and ahb_filt_hit(r, rf, tahbmi.hresp)) then v.aindex := aindex; vabufi.enable := '1'; vabufi.write := "1111"; end if; end if; end if; -- trace buffer delay counter handling if (r.dcnten = '1') and (r.ahbactive and tahbsi.hready) = '1' then if (r.delaycnt = zero32(TBUFABITS-1 downto 0)) then v.enable := '0'; v.dcnten := '0'; end if; v.delaycnt := r.delaycnt - 1; end if; -- save AHB transfer parameters if (tahbsi.hready = '1' ) then v.thaddr := tahbsi.haddr; v.thwrite := tahbsi.hwrite; v.thtrans := tahbsi.htrans; v.thsize := tahbsi.hsize; v.thburst := tahbsi.hburst; v.thmaster := tahbsi.hmaster; v.thmastlock := tahbsi.hmastlock; v.ahbactive := tahbsi.htrans(1); if FILTEN then vf.shsel := tahbsi.hsel; end if; end if; -- AHB transfer parameters for register accesses if (ahbsi.hready = '1' ) then v.haddr := ahbsi.haddr(TBUFABITS+3 downto 2); v.hwrite := ahbsi.hwrite; v.regacc := ahbsi.haddr(16); v.hsel := ahbsi.htrans(1) and ahbsi.hsel(hindex); end if; -- AHB slave access to DSU registers and trace buffers if (r.hsel and not r.hready) = '1' then if r.regacc = '0' then -- registers v.hready := '1'; case regaddr is when "000" => regsd((TBUFABITS + 15) downto 16) := r.delaycnt; if ntrace /= 1 then regsd(15) := '1'; regsd(log2(ntrace)+12 downto 12) := vb.bsel; end if; if FILTEN then regsd(5) := rf.rf; regsd(4) := rf.af; regsd(3) := rf.fr; regsd(2) := rf.fw; end if; regsd(1 downto 0) := r.dcnten & r.enable; if r.hwrite = '1' then v.delaycnt := ahbsi.hwdata((TBUFABITS+ 15) downto 16); if ntrace /= 1 then vb.bsel := ahbsi.hwdata(log2(ntrace)+12 downto 12); end if; if FILTEN then vf.rf := ahbsi.hwdata(5); vf.af := ahbsi.hwdata(4); vf.fr := ahbsi.hwdata(3); vf.fw := ahbsi.hwdata(2); end if; v.dcnten := ahbsi.hwdata(1); v.enable := ahbsi.hwdata(0); end if; when "001" => regsd((TBUFABITS - 1 + 4) downto 4) := r.aindex; if r.hwrite = '1' then v.aindex := ahbsi.hwdata((TBUFABITS- 1) downto 0); end if; when "010" => regsd((TIMEBITS - 1) downto 0) := r.timer; if r.hwrite = '1' then v.timer := ahbsi.hwdata((TIMEBITS- 1) downto 0); end if; when "011" => if FILTEN then regsd(31 downto 0) := rf.smask & rf.mmask; if r.hwrite = '1' then vf.smask := ahbsi.hwdata(31 downto 16); vf.mmask := ahbsi.hwdata(15 downto 0); end if; end if; when "100" => regsd(31 downto 2) := r.tbreg1.addr; if r.hwrite = '1' then v.tbreg1.addr := ahbsi.hwdata(31 downto 2); end if; when "101" => regsd := r.tbreg1.mask & r.tbreg1.read & r.tbreg1.write; if r.hwrite = '1' then v.tbreg1.mask := ahbsi.hwdata(31 downto 2); v.tbreg1.read := ahbsi.hwdata(1); v.tbreg1.write := ahbsi.hwdata(0); end if; when "110" => regsd(31 downto 2) := r.tbreg2.addr; if r.hwrite = '1' then v.tbreg2.addr := ahbsi.hwdata(31 downto 2); end if; when others => regsd := r.tbreg2.mask & r.tbreg2.read & r.tbreg2.write; if r.hwrite = '1' then v.tbreg2.mask := ahbsi.hwdata(31 downto 2); v.tbreg2.read := ahbsi.hwdata(1); v.tbreg2.write := ahbsi.hwdata(0); end if; end case; v.hrdata := regsd; else -- read/write access to trace buffer if r.hwrite = '1' then v.hready := '1'; else v.hready2 := not (r.hready2 or r.hready); end if; vabufi.enable := not r.enable; bufdata := tbo.data; case tbaddr is when "00" => v.hrdata := bufdata(127 downto 96); if r.hwrite = '1' then vabufi.write(3) := vabufi.enable; end if; when "01" => v.hrdata := bufdata(95 downto 64); if r.hwrite = '1' then vabufi.write(2) := vabufi.enable; end if; when "10" => v.hrdata := bufdata(63 downto 32); if r.hwrite = '1' then vabufi.write(1) := vabufi.enable; end if; when others => v.hrdata := bufdata(31 downto 0); if r.hwrite = '1' then vabufi.write(0) := vabufi.enable; end if; end case; end if; end if; if ((ahbsi.hsel(hindex) and ahbsi.hready) = '1') and ((ahbsi.htrans = HTRANS_BUSY) or (ahbsi.htrans = HTRANS_IDLE)) then v.hready := '1'; end if; if rst = '0' then v.ahbactive := '0'; v.enable := '0'; v.timer := (others => '0'); v.hsel := '0'; v.dcnten := '0'; v.bhit := '0'; v.regacc := '0'; v.hready := '1'; v.tbreg1.read := '0'; v.tbreg1.write := '0'; v.tbreg2.read := '0'; v.tbreg2.write := '0'; if FILTEN then vf.smask := (others => '0'); vf.mmask := (others => '0'); end if; if ntrace /= 1 then vb.bsel := (others => '0'); end if; end if; tbi <= vabufi; rin <= v; rfin <= vf; rbin <= vb; ahbso.hconfig <= hconfig; ahbso.hirq <= hirq; ahbso.hsplit <= (others => '0'); ahbso.hrdata <= ahbdrivedata(r.hrdata); ahbso.hready <= r.hready; ahbso.hindex <= hindex; end process; ahbso.hresp <= HRESP_OKAY; regs : process(clk) begin if rising_edge(clk) then r <= rin; end if; end process; fregs : if FILTEN generate regs : process(clk) begin if rising_edge(clk) then rf <= rfin; end if; end process; end generate; nofregs : if not FILTEN generate rf.shsel <= (others => '0'); rf.af <= '0'; rf.fr <= '0'; rf.fw <= '0'; rf.smask <= (others => '0'); rf.mmask <= (others => '0'); rf.rf <= '0'; end generate; bregs : if ntrace /= 1 generate regs : process(clk) begin if rising_edge(clk) then rb <= rbin; end if; end process; end generate; nobregs : if ntrace = 1 generate rb.bsel <= (others => '0'); end generate; enable <= tbi.enable & tbi.enable; mem0 : for i in 0 to 1 generate ram0 : syncram64 generic map (tech => tech, abits => TBUFABITS) port map (clk, tbi.addr(TBUFABITS-1 downto 0), tbi.data(((i*64)+63) downto (i*64)), tbo.data(((i*64)+63) downto (i*64)), enable, tbi.write(i*2+1 downto i*2)); end generate; -- pragma translate_off bootmsg : report_version generic map ("ahbtrace" & tost(hindex) & ": AHB Trace Buffer, " & tost(kbytes) & " kbytes"); -- pragma translate_on end;
gpl-2.0
a86ad0e580fb08fc3ded23dae538359b
0.571973
3.379747
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/road/simulation/road_synth.vhd
1
6,808
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Synthesizable Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: road_synth.vhd -- -- Description: -- Synthesizable Testbench -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY STD; USE STD.TEXTIO.ALL; --LIBRARY unisim; --USE unisim.vcomponents.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY road_synth IS GENERIC ( C_ROM_SYNTH : INTEGER := 1 ); PORT( CLK_IN : IN STD_LOGIC; RESET_IN : IN STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(8 DOWNTO 0) := (OTHERS => '0') --ERROR STATUS OUT OF FPGA ); END ENTITY; ARCHITECTURE road_synth_ARCH OF road_synth IS COMPONENT road_exdes PORT ( --Inputs - Port A ADDRA : IN STD_LOGIC_VECTOR(16 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; SIGNAL CLKA: STD_LOGIC := '0'; SIGNAL RSTA: STD_LOGIC := '0'; SIGNAL ADDRA: STD_LOGIC_VECTOR(16 DOWNTO 0) := (OTHERS => '0'); SIGNAL ADDRA_R: STD_LOGIC_VECTOR(16 DOWNTO 0) := (OTHERS => '0'); SIGNAL DOUTA: STD_LOGIC_VECTOR(11 DOWNTO 0); SIGNAL CHECKER_EN : STD_LOGIC:='0'; SIGNAL CHECKER_EN_R : STD_LOGIC:='0'; SIGNAL STIMULUS_FLOW : STD_LOGIC_VECTOR(22 DOWNTO 0) := (OTHERS =>'0'); SIGNAL clk_in_i: STD_LOGIC; SIGNAL RESET_SYNC_R1 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R2 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R3 : STD_LOGIC:='1'; SIGNAL ITER_R0 : STD_LOGIC := '0'; SIGNAL ITER_R1 : STD_LOGIC := '0'; SIGNAL ITER_R2 : STD_LOGIC := '0'; SIGNAL ISSUE_FLAG : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); SIGNAL ISSUE_FLAG_STATUS : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); BEGIN -- clk_buf: bufg -- PORT map( -- i => CLK_IN, -- o => clk_in_i -- ); clk_in_i <= CLK_IN; CLKA <= clk_in_i; RSTA <= RESET_SYNC_R3 AFTER 50 ns; PROCESS(clk_in_i) BEGIN IF(RISING_EDGE(clk_in_i)) THEN RESET_SYNC_R1 <= RESET_IN; RESET_SYNC_R2 <= RESET_SYNC_R1; RESET_SYNC_R3 <= RESET_SYNC_R2; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ISSUE_FLAG_STATUS<= (OTHERS => '0'); ELSE ISSUE_FLAG_STATUS <= ISSUE_FLAG_STATUS OR ISSUE_FLAG; END IF; END IF; END PROCESS; STATUS(7 DOWNTO 0) <= ISSUE_FLAG_STATUS; BMG_STIM_GEN_INST:ENTITY work.BMG_STIM_GEN GENERIC MAP( C_ROM_SYNTH => C_ROM_SYNTH ) PORT MAP( CLK => clk_in_i, RST => RSTA, ADDRA => ADDRA, DATA_IN => DOUTA, STATUS => ISSUE_FLAG(0) ); PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STATUS(8) <= '0'; iter_r2 <= '0'; iter_r1 <= '0'; iter_r0 <= '0'; ELSE STATUS(8) <= iter_r2; iter_r2 <= iter_r1; iter_r1 <= iter_r0; iter_r0 <= STIMULUS_FLOW(8); END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STIMULUS_FLOW <= (OTHERS => '0'); ELSIF(ADDRA(0)='1') THEN STIMULUS_FLOW <= STIMULUS_FLOW+1; END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ELSE END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ADDRA_R <= (OTHERS=> '0') AFTER 50 ns; ELSE ADDRA_R <= ADDRA AFTER 50 ns; END IF; END IF; END PROCESS; BMG_PORT: road_exdes PORT MAP ( --Port A ADDRA => ADDRA_R, DOUTA => DOUTA, CLKA => CLKA ); END ARCHITECTURE;
mit
0b5cfed2865c9e202ee0187ddde3829f
0.579318
3.794872
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/clkand.vhd
1
3,752
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: clkand -- File: clkand.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Clock gating ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use work.gencomp.all; use work.allclkgen.all; entity clkand is generic( tech : integer := 0; ren : integer range 0 to 1 := 0); -- registered enable port( i : in std_ulogic; en : in std_ulogic; o : out std_ulogic; tsten : in std_ulogic := '0' ); end entity; architecture rtl of clkand is signal eni : std_ulogic; begin re : if ren = 1 generate renproc : process(i) begin if falling_edge(i) then eni <= en; end if; end process; end generate; ce : if ren = 0 generate eni <= en; end generate; struct : if has_clkand(tech) = 1 generate xil : if is_unisim(tech) = 1 generate clkgate : clkand_unisim port map(I => i, en => eni, O => o); end generate; ut : if (tech = ut25) generate clkgate : clkand_ut025crh port map(I => i, en => eni, O => o); end generate; rhl : if (tech = rhlib18t) generate clkgate : clkand_rh_lib18t port map(I => i, en => eni, O => o, tsten => tsten); end generate; ut13 : if (tech = ut130) generate clkgate : clkand_ut130hbd port map(I => i, en => eni, O => o, tsten => tsten); end generate; ut09 : if (tech = ut90) generate clkgate : clkand_ut90nhbd port map(I => i, en => eni, O => o, tsten => tsten); end generate; n2x : if (tech = easic45) generate clkgate : clkand_n2x port map(i => i, en => eni, o => o, tsten => tsten); end generate; saed : if (tech = saed32) generate clkgate : clkand_saed32 port map(i => i, en => eni, o => o, tsten => tsten); end generate; dar : if (tech = dare) generate clkgate : clkand_dare port map(i => i, en => eni, o => o, tsten => tsten); end generate; end generate; gen : if has_clkand(tech) = 0 generate o <= i and (eni or tsten); end generate; end architecture; library ieee; use ieee.std_logic_1164.all; use work.gencomp.all; use work.allclkgen.all; entity clkrand is generic( tech : integer := 0); port( i : in std_ulogic; en : in std_ulogic; o : out std_ulogic; tsten : in std_ulogic := '0' ); end entity; architecture rtl of clkrand is signal eni : std_ulogic; begin ut13 : if (tech = ut130) generate eni <= en or tsten; clkgate : clkrand_ut130hbd port map(I => i, en => en, O => o); end generate; nonut13 : if (tech /= ut130) generate clkgate : clkand generic map (tech, 1) port map (i, en, o, tsten); end generate; end;
gpl-2.0
001034f9eaea46e5d2b83dcdbea503df
0.58742
3.604227
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/saed32/clkgen_saed32.vhd
1
5,004
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: clkgen_saed32 -- File: clkgen_saed32.vhd -- Author: Fredrik Ringhage - Aeroflex Gaisler AB -- Description: Clock generator for SAED32 ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; entity clkgen_saed32 is port ( clkin : in std_logic; clk : out std_logic; -- main clock clk2x : out std_logic; -- 2x clock sdclk : out std_logic; -- SDRAM clock pciclk : out std_logic; -- PCI clock cgi : in clkgen_in_type; cgo : out clkgen_out_type; clk4x : out std_logic; -- 4x clock clk1xu : out std_logic; -- unscaled 1X clock clk2xu : out std_logic); -- unscaled 2X clock end; architecture struct of clkgen_saed32 is component PLL port ( -- VDD25 : in std_logic; -- DVDD : inout std_logic; -- VSSA : in std_logic; -- AVDD : inout std_logic; REF_CLK : in std_logic; FB_CLK : in std_logic; FB_MODE : in std_logic; PLL_BYPASS : in std_logic; CLK_4X : out std_logic; CLK_2X : out std_logic; CLK_1X : out std_logic); end component; ----------------------------------------------------------------------------- -- attributes ----------------------------------------------------------------------------- attribute DONT_TOUCH : Boolean; attribute DONT_TOUCH of pll0 : label is True; begin pll0 : PLL port map ( -- VDD25 => '1', -- DVDD => open, -- VSSA => '0', -- AVDD => open, REF_CLK => clkin, FB_CLK => cgi.pllref, FB_MODE => cgi.pllctrl(1), PLL_BYPASS => cgi.pllctrl(0), CLK_4X => clk4x, CLK_2X => clk2x, CLK_1X => clk ); cgo.clklock <= '1'; sdclk <= '0'; pciclk <= '0'; cgo.pcilock <= '1'; clk1xu <= '0'; clk2xu <= '0'; end; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off --library saed32; --use saed32.CGLPPSX4_LVT; -- pragma translate_on entity clkand_saed32 is port ( i : in std_ulogic; en : in std_ulogic; o : out std_ulogic; tsten : in std_ulogic := '0'); end clkand_saed32; architecture rtl of clkand_saed32 is component CGLPPSX4_LVT port ( GCLK : out std_ulogic; CLK : in std_ulogic; EN : in std_ulogic; SE : in std_ulogic ); end component; attribute DONT_TOUCH : Boolean; attribute DONT_TOUCH of gate : label is True; begin gate: CGLPPSX4_LVT port map (GCLK => o , CLK => i , EN => en, SE => tsten); end rtl; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off --library saed32; --use saed32.MUX21X1_LVT; -- pragma translate_on entity clkmux_saed32 is port ( i0 : in std_ulogic; i1 : in std_ulogic; sel : in std_ulogic; o : out std_ulogic); end clkmux_saed32; architecture rtl of clkmux_saed32 is component MUX21X1_LVT port ( Y : out std_ulogic; A1 : in std_ulogic; A2 : in std_ulogic; S0 : in std_ulogic ); end component; attribute DONT_TOUCH : Boolean; attribute DONT_TOUCH of m0 : label is True; begin m0: MUX21X1_LVT port map (A1 => i0 , A2 => i1 , S0 => sel, Y => o); end rtl; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off --library saed32; --use saed32.INVX4_LVT; -- pragma translate_on entity clkinv_saed32 is port ( i : in std_ulogic; o : out std_ulogic); end clkinv_saed32; architecture rtl of clkinv_saed32 is component INVX4_LVT port ( Y : out std_ulogic; A : in std_ulogic ); end component; attribute DONT_TOUCH : Boolean; attribute DONT_TOUCH of gate : label is True; begin gate: INVX4_LVT port map (A => i , Y => o); end rtl;
gpl-2.0
769c06ab0a6d7d4514102c42250a78d2
0.552758
3.496855
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/background/simulation/background_synth.vhd
1
6,844
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Synthesizable Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: background_synth.vhd -- -- Description: -- Synthesizable Testbench -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY STD; USE STD.TEXTIO.ALL; --LIBRARY unisim; --USE unisim.vcomponents.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY background_synth IS GENERIC ( C_ROM_SYNTH : INTEGER := 1 ); PORT( CLK_IN : IN STD_LOGIC; RESET_IN : IN STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(8 DOWNTO 0) := (OTHERS => '0') --ERROR STATUS OUT OF FPGA ); END ENTITY; ARCHITECTURE background_synth_ARCH OF background_synth IS COMPONENT background_exdes PORT ( --Inputs - Port A ADDRA : IN STD_LOGIC_VECTOR(16 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; SIGNAL CLKA: STD_LOGIC := '0'; SIGNAL RSTA: STD_LOGIC := '0'; SIGNAL ADDRA: STD_LOGIC_VECTOR(16 DOWNTO 0) := (OTHERS => '0'); SIGNAL ADDRA_R: STD_LOGIC_VECTOR(16 DOWNTO 0) := (OTHERS => '0'); SIGNAL DOUTA: STD_LOGIC_VECTOR(11 DOWNTO 0); SIGNAL CHECKER_EN : STD_LOGIC:='0'; SIGNAL CHECKER_EN_R : STD_LOGIC:='0'; SIGNAL STIMULUS_FLOW : STD_LOGIC_VECTOR(22 DOWNTO 0) := (OTHERS =>'0'); SIGNAL clk_in_i: STD_LOGIC; SIGNAL RESET_SYNC_R1 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R2 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R3 : STD_LOGIC:='1'; SIGNAL ITER_R0 : STD_LOGIC := '0'; SIGNAL ITER_R1 : STD_LOGIC := '0'; SIGNAL ITER_R2 : STD_LOGIC := '0'; SIGNAL ISSUE_FLAG : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); SIGNAL ISSUE_FLAG_STATUS : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); BEGIN -- clk_buf: bufg -- PORT map( -- i => CLK_IN, -- o => clk_in_i -- ); clk_in_i <= CLK_IN; CLKA <= clk_in_i; RSTA <= RESET_SYNC_R3 AFTER 50 ns; PROCESS(clk_in_i) BEGIN IF(RISING_EDGE(clk_in_i)) THEN RESET_SYNC_R1 <= RESET_IN; RESET_SYNC_R2 <= RESET_SYNC_R1; RESET_SYNC_R3 <= RESET_SYNC_R2; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ISSUE_FLAG_STATUS<= (OTHERS => '0'); ELSE ISSUE_FLAG_STATUS <= ISSUE_FLAG_STATUS OR ISSUE_FLAG; END IF; END IF; END PROCESS; STATUS(7 DOWNTO 0) <= ISSUE_FLAG_STATUS; BMG_STIM_GEN_INST:ENTITY work.BMG_STIM_GEN GENERIC MAP( C_ROM_SYNTH => C_ROM_SYNTH ) PORT MAP( CLK => clk_in_i, RST => RSTA, ADDRA => ADDRA, DATA_IN => DOUTA, STATUS => ISSUE_FLAG(0) ); PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STATUS(8) <= '0'; iter_r2 <= '0'; iter_r1 <= '0'; iter_r0 <= '0'; ELSE STATUS(8) <= iter_r2; iter_r2 <= iter_r1; iter_r1 <= iter_r0; iter_r0 <= STIMULUS_FLOW(8); END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STIMULUS_FLOW <= (OTHERS => '0'); ELSIF(ADDRA(0)='1') THEN STIMULUS_FLOW <= STIMULUS_FLOW+1; END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ELSE END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ADDRA_R <= (OTHERS=> '0') AFTER 50 ns; ELSE ADDRA_R <= ADDRA AFTER 50 ns; END IF; END IF; END PROCESS; BMG_PORT: background_exdes PORT MAP ( --Port A ADDRA => ADDRA_R, DOUTA => DOUTA, CLKA => CLKA ); END ARCHITECTURE;
mit
e350acb274a68d15756817eabd373105
0.581531
3.82774
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_cdma_v4_1/25515467/hdl/src/vhdl/axi_cdma.vhd
1
38,764
------------------------------------------------------------------------------- -- axi_cdma ------------------------------------------------------------------------------- -- -- ************************************************************************* -- -- (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- ************************************************************************* -- ------------------------------------------------------------------------------- -- Filename: axi_cdma.vhd -- Description: This entity is the top level entity for the AXI CDMA core. -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library axi_cdma_v4_1; use axi_cdma_v4_1.axi_cdma_pkg.all; use axi_cdma_v4_1.axi_cdma_simple_wrap; use axi_cdma_v4_1.axi_cdma_sg_wrap; ------------------------------------------------------------------------------- entity axi_cdma is generic( ----------------------------------------------------------------------- -- AXI Lite Register Interface Parameters ----------------------------------------------------------------------- C_S_AXI_LITE_ADDR_WIDTH : integer range 2 to 32 := 6; -- Address width of the AXI Lite Interface (bits) C_S_AXI_LITE_DATA_WIDTH : integer range 32 to 32 := 32; -- Data width of the AXI Lite Interface (bits) C_AXI_LITE_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the AXI Lite Register interface needs to -- be asynchronous to the CDMA data transport path clocking -- 0 = s_axi_lite_aclk is the same as m_axi_aclk -- 1 = s_axi_lite_aclk is asynchronous to the m_axi_aclk ----------------------------------------------------------------------- -- DataMover Parameters ----------------------------------------------------------------------- C_M_AXI_ADDR_WIDTH : integer range 32 to 32 := 32; -- DataMover Master AXI Memory Map Address Width (bits) C_M_AXI_DATA_WIDTH : integer range 32 to 1024 := 32; -- DataMover Master AXI Memory Map Data Width (bits) C_M_AXI_MAX_BURST_LEN : integer range 2 to 256 := 16; -- DataMover Maximum burst length to use for AXI MMAP requests -- Allowed values are 16, 32, 64, 128, and 256 (data beats) C_INCLUDE_DRE : integer range 0 to 1 := 0; -- Include or exclude DataMover Data Realignment (DRE) -- NOTE: DRE is only available for 32 and 64 bit data widths -- 0 = Exclude DRE -- 1 = Include DRE C_USE_DATAMOVER_LITE : integer range 0 to 1 := 0; -- Enable DataMover Lite mode -- NOTE: Data widths limited to 32 and 64 bits, max burst -- limited to 16, 32, and 64 data beats, no DRE, 4K address -- guarding must be done by SW programmer. -- 0 = Normal DataMover mode -- 1 = Lite dataMover mode C_READ_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 4; -- This parameter specifies the depth of the DataMover -- read address pipelining queues for the Main data transport -- channels. The effective address pipelining on the AXI4 Read -- Address Channel will be the value assigned plus 2. C_WRITE_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 4; -- This parameter specifies the depth of the DataMover -- write address pipelining queues for the Main data transport -- channel. The effective address pipelining on the AXI4 Write -- Address Channel will be the value assigned plus 2. ----------------------------------------------------------------------- -- Store and Forward Parameters ----------------------------------------------------------------------- C_INCLUDE_SF : integer range 0 to 1 := 1; -- 0 = Omit Store and Forward functionality -- 1 = Include Store and Forward functionality ----------------------------------------------------------------------- -- Scatter Gather Parameters ----------------------------------------------------------------------- C_INCLUDE_SG : integer range 0 to 1 := 0; -- 0 = Omit Scatter Gather functionality -- 1 = Include Scatter Gather functionality C_M_AXI_SG_ADDR_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Address Width for Scatter Gather -- R/W Port (bits) C_M_AXI_SG_DATA_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Data Width for Scatter Gather -- R/W Port (bits) C_DLYTMR_RESOLUTION : integer range 1 to 100000 := 125; -- Interrupt Delay Timer resolution in clock ticks of axi_clk ----------------------------------------------------------------------- -- Target FPGA Family Parameter ----------------------------------------------------------------------- C_FAMILY : string := "virtex7"; -- Target FPGA Device Family C_INSTANCE : string := "axi_cdma" ); port ( ----------------------------------------------------------------------- -- Primary Clock ----------------------------------------------------------------------- m_axi_aclk : in std_logic ;-- AXI4 ----------------------------------------------------------------------- -- Primary Reset Input (active low) ----------------------------------------------------------------------- -- m_axi_aresetn : in std_logic ;-- AXI4 ----------------------------------------------------------------------- -- AXI Lite clock ----------------------------------------------------------------------- s_axi_lite_aclk : in std_logic ;-- AXI4-Lite ----------------------------------------------------------------------- -- AXI Lite reset ----------------------------------------------------------------------- s_axi_lite_aresetn : in std_logic ;-- AXI4-Lite ----------------------------------------------------------------------- -- Interrupt output ----------------------------------------------------------------------- cdma_introut : out std_logic ;-- Interupt Out --------------------------------------------------------------------------------- -- AXI4-Lite Register Access Interface --------------------------------------------------------------------------------- -- AXI Lite Write Address Channel -- AXI4-Lite s_axi_lite_awready : out std_logic ;-- AXI4-Lite s_axi_lite_awvalid : in std_logic ;-- AXI4-Lite s_axi_lite_awaddr : in std_logic_vector -- AXI4-Lite (5 downto 0);-- AXI4-Lite -- s_axi_lite_awaddr : in std_logic_vector -- AXI4-Lite -- (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Write Data Channel -- AXI4-Lite s_axi_lite_wready : out std_logic ;-- AXI4-Lite s_axi_lite_wvalid : in std_logic ;-- AXI4-Lite s_axi_lite_wdata : in std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_DATA_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Write Response Channel -- AXI4-Lite s_axi_lite_bready : in std_logic ;-- AXI4-Lite s_axi_lite_bvalid : out std_logic ;-- AXI4-Lite s_axi_lite_bresp : out std_logic_vector(1 downto 0) ;-- AXI4-Lite -- AXI4-Lite -- AXI Lite Read Address Channel -- AXI4-Lite s_axi_lite_arready : out std_logic ;-- AXI4-Lite s_axi_lite_arvalid : in std_logic ;-- AXI4-Lite s_axi_lite_araddr : in std_logic_vector -- AXI4-Lite (5 downto 0);-- AXI4-Lite -- s_axi_lite_araddr : in std_logic_vector -- AXI4-Lite -- (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0);-- AXI4-Lite -- AXI4-Lite -- AXI Lite Read Data Channel -- AXI4-Lite s_axi_lite_rready : in std_logic ;-- AXI4-Lite s_axi_lite_rvalid : out std_logic ;-- AXI4-Lite s_axi_lite_rdata : out std_logic_vector -- AXI4-Lite (C_S_AXI_LITE_DATA_WIDTH-1 downto 0);-- AXI4-Lite s_axi_lite_rresp : out std_logic_vector(1 downto 0) ;-- AXI4-Lite ---------------------------------------------------------------------------- -- AXI4 DataMover Read Channel ---------------------------------------------------------------------------- -- DataMover MMap Read Address Channel -- AXI4 m_axi_arready : in std_logic ;-- AXI4 m_axi_arvalid : out std_logic ;-- AXI4 m_axi_araddr : out std_logic_vector -- AXI4 (C_M_AXI_ADDR_WIDTH-1 downto 0) ;-- AXI4 m_axi_arlen : out std_logic_vector(7 downto 0) ;-- AXI4 m_axi_arsize : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_arburst : out std_logic_vector(1 downto 0) ;-- AXI4 m_axi_arprot : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_arcache : out std_logic_vector(3 downto 0) ;-- AXI4 -- AXI4 -- DataMover MMap Read Data Channel -- AXI4 m_axi_rready : out std_logic ;-- AXI4 m_axi_rvalid : in std_logic ;-- AXI4 m_axi_rdata : in std_logic_vector -- AXI4 (C_M_AXI_DATA_WIDTH-1 downto 0) ;-- AXI4 m_axi_rresp : in std_logic_vector(1 downto 0) ;-- AXI4 m_axi_rlast : in std_logic ;-- AXI4 ----------------------------------------------------------------------------- -- AXI4 DataMover Write Channel ----------------------------------------------------------------------------- -- DataMover Write Address Channel -- AXI4 m_axi_awready : in std_logic ; -- AXI4 m_axi_awvalid : out std_logic ; -- AXI4 m_axi_awaddr : out std_logic_vector -- AXI4 (C_M_AXI_ADDR_WIDTH-1 downto 0) ; -- AXI4 m_axi_awlen : out std_logic_vector(7 downto 0) ; -- AXI4 m_axi_awsize : out std_logic_vector(2 downto 0) ; -- AXI4 m_axi_awburst : out std_logic_vector(1 downto 0) ; -- AXI4 m_axi_awprot : out std_logic_vector(2 downto 0) ; -- AXI4 m_axi_awcache : out std_logic_vector(3 downto 0) ; -- AXI4 -- AXI4 -- DataMover Write Data Channel -- AXI4 m_axi_wready : in std_logic ; -- AXI4 m_axi_wvalid : out std_logic ; -- AXI4 m_axi_wdata : out std_logic_vector -- AXI4 (C_M_AXI_DATA_WIDTH-1 downto 0) ; -- AXI4 m_axi_wstrb : out std_logic_vector -- AXI4 ((C_M_AXI_DATA_WIDTH/8)-1 downto 0);-- AXI4 m_axi_wlast : out std_logic ; -- AXI4 -- AXI4 -- DataMover Write Response Channel -- AXI4 m_axi_bready : out std_logic ; -- AXI4 m_axi_bvalid : in std_logic ; -- AXI4 m_axi_bresp : in std_logic_vector(1 downto 0) ; -- AXI4 ---------------------------------------------------------------------------- -- AXI4 Scatter Gather Interface ---------------------------------------------------------------------------- -- Scatter Gather Write Address Channel -- AXI4 m_axi_sg_awready : in std_logic := '0' ;-- AXI4 m_axi_sg_awvalid : out std_logic ;-- AXI4 m_axi_sg_awaddr : out std_logic_vector -- AXI4 (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ;-- AXI4 m_axi_sg_awlen : out std_logic_vector(7 downto 0) ;-- AXI4 m_axi_sg_awsize : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_sg_awburst : out std_logic_vector(1 downto 0) ;-- AXI4 m_axi_sg_awprot : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_sg_awcache : out std_logic_vector(3 downto 0) ;-- AXI4 -- AXI4 -- Scatter Gather Write Data Channel -- AXI4 m_axi_sg_wready : in std_logic := '0' ;-- AXI4 m_axi_sg_wvalid : out std_logic ;-- AXI4 m_axi_sg_wdata : out std_logic_vector -- AXI4 (C_M_AXI_SG_DATA_WIDTH-1 downto 0);-- AXI4 m_axi_sg_wstrb : out std_logic_vector -- AXI4 ((C_M_AXI_SG_DATA_WIDTH/8)-1 downto 0);-- AXI4 m_axi_sg_wlast : out std_logic ;-- AXI4 -- AXI4 -- Scatter Gather Write Response Channel -- AXI4 m_axi_sg_bready : out std_logic ;-- AXI4 m_axi_sg_bvalid : in std_logic := '0' ;-- AXI4 m_axi_sg_bresp : in std_logic_vector(1 downto 0) := (others => '0') ;-- AXI4 -- AXI4 -- Scatter Gather Read Address Channel -- AXI4 m_axi_sg_arready : in std_logic := '0' ;-- AXI4 m_axi_sg_arvalid : out std_logic ;-- AXI4 m_axi_sg_araddr : out std_logic_vector -- AXI4 (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ;-- AXI4 m_axi_sg_arlen : out std_logic_vector(7 downto 0) ;-- AXI4 m_axi_sg_arsize : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_sg_arburst : out std_logic_vector(1 downto 0) ;-- AXI4 m_axi_sg_arprot : out std_logic_vector(2 downto 0) ;-- AXI4 m_axi_sg_arcache : out std_logic_vector(3 downto 0) ;-- AXI4 -- AXI4 -- Scatter Gather Read Data Channel -- AXI4 m_axi_sg_rready : out std_logic ;-- AXI4 m_axi_sg_rvalid : in std_logic := '0' ;-- AXI4 m_axi_sg_rdata : in std_logic_vector -- AXI4 (C_M_AXI_SG_DATA_WIDTH-1 downto 0) := (others => '0') ;-- AXI4 m_axi_sg_rresp : in std_logic_vector(1 downto 0) := (others => '0') ;-- AXI4 m_axi_sg_rlast : in std_logic := '0' ;-- AXI4 ----------------------------------------------------------------------- -- Test Support for Xilinx internal use ----------------------------------------------------------------------- cdma_tvect_out : Out std_logic_vector(31 downto 0) ); ----------------------------------------------------------------- -- Start of PSFUtil MPD attributes ----------------------------------------------------------------- --attribute IP_GROUP : string; --attribute IP_GROUP of axi_cdma : entity is "LOGICORE"; --attribute IPTYPE : string; --attribute IPTYPE of axi_cdma : entity is "PERIPHERAL"; --attribute RUN_NGCBUILD : string; --attribute RUN_NGCBUILD of axi_cdma : entity is "TRUE"; ----------------------------------------------------------------- -- End of PSFUtil MPD attributes ----------------------------------------------------------------- end axi_cdma; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_cdma is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_max -- -- Function Description: -- Returns the greater of two integers. -- ------------------------------------------------------------------- function funct_get_max (value_in_1 : integer; value_in_2 : integer) return integer is Variable max_value : Integer := 0; begin If (value_in_1 > value_in_2) Then max_value := value_in_1; else max_value := value_in_2; End if; Return (max_value); end function funct_get_max; ------------------------------------------------------------------- ------------------------------------------------------------------- -- Function -- -- Function Name: funct_rnd2pwr_of_2 -- -- Function Description: -- Rounds the input value up to the nearest power of 2 between -- 128 and 8192. -- ------------------------------------------------------------------- function funct_rnd2pwr_of_2 (input_value : integer) return integer is Variable temp_pwr2 : Integer := 128; begin if (input_value <= 128) then temp_pwr2 := 128; elsif (input_value <= 256) then temp_pwr2 := 256; elsif (input_value <= 512) then temp_pwr2 := 512; elsif (input_value <= 1024) then temp_pwr2 := 1024; elsif (input_value <= 2048) then temp_pwr2 := 2048; elsif (input_value <= 4096) then temp_pwr2 := 4096; else temp_pwr2 := 8192; end if; Return (temp_pwr2); end function funct_rnd2pwr_of_2; ------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- Constant SOFT_RST_TIME_CLKS : integer := 8; -- Specifies the time of the soft reset assertion in -- m_axi_aclk clock periods. -- Calculates the minimum needed depth of the CDMA Store and Forward FIFO Constant PIPEDEPTH_BURST_LEN_PROD : integer := (funct_get_max(C_READ_ADDR_PIPE_DEPTH, C_WRITE_ADDR_PIPE_DEPTH)+2) * C_M_AXI_MAX_BURST_LEN; -- Assigns the depth of the CDMA Store and Forward FIFO to the nearest -- power of 2 Constant SF_FIFO_DEPTH : integer range 128 to 8192 := funct_rnd2pwr_of_2(PIPEDEPTH_BURST_LEN_PROD); ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- -- No signals Declared ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- signal m_axi_aresetn : std_logic; begin m_axi_aresetn <= '1'; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_SIMPLE_MODE -- -- If Generate Description: -- This IfGen Implements the CDMA with Simple Mode -- -- ------------------------------------------------------------ GEN_SIMPLE_MODE : if (C_INCLUDE_SG = 0) generate begin ----------------------------------------------------------- -- Housekeep the Scatter Gather output signals that are not -- used in Simple DMA mode. ----------------------------------------------------------- -- Scatter Gather Write Address Channel m_axi_sg_awvalid <= '0' ; m_axi_sg_awaddr <= (others => '0'); m_axi_sg_awlen <= (others => '0'); m_axi_sg_awsize <= (others => '0'); m_axi_sg_awburst <= (others => '0'); m_axi_sg_awprot <= (others => '0'); m_axi_sg_awcache <= (others => '0'); -- Scatter Gather Write Data Channel m_axi_sg_wvalid <= '0'; m_axi_sg_wdata <= (others => '0'); m_axi_sg_wstrb <= (others => '0'); m_axi_sg_wlast <= '0' ; -- Scatter Gather Write Response Channel m_axi_sg_bready <= '0' ; -- Scatter Gather Read Address Channel m_axi_sg_arvalid <= '0' ; m_axi_sg_araddr <= (others => '0'); m_axi_sg_arlen <= (others => '0'); m_axi_sg_arsize <= (others => '0'); m_axi_sg_arburst <= (others => '0'); m_axi_sg_arprot <= (others => '0'); m_axi_sg_arcache <= (others => '0'); -- Memory Map to Stream Scatter Gather Read Data Channel m_axi_sg_rready <= '0' ; ------------------------------------------------------------ -- Instance: I_SIMPLE_MODE_WRAP -- -- Description: -- Instance for the CDMA Simple Mode Wrapper -- ------------------------------------------------------------ I_SIMPLE_MODE_WRAP : entity axi_cdma_v4_1.axi_cdma_simple_wrap generic map ( C_S_AXI_LITE_ADDR_WIDTH => C_S_AXI_LITE_ADDR_WIDTH , C_S_AXI_LITE_DATA_WIDTH => C_S_AXI_LITE_DATA_WIDTH , C_AXI_LITE_IS_ASYNC => C_AXI_LITE_IS_ASYNC , C_M_AXI_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_M_AXI_MAX_BURST_LEN => C_M_AXI_MAX_BURST_LEN , C_INCLUDE_DRE => C_INCLUDE_DRE , C_USE_DATAMOVER_LITE => C_USE_DATAMOVER_LITE , C_READ_ADDR_PIPE_DEPTH => C_READ_ADDR_PIPE_DEPTH , C_WRITE_ADDR_PIPE_DEPTH => C_WRITE_ADDR_PIPE_DEPTH , C_INCLUDE_SF => C_INCLUDE_SF , C_SF_FIFO_DEPTH => SF_FIFO_DEPTH , C_SOFT_RST_TIME_CLKS => SOFT_RST_TIME_CLKS , C_FAMILY => C_FAMILY ) port map ( -- Primary Clock and Reset axi_aclk => m_axi_aclk , axi_resetn => m_axi_aresetn , -- AXI Lite clock and Reset axi_lite_aclk => s_axi_lite_aclk , axi_lite_resetn => s_axi_lite_aresetn , -- Interrupt output cdma_introut => cdma_introut , -- Error Discrete output cdma_error_out => open , -- AXI Lite Write Address Channel s_axi_lite_awready => s_axi_lite_awready , s_axi_lite_awvalid => s_axi_lite_awvalid , s_axi_lite_awaddr => s_axi_lite_awaddr , -- AXI Lite Write Data Channel s_axi_lite_wready => s_axi_lite_wready , s_axi_lite_wvalid => s_axi_lite_wvalid , s_axi_lite_wdata => s_axi_lite_wdata , -- AXI Lite Write Response Channel s_axi_lite_bready => s_axi_lite_bready , s_axi_lite_bvalid => s_axi_lite_bvalid , s_axi_lite_bresp => s_axi_lite_bresp , -- AXI Lite Read Address Channel s_axi_lite_arready => s_axi_lite_arready , s_axi_lite_arvalid => s_axi_lite_arvalid , s_axi_lite_araddr => s_axi_lite_araddr , -- AXI Lite Read Data Channel s_axi_lite_rready => s_axi_lite_rready , s_axi_lite_rvalid => s_axi_lite_rvalid , s_axi_lite_rdata => s_axi_lite_rdata , s_axi_lite_rresp => s_axi_lite_rresp , -- DataMover MMap Read Address Channel m_axi_arready => m_axi_arready , m_axi_arvalid => m_axi_arvalid , m_axi_araddr => m_axi_araddr , m_axi_arlen => m_axi_arlen , m_axi_arsize => m_axi_arsize , m_axi_arburst => m_axi_arburst , m_axi_arprot => m_axi_arprot , m_axi_arcache => m_axi_arcache , -- DataMover MMap Read Data Channel m_axi_rready => m_axi_rready , m_axi_rvalid => m_axi_rvalid , m_axi_rdata => m_axi_rdata , m_axi_rresp => m_axi_rresp , m_axi_rlast => m_axi_rlast , -- DataMover Write Address Channel m_axi_awready => m_axi_awready , m_axi_awvalid => m_axi_awvalid , m_axi_awaddr => m_axi_awaddr , m_axi_awlen => m_axi_awlen , m_axi_awsize => m_axi_awsize , m_axi_awburst => m_axi_awburst , m_axi_awprot => m_axi_awprot , m_axi_awcache => m_axi_awcache , -- DataMover Write Data Channel m_axi_wready => m_axi_wready , m_axi_wvalid => m_axi_wvalid , m_axi_wdata => m_axi_wdata , m_axi_wstrb => m_axi_wstrb , m_axi_wlast => m_axi_wlast , -- DataMover Write Response Channel m_axi_bready => m_axi_bready , m_axi_bvalid => m_axi_bvalid , m_axi_bresp => m_axi_bresp , -- Debug test vector (Xilinx use only) axi_cdma_tstvec => cdma_tvect_out ); end generate GEN_SIMPLE_MODE; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_SG_MODE -- -- If Generate Description: -- This IfGen Implements the CDMA with Scatter Gather Mode -- -- ------------------------------------------------------------ GEN_SG_MODE : if (C_INCLUDE_SG = 1) generate begin ------------------------------------------------------------ -- Instance: I_SG_MODE_WRAP -- -- Description: -- Instance for the CDMA Scatter Gather Mode Wrapper -- ------------------------------------------------------------ I_SG_MODE_WRAP : entity axi_cdma_v4_1.axi_cdma_sg_wrap generic map ( C_S_AXI_LITE_ADDR_WIDTH => C_S_AXI_LITE_ADDR_WIDTH , C_S_AXI_LITE_DATA_WIDTH => C_S_AXI_LITE_DATA_WIDTH , C_AXI_LITE_IS_ASYNC => C_AXI_LITE_IS_ASYNC , C_M_AXI_ADDR_WIDTH => C_M_AXI_ADDR_WIDTH , C_M_AXI_DATA_WIDTH => C_M_AXI_DATA_WIDTH , C_M_AXI_MAX_BURST_LEN => C_M_AXI_MAX_BURST_LEN , C_INCLUDE_DRE => C_INCLUDE_DRE , C_READ_ADDR_PIPE_DEPTH => C_READ_ADDR_PIPE_DEPTH , C_WRITE_ADDR_PIPE_DEPTH => C_WRITE_ADDR_PIPE_DEPTH , C_INCLUDE_SF => C_INCLUDE_SF , C_SF_FIFO_DEPTH => SF_FIFO_DEPTH , C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXI_SG_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , C_DLYTMR_RESOLUTION => C_DLYTMR_RESOLUTION , C_SOFT_RST_TIME_CLKS => SOFT_RST_TIME_CLKS , C_FAMILY => C_FAMILY ) port map ( -- Primary Clock and Reset axi_aclk => m_axi_aclk , axi_resetn => m_axi_aresetn , -- AXI Lite clock and Reset axi_lite_aclk => s_axi_lite_aclk , axi_lite_resetn => s_axi_lite_aresetn , -- Interrupt output cdma_introut => cdma_introut , -- Error Discrete output cdma_error_out => open , -- AXI Lite Write Address Channel s_axi_lite_awready => s_axi_lite_awready , s_axi_lite_awvalid => s_axi_lite_awvalid , s_axi_lite_awaddr => s_axi_lite_awaddr , -- AXI Lite Write Data Channel s_axi_lite_wready => s_axi_lite_wready , s_axi_lite_wvalid => s_axi_lite_wvalid , s_axi_lite_wdata => s_axi_lite_wdata , -- AXI Lite Write Response Channel s_axi_lite_bready => s_axi_lite_bready , s_axi_lite_bvalid => s_axi_lite_bvalid , s_axi_lite_bresp => s_axi_lite_bresp , -- AXI Lite Read Address Channel s_axi_lite_arready => s_axi_lite_arready , s_axi_lite_arvalid => s_axi_lite_arvalid , s_axi_lite_araddr => s_axi_lite_araddr , -- AXI Lite Read Data Channel s_axi_lite_rready => s_axi_lite_rready , s_axi_lite_rvalid => s_axi_lite_rvalid , s_axi_lite_rdata => s_axi_lite_rdata , s_axi_lite_rresp => s_axi_lite_rresp , -- DataMover MMap Read Address Channel m_axi_arready => m_axi_arready , m_axi_arvalid => m_axi_arvalid , m_axi_araddr => m_axi_araddr , m_axi_arlen => m_axi_arlen , m_axi_arsize => m_axi_arsize , m_axi_arburst => m_axi_arburst , m_axi_arprot => m_axi_arprot , m_axi_arcache => m_axi_arcache , -- DataMover MMap Read Data Channel m_axi_rready => m_axi_rready , m_axi_rvalid => m_axi_rvalid , m_axi_rdata => m_axi_rdata , m_axi_rresp => m_axi_rresp , m_axi_rlast => m_axi_rlast , -- DataMover Write Address Channel m_axi_awready => m_axi_awready , m_axi_awvalid => m_axi_awvalid , m_axi_awaddr => m_axi_awaddr , m_axi_awlen => m_axi_awlen , m_axi_awsize => m_axi_awsize , m_axi_awburst => m_axi_awburst , m_axi_awprot => m_axi_awprot , m_axi_awcache => m_axi_awcache , -- DataMover Write Data Channel m_axi_wready => m_axi_wready , m_axi_wvalid => m_axi_wvalid , m_axi_wdata => m_axi_wdata , m_axi_wstrb => m_axi_wstrb , m_axi_wlast => m_axi_wlast , -- DataMover Write Response Channel m_axi_bready => m_axi_bready , m_axi_bvalid => m_axi_bvalid , m_axi_bresp => m_axi_bresp , -- Scatter Gather Write Address Channel m_axi_sg_awready => m_axi_sg_awready , m_axi_sg_awvalid => m_axi_sg_awvalid , m_axi_sg_awaddr => m_axi_sg_awaddr , m_axi_sg_awlen => m_axi_sg_awlen , m_axi_sg_awsize => m_axi_sg_awsize , m_axi_sg_awburst => m_axi_sg_awburst , m_axi_sg_awprot => m_axi_sg_awprot , m_axi_sg_awcache => m_axi_sg_awcache , -- Scatter Gather Write Data Channel m_axi_sg_wready => m_axi_sg_wready , m_axi_sg_wvalid => m_axi_sg_wvalid , m_axi_sg_wdata => m_axi_sg_wdata , m_axi_sg_wstrb => m_axi_sg_wstrb , m_axi_sg_wlast => m_axi_sg_wlast , -- Scatter Gather Write Response Channel m_axi_sg_bready => m_axi_sg_bready , m_axi_sg_bvalid => m_axi_sg_bvalid , m_axi_sg_bresp => m_axi_sg_bresp , -- Scatter Gather Read Address Channel m_axi_sg_arready => m_axi_sg_arready , m_axi_sg_arvalid => m_axi_sg_arvalid , m_axi_sg_araddr => m_axi_sg_araddr , m_axi_sg_arlen => m_axi_sg_arlen , m_axi_sg_arsize => m_axi_sg_arsize , m_axi_sg_arburst => m_axi_sg_arburst , m_axi_sg_arprot => m_axi_sg_arprot , m_axi_sg_arcache => m_axi_sg_arcache , -- Scatter Gather Read Data Channel m_axi_sg_rready => m_axi_sg_rready , m_axi_sg_rvalid => m_axi_sg_rvalid , m_axi_sg_rdata => m_axi_sg_rdata , m_axi_sg_rresp => m_axi_sg_rresp , m_axi_sg_rlast => m_axi_sg_rlast , -- Debug test vector (Xilinx use only) axi_cdma_tstvec => cdma_tvect_out ); end generate GEN_SG_MODE; end implementation;
gpl-3.0
5f89b6cf0687b9d0675661874ee14182
0.403957
4.583659
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/inferred/ddr_inferred.vhd
1
2,631
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: gen_iddr_reg -- File: gen_iddr_reg.vhd -- Author: David Lindh, Jiri Gaisler - Gaisler Research -- Description: Generic DDR input reg ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; entity gen_iddr_reg is port( Q1 : out std_ulogic; Q2 : out std_ulogic; C1 : in std_ulogic; C2 : in std_ulogic; CE : in std_ulogic; D : in std_ulogic; R : in std_ulogic; S : in std_ulogic ); end; architecture rtl of gen_iddr_reg is signal preQ2 : std_ulogic; begin ddrregp : process(R,C1) begin if R = '1' then Q1 <= '0'; Q2 <= '0'; elsif rising_edge(C1) then Q1 <= D; Q2 <= preQ2; end if; end process; ddrregn : process(R,C2) begin if R = '1' then preQ2 <= '0'; -- elsif falling_edge(C1) then preQ2 <= D; end if; elsif rising_edge(C2) then preQ2 <= D; end if; end process; end; library ieee; use ieee.std_logic_1164.all; entity gen_oddr_reg is port ( Q : out std_ulogic; C1 : in std_ulogic; C2 : in std_ulogic; CE : in std_ulogic; D1 : in std_ulogic; D2 : in std_ulogic; R : in std_ulogic; S : in std_ulogic); end; architecture rtl of gen_oddr_reg is signal Q1,Q2: std_ulogic; begin Q <= Q1 when C1='1' else Q2; ddrregp: process(C1,R,S) begin if rising_edge(C1) then Q1 <= D1; Q2 <= D2; end if; if S='1' then Q1 <= '1'; Q2 <= '1'; end if; if R='1' then Q1 <= '0'; Q2 <= '0'; end if; end process; end;
gpl-2.0
2d6e51c1d127898d172f9b7fea6905d1
0.566705
3.461842
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys2/leon3mp.vhd
1
17,843
----------------------------------------------------------------------------- -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008, 2009, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib, techmap; use grlib.amba.all; use grlib.stdlib.all; use techmap.gencomp.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.jtag.all; -- pragma translate_off use gaisler.sim.all; -- pragma translate_on library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( reset : in std_ulogic; clk : in std_ulogic; -- 50 MHz main clock error : out std_ulogic; -- memoria address : out std_logic_vector(27 downto 0); data : inout std_logic_vector(31 downto 16); ramsn : out std_logic; mben : out std_logic_vector (3 downto 0); oen : out std_ulogic; writen : out std_ulogic; RamAdv : out std_logic; RamClk : out std_logic; RamCRE : out std_logic; --RamLB : out std_logic; --RamUB : out std_logic; --memoria dsubre : in std_ulogic; dsuact : out std_ulogic; txd2 : out std_ulogic; -- UART1 tx data rxd2 : in std_ulogic; -- UART1 rx data txd1 : out std_ulogic; -- UART1 tx data rxd1 : in std_ulogic; -- UART1 rx data pio : inout std_logic_vector(17 downto 0); -- I/O port -- switch : in std_logic_vector(7 downto 0); -- switches -- button : in std_logic_vector(2 downto 0); -- buttons ps2clk : inout std_logic; ps2data : inout std_logic; vid_hsync : out std_ulogic; vid_vsync : out std_ulogic; vid_r : out std_logic; vid_g : out std_logic; vid_b : out std_logic ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant fifodepth : integer := 8; constant maxahbm : integer := CFG_NCPU+ CFG_AHB_JTAG+CFG_SVGA_ENABLE; signal vcc, gnd : std_logic_vector(4 downto 0); signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdram_out_type; signal sdo2, sdo3 : sdctrl_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, rstraw, nerror : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal gpti : gptimer_in_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal lclk, rst : std_ulogic; signal tck, tckn, tms, tdi, tdo : std_ulogic; --signal txd1,txd2 : std_ulogic; signal kbdi : ps2_in_type; signal kbdo : ps2_out_type; signal vgao : apbvga_out_type; signal clkval : std_logic_vector(1 downto 0); constant BOARD_FREQ : integer := 50000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz constant IOAEN : integer := 0; signal stati : ahbstat_in_type; signal dac_clk, clk1x, vid_clock, video_clk, clkvga : std_logic; -- signals to vga_clkgen. signal clk_sel : std_logic_vector(1 downto 0); attribute keep : boolean; attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of video_clk : signal is true; attribute syn_preserve of video_clk : signal is true; attribute keep of video_clk : signal is true; begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- RamAdv <= '0'; RamClk <= '0'; RamCRE <= '0'; --RamLB <= '0'; --RamUB <= '0'; vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk); clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN, CFG_CLK_NOFB, 0, 0, 0, BOARD_FREQ) port map (lclk, lclk, clkm, open, open, open, open, cgi, cgo, open, clk1x); resetn_pad : inpad generic map (tech => padtech) port map (reset, rst); rst0 : rstgen -- reset generator generic map (acthigh => 1) port map (rst, clkm, cgo.clklock, rstn, rstraw); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => IOAEN, nahbm => maxahbm, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- l3 : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; nerror <= not dbgo(0).error; error_pad : outpad generic map (tech => padtech) port map (error, nerror); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsui.enable <= '1'; dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, dsuo.active); end generate; end generate; nodsu : if CFG_DSU = 0 generate dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_JTAG = 1 generate -- UART dcom0: ahbuart -- Debug UART generic map (hindex => CFG_NCPU, pindex => 7, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(7), ahbmi, ahbmo(CFG_NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (rxd1, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (txd1, duo.txd); end generate; -- nouah : if CFG_AHB_UART = 0 generate apbo(7) <= apb_none; end generate; -- ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate -- ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU) -- port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU), -- open, open, open, open, open, open, open, gnd(0)); -- end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "00"; mctrl0 : mctrl generic map (hindex => 0, pindex => 0, rommask => 16#000#, iomask => 16#000#, paddr => 0, srbanks => 1, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, sden => CFG_MCTRL_SDEN, invclk => CFG_CLK_NOFB, sepbus => CFG_MCTRL_SEPBUS) port map (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo); addr_pad : outpadv generic map (width => 28, tech => padtech) port map (address, memo.address(27 downto 0)); ramsa_pad : outpad generic map (tech => padtech) port map (ramsn, memo.ramsn(0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.ramoen(0)); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.wrn(0)); mben_pads : outpadv generic map (tech => padtech, width => 4) port map (mben, memo.mben); data_pads : iopadvv generic map (tech => padtech, width => 16) port map (data, memo.data(31 downto 16), memo.vbdrive(31 downto 16), memi.data(31 downto 16)); ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR, nslaves => 16) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.extclk <= '0'; rxd1_pad : inpad generic map (tech => padtech) port map (rxd2, u1i.rxd); txd1_pad : outpad generic map (tech => padtech) port map (txd2, u1o.txd); end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; nogpt : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; kbd : if CFG_KBD_ENABLE /= 0 generate ps20 : apbps2 generic map(pindex => 5, paddr => 5, pirq => 5) port map(rstn, clkm, apbi, apbo(5), kbdi, kbdo); end generate; nokbd : if CFG_KBD_ENABLE = 0 generate apbo(5) <= apb_none; kbdo <= ps2o_none; end generate; kbdclk_pad : iopad generic map (tech => padtech) port map (ps2clk,kbdo.ps2_clk_o, kbdo.ps2_clk_oe, kbdi.ps2_clk_i); kbdata_pad : iopad generic map (tech => padtech) port map (ps2data, kbdo.ps2_data_o, kbdo.ps2_data_oe, kbdi.ps2_data_i); clkdiv : process(clk1x, rstn) begin if rstn = '0' then clkval <= "00"; elsif rising_edge(clk1x) then clkval <= clkval + 1; end if; end process; vga : if CFG_VGA_ENABLE /= 0 generate vga0 : apbvga generic map(memtech => memtech, pindex => 6, paddr => 6) port map(rstn, clkm, video_clk, apbi, apbo(6), vgao); video_clock_pad : outpad generic map ( tech => padtech) port map (vid_clock, dac_clk); dac_clk <= not video_clk; b1 : techbuf generic map (2, virtex2) port map (clkval(0), video_clk); end generate; svga : if CFG_SVGA_ENABLE /= 0 generate clkvga <= clkval(1) when clk_sel = "00" else clkval(0) when clk_sel = "01" else clkm; b1 : techbuf generic map (2, virtex2) port map (clkvga, video_clk); svga0 : svgactrl generic map(memtech => memtech, pindex => 6, paddr => 6, hindex => CFG_NCPU+CFG_AHB_JTAG, clk0 => 40000, clk1 => 20000, clk2 => 25000) port map(rstn, clkm, video_clk, apbi, apbo(6), vgao, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_JTAG), clk_sel); dac_clk <= not video_clk; video_clock_pad : outpad generic map ( tech => padtech) port map (vid_clock, dac_clk); end generate; novga : if (CFG_VGA_ENABLE = 0 and CFG_SVGA_ENABLE = 0) generate apbo(6) <= apb_none; vgao <= vgao_none; end generate; vert_sync_pad : outpad generic map (tech => padtech) port map (vid_vsync, vgao.vsync); horiz_sync_pad : outpad generic map (tech => padtech) port map (vid_hsync, vgao.hsync); video_out_r_pad : outpad generic map (tech => padtech) port map (vid_r, vgao.video_out_r(7)); video_out_g_pad : outpad generic map (tech => padtech) port map (vid_g, vgao.video_out_g(7)); video_out_b_pad : outpad generic map (tech => padtech) port map (vid_b, vgao.video_out_b(7)); gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GPIO unit grgpio0: grgpio generic map(pindex => 8, paddr => 8, imask => CFG_GRGPIO_IMASK, nbits => 18) port map(rst => rstn, clk => clkm, apbi => apbi, apbo => apbo(8), gpioi => gpioi, gpioo => gpioo); pio_pads : iopadvv generic map (width => 18, tech => padtech) port map (pio, gpioo.dout(17 downto 0), gpioo.oen(17 downto 0), gpioi.din(17 downto 0)); end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ocram : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ) port map ( rstn, clkm, ahbsi, ahbso(7)); end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- -- nam1 : for i in (CFG_NCPU+FG_AHB_UART+CFG_GRETH+CFG_AHB_JTAG) to NAHBMST-1 generate -- ahbmo(i) <= ahbm_none; -- end generate; -- nap0 : for i in 11 to NAPBSLV-1 generate apbo(i) <= apb_none; end generate; -- nah0 : for i in 8 to NAHBSLV-1 generate ahbso(i) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Test report module ---------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off test0 : ahbrep generic map (hindex => 4, haddr => 16#200#) port map (rstn, clkm, ahbsi, ahbso(4)); -- pragma translate_on ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_version generic map ( msg1 => "LEON3 Digilent XC3S1000 Demonstration design", msg2 => "GRLIB Version " & tost(LIBVHDL_VERSION/1000) & "." & tost((LIBVHDL_VERSION mod 1000)/100) & "." & tost(LIBVHDL_VERSION mod 100) & ", build " & tost(LIBVHDL_BUILD), msg3 => "Target technology: " & tech_table(fabtech) & ", memory library: " & tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
15df31cb9a8ab68bafd81cc0cfb99183
0.544415
3.629577
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/car/simulation/bmg_stim_gen.vhd
1
12,577
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Stimulus Generator For Single Port ROM -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: bmg_stim_gen.vhd -- -- Description: -- Stimulus Generation For SROM -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY REGISTER_LOGIC_SROM IS PORT( Q : OUT STD_LOGIC; CLK : IN STD_LOGIC; RST : IN STD_LOGIC; D : IN STD_LOGIC ); END REGISTER_LOGIC_SROM; ARCHITECTURE REGISTER_ARCH OF REGISTER_LOGIC_SROM IS SIGNAL Q_O : STD_LOGIC :='0'; BEGIN Q <= Q_O; FF_BEH: PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(RST /= '0' ) THEN Q_O <= '0'; ELSE Q_O <= D; END IF; END IF; END PROCESS; END REGISTER_ARCH; LIBRARY STD; USE STD.TEXTIO.ALL; LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; --USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY BMG_STIM_GEN IS GENERIC ( C_ROM_SYNTH : INTEGER := 0 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; ADDRA: OUT STD_LOGIC_VECTOR(12 DOWNTO 0) := (OTHERS => '0'); DATA_IN : IN STD_LOGIC_VECTOR (11 DOWNTO 0); --OUTPUT VECTOR STATUS : OUT STD_LOGIC:= '0' ); END BMG_STIM_GEN; ARCHITECTURE BEHAVIORAL OF BMG_STIM_GEN IS FUNCTION hex_to_std_logic_vector( hex_str : STRING; return_width : INTEGER) RETURN STD_LOGIC_VECTOR IS VARIABLE tmp : STD_LOGIC_VECTOR((hex_str'LENGTH*4)+return_width-1 DOWNTO 0); BEGIN tmp := (OTHERS => '0'); FOR i IN 1 TO hex_str'LENGTH LOOP CASE hex_str((hex_str'LENGTH+1)-i) IS WHEN '0' => tmp(i*4-1 DOWNTO (i-1)*4) := "0000"; WHEN '1' => tmp(i*4-1 DOWNTO (i-1)*4) := "0001"; WHEN '2' => tmp(i*4-1 DOWNTO (i-1)*4) := "0010"; WHEN '3' => tmp(i*4-1 DOWNTO (i-1)*4) := "0011"; WHEN '4' => tmp(i*4-1 DOWNTO (i-1)*4) := "0100"; WHEN '5' => tmp(i*4-1 DOWNTO (i-1)*4) := "0101"; WHEN '6' => tmp(i*4-1 DOWNTO (i-1)*4) := "0110"; WHEN '7' => tmp(i*4-1 DOWNTO (i-1)*4) := "0111"; WHEN '8' => tmp(i*4-1 DOWNTO (i-1)*4) := "1000"; WHEN '9' => tmp(i*4-1 DOWNTO (i-1)*4) := "1001"; WHEN 'a' | 'A' => tmp(i*4-1 DOWNTO (i-1)*4) := "1010"; WHEN 'b' | 'B' => tmp(i*4-1 DOWNTO (i-1)*4) := "1011"; WHEN 'c' | 'C' => tmp(i*4-1 DOWNTO (i-1)*4) := "1100"; WHEN 'd' | 'D' => tmp(i*4-1 DOWNTO (i-1)*4) := "1101"; WHEN 'e' | 'E' => tmp(i*4-1 DOWNTO (i-1)*4) := "1110"; WHEN 'f' | 'F' => tmp(i*4-1 DOWNTO (i-1)*4) := "1111"; WHEN OTHERS => tmp(i*4-1 DOWNTO (i-1)*4) := "1111"; END CASE; END LOOP; RETURN tmp(return_width-1 DOWNTO 0); END hex_to_std_logic_vector; CONSTANT ZERO : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL READ_ADDR_INT : STD_LOGIC_VECTOR(12 DOWNTO 0) := (OTHERS => '0'); SIGNAL READ_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL CHECK_READ_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0'); SIGNAL EXPECTED_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0) := (OTHERS => '0'); SIGNAL DO_READ : STD_LOGIC := '0'; SIGNAL CHECK_DATA : STD_LOGIC := '0'; SIGNAL CHECK_DATA_R : STD_LOGIC := '0'; SIGNAL CHECK_DATA_2R : STD_LOGIC := '0'; SIGNAL DO_READ_REG: STD_LOGIC_VECTOR(4 DOWNTO 0) :=(OTHERS => '0'); CONSTANT DEFAULT_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0):= hex_to_std_logic_vector("0",12); BEGIN SYNTH_COE: IF(C_ROM_SYNTH =0 ) GENERATE type mem_type is array (5999 downto 0) of std_logic_vector(11 downto 0); FUNCTION bit_to_sl(input: BIT) RETURN STD_LOGIC IS VARIABLE temp_return : STD_LOGIC; BEGIN IF (input = '0') THEN temp_return := '0'; ELSE temp_return := '1'; END IF; RETURN temp_return; END bit_to_sl; function char_to_std_logic ( char : in character) return std_logic is variable data : std_logic; begin if char = '0' then data := '0'; elsif char = '1' then data := '1'; elsif char = 'X' then data := 'X'; else assert false report "character which is not '0', '1' or 'X'." severity warning; data := 'U'; end if; return data; end char_to_std_logic; impure FUNCTION init_memory( C_USE_DEFAULT_DATA : INTEGER; C_LOAD_INIT_FILE : INTEGER ; C_INIT_FILE_NAME : STRING ; DEFAULT_DATA : STD_LOGIC_VECTOR(11 DOWNTO 0); width : INTEGER; depth : INTEGER) RETURN mem_type IS VARIABLE init_return : mem_type := (OTHERS => (OTHERS => '0')); FILE init_file : TEXT; VARIABLE mem_vector : BIT_VECTOR(width-1 DOWNTO 0); VARIABLE bitline : LINE; variable bitsgood : boolean := true; variable bitchar : character; VARIABLE i : INTEGER; VARIABLE j : INTEGER; BEGIN --Display output message indicating that the behavioral model is being --initialized ASSERT (NOT (C_USE_DEFAULT_DATA=1 OR C_LOAD_INIT_FILE=1)) REPORT " Block Memory Generator CORE Generator module loading initial data..." SEVERITY NOTE; -- Setup the default data -- Default data is with respect to write_port_A and may be wider -- or narrower than init_return width. The following loops map -- default data into the memory IF (C_USE_DEFAULT_DATA=1) THEN FOR i IN 0 TO depth-1 LOOP init_return(i) := DEFAULT_DATA; END LOOP; END IF; -- Read in the .mif file -- The init data is formatted with respect to write port A dimensions. -- The init_return vector is formatted with respect to minimum width and -- maximum depth; the following loops map the .mif file into the memory IF (C_LOAD_INIT_FILE=1) THEN file_open(init_file, C_INIT_FILE_NAME, read_mode); i := 0; WHILE (i < depth AND NOT endfile(init_file)) LOOP mem_vector := (OTHERS => '0'); readline(init_file, bitline); -- read(file_buffer, mem_vector(file_buffer'LENGTH-1 DOWNTO 0)); FOR j IN 0 TO width-1 LOOP read(bitline,bitchar,bitsgood); init_return(i)(width-1-j) := char_to_std_logic(bitchar); END LOOP; i := i + 1; END LOOP; file_close(init_file); END IF; RETURN init_return; END FUNCTION; --*************************************************************** -- convert bit to STD_LOGIC --*************************************************************** constant c_init : mem_type := init_memory(0, 1, "car.mif", DEFAULT_DATA, 12, 6000); constant rom : mem_type := c_init; BEGIN EXPECTED_DATA <= rom(conv_integer(unsigned(check_read_addr))); CHECKER_RD_ADDR_GEN_INST:ENTITY work.ADDR_GEN GENERIC MAP( C_MAX_DEPTH =>6000 ) PORT MAP( CLK => CLK, RST => RST, EN => CHECK_DATA_2R, LOAD => '0', LOAD_VALUE => ZERO, ADDR_OUT => CHECK_READ_ADDR ); PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(CHECK_DATA_2R ='1') THEN IF(EXPECTED_DATA = DATA_IN) THEN STATUS<='0'; ELSE STATUS <= '1'; END IF; END IF; END IF; END PROCESS; END GENERATE; -- Simulatable ROM --Synthesizable ROM SYNTH_CHECKER: IF(C_ROM_SYNTH = 1) GENERATE PROCESS(CLK) BEGIN IF(RISING_EDGE(CLK)) THEN IF(CHECK_DATA_2R='1') THEN IF(DATA_IN=DEFAULT_DATA) THEN STATUS <= '0'; ELSE STATUS <= '1'; END IF; END IF; END IF; END PROCESS; END GENERATE; READ_ADDR_INT(12 DOWNTO 0) <= READ_ADDR(12 DOWNTO 0); ADDRA <= READ_ADDR_INT ; CHECK_DATA <= DO_READ; RD_ADDR_GEN_INST:ENTITY work.ADDR_GEN GENERIC MAP( C_MAX_DEPTH => 6000 ) PORT MAP( CLK => CLK, RST => RST, EN => DO_READ, LOAD => '0', LOAD_VALUE => ZERO, ADDR_OUT => READ_ADDR ); RD_PROCESS: PROCESS (CLK) BEGIN IF (RISING_EDGE(CLK)) THEN IF(RST='1') THEN DO_READ <= '0'; ELSE DO_READ <= '1'; END IF; END IF; END PROCESS; BEGIN_SHIFT_REG: FOR I IN 0 TO 4 GENERATE BEGIN DFF_RIGHT: IF I=0 GENERATE BEGIN SHIFT_INST_0: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => DO_READ_REG(0), CLK =>CLK, RST=>RST, D =>DO_READ ); END GENERATE DFF_RIGHT; DFF_OTHERS: IF ((I>0) AND (I<=4)) GENERATE BEGIN SHIFT_INST: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => DO_READ_REG(I), CLK =>CLK, RST=>RST, D =>DO_READ_REG(I-1) ); END GENERATE DFF_OTHERS; END GENERATE BEGIN_SHIFT_REG; CHECK_DATA_REG_1: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => CHECK_DATA_2R, CLK =>CLK, RST=>RST, D =>CHECK_DATA_R ); CHECK_DATA_REG: ENTITY work.REGISTER_LOGIC_SROM PORT MAP( Q => CHECK_DATA_R, CLK =>CLK, RST=>RST, D =>CHECK_DATA ); END ARCHITECTURE;
mit
885ce51fa822227fd4fa1a97bfbec3e1
0.547666
3.687189
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-clock-gate/config.vhd
1
7,711
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := virtex2; constant CFG_MEMTECH : integer := virtex2; constant CFG_PADTECH : integer := virtex2; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := virtex2; constant CFG_CLKMUL : integer := (2); constant CFG_CLKDIV : integer := (2); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (2); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 0 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 0; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (0); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 1; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 1; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 8; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 0; constant CFG_ITLBNUM : integer := 2; constant CFG_DTLBNUM : integer := 2; constant CFG_TLB_TYPE : integer := 1 + 0*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 1; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000017#; -- PROM/SRAM controller constant CFG_SRCTRL : integer := 0; constant CFG_SRCTRL_PROMWS : integer := 0; constant CFG_SRCTRL_RAMWS : integer := 0; constant CFG_SRCTRL_IOWS : integer := 0; constant CFG_SRCTRL_RMW : integer := 0; constant CFG_SRCTRL_8BIT : integer := 0; constant CFG_SRCTRL_SRBANKS : integer := 1; constant CFG_SRCTRL_BANKSZ : integer := 0; constant CFG_SRCTRL_ROMASEL : integer := 0; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 1; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 1; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- SDRAM controller constant CFG_SDCTRL : integer := 0; constant CFG_SDCTRL_INVCLK : integer := 0; constant CFG_SDCTRL_SD64 : integer := 0; constant CFG_SDCTRL_PAGE : integer := 0 + 0; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 32; -- CAN 2.0 interface constant CFG_CAN : integer := 0; constant CFG_CANIO : integer := 16#0#; constant CFG_CANIRQ : integer := 0; constant CFG_CANLOOP : integer := 0; constant CFG_CAN_SYNCRST : integer := 0; constant CFG_CANFT : integer := 0; -- PCI interface constant CFG_PCI : integer := 0; constant CFG_PCIVID : integer := 16#0#; constant CFG_PCIDID : integer := 16#0#; constant CFG_PCIDEPTH : integer := 8; constant CFG_PCI_MTF : integer := 1; -- PCI arbiter constant CFG_PCI_ARB : integer := 0; constant CFG_PCI_ARBAPB : integer := 0; constant CFG_PCI_ARB_NGNT : integer := 4; -- PCI trace buffer constant CFG_PCITBUFEN: integer := 0; constant CFG_PCITBUF : integer := 256; -- Spacewire interface constant CFG_SPW_EN : integer := 0; constant CFG_SPW_NUM : integer := 1; constant CFG_SPW_AHBFIFO : integer := 4; constant CFG_SPW_RXFIFO : integer := 16; constant CFG_SPW_RMAP : integer := 0; constant CFG_SPW_RMAPBUF : integer := 4; constant CFG_SPW_RMAPCRC : integer := 0; constant CFG_SPW_NETLIST : integer := 0; constant CFG_SPW_FT : integer := 0; constant CFG_SPW_GRSPW : integer := 2; constant CFG_SPW_RXUNAL : integer := 0; constant CFG_SPW_DMACHAN : integer := 1; constant CFG_SPW_PORTS : integer := 1; constant CFG_SPW_INPUT : integer := 2; constant CFG_SPW_OUTPUT : integer := 0; constant CFG_SPW_RTSAME : integer := 0; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- UART 2 constant CFG_UART2_ENABLE : integer := 0; constant CFG_UART2_FIFO : integer := 1; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 1; constant CFG_GPT_WDOG : integer := 16#FFFF#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (12); -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
6a17da0e6bafaa99f474f2b5a17b76e5
0.648684
3.601588
false
false
false
false
borti4938/sd2snes
verilog/sd2snes_sdd1/SDD1.vhd
2
30,065
---------------------------------------------------------------------------------- -- Company: Traducciones Magno -- Engineer: Magno -- -- Create Date: 29.03.2018 19:16:08 -- Design Name: -- Module Name: SDD1 - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx leaf cells in this code. --library UNISIM; --use UNISIM.VComponents.all; entity SDD1 is Port( MCLK : in STD_LOGIC; SNES_cycle_start : in STD_LOGIC; SNES_cycle_end : in STD_LOGIC; SNES_REFRESH : in STD_LOGIC; RESET : in STD_LOGIC; SRAM_CS : out STD_LOGIC; SRAM_RD : out STD_LOGIC; SRAM_WR : out STD_LOGIC; ROM_OE : out STD_LOGIC; ROM_CS : out STD_LOGIC; ROM_ADDR : out STD_LOGIC_VECTOR(21 downto 0); ROM_DATA : in STD_LOGIC_VECTOR(15 downto 0); SNES_ADDR : in STD_LOGIC_VECTOR(23 downto 0); SNES_DATA_IN : in STD_LOGIC_VECTOR(7 downto 0); SNES_DATA_OUT : out STD_LOGIC_VECTOR(7 downto 0); SNES_RD : in STD_LOGIC; SNES_WR : in STD_LOGIC; SNES_WR_End : in STD_LOGIC; DMA_Transferring : out STD_LOGIC; Idle : out STD_LOGIC ); end SDD1; architecture Behavioral of SDD1 is -- number of SD2SNES clock cycles of ROM time access -> 7 cycles = 73 ns for -70ns PSRAM --constant ROM_ACCESS_CYCLES : integer := 7; -- number of SD2SNES clock cycles of ROM time access -> 9 cycles = 93.75 ns for -85ns PSRAM constant ROM_ACCESS_CYCLES : integer := 9; COMPONENT Input_Manager Port( clk : in STD_LOGIC; -- control data DMA_Conf_Valid : in STD_LOGIC; DMA_In_Progress : in STD_LOGIC; Header_Valid : out STD_LOGIC; Header_BPP : out STD_LOGIC_VECTOR(1 downto 0); Header_Context : out STD_LOGIC_VECTOR(1 downto 0); -- data input from ROM ROM_Data_tready : out STD_LOGIC; ROM_Data_tvalid : in STD_LOGIC; ROM_Data_tdata : in STD_LOGIC_VECTOR(15 downto 0); ROM_Data_tkeep : in STD_LOGIC_VECTOR(1 downto 0); -- Golomb decoded value Decoded_Bit_tready : in STD_LOGIC; Decoded_Bit_tuser : in STD_LOGIC_VECTOR(7 downto 0); Decoded_Bit_tvalid : out STD_LOGIC; Decoded_Bit_tdata : out STD_LOGIC; Decoded_Bit_tlast : out STD_LOGIC); END COMPONENT; COMPONENT Probability_Estimator Port( clk : in STD_LOGIC; -- control data DMA_In_Progress : in STD_LOGIC; Header_Valid : in STD_LOGIC; Header_Context : in STD_LOGIC_VECTOR(1 downto 0); -- run data from input manager Decoded_Bit_tready : out STD_LOGIC; Decoded_Bit_tuser : out STD_LOGIC_VECTOR(7 downto 0); Decoded_Bit_tvalid : in STD_LOGIC; Decoded_Bit_tdata : in STD_LOGIC; Decoded_Bit_tlast : in STD_LOGIC; -- estimated bit value BPP_Bit_tready : in STD_LOGIC; BPP_Bit_tuser : in STD_LOGIC_VECTOR(9 downto 0); BPP_Bit_tvalid : out STD_LOGIC; BPP_Bit_tdata : out STD_LOGIC); END COMPONENT; COMPONENT Output_Manager Port( clk : in STD_LOGIC; -- configuration received from DMA DMA_In_Progress : out STD_LOGIC; DMA_Transfer_End : in STD_LOGIC; Header_Valid : in STD_LOGIC; Header_BPP : in STD_LOGIC_VECTOR(1 downto 0); -- data input from Probability Estimator BPP_Bit_tready : out STD_LOGIC; BPP_Bit_tuser : out STD_LOGIC_VECTOR(9 downto 0); BPP_Bit_tvalid : in STD_LOGIC; BPP_Bit_tdata : in STD_LOGIC; -- data output to DMA DMA_Data_tready : in STD_LOGIC; DMA_Data_tvalid : out STD_LOGIC; DMA_Data_tdata : out STD_LOGIC_VECTOR(7 downto 0) ); END COMPONENT; type TipoEstado is(WAIT_START, GET_DMA_CONFIG, START_DECOMPRESSION, WAIT_DMA_TRIGGERED, WAIT_DMA_START_TRANSFER, WAIT_TRANSFER_COMPLETE, WAIT_READ_CYCLE_END, END_DECOMPRESSION); signal estado : TipoEstado := WAIT_START; signal DMA_Triggered : STD_LOGIC := '0'; signal DMA_Channel_Valid : STD_LOGIC := '0'; signal DMA_Channel_Select : integer range 0 to 7 := 0; signal DMA_Channel_Transfer : integer range 0 to 7 := 0; signal DMA_Channel_Select_Mask : STD_LOGIC_VECTOR(7 downto 0) := X"00"; signal DMA_Channel_Enable : STD_LOGIC := '0'; signal DMA_Target_Register : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); type DMA_Src_Addr_t is array (0 to 7) of STD_LOGIC_VECTOR(23 downto 0); type DMA_Size_t is array (0 to 7) of STD_LOGIC_VECTOR(15 downto 0); signal DMA_Src_Addr : DMA_Src_Addr_t := (others => (others => '0')); signal DMA_Size : DMA_Size_t := (others => (others => '0')); signal Curr_Src_Addr : STD_LOGIC_VECTOR(23 downto 0) := (others => '0'); signal Curr_Size : integer range 0 to 65535 := 0; signal ROM_Access_Cnt : integer range 0 to 15 := 0; signal Register_Data_Out : STD_LOGIC_VECTOR(7 downto 0) := X"00"; signal Register_Access : STD_LOGIC := '0'; signal Bank_Map_C0 : STD_LOGIC_VECTOR(3 downto 0) := X"0"; signal Bank_Map_D0 : STD_LOGIC_VECTOR(3 downto 0) := X"1"; signal Bank_Map_E0 : STD_LOGIC_VECTOR(3 downto 0) := X"2"; signal Bank_Map_F0 : STD_LOGIC_VECTOR(3 downto 0) := X"3"; signal ROM_Data_Byte : STD_LOGIC_VECTOR(7 downto 0) := X"00"; signal ROM_Data_tready : STD_LOGIC := '0'; signal ROM_Data_tvalid : STD_LOGIC := '0'; signal ROM_Data_tdata : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal ROM_Data_tkeep : STD_LOGIC_VECTOR(1 downto 0) := (others => '0'); signal DMA_Data_tready : STD_LOGIC := '0'; signal DMA_Data_tvalid : STD_LOGIC := '0'; signal DMA_Data_tdata : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal DMA_Data_out : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal FSM_Sniff_DMA_Config : STD_LOGIC := '0'; signal FSM_Avoid_Collision : STD_LOGIC := '0'; signal FSM_DMA_Transferring : STD_LOGIC := '0'; signal FSM_Start_Decompression : STD_LOGIC := '0'; signal FSM_End_Decompression : STD_LOGIC := '0'; signal FSM_Idle : STD_LOGIC := '0'; signal FSM_Reset : STD_LOGIC := '0'; signal DMA_In_Progress : STD_LOGIC := '0'; signal Header_Valid : STD_LOGIC := '0'; signal Header_BPP : STD_LOGIC_VECTOR(1 downto 0) := "00"; signal Header_Context : STD_LOGIC_VECTOR(1 downto 0) := "00"; signal Decoded_Bit_tready : STD_LOGIC := '0'; signal Decoded_Bit_tuser : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal Decoded_Bit_tvalid : STD_LOGIC := '0'; signal Decoded_Bit_tdata : STD_LOGIC := '0'; signal Decoded_Bit_tlast : STD_LOGIC := '0'; signal BPP_Bit_tready : STD_LOGIC := '0'; signal BPP_Bit_tuser : STD_LOGIC_VECTOR(9 downto 0) := (others => '0'); signal BPP_Bit_tvalid : STD_LOGIC := '0'; signal BPP_Bit_tdata : STD_LOGIC := '0'; signal SNES_RD_Pipe : STD_LOGIC_VECTOR(1 downto 0) := "11"; signal ROM_ADDR_i : STD_LOGIC_VECTOR(21 downto 0); signal ROM_CS_i : STD_LOGIC := '0'; signal FIFO_READ : STD_LOGIC := '0'; signal SNES_Refresh_Pipe : STD_LOGIC_VECTOR(5 downto 0) := "000000"; signal SNES_Refresh_Cycle : STD_LOGIC := '0'; signal Bus_Slot : STD_LOGIC := '0'; signal Bus_Slot_Free : STD_LOGIC := '0'; signal DMA_Src_Match : STD_LOGIC := '0'; signal SNES_cycle_start_i : STD_LOGIC := '0'; signal SNES_cycle_end_i : STD_LOGIC := '0'; begin DMA_Transferring <= FSM_DMA_Transferring; Idle <= FSM_Idle; -- clock (edge) generation -- RG support two bus slots per SNES cycle. One typically used by the SNES and one that is always free. Process( MCLK ) begin if rising_edge( MCLK ) then -- RG free slot always available. main blocks MCU during active S-DD1. -- SNES slot is available during a Src Match (DMA) or during refresh to provide more bandwidth. -- refresh seemed to fix the glitches. SO (JP) was randomly corrupting the New Game screen whenever a refresh happened right after a $4801 <- 1 write. -- This left 1-2 free slots before the dead SNES_cycles which caused a problem. does the decompressor require some number of bytes to always be available -- during a fixed period prior to DMA start? this also fixed other glitches in SO and SFA. -- Bus_Slot <= SNES_cycle_start OR SNES_cycle_end; -- Bus_Slot_Free <= SNES_cycle_end; -- to reproduce the problem remove the Refresh term and toggle New Game (A button) then back (B button) repeatedly until there is a longer pause and graphics glitch on SO (JP). -- the byte that fails is the 7th decompressed byte from $FE5CF0 (should be $58, but is actually $78) on the transition to the New Game screen. -- this is a DMA to WRAM $7F2800. $7F2000/$2800 are used as some sort of lookup table and the corruption causes the SNES to execute incorrectly (but not crash most of the time). --Bus_Slot_Free <= SNES_Cycle_End OR (SNES_Cycle_Start AND DMA_Src_Match) OR (SNES_Refresh_Pipe(1) XOR SNES_Refresh_Pipe(0)); Bus_Slot_Free <= SNES_Cycle_End OR (SNES_Cycle_Start AND FSM_DMA_Transferring) OR SNES_Refresh_Cycle; -- pipeline for avoiding glitches and metastability SNES_Refresh_Pipe <= SNES_Refresh_Pipe(4 downto 0) & SNES_REFRESH; end if; End Process; -- allow a ROM read slot just after REFRESH is started and just after REFRESH is finished SNES_Refresh_Cycle <= '1' when SNES_Refresh_Pipe(5 downto 1) = "00011" OR SNES_Refresh_Pipe(5 downto 1) = "11100" else '0'; -- decode SRAM access [$7X]:[$6000-$7FFF]; be careful with W-RAM $7E and $7F -- RG access only driven by address compare. Process(SNES_ADDR, SNES_RD, SNES_WR) Begin if( SNES_ADDR(23 downto 19) = B"01110" AND SNES_ADDR(15 downto 13) = "011" ) then SRAM_CS <= SNES_RD AND SNES_WR; SRAM_RD <= SNES_RD; SRAM_WR <= SNES_WR; else SRAM_CS <= '1'; SRAM_RD <= '1'; SRAM_WR <= '1'; end if; End Process; -- decode ROM access; SNES CPU has priority over decompression core's input FIFO Process( SNES_ADDR, SNES_RD, FSM_DMA_Transferring, FSM_Avoid_Collision, Curr_Src_Addr, ROM_Data_tready, Bank_Map_C0, Bank_Map_D0, Bank_Map_E0, Bank_Map_F0, Bus_Slot_Free, ROM_Access_Cnt ) Begin -- when CPU and SDD1 may collide -- RG allow DMA to use both slots. Prefetch can only use the free slot. Once an access is started, always drive the address and OE. if ( (FSM_DMA_Transferring = '1' AND Bus_Slot_Free = '1') OR (FSM_Avoid_Collision = '1' AND Bus_Slot_Free = '1') OR ROM_Access_Cnt /= 0 ) then -- check which megabit is mapped onto $C0 if( Curr_Src_Addr(23 downto 20) = X"C" ) then ROM_ADDR_i <= Bank_Map_C0(2 downto 0) & Curr_Src_Addr(19 downto 1); ROM_CS_i <= NOT ROM_Data_tready; ROM_OE <= NOT ROM_Data_tready; -- check which megabit is mapped onto $D0 elsif( Curr_Src_Addr(23 downto 20) = X"D" ) then ROM_ADDR_i <= Bank_Map_D0(2 downto 0) & Curr_Src_Addr(19 downto 1); ROM_CS_i <= NOT ROM_Data_tready; ROM_OE <= NOT ROM_Data_tready; -- check which megabit is mapped onto $E0 elsif( Curr_Src_Addr(23 downto 20) = X"E" ) then ROM_ADDR_i <= Bank_Map_E0(2 downto 0) & Curr_Src_Addr(19 downto 1); ROM_CS_i <= NOT ROM_Data_tready; ROM_OE <= NOT ROM_Data_tready; -- check which megabit is mapped onto $F0 elsif( Curr_Src_Addr(23 downto 20) = X"F" ) then ROM_ADDR_i <= Bank_Map_F0(2 downto 0) & Curr_Src_Addr(19 downto 1); ROM_CS_i <= NOT ROM_Data_tready; ROM_OE <= NOT ROM_Data_tready; else ROM_ADDR_i <= Curr_Src_Addr(22 downto 1); ROM_CS_i <= '1'; ROM_OE <= '1'; end if; -- Perform non-SDD1 ROM access for SNES -- RG drive ROM based only on address compares. The timing of the ROM access and internal SNES_RD signal requires this. else -- Low addresses are not mapped if( SNES_ADDR(22) = '0' AND SNES_ADDR(15) = '1' ) then ROM_ADDR_i <= SNES_ADDR(23 downto 16) & SNES_ADDR(14 downto 1); ROM_CS_i <= '0'; ROM_OE <= '0'; -- check which megabit is mapped onto $C0 elsif( SNES_ADDR(23 downto 20) = X"C" ) then ROM_ADDR_i <= Bank_Map_C0(2 downto 0) & SNES_ADDR(19 downto 1); ROM_CS_i <= '0'; ROM_OE <= '0'; -- check which megabit is mapped onto $D0 elsif( SNES_ADDR(23 downto 20) = X"D" ) then ROM_ADDR_i <= Bank_Map_D0(2 downto 0) & SNES_ADDR(19 downto 1); ROM_CS_i <= '0'; ROM_OE <= '0'; -- check which megabit is mapped onto $E0 elsif( SNES_ADDR(23 downto 20) = X"E" ) then ROM_ADDR_i <= Bank_Map_E0(2 downto 0) & SNES_ADDR(19 downto 1); ROM_CS_i <= '0'; ROM_OE <= '0'; -- check which megabit is mapped onto $F0 elsif( SNES_ADDR(23 downto 20) = X"F" ) then ROM_ADDR_i <= Bank_Map_F0(2 downto 0) & SNES_ADDR(19 downto 1); ROM_CS_i <= '0'; ROM_OE <= '0'; else ROM_ADDR_i <= SNES_ADDR(21 downto 0); ROM_CS_i <= '1'; ROM_OE <= '1'; end if; end if; End Process; ROM_CS <= ROM_CS_i; ROM_ADDR <= ROM_ADDR_i; -- decode data bus Process(SNES_RD, SNES_ADDR, ROM_DATA) Begin if( SNES_RD = '0' ) then if( SNES_ADDR(0) = '0' ) then ROM_Data_Byte <= ROM_DATA(7 downto 0); else ROM_Data_Byte <= ROM_DATA(15 downto 8); end if; else ROM_Data_Byte <= X"00"; end if; End Process; -- S-DD1 WRITE register map -- $4800 = x -> put S-DD1 to sniff configuration for DMA channel x from SNES address bus -- $4801 = x -> start decompression from DMA channel x -- $4802 = ? -> ??? -- $4803 = ? -> ??? -- $4804 = x -> maps the x-th megabit in ROM into SNES $C0-$CF -- $4805 = x -> maps the x-th megabit in ROM into SNES $D0-$DF -- $4806 = x -> maps the x-th megabit in ROM into SNES $E0-$EF -- $4807 = x -> maps the x-th megabit in ROM into SNES $F0-$FF Process( MCLK ) Begin if rising_edge( MCLK ) then if( RESET = '0' ) then Bank_Map_C0 <= X"0"; Bank_Map_D0 <= X"1"; Bank_Map_E0 <= X"2"; Bank_Map_F0 <= X"3"; DMA_Channel_Valid <= '0'; DMA_Channel_Select_Mask <= X"00"; DMA_Channel_Enable <= '0'; DMA_Channel_Transfer <= 0; else -- SNES bank $00 -> register $480X can be accessed from any LoROM bank if( SNES_WR_End = '1' AND SNES_ADDR(22) = '0' AND SNES_ADDR(15 downto 4) = X"480" ) then case SNES_ADDR(3 downto 0) is -- register $4800 -> select the DMA channels to sniff when X"0" => -- register channel mask to sniff writes to $43X- DMA_Channel_Select_Mask <= SNES_DATA_IN; -- if channel is 0, decoding is disabled; if not, decoding can be -- triggered again without writting to $4800 if( SNES_DATA_IN = X"00" ) then DMA_Channel_Valid <= '0'; else DMA_Channel_Valid <= '1'; end if; -- register $4801 -> select the DMA channel to be triggered -- this is used to pre-fetch data from the source address before -- DMA is triggered writing to $420B when X"1" => case SNES_DATA_IN is when X"02" => DMA_Channel_Transfer <= 1; when X"04" => DMA_Channel_Transfer <= 2; when X"08" => DMA_Channel_Transfer <= 3; when X"10" => DMA_Channel_Transfer <= 4; when X"20" => DMA_Channel_Transfer <= 5; when X"40" => DMA_Channel_Transfer <= 6; when X"80" => DMA_Channel_Transfer <= 7; when others => DMA_Channel_Transfer <= 0; end case; if( (DMA_Channel_Select_Mask AND SNES_DATA_IN) /= X"00" ) then DMA_Channel_Enable <= '1'; end if; -- register $4804 when X"4" => Bank_Map_C0 <= SNES_DATA_IN(3 downto 0); -- register $4805 when X"5" => Bank_Map_D0 <= SNES_DATA_IN(3 downto 0); -- register $4806 when X"6" => Bank_Map_E0 <= SNES_DATA_IN(3 downto 0); -- register $4807 when X"7" => Bank_Map_F0 <= SNES_DATA_IN(3 downto 0); when others => DMA_Channel_Enable <= '0'; end case; else DMA_Channel_Enable <= '0'; end if; end if; end if; End Process; -- S-DD1 READ register map -- $4800 = x -> put S-DD1 to sniff configuration for DMA channel x from SNES address bus -- $4801 = x -> start decompression from DMA channel x -- $4802 = ? -> ??? -- $4803 = ? -> ??? -- $4804 = x -> maps the x-th megabit in ROM into SNES $C0-$CF -- $4805 = x -> maps the x-th megabit in ROM into SNES $D0-$DF -- $4806 = x -> maps the x-th megabit in ROM into SNES $E0-$EF -- $4807 = x -> maps the x-th megabit in ROM into SNES $F0-$FF Process( MCLK ) Begin if rising_edge( MCLK ) then if( RESET = '0' ) then Register_Access <= '0'; Register_Data_Out <= X"00"; else -- SNES bank $00 -> register $480X can be accessed from any LoROM bank if( SNES_ADDR(22) = '0' AND SNES_ADDR(15 downto 4) = X"480" ) then Register_Access <= '1'; case SNES_ADDR(3 downto 0) is -- register $4800 -> select the DMA channels to sniff when X"0" => Register_Data_Out <= DMA_Channel_Select_Mask; -- register $4801 -> select the DMA channel to be triggered -- this is used to pre-fetch data from the source address before -- DMA is triggered writing to $420B when X"1" => case DMA_Channel_Transfer is when 1 => Register_Data_Out <= X"02"; when 2 => Register_Data_Out <= X"04"; when 3 => Register_Data_Out <= X"08"; when 4 => Register_Data_Out <= X"10"; when 5 => Register_Data_Out <= X"20"; when 6 => Register_Data_Out <= X"40"; when 7 => Register_Data_Out <= X"80"; when others => Register_Data_Out <= X"01"; end case; -- register $4804 when X"4" => Register_Data_Out <= X"0" & Bank_Map_C0; -- register $4805 when X"5" => Register_Data_Out <= X"0" & Bank_Map_D0; -- register $4806 when X"6" => Register_Data_Out <= X"0" & Bank_Map_E0; -- register $4807 when X"7" => Register_Data_Out <= X"0" & Bank_Map_F0; when others => Register_Data_Out <= X"00"; end case; else Register_Access <= '0'; end if; end if; end if; End Process; -- DMA channel mask decoded from register address $43X- with SNES_ADDR(7 downto 4) select DMA_Target_Register <= X"01" when X"0", X"02" when X"1", X"04" when X"2", X"08" when X"3", X"10" when X"4", X"20" when X"5", X"40" when X"6", X"80" when X"7", X"00" when others; -- channel select to store configuration DMA_Channel_Select <= conv_integer(SNES_ADDR(7 downto 4)); -- capture DMA configuration from SNES bus -- RG DMA registers may be updated at any point. SO requires this: the source bank was -- changed outside of a decompression DMA and not updated for a later decompression DMA. Process( MCLK ) Begin if rising_edge( MCLK ) then if( SNES_WR_End = '1' ) then -- capture source address low byte if( SNES_ADDR(22) = '0' AND SNES_ADDR(15 downto 8) = X"43" ) then if( SNES_ADDR(3 downto 0) = X"2" ) then DMA_Src_Addr(DMA_Channel_Select)(7 downto 0) <= SNES_DATA_IN; end if; if( SNES_ADDR(3 downto 0) = X"3" ) then DMA_Src_Addr(DMA_Channel_Select)(15 downto 8)<= SNES_DATA_IN; end if; if( SNES_ADDR(3 downto 0) = X"4" ) then DMA_Src_Addr(DMA_Channel_Select)(23 downto 16)<= SNES_DATA_IN; end if; if( SNES_ADDR(3 downto 0) = X"5" ) then DMA_Size(DMA_Channel_Select)(7 downto 0) <= SNES_DATA_IN; end if; if( SNES_ADDR(3 downto 0) = X"6" ) then DMA_Size(DMA_Channel_Select)(15 downto 8) <= SNES_DATA_IN; end if; -- get DMA trigger elsif( SNES_ADDR(22) = '0' AND SNES_ADDR(15 downto 0) = X"420B" ) then DMA_Triggered <= '1'; else DMA_Triggered <= '0'; end if; else DMA_Triggered <= '0'; end if; end if; End Process; -- FSM for controlling configuration capture, decompression and signalling Process( MCLK ) Begin if rising_edge( MCLK ) then if( RESET = '0' ) then estado <= WAIT_START; else case estado is -- wait until register $4800 is written when WAIT_START => if( DMA_Channel_Valid = '1' ) then estado <= GET_DMA_CONFIG; end if; -- get DMA configuration after writing to $4801 -- RG either exit when $4800 is cleared or continue when $4801 is written when GET_DMA_CONFIG => if( DMA_Channel_Valid = '0' ) then estado <= WAIT_START; elsif( DMA_Channel_Enable = '1' ) then estado <= START_DECOMPRESSION; end if; -- update source address and size registers and launch decompression when START_DECOMPRESSION => estado <= WAIT_DMA_TRIGGERED; -- wait until DMA is triggered writting to $420B; until then, ROM access form SNES -- CPU has priority over decompression core and it is done each rising edge in SNES_RD when WAIT_DMA_TRIGGERED => if( DMA_Triggered = '1' ) then estado <= WAIT_DMA_START_TRANSFER; end if; -- wait until DMA starts; we know it starts when source address appears on address bus when WAIT_DMA_START_TRANSFER => if( DMA_Src_Addr(DMA_Channel_Transfer) = SNES_ADDR ) then estado <= WAIT_TRANSFER_COMPLETE; end if; -- wait until all bytes have been transferred when WAIT_TRANSFER_COMPLETE => if( Curr_Size = 0 ) then estado <= WAIT_READ_CYCLE_END; end if; -- wait until SNESread cycle ends when WAIT_READ_CYCLE_END => if( SNES_RD = '1' ) then --if( SNES_RD_Pipe = "01" ) then estado <= END_DECOMPRESSION; end if; -- stop decompression -- RG sdd1 is allowed to continue with further writes of $4801 until $4800 is cleared. SO does this. when END_DECOMPRESSION => estado <= GET_DMA_CONFIG; end case; end if; end if; End Process; -- get configuration fom SNES data bus with estado select FSM_Sniff_DMA_Config <= '1' when GET_DMA_CONFIG, '1' when START_DECOMPRESSION, '1' when WAIT_DMA_TRIGGERED, '0' when others; -- waiting for DMA to start with estado select FSM_Avoid_Collision <= '1' when WAIT_DMA_TRIGGERED, '1' when WAIT_DMA_START_TRANSFER, '0' when others; -- signal core to start decompression FSM_Start_Decompression <= '1' when estado = START_DECOMPRESSION else '0'; -- decompression and DMA transfer in progress with estado select FSM_DMA_Transferring <= '1' when WAIT_TRANSFER_COMPLETE, '1' when WAIT_READ_CYCLE_END, '0' when others; -- signal core to stop decompression FSM_End_Decompression <= '1' when estado = END_DECOMPRESSION else '0'; -- signal idle for memory controller -- RG idle used to block MCU accesses -- ikari_01 consider GET_DMA_CONFIG idle as well because SFA never returns S-DD1 to WAIT_START with estado select FSM_Idle <= '1' when WAIT_START, '1' when GET_DMA_CONFIG, '0' when others; -- fetch data from ROM while decompressing Process( MCLK ) Begin if rising_edge(MCLK) then if (RESET = '0') then ROM_Access_Cnt <= 0; else -- update source address if( FSM_Start_Decompression = '1' ) then Curr_Src_Addr <= DMA_Src_Addr(DMA_Channel_Transfer); ROM_Access_Cnt <= 0; -- after writting to $4801, SNES CPU can fetch new instructions (STA.w $420B and others), so -- ROM access must be time multiplexed; when decompressing from S-DD1, ROM is fully time- -- allocated to get data (after 3 master cycles) elsif( (FSM_DMA_Transferring = '1' AND Bus_Slot_Free = '1') OR (FSM_Avoid_Collision = '1' AND Bus_Slot_Free = '1') OR ROM_Access_Cnt /= 0 ) then if( ROM_Data_tready = '1' ) then -- when ROM's access time finish, get data and increment source address if( ROM_Access_Cnt = ROM_ACCESS_CYCLES-1 ) then ROM_Access_Cnt <= 0; -- if source address is odd, tkeep is "10" to register upper byte and source address -- is incremented by 1 to align source address if( Curr_Src_Addr(0) = '1' ) then Curr_Src_Addr <= Curr_Src_Addr + 1; else Curr_Src_Addr <= Curr_Src_Addr + 2; end if; else ROM_Access_Cnt <= ROM_Access_Cnt + 1; end if; else ROM_Access_Cnt <= 0; end if; else ROM_Access_Cnt <= 0; end if; end if; end if; End Process; -- in the third read cycle, data is registered on the FIFO ROM_Data_tvalid <= '1' when (FSM_DMA_Transferring = '1' AND ROM_Access_Cnt = (ROM_ACCESS_CYCLES-1) ) else '1' when (FSM_Avoid_Collision = '1' AND ROM_Access_Cnt = (ROM_ACCESS_CYCLES-1) ) else '0'; -- if start address is odd, just register upper byte ROM_Data_tkeep <= "10" when Curr_Src_Addr(0) = '1' else "11"; -- data for decompression is always 16 bits ROM_Data_tdata <= ROM_DATA; -- get data from ROM and decode it into N-order Golomb runs IM : Input_Manager Port map(clk => MCLK, -- control data DMA_Conf_Valid => FSM_Start_Decompression, DMA_In_Progress => DMA_In_Progress, Header_Valid => Header_Valid, Header_BPP => Header_BPP, Header_Context => Header_Context, -- data input from ROM ROM_Data_tready => ROM_Data_tready, ROM_Data_tvalid => ROM_Data_tvalid, ROM_Data_tdata => ROM_Data_tdata, ROM_Data_tkeep => ROM_Data_tkeep, -- Golomb decoded value Decoded_Bit_tready => Decoded_Bit_tready, Decoded_Bit_tuser => Decoded_Bit_tuser, Decoded_Bit_tvalid => Decoded_Bit_tvalid, Decoded_Bit_tdata => Decoded_Bit_tdata, Decoded_Bit_tlast => Decoded_Bit_tlast ); -- get Golomb data and context to decode pixel PE : Probability_Estimator Port map(clk => MCLK, -- control data DMA_In_Progress => DMA_In_Progress, Header_Valid => Header_Valid, Header_Context => Header_Context, -- run data from input manager Decoded_Bit_tready => Decoded_Bit_tready, Decoded_Bit_tuser => Decoded_Bit_tuser, Decoded_Bit_tvalid => Decoded_Bit_tvalid, Decoded_Bit_tdata => Decoded_Bit_tdata, Decoded_Bit_tlast => Decoded_Bit_tlast, -- estimated bit value BPP_Bit_tready => BPP_Bit_tready, BPP_Bit_tuser => BPP_Bit_tuser, BPP_Bit_tvalid => BPP_Bit_tvalid, BPP_Bit_tdata => BPP_Bit_tdata ); OM : Output_Manager Port map(clk => MCLK, -- configuration received from DMA DMA_In_Progress => DMA_In_Progress, DMA_Transfer_End => FSM_End_Decompression, Header_Valid => Header_Valid, Header_BPP => Header_BPP, -- data input from Probability Estimator BPP_Bit_tready => BPP_Bit_tready, BPP_Bit_tuser => BPP_Bit_tuser, BPP_Bit_tvalid => BPP_Bit_tvalid, BPP_Bit_tdata => BPP_Bit_tdata, -- data output to DMA DMA_Data_tready => DMA_Data_tready, DMA_Data_tvalid => DMA_Data_tvalid, DMA_Data_tdata => DMA_Data_tdata ); -- tri-State Buffer control SNES_DATA_OUT <= DMA_Data_out when (FSM_DMA_Transferring = '1') else Register_Data_Out when (Register_Access = '1') else ROM_Data_Byte; -- send data to SNES while decompressing using DMA Process( MCLK ) Begin if rising_edge(MCLK) then if (RESET = '0') then DMA_Data_tready <= '0'; else -- register rising edge in SNES_RD from CPU SNES_RD_Pipe <= SNES_RD_Pipe(0) & SNES_RD; -- update transfer size if( FSM_Start_Decompression = '1' ) then Curr_Size <= conv_integer(DMA_Size(DMA_Channel_Transfer)); DMA_Data_tready <= '0'; -- when source address appears on SNES_ADDR bus, data must be read from core's output FIFO elsif( FSM_DMA_Transferring = '1' ) then if( DMA_Src_Addr(DMA_Channel_Transfer) = SNES_ADDR ) then -- each falling edge in SNES_RD, a data is output from FIFO if( DMA_Data_tready = '1' AND DMA_Data_tvalid = '1' ) then DMA_Data_tready <= '0'; elsif( SNES_RD_Pipe = "10" ) then DMA_Data_tready <= '1'; end if; end if; end if; -- register decompressed data if( DMA_Data_tready = '1' AND DMA_Data_tvalid = '1' ) then DMA_Data_out <= DMA_Data_tdata; Curr_Size <= Curr_Size - 1; end if; end if; end if; End Process; end Behavioral;
gpl-2.0
623fb4c245ba487c91de4403c12b670a
0.586064
2.994522
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/cpu_disas_net.vhd
1
4,505
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: cpu_disas_net -- File: cpu_disas_net.vhd -- Author: Jiri Gaisler, Gaisler Research -- Description: SPARC disassembler according to SPARC V8 manual ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; -- pragma translate_off library grlib; use grlib.stdlib.all; use grlib.sparc.all; use grlib.sparc_disas.all; -- pragma translate_on entity cpu_disas_net is port ( clk : in std_ulogic; rstn : in std_ulogic; dummy : out std_ulogic; inst : in std_logic_vector(31 downto 0); pc : in std_logic_vector(31 downto 2); result: in std_logic_vector(31 downto 0); index : in std_logic_vector(3 downto 0); wreg : in std_ulogic; annul : in std_ulogic; holdn : in std_ulogic; pv : in std_ulogic; trap : in std_ulogic; disas : in std_ulogic); end; architecture behav of cpu_disas_net is begin dummy <= '1'; -- pragma translate_off trc : process(clk) variable valid : boolean; variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable fpins, fpld : boolean; variable iindex : integer; begin iindex := conv_integer(index); op := inst(31 downto 30); op3 := inst(24 downto 19); fpins := (op = FMT3) and ((op3 = FPOP1) or (op3 = FPOP2)); fpld := (op = LDST) and ((op3 = LDF) or (op3 = LDDF) or (op3 = LDFSR)); valid := (((not annul) and pv) = '1') and (not ((fpins or fpld) and (trap = '0'))); valid := valid and (holdn = '1'); if rising_edge(clk) and (rstn = '1') and (disas = '1') then print_insn (iindex, pc(31 downto 2) & "00", inst, result, valid, trap = '1', wreg = '1', false); end if; end process; -- pragma translate_on end; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off library grlib; use grlib.stdlib.all; use grlib.sparc.all; use grlib.sparc_disas.all; -- pragma translate_on entity fpu_disas_net is port ( clk : in std_ulogic; rstn : in std_ulogic; dummy : out std_ulogic; wr2inst : in std_logic_vector(31 downto 0); wr2pc : in std_logic_vector(31 downto 2); divinst : in std_logic_vector(31 downto 0); divpc : in std_logic_vector(31 downto 2); dbg_wrdata: in std_logic_vector(63 downto 0); index : in std_logic_vector(3 downto 0); dbg_wren : in std_logic_vector(1 downto 0); resv : in std_ulogic; ld : in std_ulogic; rdwr : in std_ulogic; ccwr : in std_ulogic; rdd : in std_ulogic; div_valid : in std_ulogic; holdn : in std_ulogic; disas : in std_ulogic); end; architecture behav of fpu_disas_net is begin dummy <= '1'; -- pragma translate_off trc : process(clk) variable valid : boolean; variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable fpins, fpld : boolean; variable iindex : integer; begin iindex := conv_integer(index); if rising_edge(clk) and (rstn = '1') and (disas /= '0') then valid := ((((rdwr and not ld) or ccwr or (ld and resv)) and holdn) = '1'); print_fpinsn(0, wr2pc(31 downto 2) & "00", wr2inst, dbg_wrdata, (rdd = '1'), valid, false, (dbg_wren /= "00")); print_fpinsn(0, divpc(31 downto 2) & "00", divinst, dbg_wrdata, (rdd = '1'), (div_valid and holdn) = '1', false, (dbg_wren /= "00")); end if; end process; -- pragma translate_on end;
gpl-2.0
76eedede29408e880c197ddd2be01af8
0.607991
3.433689
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3mp/config.vhd
1
7,709
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := inferred; constant CFG_MEMTECH : integer := inferred; constant CFG_PADTECH : integer := inferred; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := inferred; constant CFG_CLKMUL : integer := 2; constant CFG_CLKDIV : integer := 2; constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 0 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 0; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (0); constant CFG_PWD : integer := 0*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 1; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 1; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 8; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 0 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 0; constant CFG_ITBSZ : integer := 0; constant CFG_ATBSZ : integer := 0; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 1; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 0; -- Ethernet DSU constant CFG_DSU_ETH : integer := 0 + 0 + 0; constant CFG_ETH_BUF : integer := 1; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000009#; -- PROM/SRAM controller constant CFG_SRCTRL : integer := 0; constant CFG_SRCTRL_PROMWS : integer := 0; constant CFG_SRCTRL_RAMWS : integer := 0; constant CFG_SRCTRL_IOWS : integer := 0; constant CFG_SRCTRL_RMW : integer := 0; constant CFG_SRCTRL_8BIT : integer := 0; constant CFG_SRCTRL_SRBANKS : integer := 1; constant CFG_SRCTRL_BANKSZ : integer := 0; constant CFG_SRCTRL_ROMASEL : integer := 0; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 1; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 1 + 0; -- SDRAM controller constant CFG_SDCTRL : integer := 0; constant CFG_SDCTRL_INVCLK : integer := 0; constant CFG_SDCTRL_SD64 : integer := 0; constant CFG_SDCTRL_PAGE : integer := 0 + 0; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 0; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 8; -- CAN 2.0 interface constant CFG_CAN : integer := 0; constant CFG_CANIO : integer := 16#0#; constant CFG_CANIRQ : integer := 0; constant CFG_CANLOOP : integer := 0; constant CFG_CAN_SYNCRST : integer := 0; constant CFG_CANFT : integer := 0; -- PCI interface constant CFG_PCI : integer := 0; constant CFG_PCIVID : integer := 16#0#; constant CFG_PCIDID : integer := 16#0#; constant CFG_PCIDEPTH : integer := 8; constant CFG_PCI_MTF : integer := 1; -- PCI arbiter constant CFG_PCI_ARB : integer := 0; constant CFG_PCI_ARBAPB : integer := 0; constant CFG_PCI_ARB_NGNT : integer := 4; -- PCI trace buffer constant CFG_PCITBUFEN: integer := 0; constant CFG_PCITBUF : integer := 256; -- Spacewire interface constant CFG_SPW_EN : integer := 0; constant CFG_SPW_NUM : integer := 1; constant CFG_SPW_AHBFIFO : integer := 4; constant CFG_SPW_RXFIFO : integer := 16; constant CFG_SPW_RMAP : integer := 0; constant CFG_SPW_RMAPBUF : integer := 4; constant CFG_SPW_RMAPCRC : integer := 0; constant CFG_SPW_NETLIST : integer := 0; constant CFG_SPW_FT : integer := 0; constant CFG_SPW_GRSPW : integer := 2; constant CFG_SPW_RXUNAL : integer := 0; constant CFG_SPW_DMACHAN : integer := 1; constant CFG_SPW_PORTS : integer := 1; constant CFG_SPW_INPUT : integer := 2; constant CFG_SPW_OUTPUT : integer := 0; constant CFG_SPW_RTSAME : integer := 0; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- UART 2 constant CFG_UART2_ENABLE : integer := 0; constant CFG_UART2_FIFO : integer := 1; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 1; constant CFG_GPT_WDOG : integer := 16#FFFF#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (8); -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
34f2be919933ca8ba3f37d98705502af
0.649111
3.610773
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys4/testbench.vhd
1
6,755
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library hynix; use hynix.components.all; use work.debug.all; use work.config.all; library hynix; use hynix.components.all; entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 10 -- system clock period ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sdramfile : string := "ram.srec"; -- sdram contents constant lresp : boolean := false; constant ct : integer := clkperiod/2; signal clk : std_logic := '0'; signal rst : std_logic := '0'; signal rstn : std_logic; signal error : std_logic; -- PROM flash signal address : std_logic_vector(26 downto 0):=(others =>'0'); signal data : std_logic_vector(31 downto 0); signal RamCE : std_logic; signal oen : std_ulogic; signal writen : std_ulogic; -- Debug support unit signal dsubre : std_ulogic; -- AHB Uart signal dsurx : std_ulogic; signal dsutx : std_ulogic; -- APB Uart signal urxd : std_ulogic; signal utxd : std_ulogic; -- Ethernet signals signal erx_er : std_ulogic; signal erx_crs : std_ulogic; signal etxdt : std_logic_vector(1 downto 0); -- SVGA signals signal vid_hsync : std_ulogic; signal vid_vsync : std_ulogic; signal vid_r : std_logic_vector(3 downto 0); signal vid_g : std_logic_vector(3 downto 0); signal vid_b : std_logic_vector(3 downto 0); -- Select signal for SPI flash signal spi_sel_n : std_logic; signal spi_clk : std_logic; signal spi_mosi : std_logic; -- Output signals for LEDs signal led : std_logic_vector(15 downto 0); signal brdyn : std_ulogic; signal sw : std_logic_vector(15 downto 0):= (others =>'0'); signal btn : std_logic_vector(4 downto 0):= (others =>'0'); begin -- clock and reset clk <= not clk after ct * 1 ns; rst <= '1', '0' after 100 ns; rstn <= not rst; dsubre <= '0'; urxd <= 'H'; spi_sel_n <= 'H'; spi_clk <= 'L'; d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, clktech, disas, dbguart, pclow) port map ( clk => clk, btnCpuResetn => rstn, -- PROM address => address(22 downto 0), data => data(31 downto 16), RamOE => oen, RamWE => writen, RamCE => RamCE, -- AHB Uart RsRx => dsurx, RsTx => dsutx, -- PHY PhyCrs => erx_crs, PhyRxd => etxdt, PhyRxEr => erx_er, -- Output signals for LEDs led => led, sw => sw, btn => btn ); sram0 : sram generic map (index => 4, abits => 24, fname => sdramfile) port map (address(23 downto 0), data(31 downto 24), RamCE, writen, oen); sram1 : sram generic map (index => 5, abits => 24, fname => sdramfile) port map (address(23 downto 0), data(23 downto 16), RamCE, writen, oen); -- Ethernet model diasbled erx_crs <= '0'; etxdt<= (others =>'0'); erx_er<= '0'; spimem0: if CFG_SPIMCTRL = 1 generate s0 : spi_flash generic map (ftype => 4, debug => 0, fname => promfile, readcmd => CFG_SPIMCTRL_READCMD, dummybyte => CFG_SPIMCTRL_DUMMYBYTE, dualoutput => 0) port map (spi_clk, spi_mosi, data(24), spi_sel_n); end generate spimem0; led(3) <= 'L'; -- ERROR pull-down error <= not led(3); iuerr : process begin wait for 5 us; assert (to_X01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure; end process; data <= buskeep(data) after 5 ns; dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#00#, 16#ef#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); -- -- txc(dsutx, 16#80#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end;
gpl-2.0
44e317c03f9b8e8ce7a3a239955a279d
0.565211
3.564644
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/ahbtrace_mb.vhd
1
2,642
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahbtrace_mb -- File: ahbtrace_mb.vhd -- Author: Jiri Gaisler - Gaisler Research -- Modified: Jan Andersson - Aeroflex Gaisler -- Description: AHB trace unit that can have registers on a separate bus ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.misc.all; entity ahbtrace_mb is generic ( hindex : integer := 0; ioaddr : integer := 16#000#; iomask : integer := 16#E00#; tech : integer := DEFMEMTECH; irq : integer := 0; kbytes : integer := 1; ahbfilt : integer := 0); port ( rst : in std_ulogic; clk : in std_ulogic; ahbsi : in ahb_slv_in_type; -- Register interface ahbso : out ahb_slv_out_type; tahbmi : in ahb_mst_in_type; -- Trace tahbsi : in ahb_slv_in_type ); end; architecture rtl of ahbtrace_mb is signal tahbmiv : ahb_mst_in_vector_type(0 to 0); signal tahbsiv : ahb_slv_in_vector_type(0 to 0); begin tahbmiv(0) <= tahbmi; tahbsiv(0) <= tahbsi; ahbt0 : ahbtrace_mmb generic map ( hindex => hindex, ioaddr => ioaddr, iomask => iomask, tech => tech, irq => irq, kbytes => kbytes, ahbfilt => ahbfilt, ntrace => 1) port map( rst => rst, clk => clk, ahbsi => ahbsi, ahbso => ahbso, tahbmiv => tahbmiv, tahbsiv => tahbsiv); end;
gpl-2.0
f6ca54cbf10c5dce846e3c8b02ee633f
0.584027
3.931548
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml403/config.vhd
1
6,296
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := virtex4; constant CFG_MEMTECH : integer := virtex4; constant CFG_PADTECH : integer := virtex4; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := virtex4; constant CFG_CLKMUL : integer := (13); constant CFG_CLKDIV : integer := (20); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 0 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (1); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 8; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 1; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 1; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 0; constant CFG_ITLBNUM : integer := 2; constant CFG_DTLBNUM : integer := 2; constant CFG_TLB_TYPE : integer := 1 + 0*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 0 + 0 + 0; constant CFG_ETH_BUF : integer := 1; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000009#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- DDR controller constant CFG_DDRSP : integer := 1; constant CFG_DDRSP_INIT : integer := 1; constant CFG_DDRSP_FREQ : integer := (100); constant CFG_DDRSP_COL : integer := (9); constant CFG_DDRSP_SIZE : integer := (64); constant CFG_DDRSP_RSKEW : integer := (0); -- SSRAM controller constant CFG_SSCTRL : integer := 0; constant CFG_SSCTRLP16 : integer := 0; -- AHB status register constant CFG_AHBSTAT : integer := 1; constant CFG_AHBSTATN : integer := (1); -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 0; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 8; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0FFFE#; constant CFG_GRGPIO_WIDTH : integer := (14); -- I2C master constant CFG_I2C_ENABLE : integer := 1; -- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := 0; constant CFG_VGA_ENABLE : integer := 0; constant CFG_SVGA_ENABLE : integer := 0; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
799bd74d9bd71c3b23b4cec68d62ceae
0.644377
3.620472
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/ddr/ddrspa.vhd
1
5,345
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ddrspm -- File: ddrspm.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: 16-, 32- or 64-bit DDR266 memory controller module. ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library gaisler; use grlib.devices.all; use gaisler.ddrpkg.all; library techmap; use techmap.gencomp.all; entity ddrspa is generic ( fabtech : integer := virtex2; memtech : integer := 0; rskew : integer := 0; hindex : integer := 0; haddr : integer := 0; hmask : integer := 16#f00#; ioaddr : integer := 16#000#; iomask : integer := 16#fff#; MHz : integer := 100; clkmul : integer := 2; clkdiv : integer := 2; col : integer := 9; Mbyte : integer := 16; rstdel : integer := 200; pwron : integer := 0; oepol : integer := 0; ddrbits : integer := 16; ahbfreq : integer := 50; mobile : integer := 0; confapi : integer := 0; conf0 : integer := 0; conf1 : integer := 0; regoutput : integer := 0; nosync : integer := 0; ddr400 : integer := 1; scantest: integer := 0; phyiconf : integer := 0 ); port ( rst_ddr : in std_ulogic; rst_ahb : in std_ulogic; clk_ddr : in std_ulogic; clk_ahb : in std_ulogic; lock : out std_ulogic; -- DCM locked clkddro : out std_ulogic; -- DCM locked clkddri : in std_ulogic; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; ddr_clk : out std_logic_vector(2 downto 0); ddr_clkb : out std_logic_vector(2 downto 0); ddr_clk_fb_out : out std_logic; ddr_clk_fb : in std_logic; ddr_cke : out std_logic_vector(1 downto 0); ddr_csb : out std_logic_vector(1 downto 0); ddr_web : out std_ulogic; -- ddr write enable ddr_rasb : out std_ulogic; -- ddr ras ddr_casb : out std_ulogic; -- ddr cas ddr_dm : out std_logic_vector (ddrbits/8-1 downto 0); -- ddr dm ddr_dqs : inout std_logic_vector (ddrbits/8-1 downto 0); -- ddr dqs ddr_ad : out std_logic_vector (13 downto 0); -- ddr address ddr_ba : out std_logic_vector (1 downto 0); -- ddr bank address ddr_dq : inout std_logic_vector (ddrbits-1 downto 0) -- ddr data ); end; architecture rtl of ddrspa is constant DDR_FREQ : integer := (clkmul * MHz) / clkdiv; signal sdi : ddrctrl_in_type; signal sdo : ddrctrl_out_type; signal clkread : std_ulogic; signal ilock: std_ulogic; signal ddr_rst: std_logic; signal ddr_rst_gen: std_logic_vector(3 downto 0); constant ddr_syncrst: integer := 0; begin lock <= ilock; ddr_rst <= (ddr_rst_gen(3) and ddr_rst_gen(2) and ddr_rst_gen(1) and rst_ahb); -- Reset signal in DDR clock domain ddrrstproc: process(clkddri, ilock) begin if rising_edge(clkddri) then ddr_rst_gen <= ddr_rst_gen(2 downto 0) & '1'; if ddr_syncrst /= 0 and rst_ahb='0' then ddr_rst_gen <= "0000"; end if; end if; if ddr_syncrst=0 and ilock='0' then ddr_rst_gen <= "0000"; end if; end process; ddr_phy0 : ddrphy_wrap_cbd generic map (tech => fabtech, MHz => MHz, dbits => ddrbits, rstdelay => 0, clk_mul => clkmul, clk_div => clkdiv, rskew => rskew, mobile => mobile, scantest => scantest, phyiconf => phyiconf) port map ( rst_ddr, clk_ddr, clkddro, clkddri, clkread, ilock, ddr_clk, ddr_clkb, ddr_clk_fb_out, ddr_clk_fb, ddr_cke, ddr_csb, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_ad, ddr_ba, ddr_dq, sdi, sdo, ahbsi.testen, ahbsi.testrst, ahbsi.scanen, ahbsi.testoen); ddrc : ddr1spax generic map (ddrbits => ddrbits, memtech => memtech, phytech => fabtech, hindex => hindex, haddr => haddr, hmask => hmask, ioaddr => ioaddr, iomask => iomask, pwron => pwron, MHz => DDR_FREQ, col => col, Mbyte => Mbyte, mobile => mobile, confapi => confapi, conf0 => conf0, conf1 => conf1, regoutput => regoutput, nosync => nosync, ddr400 => ddr400, ahbbits => 32, rstdel => rstdel, scantest => scantest) port map (ddr_rst, rst_ahb, clkddri, clk_ahb, ahbsi, ahbso, sdi, sdo); end;
gpl-2.0
23b7f66414dd2586c3f6d2084c3d805d
0.591955
3.493464
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/cycloneiii/cycloneiii_clkgen.vhd
1
7,921
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; -- pragma translate_off library altera_mf; use altera_mf.altpll; -- pragma translate_on entity cyclone3_pll is generic ( clk_mul : integer := 1; clk_div : integer := 1; clk_freq : integer := 25000; clk2xen : integer := 0; sdramen : integer := 0 ); port ( inclk0 : in std_ulogic; c0 : out std_ulogic; c0_2x : out std_ulogic; e0 : out std_ulogic; locked : out std_ulogic ); end; architecture rtl of cyclone3_pll is component altpll generic ( intended_device_family : string := "CycloneIII" ; operation_mode : string := "NORMAL" ; compensate_clock : string := "clock0"; inclk0_input_frequency : positive; width_clock : positive := 6; clk0_multiply_by : positive := 1; clk0_divide_by : positive := 1; clk1_multiply_by : positive := 1; clk1_divide_by : positive := 1; clk2_multiply_by : positive := 1; clk2_divide_by : positive := 1; port_clkena0 : string := "PORT_CONNECTIVITY"; port_clkena1 : string := "PORT_CONNECTIVITY"; port_clkena2 : string := "PORT_CONNECTIVITY"; port_clkena3 : string := "PORT_CONNECTIVITY"; port_clkena4 : string := "PORT_CONNECTIVITY"; port_clkena5 : string := "PORT_CONNECTIVITY" ); port ( inclk : in std_logic_vector(1 downto 0); clkena : in std_logic_vector(5 downto 0); clk : out std_logic_vector(width_clock-1 downto 0); locked : out std_logic ); end component; signal clkena : std_logic_vector (5 downto 0); signal clkout : std_logic_vector (4 downto 0); signal inclk : std_logic_vector (1 downto 0); constant clk_period : integer := 1000000000/clk_freq; constant CLK_MUL2X : integer := clk_mul * 2; begin clkena(5 downto 3) <= (others => '0'); clkena(0) <= '1'; clkena(1) <= '1' when sdramen = 1 else '0'; clkena(2) <= '1' when clk2xen = 1 else '0'; inclk <= '0' & inclk0; c0 <= clkout(0); c0_2x <= clkout(2); e0 <= clkout(1); sden : if sdramen = 1 generate altpll0 : altpll generic map ( intended_device_family => "Cyclone III", operation_mode => "ZERO_DELAY_BUFFER", inclk0_input_frequency => clk_period, width_clock => 5, compensate_clock => "CLK1", port_clkena2 => "PORT_UNUSED", port_clkena3 => "PORT_UNUSED", port_clkena4 => "PORT_UNUSED", port_clkena5 => "PORT_UNUSED", clk0_multiply_by => clk_mul, clk0_divide_by => clk_div, clk1_multiply_by => clk_mul, clk1_divide_by => clk_div, clk2_multiply_by => CLK_MUL2X, clk2_divide_by => clk_div) port map ( clkena => clkena, inclk => inclk, clk => clkout, locked => locked); end generate; -- Must use operation_mode other than "ZERO_DELAY_BUFFER" due to -- tool issues with ZERO_DELAY_BUFFER and non-existent output clock nosd : if sdramen = 0 generate altpll0 : altpll generic map ( intended_device_family => "Cyclone III", operation_mode => "NORMAL", inclk0_input_frequency => clk_period, width_clock => 5, port_clkena1 => "PORT_UNUSED", port_clkena2 => "PORT_UNUSED", port_clkena3 => "PORT_UNUSED", port_clkena4 => "PORT_UNUSED", port_clkena5 => "PORT_UNUSED", clk0_multiply_by => clk_mul, clk0_divide_by => clk_div, clk1_multiply_by => clk_mul, clk1_divide_by => clk_div, clk2_multiply_by => CLK_MUL2X, clk2_divide_by => clk_div) port map ( clkena => clkena, inclk => inclk, clk => clkout, locked => locked); end generate; end; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off library altera_mf; library grlib; use grlib.stdlib.all; -- pragma translate_on library techmap; use techmap.gencomp.all; entity clkgen_cycloneiii is generic ( clk_mul : integer := 1; clk_div : integer := 1; sdramen : integer := 0; sdinvclk : integer := 0; pcien : integer := 0; pcidll : integer := 0; pcisysclk: integer := 0; freq : integer := 25000; clk2xen : integer := 0; tech : integer := 0); port ( clkin : in std_logic; pciclkin: in std_logic; clk : out std_logic; -- main clock clkn : out std_logic; -- inverted main clock clk2x : out std_logic; -- double clock sdclk : out std_logic; -- SDRAM clock pciclk : out std_logic; -- PCI clock cgi : in clkgen_in_type; cgo : out clkgen_out_type); end; architecture rtl of clkgen_cycloneiii is constant VERSION : integer := 1; constant CLKIN_PERIOD : integer := 20; signal clk_i : std_logic; signal clkint, pciclkint : std_logic; signal pllclk, pllclkn : std_logic; -- generated clocks signal s_clk : std_logic; component cyclone3_pll generic ( clk_mul : integer := 1; clk_div : integer := 1; clk_freq : integer := 25000; clk2xen : integer := 0; sdramen : integer := 0 ); port ( inclk0 : in std_ulogic; c0 : out std_ulogic; c0_2x : out std_ulogic; e0 : out std_ulogic; locked : out std_ulogic); end component; begin cgo.pcilock <= '1'; -- c0 : if (PCISYSCLK = 0) generate -- Clkint <= Clkin; -- end generate; -- c1 : if (PCISYSCLK = 1) generate -- Clkint <= pciclkin; -- end generate; -- c2 : if (PCIEN = 1) generate -- p0 : if (PCIDLL = 1) generate -- pciclkint <= pciclkin; -- pciclk <= pciclkint; -- end generate; -- p1 : if (PCIDLL = 0) generate -- u0 : if (PCISYSCLK = 0) generate -- pciclkint <= pciclkin; -- end generate; -- pciclk <= clk_i when (PCISYSCLK = 1) else pciclkint; -- end generate; -- end generate; -- c3 : if (PCIEN = 0) generate -- pciclk <= Clkint; -- end generate; c0: if (PCISYSCLK = 0) or (PCIEN = 0) generate clkint <= clkin; end generate c0; c1: if PCIEN /= 0 generate d0: if PCISYSCLK = 1 generate clkint <= pciclkin; end generate d0; pciclk <= pciclkin; end generate c1; c2: if PCIEN = 0 generate pciclk <= '0'; end generate c2; sdclk_pll : cyclone3_pll generic map (clk_mul, clk_div, freq, clk2xen, sdramen) port map ( inclk0 => clkint, e0 => sdclk, c0 => s_clk, c0_2x => clk2x, locked => cgo.clklock); clk <= s_clk; clkn <= not s_clk; -- pragma translate_off bootmsg : report_version generic map ( "clkgen_cycloneiii" & ": altpll sdram/pci clock generator, version " & tost(VERSION), "clkgen_cycloneiii" & ": Frequency " & tost(freq) & " KHz, PLL scaler " & tost(clk_mul) & "/" & tost(clk_div)); -- pragma translate_on end;
gpl-2.0
5ae911d24073774fcba0e7705b2dc8c2
0.586921
3.51888
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/grsysmon.vhd
1
16,851
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: grsysmon -- File: grsysmon.vhd -- Author: Jan Andersson - Gaisler Research AB -- Description: Provides GRLIB AMBA AHB slave interface to Xilinx SYSMON library ieee; use ieee.std_logic_1164.all; library grlib, gaisler; use grlib.amba.all; use grlib.devices.all; use grlib.stdlib.all; use gaisler.misc.all; library techmap; use techmap.gencomp.all; entity grsysmon is generic ( -- GRLIB generics tech : integer := DEFFABTECH; hindex : integer := 0; -- AHB slave index hirq : integer := 0; -- Interrupt line caddr : integer := 16#000#; -- Base address for configuration area cmask : integer := 16#fff#; -- Area mask saddr : integer := 16#001#; -- Base address for sysmon register area smask : integer := 16#fff#; -- Area mask split : integer := 0; -- Enable AMBA SPLIT support extconvst : integer := 0; -- Use external CONVST signal wrdalign : integer := 0; -- Word align System Monitor registers -- Virtex 5 SYSMON generics INIT_40 : bit_vector := X"0000"; INIT_41 : bit_vector := X"0000"; INIT_42 : bit_vector := X"0800"; INIT_43 : bit_vector := X"0000"; INIT_44 : bit_vector := X"0000"; INIT_45 : bit_vector := X"0000"; INIT_46 : bit_vector := X"0000"; INIT_47 : bit_vector := X"0000"; INIT_48 : bit_vector := X"0000"; INIT_49 : bit_vector := X"0000"; INIT_4A : bit_vector := X"0000"; INIT_4B : bit_vector := X"0000"; INIT_4C : bit_vector := X"0000"; INIT_4D : bit_vector := X"0000"; INIT_4E : bit_vector := X"0000"; INIT_4F : bit_vector := X"0000"; INIT_50 : bit_vector := X"0000"; INIT_51 : bit_vector := X"0000"; INIT_52 : bit_vector := X"0000"; INIT_53 : bit_vector := X"0000"; INIT_54 : bit_vector := X"0000"; INIT_55 : bit_vector := X"0000"; INIT_56 : bit_vector := X"0000"; INIT_57 : bit_vector := X"0000"; SIM_MONITOR_FILE : string := "sysmon.txt"); port ( rstn : in std_ulogic; clk : in std_ulogic; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; sysmoni : in grsysmon_in_type; sysmono : out grsysmon_out_type ); end grsysmon; architecture rtl of grsysmon is ----------------------------------------------------------------------------- -- Constants ----------------------------------------------------------------------------- constant REVISION : amba_version_type := 0; constant HCONFIG : ahb_config_type := ( 0 => ahb_device_reg(VENDOR_GAISLER, GAISLER_GRSYSMON, 0, REVISION, hirq), 4 => ahb_iobar(caddr, cmask), 5 => ahb_iobar(saddr, smask), others => zero32); -- BANKs constant CONF_BANK : integer := 0; constant SYSMON_BANK : integer := 1; -- Registers constant CONF_REG_OFF : std_ulogic := '0'; constant STAT_REG_OFF : std_ulogic := '1'; ----------------------------------------------------------------------------- -- Types ----------------------------------------------------------------------------- type sysmon_out_type is record alm : std_logic_vector(2 downto 0); busy : std_ulogic; channel : std_logic_vector(4 downto 0); do : std_logic_vector(15 downto 0); drdy : std_ulogic; eoc : std_ulogic; eos : std_ulogic; jtagbusy : std_ulogic; jtaglocked : std_ulogic; jtagmodified : std_ulogic; ot : std_ulogic; end record; type sysmon_in_type is record daddr : std_logic_vector(6 downto 0); den : std_ulogic; di : std_logic_vector(15 downto 0); dwe : std_ulogic; end record; type grsysmon_conf_reg_type is record ot_ien : std_ulogic; alm_ien : std_logic_vector(2 downto 0); convst : std_ulogic; eos_ien : std_ulogic; eoc_ien : std_ulogic; busy_ien : std_ulogic; jb_ien : std_ulogic; jl_ien : std_ulogic; jm_ien : std_ulogic; end record; type grsysmon_reg_type is record cfgreg : grsysmon_conf_reg_type; -- SYSMON den : std_ulogic; -- System monitor data enable sma : std_ulogic; -- System monitor access smr : std_ulogic; -- System monitor access ready -- AHB insplit : std_ulogic; -- SPLIT response issued unsplit : std_ulogic; -- SPLIT complete not issued irq : std_ulogic; -- Interrupt request hwrite : std_ulogic; hsel : std_ulogic; hmbsel : std_logic_vector(0 to 1); haddr : std_logic_vector(6 downto 0); hready : std_ulogic; srdata : std_logic_vector(15 downto 0); -- SYSMON response data rrdata : std_logic_vector(12 downto 0); -- Register response data hresp : std_logic_vector(1 downto 0); splmst : std_logic_vector(log2(NAHBMST)-1 downto 0); -- SPLIT:ed master hsplit : std_logic_vector(NAHBMST-1 downto 0); -- Other SPLIT:ed masters ahbcancel : std_ulogic; -- Locked access cancels ongoing SPLIT -- response end record; ----------------------------------------------------------------------------- -- Signals ----------------------------------------------------------------------------- signal r, rin : grsysmon_reg_type; signal syso : sysmon_out_type; signal sysi : sysmon_in_type; signal sysmon_rst : std_ulogic; signal lconvst : std_ulogic; begin -- rtl sysmon_rst <= not rstn; convstint: if extconvst = 0 generate lconvst <= r.cfgreg.convst; end generate convstint; convstext: if extconvst /= 0 generate lconvst <= sysmoni.convst; end generate convstext; ----------------------------------------------------------------------------- -- System monitor ----------------------------------------------------------------------------- macro0 : system_monitor generic map (tech => tech, INIT_40 => INIT_40, INIT_41 => INIT_41, INIT_42 => INIT_42, INIT_43 => INIT_43, INIT_44 => INIT_44, INIT_45 => INIT_45, INIT_46 => INIT_46, INIT_47 => INIT_47, INIT_48 => INIT_48, INIT_49 => INIT_49, INIT_4A => INIT_4A, INIT_4B => INIT_4B, INIT_4C => INIT_4C, INIT_4D => INIT_4D, INIT_4E => INIT_4E, INIT_4F => INIT_4F, INIT_50 => INIT_50, INIT_51 => INIT_51, INIT_52 => INIT_52, INIT_53 => INIT_53, INIT_54 => INIT_54, INIT_55 => INIT_55, INIT_56 => INIT_56, INIT_57 => INIT_57, SIM_MONITOR_FILE => SIM_MONITOR_FILE) port map (alm => syso.alm, busy => syso.busy, channel => syso.channel, do => syso.do, drdy => syso.drdy, eoc => syso.eoc, eos => syso.eos, jtagbusy => syso.jtagbusy, jtaglocked => syso.jtaglocked, jtagmodified => syso.jtagmodified, ot => syso.ot, convst => lconvst, convstclk => sysmoni.convstclk, daddr => sysi.daddr, dclk => clk, den => sysi.den, di => sysi.di, dwe => sysi.dwe, reset => sysmon_rst, vauxn => sysmoni.vauxn, vauxp => sysmoni.vauxp, vn => sysmoni.vn, vp => sysmoni.vp); ----------------------------------------------------------------------------- -- AMBA and control i/f ----------------------------------------------------------------------------- comb: process (r, rstn, ahbsi, syso) variable v : grsysmon_reg_type; variable irq : std_logic_vector((NAHBIRQ-1) downto 0); variable addr : std_logic_vector(7 downto 0); variable hsplit : std_logic_vector(NAHBMST-1 downto 0); variable regaddr : std_ulogic; variable hrdata : std_logic_vector(31 downto 0); variable hwdata : std_logic_vector(31 downto 0); begin -- process comb v := r; v.irq := '0'; irq := (others => '0'); irq(hirq) := r.irq; v.hresp := HRESP_OKAY; v.hready := '1'; v.den := '0'; regaddr := r.haddr(1-wrdalign); hsplit := (others => '0'); v.cfgreg.convst := '0'; hwdata := ahbreadword(ahbsi.hwdata, r.haddr(4 downto 2)); -- AHB communication if ahbsi.hready = '1' then if (ahbsi.hsel(hindex) and ahbsi.htrans(1)) = '1' then v.hmbsel := ahbsi.hmbsel(r.hmbsel'range); if split = 0 or (not r.sma or ahbsi.hmbsel(CONF_BANK) or ahbsi.hmastlock) = '1' then v.hready := ahbsi.hmbsel(CONF_BANK) and ahbsi.hwrite; v.hwrite := ahbsi.hwrite; v.haddr := ahbsi.haddr((7+wrdalign) downto (1+wrdalign)); v.hsel := '1'; if ahbsi.hmbsel(SYSMON_BANK) = '1' then v.den := not r.insplit; v.sma := '1'; if split /= 0 then if ahbsi.hmastlock = '0' then v.hresp := HRESP_SPLIT; v.splmst := ahbsi.hmaster; v.unsplit := '1'; else v.ahbcancel := r.insplit; end if; v.insplit := not ahbsi.hmastlock; end if; end if; else -- Core is busy, transfer is not locked and access was to sysmon -- registers. Respond with SPLIT or insert wait states v.hready := '0'; if split /= 0 then v.hresp := HRESP_SPLIT; v.hsplit(conv_integer(ahbsi.hmaster)) := '1'; end if; end if; else v.hsel := '0'; end if; end if; if (r.hready = '0') then if (r.hresp = HRESP_OKAY) then v.hready := '0'; else v.hresp := r.hresp; end if; end if; -- Read access to conf registers if (r.hsel and r.hmbsel(CONF_BANK)) = '1' then v.rrdata := (others => '0'); if r.hwrite = '0' then v.hready := '1'; v.hsel := '0'; end if; case regaddr is when CONF_REG_OFF => v.rrdata(12) := r.cfgreg.ot_ien; v.rrdata(11 downto 9) := r.cfgreg.alm_ien; if extconvst = 0 then v.rrdata(6) := r.cfgreg.convst; end if; v.rrdata(5) := r.cfgreg.eos_ien; v.rrdata(4) := r.cfgreg.eoc_ien; v.rrdata(3) := r.cfgreg.busy_ien; v.rrdata(2) := r.cfgreg.jb_ien; v.rrdata(1) := r.cfgreg.jl_ien; v.rrdata(0) := r.cfgreg.jm_ien; if r.hwrite = '1' then v.cfgreg.ot_ien := hwdata(12); v.cfgreg.alm_ien := hwdata(11 downto 9); if extconvst = 0 then v.cfgreg.convst := hwdata(6); end if; v.cfgreg.eos_ien := hwdata(5); v.cfgreg.eoc_ien := hwdata(4); v.cfgreg.busy_ien := hwdata(3); v.cfgreg.jb_ien := hwdata(2); v.cfgreg.jl_ien := hwdata(1); v.cfgreg.jm_ien := hwdata(0); end if; when STAT_REG_OFF => v.rrdata(12) := syso.ot; v.rrdata(11 downto 9) := syso.alm; v.rrdata(8 downto 4) := syso.channel; v.rrdata(3) := syso.busy; v.rrdata(2) := syso.jtagbusy; v.rrdata(1) := syso.jtaglocked; v.rrdata(0) := syso.jtagmodified; when others => null; end case; end if; -- SYSMON access finished if syso.drdy = '1' then v.srdata := syso.do; v.smr := '1'; end if; if (syso.drdy or r.smr) = '1' then if split /= 0 and r.unsplit = '1' then hsplit(conv_integer(r.splmst)) := '1'; v.unsplit := '0'; end if; if ((split = 0 or v.ahbcancel = '0') and (split = 0 or ahbsi.hmaster = r.splmst or r.insplit = '0') and -- (((split = 0 or r.insplit = '0') and r.hmbsel(SYSMON_BANK) = '1') or -- (split = 1 and ahbsi.hmbsel(SYSMON_BANK) = '1')) and (((ahbsi.hsel(hindex) and ahbsi.hready and ahbsi.htrans(1)) = '1') or ((split = 0 or r.insplit = '0') and r.hready = '0' and r.hresp = HRESP_OKAY))) then v.hresp := HRESP_OKAY; if split /= 0 then v.insplit := '0'; v.hsplit := r.hsplit; end if; v.hready := '1'; v.hsel := '0'; v.smr := '0'; v.sma := '0'; elsif split /= 0 and v.ahbcancel = '1' then v.den := '1'; v.smr := '0'; v.ahbcancel := '0'; end if; end if; -- Interrupts if (syso.ot and v.cfgreg.ot_ien) = '1' then v.irq := '1'; v.cfgreg.ot_ien := '0'; end if; for i in r.cfgreg.alm_ien'range loop if (syso.alm(i) and r.cfgreg.alm_ien(i)) = '1' then v.irq := '1'; v.cfgreg.alm_ien(i) := '0'; end if; end loop; -- i if (syso.eos and v.cfgreg.eos_ien) = '1' then v.irq := '1'; v.cfgreg.eos_ien := '0'; end if; if (syso.eoc and v.cfgreg.eoc_ien) = '1' then v.irq := '1'; v.cfgreg.eoc_ien := '0'; end if; if (syso.busy and v.cfgreg.busy_ien) = '1' then v.irq := '1'; v.cfgreg.busy_ien := '0'; end if; if (syso.jtagbusy and v.cfgreg.jb_ien) = '1' then v.irq := '1'; v.cfgreg.jb_ien := '0'; end if; if (syso.jtaglocked and v.cfgreg.jl_ien) = '1' then v.irq := '1'; v.cfgreg.jl_ien := '0'; end if; if (syso.jtagmodified and v.cfgreg.jm_ien) = '1' then v.irq := '1'; v.cfgreg.jm_ien := '0'; end if; -- Reset if rstn = '0' then v.cfgreg.ot_ien := '0'; v.cfgreg.alm_ien := (others => '0'); v.cfgreg.eos_ien := '0'; v.cfgreg.eoc_ien := '0'; v.cfgreg.busy_ien := '0'; v.cfgreg.jb_ien := '0'; v.cfgreg.jl_ien := '0'; v.cfgreg.jm_ien := '0'; v.sma := '0'; v.smr := '0'; v.insplit := '0'; v.unsplit := '0'; v.hready := '1'; v.hwrite := '0'; v.hsel := '0'; v.hmbsel := (others => '0'); v.ahbcancel := '0'; end if; if split = 0 then v.insplit := '0'; v.unsplit := '0'; v.splmst := (others => '0'); v.hsplit := (others => '0'); v.ahbcancel := '0'; end if; -- Update registers rin <= v; -- AHB slave output ahbso.hready <= r.hready; ahbso.hresp <= r.hresp; if r.hmbsel(CONF_BANK) = '1' then if wrdalign = 0 then hrdata := zero32(31 downto 13) & r.rrdata; else hrdata := '1' & zero32(30 downto 13) & r.rrdata; end if; else if wrdalign = 0 then hrdata := r.srdata & r.srdata; else hrdata := zero32(31 downto 16) & r.srdata; end if; end if; ahbso.hrdata <= ahbdrivedata(hrdata); ahbso.hconfig <= HCONFIG; ahbso.hirq <= irq; ahbso.hindex <= hindex; ahbso.hsplit <= hsplit; -- Signals to system monitor sysi.daddr <= r.haddr; sysi.den <= r.den; sysi.dwe <= r.hwrite; if wrdalign = 0 then if r.haddr(0) = '0' then sysi.di <= hwdata(31 downto 16); else sysi.di <= hwdata(15 downto 0); end if; else sysi.di <= hwdata(15 downto 0); end if; -- Signals from system monitor to core outputs sysmono.alm <= syso.alm; sysmono.ot <= syso.ot; sysmono.eoc <= syso.eoc; sysmono.eos <= syso.eos; sysmono.channel <= syso.channel; end process comb; reg: process (clk) begin -- process reg if rising_edge(clk) then r <= rin; end if; end process reg; -- Boot message -- pragma translate_off bootmsg : report_version generic map ( "grsysmon" & tost(hindex) & ": AMBA wrapper for System Monitor, rev " & tost(REVISION) & ", irq " & tost(hirq)); -- pragma translate_on end rtl;
gpl-2.0
7aa699055cc324c7f9388088c6158821
0.50632
3.599103
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-c5ekit/lpddr2if.vhd
1
8,335
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.devices.all; library gaisler; use gaisler.ddrpkg.all; entity lpddr2if is generic ( hindex: integer; haddr: integer := 16#400#; hmask: integer := 16#000#; burstlen: integer := 8 ); port ( pll_ref_clk: in std_ulogic; global_reset_n: in std_ulogic; mem_ca: out std_logic_vector(9 downto 0); mem_ck: out std_ulogic; mem_ck_n: out std_ulogic; mem_cke: out std_ulogic; mem_cs_n: out std_ulogic; mem_dm: out std_logic_vector(1 downto 0); mem_dq: inout std_logic_vector(15 downto 0); mem_dqs: inout std_logic_vector(1 downto 0); mem_dqs_n: inout std_logic_vector(1 downto 0); oct_rzqin: in std_logic; ahb_clk: in std_ulogic; ahb_rst: in std_ulogic; ahbsi: in ahb_slv_in_type; ahbso: out ahb_slv_out_type ); end; architecture rtl of lpddr2if is component lpddr2ctrl1 is port ( pll_ref_clk : in std_logic := 'X'; -- clk global_reset_n : in std_logic := 'X'; -- reset_n soft_reset_n : in std_logic := 'X'; -- reset_n afi_clk : out std_logic; -- clk afi_half_clk : out std_logic; -- clk afi_reset_n : out std_logic; -- reset_n afi_reset_export_n : out std_logic; -- reset_n mem_ca : out std_logic_vector(9 downto 0); -- mem_ca mem_ck : out std_logic_vector(0 downto 0); -- mem_ck mem_ck_n : out std_logic_vector(0 downto 0); -- mem_ck_n mem_cke : out std_logic_vector(0 downto 0); -- mem_cke mem_cs_n : out std_logic_vector(0 downto 0); -- mem_cs_n mem_dm : out std_logic_vector(1 downto 0); -- mem_dm mem_dq : inout std_logic_vector(15 downto 0) := (others => 'X'); -- mem_dq mem_dqs : inout std_logic_vector(1 downto 0) := (others => 'X'); -- mem_dqs mem_dqs_n : inout std_logic_vector(1 downto 0) := (others => 'X'); -- mem_dqs_n avl_ready : out std_logic; -- waitrequest_n avl_burstbegin : in std_logic := 'X'; -- beginbursttransfer avl_addr : in std_logic_vector(24 downto 0) := (others => 'X'); -- address avl_rdata_valid : out std_logic; -- readdatavalid avl_rdata : out std_logic_vector(63 downto 0); -- readdata avl_wdata : in std_logic_vector(63 downto 0) := (others => 'X'); -- writedata avl_be : in std_logic_vector(7 downto 0) := (others => 'X'); -- byteenable avl_read_req : in std_logic := 'X'; -- read avl_write_req : in std_logic := 'X'; -- write avl_size : in std_logic_vector(2 downto 0) := (others => 'X'); -- burstcount local_init_done : out std_logic; -- local_init_done local_cal_success : out std_logic; -- local_cal_success local_cal_fail : out std_logic; -- local_cal_fail oct_rzqin : in std_logic := 'X'; -- rzqin pll_mem_clk : out std_logic; -- pll_mem_clk pll_write_clk : out std_logic; -- pll_write_clk pll_write_clk_pre_phy_clk : out std_logic; -- pll_write_clk_pre_phy_clk pll_addr_cmd_clk : out std_logic; -- pll_addr_cmd_clk pll_locked : out std_logic; -- pll_locked pll_avl_clk : out std_logic; -- pll_avl_clk pll_config_clk : out std_logic; -- pll_config_clk pll_mem_phy_clk : out std_logic; -- pll_mem_phy_clk afi_phy_clk : out std_logic; -- afi_phy_clk pll_avl_phy_clk : out std_logic -- pll_avl_phy_clk ); end component lpddr2ctrl1; signal vcc: std_ulogic; signal afi_clk, afi_half_clk, afi_reset_n: std_ulogic; signal local_init_done, local_cal_success, local_cal_fail: std_ulogic; signal ck_p_arr, ck_n_arr, cke_arr, cs_arr: std_logic_vector(0 downto 0); signal avlsi: ddravl_slv_in_type; signal avlso: ddravl_slv_out_type; begin vcc <= '1'; mem_ck <= ck_p_arr(0); mem_ck_n <= ck_n_arr(0); mem_cke <= cke_arr(0); mem_cs_n <= cs_arr(0); ctrl0: lpddr2ctrl1 port map ( pll_ref_clk => pll_ref_clk, global_reset_n => global_reset_n, soft_reset_n => vcc, afi_clk => afi_clk, afi_half_clk => afi_half_clk, afi_reset_n => afi_reset_n, afi_reset_export_n => open, mem_ca => mem_ca, mem_ck => ck_p_arr, mem_ck_n => ck_n_arr, mem_cke => cke_arr, mem_cs_n => cs_arr, mem_dm => mem_dm, mem_dq => mem_dq, mem_dqs => mem_dqs, mem_dqs_n => mem_dqs_n, avl_ready => avlso.ready, avl_burstbegin => avlsi.burstbegin, avl_addr => avlsi.addr(24 downto 0), avl_rdata_valid => avlso.rdata_valid, avl_rdata => avlso.rdata(63 downto 0), avl_wdata => avlsi.wdata(63 downto 0), avl_be => avlsi.be(7 downto 0), avl_read_req => avlsi.read_req, avl_write_req => avlsi.write_req, avl_size => avlsi.size(2 downto 0), local_init_done => local_init_done, local_cal_success => local_cal_success, local_cal_fail => local_cal_fail, oct_rzqin => oct_rzqin, pll_mem_clk => open, pll_write_clk => open, pll_write_clk_pre_phy_clk => open, pll_addr_cmd_clk => open, pll_locked => open, pll_avl_clk => open, pll_config_clk => open, pll_mem_phy_clk => open, afi_phy_clk => open, pll_avl_phy_clk => open ); avlso.rdata(avlso.rdata'high downto 64) <= (others => '0'); ahb2avl0: ahb2avl_async generic map ( hindex => hindex, haddr => haddr, hmask => hmask, burstlen => burstlen, nosync => 0, avldbits => 64, avlabits => 25 ) port map ( rst_ahb => ahb_rst, clk_ahb => ahb_clk, ahbsi => ahbsi, ahbso => ahbso, rst_avl => afi_reset_n, clk_avl => afi_clk, avlsi => avlsi, avlso => avlso ); end;
gpl-2.0
82b505b5050b011510bfccc00fcce820
0.475225
3.658911
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/leon3v3/regfile_3p_l3.vhd
1
3,075
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: regfile_3p_l3 -- File: regfile_3p_l3.vhd -- Author: Jiri Gaisler, Edvin Catovic - Gaisler Research -- Description: 3-port regfile implemented with two 2-port rams ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; library techmap; use techmap.gencomp.all; use grlib.stdlib.all; entity regfile_3p_l3 is generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; wrfst : integer := 0; numregs : integer := 64; testen : integer := 0); port ( wclk : in std_ulogic; waddr : in std_logic_vector((abits -1) downto 0); wdata : in std_logic_vector((dbits -1) downto 0); we : in std_ulogic; rclk : in std_ulogic; raddr1 : in std_logic_vector((abits -1) downto 0); re1 : in std_ulogic; rdata1 : out std_logic_vector((dbits -1) downto 0); raddr2 : in std_logic_vector((abits -1) downto 0); re2 : in std_ulogic; rdata2 : out std_logic_vector((dbits -1) downto 0); testin : in std_logic_vector(3 downto 0) := "0000"); end; architecture rtl of regfile_3p_l3 is constant rfinfer : boolean := (regfile_3p_infer(tech) = 1); signal wd1, wd2 : std_logic_vector((dbits -1 + 8) downto 0); signal e1, e2 : std_logic_vector((dbits-1) downto 0); signal we1, we2 : std_ulogic; signal vcc, gnd : std_ulogic; signal vgnd : std_logic_vector(dbits-1 downto 0); signal write2, renable2 : std_ulogic; begin vcc <= '1'; gnd <= '0'; vgnd <= (others => '0'); we1 <= we ; we2 <= we ; s0 : if rfinfer generate inf : regfile_3p generic map (0, abits, dbits, wrfst, numregs) port map ( wclk, waddr, wdata, we, rclk, raddr1, re1, rdata1, raddr2, re2, rdata2); end generate; s1 : if not rfinfer generate rhu : regfile_3p generic map (tech, abits, dbits, wrfst, numregs, testen) port map ( wclk, waddr, wdata, we, rclk, raddr1, re1, rdata1, raddr2, re2, rdata2); end generate; end;
gpl-2.0
74a5b706efeeb2c854696dd43e9f2a65
0.606504
3.575581
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/allmul.vhd
1
3,153
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: allmul -- File: allmul.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Multiplier components ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; package allmul is component mul_dw is generic ( a_width : positive := 2; -- multiplier word width b_width : positive := 2; -- multiplicand word width num_stages : positive := 2; -- number of pipeline stages stall_mode : natural range 0 to 1 := 1 -- '0': non-stallable; '1': stallable ); port(a : in std_logic_vector(a_width-1 downto 0); b : in std_logic_vector(b_width-1 downto 0); clk : in std_logic; en : in std_logic; sign : in std_logic; product : out std_logic_vector(a_width+b_width-1 downto 0)); end component; component gen_mult_pipe generic ( a_width : positive; -- multiplier word width b_width : positive; -- multiplicand word width num_stages : positive := 2; -- number of pipeline stages stall_mode : natural range 0 to 1 := 1); -- '0': non-stallable; '1': stallable port ( clk : in std_logic; -- register clock en : in std_logic; -- register enable tc : in std_logic; -- '0' : unsigned, '1' : signed a : in std_logic_vector(a_width-1 downto 0); -- multiplier b : in std_logic_vector(b_width-1 downto 0); -- multiplicand product : out std_logic_vector(a_width+b_width-1 downto 0)); -- product end component; component axcel_mul_33x33_signed generic ( pipe: Integer := 0); port ( a: in Std_Logic_Vector(32 downto 0); b: in Std_Logic_Vector(32 downto 0); en: in Std_Logic; clk: in Std_Logic; p: out Std_Logic_Vector(65 downto 0)); end component; end;
gpl-2.0
6ed704e1d269115bec4a747f4b32739d
0.541072
4.121569
false
false
false
false
CogPy/cog
xUnit/vhdl/test_order.vhd
1
2,704
------------------------------------------------------------------------------- -- Title : test_order -- Project : ------------------------------------------------------------------------------- -- File : test_order.vhd -- Author : <kristoffer.nordstrom@HELVNB0100> -- Company : -- Created : 2015-04-27 -- Last update: 2015-05-20 -- Platform : -- Standard : VHDL'93/02 ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- -- Copyright (c) 2015 ------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- 2015-04-27 1.0 kn Created ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.test_order_pkg.all; ------------------------------------------------------------------------------- entity test_order is port ( Clk : in std_logic; Clr : in std_logic; Order_A : in std_logic_vector(3 downto 0); Order_B : in std_logic_vector(3 downto 0); Order_AB : out std_logic_vector(4 downto 0) ); end entity test_order; ------------------------------------------------------------------------------- architecture str of test_order is ----------------------------------------------------------------------------- -- Internal signal declarations ----------------------------------------------------------------------------- signal AB : unsigned(Order_AB'range); begin -- architecture str ----------------------------------------------------------------------------- -- Output assignments ----------------------------------------------------------------------------- Order_AB <= std_logic_vector(AB); ----------------------------------------------------------------------------- -- Component instantiations ----------------------------------------------------------------------------- p_addAandB: process (Clk) is begin -- process p_addAandB if Clk'event and Clk = '1' then -- rising clock edge if Clr = '1' then AB <= to_unsigned(0, AB'length); else AB <= resize(unsigned(Order_A), AB'length) + resize(unsigned(Order_B), AB'length); end if; end if; end process p_addAandB; assert THE_TRUTH = 42 report "No answer to the question." severity error; end architecture str; -------------------------------------------------------------------------------
lgpl-3.0
873e2f2d6c88d8d2210866ba288b60b7
0.33247
5.529652
false
true
false
false
Luisda199824/ProcesadorMonociclo
TB_SignExtend.vhd
1
1,267
LIBRARY ieee; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY TB_SignExtend IS END TB_SignExtend; ARCHITECTURE behavior OF TB_SignExtend IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT SignExtender PORT( A : IN std_logic_vector(12 downto 0); clk : IN std_logic; SEOut : OUT std_logic_vector(31 downto 0) ); END COMPONENT; --Inputs signal A : std_logic_vector(12 downto 0) := (others => '0'); signal clk : std_logic := '0'; --Outputs signal SEOut : std_logic_vector(31 downto 0); -- Clock period definitions constant clk_period : time := 20 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: SignExtender PORT MAP ( A => A, clk => clk, SEOut => SEOut ); -- Clock process definitions clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process begin A <= "0000000000010"; wait for 100 ns; A <= "0000000001000"; wait for 100 ns; A <= "1000000000001"; wait for 100 ns; A <= "1110000000001"; wait; end process; END;
mit
eedf05143082fc237893e8af6f17f1f3
0.605367
3.509695
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-xc3sd-1800/config.vhd
1
7,530
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := spartan3; constant CFG_MEMTECH : integer := spartan3; constant CFG_PADTECH : integer := spartan3; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := spartan3; constant CFG_CLKMUL : integer := (8); constant CFG_CLKDIV : integer := (25); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 2 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 1; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 2; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 2; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 0; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 4; constant CFG_ATBSZ : integer := 4; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 1; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#001234#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 1; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- DDR controller constant CFG_DDR2SP : integer := 1; constant CFG_DDR2SP_INIT : integer := 1; constant CFG_DDR2SP_FREQ : integer := (125); constant CFG_DDR2SP_TRFC : integer := (130); constant CFG_DDR2SP_DATAWIDTH : integer := (32); constant CFG_DDR2SP_FTEN : integer := 0; constant CFG_DDR2SP_FTWIDTH : integer := 0; constant CFG_DDR2SP_COL : integer := (10); constant CFG_DDR2SP_SIZE : integer := (128); constant CFG_DDR2SP_DELAY0 : integer := (0); constant CFG_DDR2SP_DELAY1 : integer := (0); constant CFG_DDR2SP_DELAY2 : integer := (0); constant CFG_DDR2SP_DELAY3 : integer := (0); constant CFG_DDR2SP_DELAY4 : integer := (0); constant CFG_DDR2SP_DELAY5 : integer := (0); constant CFG_DDR2SP_DELAY6 : integer := (0); constant CFG_DDR2SP_DELAY7 : integer := (0); constant CFG_DDR2SP_NOSYNC : integer := 0; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 16; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (8); -- SVGA controller constant CFG_SVGA_ENABLE : integer := 0; -- SPI memory controller constant CFG_SPIMCTRL : integer := 0; constant CFG_SPIMCTRL_SDCARD : integer := 0; constant CFG_SPIMCTRL_READCMD : integer := 16#0#; constant CFG_SPIMCTRL_DUMMYBYTE : integer := 0; constant CFG_SPIMCTRL_DUALOUTPUT : integer := 0; constant CFG_SPIMCTRL_SCALER : integer := 1; constant CFG_SPIMCTRL_ASCALER : integer := 1; constant CFG_SPIMCTRL_PWRUPCNT : integer := 0; constant CFG_SPIMCTRL_OFFSET : integer := 16#0#; -- SPI controller constant CFG_SPICTRL_ENABLE : integer := 0; constant CFG_SPICTRL_NUM : integer := 1; constant CFG_SPICTRL_SLVS : integer := 1; constant CFG_SPICTRL_FIFO : integer := 1; constant CFG_SPICTRL_SLVREG : integer := 0; constant CFG_SPICTRL_ODMODE : integer := 0; constant CFG_SPICTRL_AM : integer := 0; constant CFG_SPICTRL_ASEL : integer := 0; constant CFG_SPICTRL_TWEN : integer := 0; constant CFG_SPICTRL_MAXWLEN : integer := 0; constant CFG_SPICTRL_SYNCRAM : integer := 0; constant CFG_SPICTRL_FT : integer := 0; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
e2de0d7a8f91edf6933adce773175857
0.652457
3.584008
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/work/debug/grtestmod.vhd
1
6,775
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: grtestmod -- File: grtestmod.vhd -- Author: Jiri Gaisler, Gaisler Research -- Modified: Jan Andersson, Aeroflex Gaisler -- Contact: [email protected] -- Description: Test report module -- -- See also the gaiser.sim.ahbrep module for a module connected via AHB for -- for use internally on SoC. -- -- This module supports a 16- or 32-bit interface as selected via the 'width' -- generic. -- -- In 32-bit mode the module has the following memory map: -- -- 0x00 : sets and prints vendor id from data[31:24] and -- device id from data[23:12] -- 0x04 : asserts error number data[15:0] -- 0x08 : calls subtest data[7:0] -- 0x10 : prints *** GRLIB system test starting *** -- 0x14 : prints Test passed / errors detected -- 0x18 : prints Checkpoint data[15:0] with time stamp -- -- In 16-bit mode the module has the following memory map: -- -- 0x00 : sets vendor id from data[15:8] and MSbs of device id from data[7:0] -- 0x04 : asserts error number data[15:0] -- 0x08 : calls subtest data[7:0] -- 0x0C : sets LSbs of device id from data[15:12], prints vendor and device id -- 0x10 : prints *** GRLIB system test starting *** -- 0x14 : prints Test passed / errors detected -- 0x18 : prints Checkpoint data[15:0] with time stamp -- -- The width is defined for the systest software via GRLIB_REPORTDEV_WIDTH ------------------------------------------------------------------------------ -- pragma translate_off library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.sim.all; library grlib; use grlib.stdlib.all; use grlib.stdio.all; use grlib.devices.all; use std.textio.all; entity grtestmod is generic ( halt : integer := 0; width : integer := 32); port ( resetn : in std_ulogic; clk : in std_ulogic; errorn : in std_ulogic; address : in std_logic_vector(21 downto 2); data : inout std_logic_vector(width-1 downto 0); iosn : in std_ulogic; oen : in std_ulogic; writen : in std_ulogic; brdyn : out std_ulogic := '1'; bexcn : out std_ulogic := '1'; state : out std_logic_vector(1 downto 0); testdev : out std_logic_vector(19 downto 0); subtest : out std_logic_vector(7 downto 0) ); end; architecture sim of grtestmod is subtype msgtype is string(1 to 40); constant ntests : integer := 2; type msgarr is array (0 to ntests) of msgtype; constant msg : msgarr := ( "*** Starting GRLIB system test *** ", -- 0 "Test completed OK, halting simulation ", -- 1 "Test FAILED " -- 2 ); signal ior, iow : std_ulogic; signal addr : std_logic_vector(21 downto 2); signal ldata : std_logic_vector(width-1 downto 0); begin ior <= iosn or oen; iow <= iosn or writen; data <= (others => 'Z'); addr <= to_X01(address) after 1 ns; ldata <= to_X01(data) after 1 ns; log : process(ior, iow) --, clk) variable errno, errcnt, lsubtest, vendorid, deviceid : integer; variable lstate: std_logic_vector(1 downto 0) := "00"; --variable addr : std_logic_vector(21 downto 2); --variable ldata : std_logic_vector(width-1 downto 0); begin --if rising_edge(clk) then -- addr := to_X01(address); -- ldata := to_X01(data); --end if; if falling_edge (ior) then brdyn <= '1', '0' after 100 ns; if addr(15) = '1' then bexcn <= '1', '0' after 100 ns; end if; elsif rising_edge (ior) then brdyn <= '1'; bexcn <= '1'; elsif falling_edge(iow) then brdyn <= '1', '0' after 100 ns; if addr(15) = '1' then bexcn <= '1', '0' after 100 ns; end if; elsif rising_edge(iow) then brdyn <= '1'; bexcn <= '1'; -- addr := to_X01(address); case addr(7 downto 2) is when "000000" => if width = 32 then vendorid := conv_integer(ldata(31*(width/32) downto 24*(width/32))); deviceid := conv_integer(ldata(23*(width/32) downto 12*(width/32))); print(iptable(vendorid).device_table(deviceid)); testdev <= conv_std_logic_vector(vendorid*256+deviceid,20); else vendorid := conv_integer(ldata(15 downto 8)); deviceid := 2**4*conv_integer(ldata(7 downto 0)); end if; when "000001" => errno := conv_integer(ldata(15 downto 0)); if (halt = 0) then assert false report "test failed, error (" & tost(errno) & ")" severity failure; else assert false report "test failed, error (" & tost(errno) & ")" severity warning; end if; lstate := "11"; when "000010" => lsubtest := conv_integer(ldata(7 downto 0)); call_subtest(vendorid, deviceid, lsubtest); subtest <= conv_std_logic_vector(lsubtest,8); when "000011" => if width = 16 then deviceid := deviceid + conv_integer(ldata(15 downto 12)); print(iptable(vendorid).device_table(deviceid)); testdev <= conv_std_logic_vector(vendorid*256+deviceid,20); end if; when "000100" => print (""); print ("**** GRLIB system test starting ****"); errcnt := 0; if lstate="00" then lstate := "01"; end if; when "000101" => if errcnt = 0 then print ("Test passed, halting with IU error mode"); if lstate="01" then lstate := "10"; end if; elsif errcnt = 1 then print ("1 error detected, halting with IU error mode"); else print (tost(errcnt) & " errors detected, halting with IU error mode"); end if; print (""); when "000110" => grlib.testlib.print("Checkpoint " & tost(conv_integer(ldata(15 downto 0)))); when others => end case; end if; state <= lstate; end process; end; -- pragma translate_on
gpl-2.0
3cd45a92ab3e49c08827e63601729dd4
0.603542
3.594164
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/apbvga.vhd
1
11,932
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: apbvga -- File: vga.vhd -- Author: Marcus Hellqvist -- Description: VGA controller ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.misc.all; use gaisler.charrom_package.all; entity apbvga is generic( memtech : integer := DEFMEMTECH; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff# ); port( rst : in std_ulogic; -- Global asynchronous reset clk : in std_ulogic; -- Global clock vgaclk : in std_ulogic; -- VGA clock apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; vgao : out apbvga_out_type ); end entity apbvga; architecture rtl of apbvga is type state_type is (s0,s1,s2); constant RAM_DEPTH : integer := 12; constant RAM_DATA_BITS : integer := 8; constant MAX_FRAME : std_logic_vector((RAM_DEPTH-1) downto 0):= X"B90"; type ram_out_type is record dataout2 : std_logic_vector((RAM_DATA_BITS -1) downto 0); end record; type vga_regs is record video_out : std_logic_vector(23 downto 0); hsync : std_ulogic; vsync : std_ulogic; csync : std_ulogic; hcnt : std_logic_vector(9 downto 0); vcnt : std_logic_vector(9 downto 0); blank : std_ulogic; linecnt : std_logic_vector(3 downto 0); h_video_on : std_ulogic; v_video_on : std_ulogic; pixel : std_ulogic; state : state_type; rombit : std_logic_vector(2 downto 0); romaddr : std_logic_vector(11 downto 0); ramaddr2 : std_logic_vector((RAM_DEPTH -1) downto 0); ramdatain2 : std_logic_vector((RAM_DATA_BITS -1) downto 0); wstartaddr : std_logic_vector((RAM_DEPTH-1) downto 0); raddr : std_logic_vector((RAM_DEPTH-1) downto 0); tmp : std_logic_vector(RAM_DEPTH-1 downto 0); end record; type color_reg_type is record bgcolor : std_logic_vector(23 downto 0); txtcolor : std_logic_vector(23 downto 0); end record; type vmmu_reg_type is record waddr : std_logic_vector((RAM_DEPTH-1) downto 0); wstartaddr : std_logic_vector((RAM_DEPTH-1) downto 0); ramaddr1 : std_logic_vector((RAM_DEPTH -1) downto 0); ramdatain1 : std_logic_vector((RAM_DATA_BITS -1) downto 0); ramenable1 : std_ulogic; ramwrite1 : std_ulogic; color : color_reg_type; end record; constant REVISION : amba_version_type := 0; constant pconfig : apb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_VGACTRL, 0, REVISION, 0), 1 => apb_iobar(paddr, pmask)); constant hmax : integer:= 799; constant vmax : integer:= 524; constant hvideo : integer:= 639; constant vvideo : integer:= 480; constant hfporch : integer:= 19; constant vfporch : integer:= 11; constant hbporch : integer:= 45; constant vbporch : integer:= 31; constant hsyncpulse : integer:= 96; constant vsyncpulse : integer:= 2; constant char_height : std_logic_vector(3 downto 0):="1100"; signal p,pin : vmmu_reg_type; signal ramo : ram_out_type; signal r,rin : vga_regs; signal romdata : std_logic_vector(7 downto 0); signal gnd, vcc : std_ulogic; begin gnd <= '0'; vcc <= '1'; comb1: process(rst,r,p,romdata,ramo) variable v : vga_regs; begin v:=r; v.wstartaddr := p.wstartaddr; -- horizontal counter if r.hcnt < conv_std_logic_vector(hmax,10) then v.hcnt := r.hcnt +1; else v.hcnt := (others => '0'); end if; -- vertical counter if (r.vcnt >= conv_std_logic_vector(vmax,10)) and (r.hcnt >= conv_std_logic_vector(hmax,10)) then v.vcnt := (others => '0'); elsif r.hcnt = conv_std_logic_vector(hmax,10) then v.vcnt := r.vcnt +1; end if; -- horizontal pixel out if r.hcnt <= conv_std_logic_vector(hvideo,10) then v.h_video_on := '1'; else v.h_video_on := '0'; end if; -- vertical pixel out if r.vcnt <= conv_std_logic_vector(vvideo,10) then v.v_video_on := '1'; else v.v_video_on := '0'; end if; -- generate hsync if (r.hcnt <= conv_std_logic_vector((hvideo+hfporch+hsyncpulse),10)) and (r.hcnt >= conv_std_logic_vector((hvideo+hfporch),10)) then v.hsync := '0'; else v.hsync := '1'; end if; -- generate vsync if (r.vcnt <= conv_std_logic_vector((vvideo+vfporch+vsyncpulse),10)) and (r.vcnt >= conv_std_logic_vector((vvideo+vfporch),10)) then v.vsync := '0'; else v.vsync := '1'; end if; --generate csync & blank v.csync := not (v.hsync xor v.vsync); v.blank := v.h_video_on and v.v_video_on; -- count line of character if v.hcnt = conv_std_logic_vector(hvideo,10) then if (r.linecnt = char_height) or (v.vcnt = conv_std_logic_vector(vmax,10)) then v.linecnt := (others => '0'); else v.linecnt := r.linecnt +1; end if; end if; if v.blank = '1' then case r.state is when s0 => v.ramaddr2 := r.raddr; v.raddr := r.raddr +1; v.state := s1; when s1 => v.romaddr := v.linecnt & ramo.dataout2; v.state := s2; when s2 => if r.rombit = "011" then v.ramaddr2 := r.raddr; v.raddr := r.raddr +1; elsif r.rombit = "010" then v.state := s1; end if; end case; v.rombit := r.rombit - 1; v.pixel := romdata(conv_integer(r.rombit)); end if; -- read from same address char_height times if v.raddr = (r.tmp + X"050") then if (v.linecnt < char_height) then v.raddr := r.tmp; elsif v.raddr(11 downto 4) = X"FF" then --check for end of allowed memory(80x51) v.raddr := (others => '0'); v.tmp := (others => '0'); else v.tmp := r.tmp + X"050"; end if; end if; if v.v_video_on = '0' then v.raddr := r.wstartaddr; v.tmp := r.wstartaddr; v.state := s0; end if; -- define pixel color if v.pixel = '1'and v.blank = '1' then v.video_out := p.color.txtcolor; else v.video_out := p.color.bgcolor; end if; if rst = '0' then v.hcnt := conv_std_logic_Vector(hmax,10); v.vcnt := conv_std_logic_Vector(vmax,10); v.v_video_on := '0'; v.h_video_on := '0'; v.hsync := '0'; v.vsync := '0'; v.csync := '0'; v.blank := '0'; v.linecnt := (others => '0'); v.state := s0; v.rombit := "111"; v.pixel := '0'; v.video_out := (others => '0'); v.raddr := (others => '0'); v.tmp := (others => '0'); v.ramaddr2 := (others => '0'); v.ramdatain2 := (others => '0'); end if; -- update register rin <= v; -- drive outputs vgao.hsync <= r.hsync; vgao.vsync <= r.vsync; vgao.comp_sync <= r.csync; vgao.blank <= r.blank; vgao.video_out_r <= r.video_out(23 downto 16); vgao.video_out_g <= r.video_out(15 downto 8); vgao.video_out_b <= r.video_out(7 downto 0); vgao.bitdepth <= "11"; -- All data is valid end process; comb2: process(rst,r,p,apbi,ramo) variable v : vmmu_reg_type; variable rdata : std_logic_vector(31 downto 0); begin v := p; v.ramenable1 := '0'; v.ramwrite1 := '0'; rdata := (others => '0'); case apbi.paddr(3 downto 2) is when "00" => if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then v.waddr := apbi.pwdata(19 downto 8); v.ramdatain1 := apbi.pwdata(7 downto 0); v.ramenable1 := '1'; v.ramwrite1 := '1'; v.ramaddr1 := apbi.pwdata(19 downto 8); end if; when "01" => if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then v.color.bgcolor := apbi.pwdata(23 downto 0); end if; when "10" => if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then v.color.txtcolor := apbi.pwdata(23 downto 0); end if; when others => null; end case; if (p.waddr - p.wstartaddr) >= MAX_FRAME then if p.wstartaddr(11 downto 4) = X"FA" then --last position of allowed memory v.wstartaddr := X"000"; else v.wstartaddr := p.wstartaddr + X"050"; end if; end if; if rst = '0' then v.waddr := (others => '0'); v.wstartaddr := (others => '0'); v.color.bgcolor := (others => '0'); v.color.txtcolor := (others => '1'); end if; --update registers pin <= v; --drive outputs apbo.prdata <= rdata; apbo.pindex <= pindex; apbo.pirq <= (others => '0'); end process; apbo.pconfig <= pconfig; reg : process(clk) begin if clk'event and clk = '1' then p <= pin; end if; end process; reg2 : process(vgaclk) begin if vgaclk'event and vgaclk = '1' then r <= rin; end if; end process; rom0 : charrom port map(clk=>vgaclk, addr=>r.romaddr, data=>romdata); ram0 : syncram_2p generic map (tech => memtech, abits => RAM_DEPTH, dbits => RAM_DATA_BITS, sepclk => 1) port map ( rclk => vgaclk, raddress => r.ramaddr2, dataout => ramo.dataout2, renable => vcc, wclk => clk, waddress => p.ramaddr1, datain => p.ramdatain1, write => p.ramwrite1 ); -- ram0 : syncram_dp generic map (tech => memtech, abits => RAM_DEPTH, dbits => RAM_DATA_BITS) -- port map ( clk1 => clk, address1 => p.ramaddr1, datain1 => p.ramdatain1, -- dataout1 => open, enable1 => p.ramenable1, write1 => p.ramwrite1, -- clk2 => vgaclk, address2 => r.ramaddr2, datain2 => r.ramdatain2, -- dataout2 => ramo.dataout2, enable2 => gnd, write2 => gnd); -- pragma translate_off bootmsg : report_version generic map ("apbvga" & tost(pindex) & ": APB VGA module rev 0"); -- pragma translate_on end architecture;
gpl-2.0
5b34b88d274a9f8d6e8b431d51e03eb7
0.531009
3.504258
false
false
false
false
CogPy/cog
xUnit/vhdl/B.vhd
1
2,182
------------------------------------------------------------------------------- -- Title : B -- Project : ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; ------------------------------------------------------------------------------- entity B is port ( Clk : in std_logic; Clr : in std_logic; B_A : in std_logic_vector(3 downto 0); B_B : in std_logic_vector(3 downto 0); B_AB : out std_logic_vector(4 downto 0) ); end entity B; ------------------------------------------------------------------------------- architecture str of B is signal Cents_A : std_logic_vector(3 downto 0); signal Cents_B : std_logic_vector(3 downto 0); signal Cents_AB : std_logic_vector(4 downto 0); ----------------------------------------------------------------------------- -- Internal signal declarations ----------------------------------------------------------------------------- signal AB : unsigned(B_AB'range); begin -- architecture str ----------------------------------------------------------------------------- -- Output assignments ----------------------------------------------------------------------------- B_AB <= std_logic_vector(AB); ----------------------------------------------------------------------------- -- Component instantiations ----------------------------------------------------------------------------- p_addAandB: process (Clk) is begin -- process p_addAandB if Clk'event and Clk = '1' then -- rising clock edge if Clr = '1' then AB <= to_unsigned(0, AB'length); else AB <= resize(unsigned(B_A), AB'length) + resize(unsigned(B_B), AB'length); end if; end if; end process p_addAandB; i_Cents_1: entity work.Cents port map ( Clk => Clk, Clr => Clr, Cents_A => Cents_A, Cents_B => Cents_B, Cents_AB => Cents_AB); end architecture str; -------------------------------------------------------------------------------
lgpl-3.0
c462c7a39074ed7060619f49831aa088
0.337305
5.074419
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/prj/solution1/syn/vhdl/FIFO_image_filter_img_1_data_stream_0_V.vhd
4
4,629
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_img_1_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_img_1_data_stream_0_V_shiftReg; architecture rtl of FIFO_image_filter_img_1_data_stream_0_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_img_1_data_stream_0_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_img_1_data_stream_0_V is component FIFO_image_filter_img_1_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_img_1_data_stream_0_V_shiftReg : FIFO_image_filter_img_1_data_stream_0_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
68c59d2e2aeff62d1cc7c293a1865812
0.537697
3.449329
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/jtag/libjtagcom.vhd
1
2,842
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: libjtagcom -- File: libjtagcom.vhd -- Author: Edvin Catovic - Gaisler Research -- Description: JTAG Commulnications link signal and component declarations ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; library gaisler; use gaisler.misc.all; package libjtagcom is type tap_in_type is record en : std_ulogic; tdo : std_ulogic; end record; type tap_out_type is record tck : std_ulogic; tdi : std_ulogic; inst : std_logic_vector(7 downto 0); asel : std_ulogic; dsel : std_ulogic; reset : std_ulogic; capt : std_ulogic; shift : std_ulogic; upd : std_ulogic; end record; component jtagcom generic ( isel : integer range 0 to 1 := 0; nsync : integer range 1 to 2 := 2; ainst : integer range 0 to 255 := 2; dinst : integer range 0 to 255 := 3; reread : integer range 0 to 1 := 0); port ( rst : in std_ulogic; clk : in std_ulogic; tapo : in tap_out_type; tapi : out tap_in_type; dmao : in ahb_dma_out_type; dmai : out ahb_dma_in_type; tck : in std_ulogic; trst : in std_ulogic ); end component; component jtagcom2 is generic ( gatetech: integer := 0; isel : integer range 0 to 1 := 0; ainst : integer range 0 to 255 := 2; dinst : integer range 0 to 255 := 3); port ( rst : in std_ulogic; clk : in std_ulogic; tapo : in tap_out_type; tapi : out tap_in_type; dmao : in ahb_dma_out_type; dmai : out ahb_dma_in_type; tckp : in std_ulogic; tckn : in std_ulogic; trst : in std_ulogic ); end component; end;
gpl-2.0
6034835e9ca568508de3d7a41ce6b148
0.580225
3.850949
false
false
false
false
Yuriu5/MiniBlaze
test/Nexys2/shared/decode_7seg.vhd
1
2,320
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity decode_7seg is port( clk : in std_logic; -- Clock reset : in std_logic; -- Reset data_in : in std_logic_vector(15 downto 0);-- Number to be displayed 4 bits for each segements segments : out std_logic_vector(6 downto 0); -- Seven segments anode_selected : out std_logic_vector(3 downto 0) -- Selecting one of the four seven segments ); end decode_7seg; architecture rtl of decode_7seg is constant c_1_ms : integer := 50000; signal r_cnt : unsigned(31 downto 0) := (others => '0'); signal r_segments : std_logic_vector(6 downto 0) := (others => '1'); signal r_data_4b : std_logic_vector(3 downto 0) := (others => '0'); signal r_anode_selected : std_logic_vector(3 downto 0) := "1110"; begin process(clk) begin if rising_edge(clk) then if reset = '1' then r_segments <= "1111111"; r_cnt <= (others => '0'); r_anode_selected <= "1110"; else -- Mux data_in for i in 0 to r_anode_selected'length-1 loop if r_anode_selected(i) = '0' then r_data_4b <= data_in(4*(i+1)-1 downto 4*i); end if; end loop; -- Display case r_data_4b is when "0000" => -- Display 0 r_segments <= "1000000"; when "0001" => -- Display 1 r_segments <= "1111001"; when "0010" => -- Display 2 r_segments <= "0100100"; when "0011" => -- Display 3 r_segments <= "0110000"; when "0100" => -- Display 4 r_segments <= "0011001"; when "0101" => -- Display 5 r_segments <= "0010010"; when "0110" => -- Display 6 r_segments <= "0000010"; when "0111" => -- Display 7 r_segments <= "1111000"; when "1000" => -- Display 8 r_segments <= "0000000"; when "1001" => -- Display 9 r_segments <= "0010000"; when others => r_segments <= "0000000"; end case; -- Switch anode every 10 ms if r_cnt = c_1_ms then r_cnt <= (others => '0'); r_anode_selected <= r_anode_selected(2 downto 0) & r_anode_selected(3); else r_cnt <= r_cnt + 1; end if; end if; end if; end process; segments <= r_segments; anode_selected <= r_anode_selected; end rtl;
mit
c66e9ddf51c1cae5ef006699cb57dd5e
0.557328
2.955414
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/acme/prj/solution1/syn/vhdl/image_filter_mul_10ns_12ns_22_2.vhd
2
2,336
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter_mul_10ns_12ns_22_2_AM2S_0 is port ( clk: in std_logic; ce: in std_logic; a: in std_logic_vector(10 - 1 downto 0); b: in std_logic_vector(12 - 1 downto 0); p: out std_logic_vector(22 - 1 downto 0)); end entity; architecture behav of image_filter_mul_10ns_12ns_22_2_AM2S_0 is signal tmp_product : std_logic_vector(22 - 1 downto 0); signal a_i : std_logic_vector(10 - 1 downto 0); signal b_i : std_logic_vector(12 - 1 downto 0); signal p_tmp : std_logic_vector(22 - 1 downto 0); begin a_i <= a; b_i <= b; p <= p_tmp; tmp_product <= std_logic_vector(resize(unsigned(a_i) * unsigned(b_i), 22)); process(clk) begin if (clk'event and clk = '1') then if (ce = '1') then p_tmp <= tmp_product; end if; end if; end process; end architecture; Library IEEE; use IEEE.std_logic_1164.all; entity image_filter_mul_10ns_12ns_22_2 is generic ( ID : INTEGER; NUM_STAGE : INTEGER; din0_WIDTH : INTEGER; din1_WIDTH : INTEGER; dout_WIDTH : INTEGER); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; ce : IN STD_LOGIC; din0 : IN STD_LOGIC_VECTOR(din0_WIDTH - 1 DOWNTO 0); din1 : IN STD_LOGIC_VECTOR(din1_WIDTH - 1 DOWNTO 0); dout : OUT STD_LOGIC_VECTOR(dout_WIDTH - 1 DOWNTO 0)); end entity; architecture arch of image_filter_mul_10ns_12ns_22_2 is component image_filter_mul_10ns_12ns_22_2_AM2S_0 is port ( clk : IN STD_LOGIC; ce : IN STD_LOGIC; a : IN STD_LOGIC_VECTOR; b : IN STD_LOGIC_VECTOR; p : OUT STD_LOGIC_VECTOR); end component; begin image_filter_mul_10ns_12ns_22_2_AM2S_0_U : component image_filter_mul_10ns_12ns_22_2_AM2S_0 port map ( clk => clk, ce => ce, a => din0, b => din1, p => dout); end architecture;
gpl-3.0
dcea705730870716548a62cda2e11e55
0.550086
3.208791
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/ec/ddr_ec.vhd
1
2,040
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ddr_ec -- File: ddr_ec.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Lattice DDR regs ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; -- pragma translate_off library ec; use ec.ODDRXB; --pragma translate_on entity ec_oddr_reg is port ( Q : out std_ulogic; C1 : in std_ulogic; C2 : in std_ulogic; CE : in std_ulogic; D1 : in std_ulogic; D2 : in std_ulogic; R : in std_ulogic; S : in std_ulogic); end; architecture rtl of ec_oddr_reg is component ODDRXB port( DA : in STD_LOGIC; DB : in STD_LOGIC; CLK : in STD_LOGIC; LSR : in STD_LOGIC; Q : out STD_LOGIC ); end component; begin U0 : ODDRXB port map( DA => D1, DB => D2, CLK => C1, LSR => R, Q => Q); end;
gpl-2.0
ccc87eefec2705d40cdd709ea8b4e2dd
0.538725
4.112903
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-sp605/config.vhd
1
7,548
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := spartan6; constant CFG_MEMTECH : integer := spartan6; constant CFG_PADTECH : integer := spartan6; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := spartan6; constant CFG_CLKMUL : integer := (5); constant CFG_CLKDIV : integer := (3); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 16#32# + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 1; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 1; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 8; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 2; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 2; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 1 + 4*1; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 0; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 4; constant CFG_ATBSZ : integer := 4; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020605#; constant CFG_ETH_ENL : integer := 16#000987#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 1; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- Xilinx MIG constant CFG_MIG_DDR2 : integer := 1; constant CFG_MIG_RANKS : integer := (1); constant CFG_MIG_COLBITS : integer := (10); constant CFG_MIG_ROWBITS : integer := (13); constant CFG_MIG_BANKBITS: integer := (2); constant CFG_MIG_HMASK : integer := 16#F00#; -- AHB status register constant CFG_AHBSTAT : integer := 1; constant CFG_AHBSTATN : integer := (1); -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 32; constant CFG_GRETH_FT : integer := 0; constant CFG_GRETH_EDCLFT : integer := 0; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (8); -- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := 0; constant CFG_VGA_ENABLE : integer := 0; constant CFG_SVGA_ENABLE : integer := 1; -- SPI memory controller constant CFG_SPIMCTRL : integer := 0; constant CFG_SPIMCTRL_SDCARD : integer := 0; constant CFG_SPIMCTRL_READCMD : integer := 16#0#; constant CFG_SPIMCTRL_DUMMYBYTE : integer := 0; constant CFG_SPIMCTRL_DUALOUTPUT : integer := 0; constant CFG_SPIMCTRL_SCALER : integer := 1; constant CFG_SPIMCTRL_ASCALER : integer := 1; constant CFG_SPIMCTRL_PWRUPCNT : integer := 0; constant CFG_SPIMCTRL_OFFSET : integer := 16#0#; -- SPI controller constant CFG_SPICTRL_ENABLE : integer := 0; constant CFG_SPICTRL_NUM : integer := 1; constant CFG_SPICTRL_SLVS : integer := 1; constant CFG_SPICTRL_FIFO : integer := 1; constant CFG_SPICTRL_SLVREG : integer := 0; constant CFG_SPICTRL_ODMODE : integer := 0; constant CFG_SPICTRL_AM : integer := 0; constant CFG_SPICTRL_ASEL : integer := 0; constant CFG_SPICTRL_TWEN : integer := 0; constant CFG_SPICTRL_MAXWLEN : integer := 0; constant CFG_SPICTRL_SYNCRAM : integer := 0; constant CFG_SPICTRL_FT : integer := 0; -- AMBA System ACE Interface Controller constant CFG_GRACECTRL : integer := 1; -- PCIEXP interface constant CFG_PCIEXP : integer := 0; constant CFG_PCIE_TYPE : integer := 0; constant CFG_PCIE_SIM_MAS : integer := 0; constant CFG_PCIEXPVID : integer := 16#0#; constant CFG_PCIEXPDID : integer := 16#0#; constant CFG_NO_OF_LANES : integer := 1; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
bd23d22bf1ab904e9489c5dc2a33605f
0.653286
3.6411
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-xc7z020/leon3_zedboard_stub_sim.vhd
1
2,919
------------------------------------------------------------------------------- -- leon3_zedboard_stub.vhd ------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity leon3_zedboard_stub is port ( processing_system7_0_MIO : inout std_logic_vector(53 downto 0); processing_system7_0_PS_SRSTB : in std_logic; processing_system7_0_PS_CLK : in std_logic; processing_system7_0_PS_PORB : in std_logic; processing_system7_0_DDR_Clk : inout std_logic; processing_system7_0_DDR_Clk_n : inout std_logic; processing_system7_0_DDR_CKE : inout std_logic; processing_system7_0_DDR_CS_n : inout std_logic; processing_system7_0_DDR_RAS_n : inout std_logic; processing_system7_0_DDR_CAS_n : inout std_logic; processing_system7_0_DDR_WEB_pin : out std_logic; processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0); processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0); processing_system7_0_DDR_ODT : inout std_logic; processing_system7_0_DDR_DRSTB : inout std_logic; processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0); processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_VRN : inout std_logic; processing_system7_0_DDR_VRP : inout std_logic; ahblite_axi_bridge_0_S_AHB_HSEL_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HADDR_pin : in std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HPROT_pin : in std_logic_vector(3 downto 0); ahblite_axi_bridge_0_S_AHB_HTRANS_pin : in std_logic_vector(1 downto 0); ahblite_axi_bridge_0_S_AHB_HSIZE_pin : in std_logic_vector(2 downto 0); ahblite_axi_bridge_0_S_AHB_HWRITE_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HBURST_pin : in std_logic_vector(2 downto 0); ahblite_axi_bridge_0_S_AHB_HWDATA_pin : in std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HREADY_OUT_pin : out std_logic; ahblite_axi_bridge_0_S_AHB_HREADY_IN_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HRDATA_pin : out std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HRESP_pin : out std_logic; processing_system7_0_FCLK_CLK0_pin : out std_logic; processing_system7_0_FCLK_RESET0_N_pin : out std_logic; processing_system7_0_FCLK_CLKTRIG0_N_pin : in std_logic ); end leon3_zedboard_stub; architecture STRUCTURE of leon3_zedboard_stub is signal gclk : std_logic := '0'; signal rst : std_logic := '0'; begin gclk <= not gclk after 10.0 ns; rst <= '1' after 1 us; processing_system7_0_FCLK_CLK0_pin <= gclk; processing_system7_0_FCLK_RESET0_N_pin <= rst; end architecture STRUCTURE;
gpl-2.0
2b990b9f86f1c789b352fa5109c1b781
0.662556
3.028008
false
false
false
false
pdt/ttask
test/fpga-sim/sim/my_fpga_test_gates.vhdl
1
1,636
-- -- my_fpga_test_gates.vhdl -- library ieee; use ieee.std_logic_1164.all; use work.tbmsgs.all; entity my_fpga_test_gates is end entity; architecture sim of my_fpga_test_gates is signal clk : std_logic := '0'; signal n_rst : std_logic := '0'; signal up : std_logic := '0'; signal dn : std_logic := '0'; signal cnt : std_logic_vector(31 downto 0); signal cnt_1k : std_logic_vector(3 downto 0); signal in1 : std_logic := '0'; signal in2 : std_logic := '0'; signal out1 : std_logic; signal out2 : std_logic; begin uut : entity work.my_fpga port map ( clk => clk, n_rst => n_rst, up => up, dn => dn, cnt => cnt, cnt_1k => cnt_1k, in1 => in1, in2 => in2, out1 => out1, out2 => out2 ); test : process begin testcase("my_fpga gates", 4); wait for 1 us; check(out1 = '0', "out1 should be '0'"); check(out2 = '0', "out2 should be '0'"); tested("inputs set to 00"); in1 <= '1'; wait for 1 us; check(out1 = '1', "out1 should be '1'"); check(out2 = '0', "out2 should be '0'"); tested("inputs set to 01"); in2 <= '1'; wait for 1 us; check(out1 = '1', "out1 should be '1'"); check(out2 = '1', "out2 should be '1'"); tested("inputs set to 11"); in1 <= '0'; wait for 1 us; check(out1 = '1', "out1 should be '1'"); check(out2 = '0', "out2 should be '0'"); tested("inputs set to 10"); testcase_complete; wait; end process; end;
mit
889b0b5190754bdb863a5ab86b1f2bb3
0.501222
3.16441
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-nuhorizons-3s1500/leon3mp.vhd
1
24,422
----------------------------------------------------------------------------- -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.can.all; use gaisler.net.all; use gaisler.jtag.all; library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( pb_sw : in std_logic_vector (4 downto 1); -- push buttons pll_clk : in std_ulogic; -- PLL clock led : out std_logic_vector(8 downto 1); flash_a : out std_logic_vector(20 downto 0); flash_d : inout std_logic_vector(15 downto 0); sdram_a : out std_logic_vector(11 downto 0); sdram_d : inout std_logic_vector(31 downto 0); sdram_ba : out std_logic_vector(3 downto 0); sdram_dqm : out std_logic_vector(3 downto 0); sdram_clk : inout std_ulogic; sdram_cke : out std_ulogic; -- sdram clock enable sdram_csn : out std_ulogic; -- sdram chip select sdram_wen : out std_ulogic; -- sdram write enable sdram_rasn : out std_ulogic; -- sdram ras sdram_casn : out std_ulogic; -- sdram cas uart1_txd : out std_ulogic; uart1_rxd : in std_ulogic; uart1_rts : out std_ulogic; uart1_cts : in std_ulogic; uart2_txd : out std_ulogic; uart2_rxd : in std_ulogic; uart2_rts : out std_ulogic; uart2_cts : in std_ulogic; flash_oen : out std_ulogic; flash_wen : out std_ulogic; flash_cen : out std_ulogic; flash_byte : out std_ulogic; flash_ready : in std_ulogic; flash_rpn : out std_ulogic; flash_wpn : out std_ulogic; phy_mii_data: inout std_logic; -- ethernet PHY interface phy_tx_clk : in std_ulogic; phy_rx_clk : in std_ulogic; phy_rx_data : in std_logic_vector(3 downto 0); phy_dv : in std_ulogic; phy_rx_er : in std_ulogic; phy_col : in std_ulogic; phy_crs : in std_ulogic; phy_tx_data : out std_logic_vector(3 downto 0); phy_tx_en : out std_ulogic; phy_mii_clk : out std_ulogic; phy_100 : in std_ulogic; -- 100 Mbit indicator phy_rst_n : out std_ulogic; gpio : inout std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); -- lcd_data : inout std_logic_vector(7 downto 0); -- lcd_rs : out std_ulogic; -- lcd_rw : out std_ulogic; -- lcd_en : out std_ulogic; -- lcd_backl : out std_ulogic; can_txd : out std_ulogic; can_rxd : in std_ulogic; smsc_addr : out std_logic_vector(14 downto 0); smsc_data : inout std_logic_vector(31 downto 0); smsc_nbe : out std_logic_vector(3 downto 0); smsc_resetn : out std_ulogic; smsc_ardy : in std_ulogic; -- smsc_intr : in std_ulogic; smsc_nldev : in std_ulogic; smsc_nrd : out std_ulogic; smsc_nwr : out std_ulogic; smsc_ncs : out std_ulogic; smsc_aen : out std_ulogic; smsc_lclk : out std_ulogic; smsc_wnr : out std_ulogic; smsc_rdyrtn : out std_ulogic; smsc_cycle : out std_ulogic; smsc_nads : out std_ulogic ); end; architecture rtl of leon3mp is signal vcc, gnd : std_logic_vector(7 downto 0); signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdram_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, rstraw, pciclk, sdclkl : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ethi, ethi1, ethi2 : eth_in_type; signal etho, etho1, etho2 : eth_out_type; signal gpti : gptimer_in_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal can_lrx, can_ltx : std_ulogic; signal lclk, pci_lclk, sdfb : std_ulogic; signal tck, tms, tdi, tdo : std_ulogic; signal resetn : std_ulogic; signal pbsw : std_logic_vector(4 downto 1); signal ledo : std_logic_vector(8 downto 1); signal memi : memory_in_type; signal memo : memory_out_type; --for smc lan chip signal s_eth_aen : std_logic; signal s_eth_readn : std_logic; signal s_eth_writen: std_logic; signal s_eth_nbe : std_logic_vector(3 downto 0); signal s_eth_din : std_logic_vector(31 downto 0); constant ahbmmax : integer := CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+ CFG_GRETH; constant BOARD_FREQ : integer := 50000; -- board frequency in KHz constant CPU_FREQ : integer := (BOARD_FREQ*CFG_CLKMUL)/CFG_CLKDIV; -- cpu frequency in KHz begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); sdram_clk_pad : skew_outpad generic map (tech => padtech, slew => 1, strength => 24, skew => -60) port map (sdram_clk, sdclkl, rstn); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; resetn <= pbsw(4); ledo(2) <= not cgo.clklock; ledo(3) <= pbsw(3); clk_pad : clkpad generic map (tech => padtech) port map (pll_clk, lclk); clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN, CFG_CLK_NOFB, 0, 0, 0, BOARD_FREQ) port map (lclk, pci_lclk, clkm, open, open, sdclkl, pciclk, cgi, cgo); rst0 : rstgen -- reset generator port map (resetn, clkm, cgo.clklock, rstn, rstraw); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, nahbm => ahbmmax, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- l3 : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; ledo(8) <= dbgo(0).error; dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsui.enable <= '1'; dsui.break <= pbsw(1); ledo(1) <= not dsuo.active; end generate; end generate; nodcom : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0: ahbuart -- Debug UART generic map (hindex => CFG_NCPU, pindex => 7, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(7), ahbmi, ahbmo(CFG_NCPU)); dui.rxd <= u2i.rxd; u2o.txd <= duo.txd; u2o.rtsn <= gnd(0); end generate; nouah : if CFG_AHB_UART = 0 generate apbo(7) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- PROM/SDRAM Memory controller ------------------------------------ ---------------------------------------------------------------------- memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "00" when CFG_MCTRL_RAM16BIT = 0 else "01"; mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : entity work.smc_mctrl generic map (hindex => 0, pindex => 0, paddr => 0, srbanks => 4+CFG_MCTRL_5CS, sden => CFG_MCTRL_SDEN, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, invclk => CFG_MCTRL_INVCLK, sepbus => CFG_MCTRL_SEPBUS, sdbits => 32 + 32*CFG_MCTRL_SD64) port map (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo, s_eth_aen, s_eth_readn, s_eth_writen, s_eth_nbe, s_eth_din); addr_pad : outpadv generic map (width => 21, tech => padtech) port map (flash_a(20 downto 0), memo.address(21 downto 1)); roms_pad : outpad generic map (tech => padtech) port map (flash_cen, memo.romsn(0)); oen_pad : outpad generic map (tech => padtech) port map (flash_oen, memo.oen); wri_pad : outpad generic map (tech => padtech) port map (flash_wen, memo.writen); rom8 : if CFG_MCTRL_RAM16BIT = 0 generate data_pad : iopadv generic map (tech => padtech, width => 8) port map (flash_d(7 downto 0), memo.data(31 downto 24), memo.bdrive(0), memi.data(31 downto 24)); data15_pad : iopad generic map (tech => padtech) port map (flash_d(15), memo.address(0), gnd(0), open); end generate; rom16 : if CFG_MCTRL_RAM16BIT = 1 generate data_pad : iopadv generic map (tech => padtech, width => 16) port map (flash_d(15 downto 0), memo.data(31 downto 16), memo.bdrive(0), memi.data(31 downto 16)); end generate; sa_pad : outpadv generic map (width => 12, tech => padtech) port map (sdram_a, memo.sa(11 downto 0)); sba1_pad : outpadv generic map (width => 2, tech => padtech) port map (sdram_ba(1 downto 0), memo.sa(14 downto 13)); sba2_pad : outpadv generic map (width => 2, tech => padtech) port map (sdram_ba(3 downto 2), memo.sa(14 downto 13)); bdr : for i in 0 to 3 generate sd_pad : iopadv generic map (tech => padtech, width => 8) port map (sdram_d(31-i*8 downto 24-i*8), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), memi.sd(31-i*8 downto 24-i*8)); end generate; sdcke_pad : outpad generic map (tech => padtech) port map (sdram_cke, sdo.sdcke(0)); sdwen_pad : outpad generic map (tech => padtech) port map (sdram_wen, sdo.sdwen); sdcsn_pad : outpad generic map (tech => padtech) port map (sdram_csn, sdo.sdcsn(0)); sdras_pad : outpad generic map (tech => padtech) port map (sdram_rasn, sdo.rasn); sdcas_pad : outpad generic map (tech => padtech) port map (sdram_casn, sdo.casn); sddqm_pad : outpadv generic map (width => 4, tech => padtech) port map (sdram_dqm, sdo.dqm(3 downto 0)); end generate; nosd0 : if (CFG_MCTRL_SDEN = 0) generate -- no SDRAM controller sdcke_pad : outpad generic map (tech => padtech) port map (sdram_cke, gnd(0)); sdcsn_pad : outpad generic map (tech => padtech) port map (sdram_csn, vcc(0)); end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 4, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(4)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(4) <= ahbs_none; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.extclk <= '0'; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; ua1rx_pad : inpad generic map (tech => padtech) port map (uart1_rxd, u1i.rxd); ua1tx_pad : outpad generic map (tech => padtech) port map (uart1_txd, u1o.txd); ua1cts_pad : inpad generic map (tech => padtech) port map (uart1_cts, u1i.ctsn); ua1rts_pad : outpad generic map (tech => padtech) port map (uart1_rts, u1o.rtsn); ua2 : if (CFG_UART2_ENABLE /= 0) and (CFG_AHB_UART = 0) generate uart2 : apbuart -- UART 2 generic map (pindex => 9, paddr => 9, pirq => 3, fifosize => CFG_UART2_FIFO) port map (rstn, clkm, apbi, apbo(9), u2i, u2o); u2i.extclk <= '0'; end generate; noua1 : if CFG_UART2_ENABLE = 0 generate apbo(9) <= apb_none; end generate; ua2rx_pad : inpad generic map (tech => padtech) port map (uart2_rxd, u2i.rxd); ua2tx_pad : outpad generic map (tech => padtech) port map (uart2_txd, u2o.txd); ua2cts_pad : inpad generic map (tech => padtech) port map (uart2_cts, u2i.ctsn); ua2rts_pad : outpad generic map (tech => padtech) port map (uart2_rts, u2o.rtsn); irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW, wdog => CFG_GPT_WDOG) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GPIO unit grgpio0: grgpio generic map(pindex => 5, paddr => 5, imask => CFG_GRGPIO_IMASK, nbits => CFG_GRGPIO_WIDTH) port map(rst => rstn, clk => clkm, apbi => apbi, apbo => apbo(5), gpioi => gpioi, gpioo => gpioo); pio_pads : for i in 0 to CFG_GRGPIO_WIDTH-1 generate pio_pad : iopad generic map (tech => padtech) port map (gpio(i), gpioo.dout(i), gpioo.oen(i), gpioi.din(i)); end generate; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : greth generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, pindex => 15, paddr => 15, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL) port map( rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); end generate; ethpads : if CFG_GRETH = 0 generate -- no eth etho <= eth_out_none; end generate; emdio_pad : iopad generic map (tech => padtech) port map (phy_mii_data, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 0) port map (phy_tx_clk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 0) port map (phy_rx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (phy_rx_data, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (phy_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (phy_rx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (phy_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (phy_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (phy_tx_data, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map ( phy_tx_en, etho.tx_en); emdc_pad : outpad generic map (tech => padtech) port map (phy_mii_clk, etho.mdc); ereset_pad : outpad generic map (tech => padtech) port map (phy_rst_n, rstn); ----------------------------------------------------------------------- --- CAN -------------------------------------------------------------- ----------------------------------------------------------------------- can0 : if CFG_CAN = 1 generate can0 : can_oc generic map (slvndx => 6, ioaddr => CFG_CANIO, iomask => 16#FF0#, irq => CFG_CANIRQ, memtech => memtech) port map (rstn, clkm, ahbsi, ahbso(6), can_lrx, can_ltx ); end generate; ncan : if CFG_CAN = 0 generate ahbso(6) <= ahbs_none; end generate; can_loopback : if CFG_CANLOOP = 1 generate can_lrx <= can_ltx; end generate; can_pads : if CFG_CANLOOP = 0 generate can_tx_pad : outpad generic map (tech => padtech) port map (can_txd, can_ltx); can_rx_pad : inpad generic map (tech => padtech) port map (can_rxd, can_lrx); end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ocram : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map ( rstn, clkm, ahbsi, ahbso(7)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(7) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- I/O interface --------------------------------------------------- ----------------------------------------------------------------------- pb_sw_pad : inpadv generic map (width => 4, tech => padtech) port map (pb_sw, pbsw); led_pad : outpadv generic map (width => 8, tech => padtech) port map (led, ledo); rom8 : if CFG_MCTRL_RAM16BIT = 0 generate byte_pad : outpad generic map (tech => padtech) port map (flash_byte, gnd(0)); end generate; rom16 : if CFG_MCTRL_RAM16BIT = 1 generate byte_pad : outpad generic map (tech => padtech) port map (flash_byte, vcc(0)); end generate; rpn_pad : outpad generic map (tech => padtech) port map (flash_rpn, rstn); wpn_pad : outpad generic map (tech => padtech) port map (flash_wpn, vcc(0)); ready_pad : inpad generic map (tech => padtech) port map (flash_ready, open); smsc_data_pads : for i in 0 to 3 generate data_pad : iopadv generic map (tech => padtech, width => 8) port map (smsc_data(31-i*8 downto 24-i*8), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), s_eth_din(31-i*8 downto 24-i*8)); end generate; smsc_addr_pad : outpadv generic map (tech => padtech, width => 15) port map (smsc_addr, memo.address(15 downto 1)); smsc_nbe_pad : outpadv generic map (tech => padtech, width => 4) port map (smsc_nbe, s_eth_nbe); smsc_reset_pad : outpad generic map (tech => padtech) port map (smsc_resetn, rstn); smsc_nrd_pad : outpad generic map (tech => padtech) port map (smsc_nrd, s_eth_readn); smsc_nwr_pad : outpad generic map (tech => padtech) port map (smsc_nwr, s_eth_writen); smsc_ncs_pad : outpad generic map (tech => padtech) port map (smsc_ncs, memo.iosn); smsc_aen_pad : outpad generic map (tech => padtech) port map (smsc_aen, s_eth_aen); smsc_lclk_pad : outpad generic map (tech => padtech) port map (smsc_lclk, vcc(0)); smsc_wnr_pad : outpad generic map (tech => padtech) port map (smsc_wnr, vcc(0)); smsc_rdyrtn_pad : outpad generic map (tech => padtech) port map (smsc_rdyrtn, vcc(0)); smsc_cycle_pad : outpad generic map (tech => padtech) port map (smsc_cycle, vcc(0)); smsc_nads_pad : outpad generic map (tech => padtech) port map (smsc_nads, gnd(0)); -- lcd_data_pad : iopadv generic map (width => 8, tech => padtech) -- port map (lcd_data, nuo.lcd_data, nuo.lcd_ben, nui.lcd_data); -- lcd_rs_pad : outpad generic map (tech => padtech) -- port map (lcd_rs, nuo.lcd_rs); -- lcd_rw_pad : outpad generic map (tech => padtech) -- port map (lcd_rw, nuo.lcd_rw ); -- lcd_en_pad : outpad generic map (tech => padtech) -- port map (lcd_en, nuo.lcd_en); -- lcd_backl_pad : outpad generic map (tech => padtech) -- port map (lcd_backl, nuo.lcd_backl); ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- -- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG) to NAHBMST-1 generate -- ahbmo(i) <= ahbm_none; -- end generate; -- nap0 : for i in 11 to NAPBSLV-1-CFG_GRETH generate apbo(i) <= apb_none; end generate; apbo(6) <= apb_none; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Demonstration design for Nuhorizon SP3 board", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
ac158368b848479da606454674fe613d
0.567194
3.448948
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-sp601/config.vhd
1
7,726
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := spartan6; constant CFG_MEMTECH : integer := spartan6; constant CFG_PADTECH : integer := spartan6; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := spartan6; constant CFG_CLKMUL : integer := (18); constant CFG_CLKDIV : integer := (9); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 16#32# + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 1; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 1; constant CFG_NWP : integer := (0); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 1; constant CFG_ISETSZ : integer := 8; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 1; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 0 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 0; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 0 + 0 + 0; constant CFG_ETH_BUF : integer := 1; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000009#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 1; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- DDR controller constant CFG_DDR2SP : integer := 0; constant CFG_DDR2SP_INIT : integer := 0; constant CFG_DDR2SP_FREQ : integer := 100; constant CFG_DDR2SP_TRFC : integer := 130; constant CFG_DDR2SP_DATAWIDTH : integer := 64; constant CFG_DDR2SP_FTEN : integer := 0; constant CFG_DDR2SP_FTWIDTH : integer := 0; constant CFG_DDR2SP_COL : integer := 9; constant CFG_DDR2SP_SIZE : integer := 8; constant CFG_DDR2SP_DELAY0 : integer := 0; constant CFG_DDR2SP_DELAY1 : integer := 0; constant CFG_DDR2SP_DELAY2 : integer := 0; constant CFG_DDR2SP_DELAY3 : integer := 0; constant CFG_DDR2SP_DELAY4 : integer := 0; constant CFG_DDR2SP_DELAY5 : integer := 0; constant CFG_DDR2SP_DELAY6 : integer := 0; constant CFG_DDR2SP_DELAY7 : integer := 0; constant CFG_DDR2SP_NOSYNC : integer := 0; -- Xilinx MIG constant CFG_MIG_DDR2 : integer := 1; constant CFG_MIG_RANKS : integer := (1); constant CFG_MIG_COLBITS : integer := (10); constant CFG_MIG_ROWBITS : integer := (13); constant CFG_MIG_BANKBITS: integer := (2); constant CFG_MIG_HMASK : integer := 16#F00#; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 32; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (8); -- SPI memory controller constant CFG_SPIMCTRL : integer := 0; constant CFG_SPIMCTRL_SDCARD : integer := 0; constant CFG_SPIMCTRL_READCMD : integer := 16#0#; constant CFG_SPIMCTRL_DUMMYBYTE : integer := 0; constant CFG_SPIMCTRL_DUALOUTPUT : integer := 0; constant CFG_SPIMCTRL_SCALER : integer := 1; constant CFG_SPIMCTRL_ASCALER : integer := 1; constant CFG_SPIMCTRL_PWRUPCNT : integer := 0; constant CFG_SPIMCTRL_OFFSET : integer := 16#0#; -- SPI controller constant CFG_SPICTRL_ENABLE : integer := 0; constant CFG_SPICTRL_NUM : integer := 1; constant CFG_SPICTRL_SLVS : integer := 1; constant CFG_SPICTRL_FIFO : integer := 1; constant CFG_SPICTRL_SLVREG : integer := 0; constant CFG_SPICTRL_ODMODE : integer := 0; constant CFG_SPICTRL_AM : integer := 0; constant CFG_SPICTRL_ASEL : integer := 0; constant CFG_SPICTRL_TWEN : integer := 0; constant CFG_SPICTRL_MAXWLEN : integer := 0; constant CFG_SPICTRL_SYNCRAM : integer := 0; constant CFG_SPICTRL_FT : integer := 0; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
df248b82a003d9a933bbf00f9b9fb39a
0.654025
3.581827
false
false
false
false
freecores/usb_fpga_1_11
examples/usb-fpga-1.15/1.15a/memtest/fpga/memtest.vhd
5
24,307
library ieee; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; Library UNISIM; use UNISIM.vcomponents.all; entity memtest is port( FXCLK : in std_logic; RESET_IN : in std_logic; IFCLK : in std_logic; PC0 : in std_logic; -- FX2 FIFO FD : out std_logic_vector(15 downto 0); SLOE : out std_logic; SLRD : out std_logic; SLWR : out std_logic; FIFOADR0 : out std_logic; FIFOADR1 : out std_logic; PKTEND : out std_logic; FLAGB : in std_logic; -- DDR-SDRAM mcb3_dram_dq : inout std_logic_vector(15 downto 0); mcb3_rzq : inout std_logic; mcb3_zio : inout std_logic; mcb3_dram_udqs : inout std_logic; mcb3_dram_udqs_n : inout std_logic; mcb3_dram_dqs : inout std_logic; mcb3_dram_dqs_n : inout std_logic; mcb3_dram_a : out std_logic_vector(12 downto 0); mcb3_dram_ba : out std_logic_vector(2 downto 0); mcb3_dram_cke : out std_logic; mcb3_dram_ras_n : out std_logic; mcb3_dram_cas_n : out std_logic; mcb3_dram_we_n : out std_logic; -- mcb3_dram_odt : out std_logic; mcb3_dram_dm : out std_logic; mcb3_dram_udm : out std_logic; mcb3_dram_ck : out std_logic; mcb3_dram_ck_n : out std_logic ); end memtest; architecture RTL of memtest is component mem0 generic ( C3_P0_MASK_SIZE : integer := 4; C3_P0_DATA_PORT_SIZE : integer := 32; C3_P1_MASK_SIZE : integer := 4; C3_P1_DATA_PORT_SIZE : integer := 32; C3_MEMCLK_PERIOD : integer := 2500; C3_INPUT_CLK_TYPE : string := "SINGLE_ENDED"; C3_RST_ACT_LOW : integer := 0; C3_CALIB_SOFT_IP : string := "FALSE"; C3_MEM_ADDR_ORDER : string := "ROW_BANK_COLUMN"; C3_NUM_DQ_PINS : integer := 16; C3_MEM_ADDR_WIDTH : integer := 13; C3_MEM_BANKADDR_WIDTH : integer := 3 ); port ( mcb3_dram_dq : inout std_logic_vector(C3_NUM_DQ_PINS-1 downto 0); mcb3_dram_a : out std_logic_vector(C3_MEM_ADDR_WIDTH-1 downto 0); mcb3_dram_ba : out std_logic_vector(C3_MEM_BANKADDR_WIDTH-1 downto 0); mcb3_dram_cke : out std_logic; mcb3_dram_ras_n : out std_logic; mcb3_dram_cas_n : out std_logic; mcb3_dram_we_n : out std_logic; mcb3_dram_dm : out std_logic; mcb3_dram_udqs : inout std_logic; mcb3_dram_udqs_n : inout std_logic; mcb3_rzq : inout std_logic; mcb3_zio : inout std_logic; mcb3_dram_udm : out std_logic; mcb3_dram_dqs : inout std_logic; mcb3_dram_dqs_n : inout std_logic; mcb3_dram_ck : out std_logic; mcb3_dram_ck_n : out std_logic; -- mcb3_dram_odt : out std_logic; c3_sys_clk : in std_logic; c3_sys_rst_n : in std_logic; c3_calib_done : out std_logic; c3_clk0 : out std_logic; c3_rst0 : out std_logic; c3_p0_cmd_clk : in std_logic; c3_p0_cmd_en : in std_logic; c3_p0_cmd_instr : in std_logic_vector(2 downto 0); c3_p0_cmd_bl : in std_logic_vector(5 downto 0); c3_p0_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p0_cmd_empty : out std_logic; c3_p0_cmd_full : out std_logic; c3_p0_wr_clk : in std_logic; c3_p0_wr_en : in std_logic; c3_p0_wr_mask : in std_logic_vector(C3_P0_MASK_SIZE - 1 downto 0); c3_p0_wr_data : in std_logic_vector(C3_P0_DATA_PORT_SIZE - 1 downto 0); c3_p0_wr_full : out std_logic; c3_p0_wr_empty : out std_logic; c3_p0_wr_count : out std_logic_vector(6 downto 0); c3_p0_wr_underrun : out std_logic; c3_p0_wr_error : out std_logic; c3_p0_rd_clk : in std_logic; c3_p0_rd_en : in std_logic; c3_p0_rd_data : out std_logic_vector(C3_P0_DATA_PORT_SIZE - 1 downto 0); c3_p0_rd_full : out std_logic; c3_p0_rd_empty : out std_logic; c3_p0_rd_count : out std_logic_vector(6 downto 0); c3_p0_rd_overflow : out std_logic; c3_p0_rd_error : out std_logic; c3_p1_cmd_clk : in std_logic; c3_p1_cmd_en : in std_logic; c3_p1_cmd_instr : in std_logic_vector(2 downto 0); c3_p1_cmd_bl : in std_logic_vector(5 downto 0); c3_p1_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p1_cmd_empty : out std_logic; c3_p1_cmd_full : out std_logic; c3_p1_wr_clk : in std_logic; c3_p1_wr_en : in std_logic; c3_p1_wr_mask : in std_logic_vector(C3_P1_MASK_SIZE - 1 downto 0); c3_p1_wr_data : in std_logic_vector(C3_P1_DATA_PORT_SIZE - 1 downto 0); c3_p1_wr_full : out std_logic; c3_p1_wr_empty : out std_logic; c3_p1_wr_count : out std_logic_vector(6 downto 0); c3_p1_wr_underrun : out std_logic; c3_p1_wr_error : out std_logic; c3_p1_rd_clk : in std_logic; c3_p1_rd_en : in std_logic; c3_p1_rd_data : out std_logic_vector(C3_P1_DATA_PORT_SIZE - 1 downto 0); c3_p1_rd_full : out std_logic; c3_p1_rd_empty : out std_logic; c3_p1_rd_count : out std_logic_vector(6 downto 0); c3_p1_rd_overflow : out std_logic; c3_p1_rd_error : out std_logic; c3_p2_cmd_clk : in std_logic; c3_p2_cmd_en : in std_logic; c3_p2_cmd_instr : in std_logic_vector(2 downto 0); c3_p2_cmd_bl : in std_logic_vector(5 downto 0); c3_p2_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p2_cmd_empty : out std_logic; c3_p2_cmd_full : out std_logic; c3_p2_wr_clk : in std_logic; c3_p2_wr_en : in std_logic; c3_p2_wr_mask : in std_logic_vector(3 downto 0); c3_p2_wr_data : in std_logic_vector(31 downto 0); c3_p2_wr_full : out std_logic; c3_p2_wr_empty : out std_logic; c3_p2_wr_count : out std_logic_vector(6 downto 0); c3_p2_wr_underrun : out std_logic; c3_p2_wr_error : out std_logic; c3_p3_cmd_clk : in std_logic; c3_p3_cmd_en : in std_logic; c3_p3_cmd_instr : in std_logic_vector(2 downto 0); c3_p3_cmd_bl : in std_logic_vector(5 downto 0); c3_p3_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p3_cmd_empty : out std_logic; c3_p3_cmd_full : out std_logic; c3_p3_rd_clk : in std_logic; c3_p3_rd_en : in std_logic; c3_p3_rd_data : out std_logic_vector(31 downto 0); c3_p3_rd_full : out std_logic; c3_p3_rd_empty : out std_logic; c3_p3_rd_count : out std_logic_vector(6 downto 0); c3_p3_rd_overflow : out std_logic; c3_p3_rd_error : out std_logic; c3_p4_cmd_clk : in std_logic; c3_p4_cmd_en : in std_logic; c3_p4_cmd_instr : in std_logic_vector(2 downto 0); c3_p4_cmd_bl : in std_logic_vector(5 downto 0); c3_p4_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p4_cmd_empty : out std_logic; c3_p4_cmd_full : out std_logic; c3_p4_wr_clk : in std_logic; c3_p4_wr_en : in std_logic; c3_p4_wr_mask : in std_logic_vector(3 downto 0); c3_p4_wr_data : in std_logic_vector(31 downto 0); c3_p4_wr_full : out std_logic; c3_p4_wr_empty : out std_logic; c3_p4_wr_count : out std_logic_vector(6 downto 0); c3_p4_wr_underrun : out std_logic; c3_p4_wr_error : out std_logic; c3_p5_cmd_clk : in std_logic; c3_p5_cmd_en : in std_logic; c3_p5_cmd_instr : in std_logic_vector(2 downto 0); c3_p5_cmd_bl : in std_logic_vector(5 downto 0); c3_p5_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p5_cmd_empty : out std_logic; c3_p5_cmd_full : out std_logic; c3_p5_rd_clk : in std_logic; c3_p5_rd_en : in std_logic; c3_p5_rd_data : out std_logic_vector(31 downto 0); c3_p5_rd_full : out std_logic; c3_p5_rd_empty : out std_logic; c3_p5_rd_count : out std_logic_vector(6 downto 0); c3_p5_rd_overflow : out std_logic; c3_p5_rd_error : out std_logic ); end component; --attribute optimize : string; --attribute optimize of counters:entity is "off"; signal fxclk_buf : std_logic; signal CLK : std_logic; signal RESET0 : std_logic; -- released after dcm0 is ready signal RESET : std_logic; -- released after MCB is ready signal DCM0_LOCKED : std_logic; --signal DCM0_CLK_VALID : std_logic; ---------------------------- -- test pattern generator -- ---------------------------- signal GEN_CNT : std_logic_vector(29 downto 0); signal GEN_PATTERN : std_logic_vector(29 downto 0); signal FIFO_WORD : std_logic; ----------------------- -- memory controller -- ----------------------- signal MEM_CLK : std_logic; signal C3_CALIB_DONE : std_logic; signal C3_RST0 : std_logic; --------------- -- DRAM FIFO -- --------------- signal WR_CLK : std_logic; signal WR_CMD_EN : std_logic_vector(2 downto 0); type WR_CMD_ADDR_ARRAY is array(2 downto 0) of std_logic_vector(29 downto 0); signal WR_CMD_ADDR : WR_CMD_ADDR_ARRAY; signal WR_ADDR : std_logic_vector(18 downto 0); -- in 256 bytes burst blocks signal WR_EN : std_logic_vector(2 downto 0); signal WR_EN_TMP : std_logic_vector(2 downto 0); signal WR_DATA : std_logic_vector(31 downto 0); signal WR_EMPTY : std_logic_vector(2 downto 0); signal WR_UNDERRUN : std_logic_vector(2 downto 0); signal WR_ERROR : std_logic_vector(2 downto 0); type WR_COUNT_ARRAY is array(2 downto 0) of std_logic_vector(6 downto 0); signal WR_COUNT : WR_COUNT_ARRAY; signal WR_PORT : std_logic_vector(1 downto 0); signal RD_CLK : std_logic; signal RD_CMD_EN : std_logic_vector(2 downto 0); type RD_CMD_ADDR_ARRAY is array(2 downto 0) of std_logic_vector(29 downto 0); signal RD_CMD_ADDR : WR_CMD_ADDR_ARRAY; signal RD_ADDR : std_logic_vector(18 downto 0); -- in 256 bytes burst blocks signal RD_EN : std_logic_vector(2 downto 0); type RD_DATA_ARRAY is array(2 downto 0) of std_logic_vector(31 downto 0); signal RD_DATA : RD_DATA_ARRAY; signal RD_EMPTY : std_logic_vector(2 downto 0); signal RD_OVERFLOW : std_logic_vector(2 downto 0); signal RD_ERROR : std_logic_vector(2 downto 0); signal RD_PORT : std_logic_vector(1 downto 0); type RD_COUNT_ARRAY is array(2 downto 0) of std_logic_vector(6 downto 0); signal RD_COUNT : RD_COUNT_ARRAY; signal FD_TMP : std_logic_vector(15 downto 0); signal RD_ADDR2 : std_logic_vector(18 downto 0); -- 256 bytes burst block currently beeing read signal RD_ADDR2_BAK1 : std_logic_vector(18 downto 0); -- backup for synchronization signal RD_ADDR2_BAK2 : std_logic_vector(18 downto 0); -- backup for synchronization signal WR_ADDR2 : std_logic_vector(18 downto 0); -- 256 bytes burst block currently beeing written signal WR_ADDR2_BAK1 : std_logic_vector(18 downto 0); -- backup for synchronization signal WR_ADDR2_BAK2 : std_logic_vector(18 downto 0); -- backup for synchronization signal RD_STOP : std_logic; begin clkin_buf : IBUFG port map ( O => FXCLK_BUF, I => FXCLK ); dcm0 : DCM_CLKGEN generic map ( CLKFX_DIVIDE => 3, -- CLKFX_MULTIPLY => 33, CLKFX_MULTIPLY => 21, CLKFXDV_DIVIDE => 8, SPREAD_SPECTRUM => "NONE", STARTUP_WAIT => FALSE, CLKIN_PERIOD => 20.83333, CLKFX_MD_MAX => 0.000 ) port map ( CLKIN => FXCLK_BUF, CLKFX => MEM_CLK, CLKFX180 => open, CLKFXDV => CLK, LOCKED => DCM0_LOCKED, PROGDONE => open, STATUS => open, FREEZEDCM => '0', PROGCLK => '0', PROGDATA => '0', PROGEN => '0', RST => '0' ); inst_mem0 : mem0 port map ( mcb3_dram_dq => mcb3_dram_dq, mcb3_dram_a => mcb3_dram_a, mcb3_dram_ba => mcb3_dram_ba, mcb3_dram_ras_n => mcb3_dram_ras_n, mcb3_dram_cas_n => mcb3_dram_cas_n, mcb3_dram_we_n => mcb3_dram_we_n, -- mcb3_dram_odt => mcb3_dram_odt, mcb3_dram_cke => mcb3_dram_cke, mcb3_dram_ck => mcb3_dram_ck, mcb3_dram_ck_n => mcb3_dram_ck_n, mcb3_dram_dqs => mcb3_dram_dqs, mcb3_dram_dqs_n => mcb3_dram_dqs_n, mcb3_dram_udqs => mcb3_dram_udqs, -- for X16 parts mcb3_dram_udqs_n=> mcb3_dram_udqs_n, -- for X16 parts mcb3_dram_udm => mcb3_dram_udm, -- for X16 parts mcb3_dram_dm => mcb3_dram_dm, mcb3_rzq => mcb3_rzq, mcb3_zio => mcb3_zio, c3_sys_clk => MEM_CLK, c3_sys_rst_n => RESET0, c3_clk0 => open, c3_rst0 => C3_RST0, c3_calib_done => C3_CALIB_DONE, c3_p0_cmd_clk => WR_CLK, c3_p0_cmd_en => WR_CMD_EN(0), c3_p0_cmd_instr => "000", c3_p0_cmd_bl => ( others => '1' ), c3_p0_cmd_byte_addr => WR_CMD_ADDR(0), c3_p0_cmd_empty => open, c3_p0_cmd_full => open, c3_p0_wr_clk => WR_CLK, c3_p0_wr_en => WR_EN(0), c3_p0_wr_mask => ( others => '0' ), c3_p0_wr_data => WR_DATA, c3_p0_wr_full => open, c3_p0_wr_empty => WR_EMPTY(0), c3_p0_wr_count => open, c3_p0_wr_underrun => WR_UNDERRUN(0), c3_p0_wr_error => WR_ERROR(0), c3_p0_rd_clk => WR_CLK, c3_p0_rd_en => '0', c3_p0_rd_data => open, c3_p0_rd_full => open, c3_p0_rd_empty => open, c3_p0_rd_count => open, c3_p0_rd_overflow => open, c3_p0_rd_error => open, c3_p2_cmd_clk => WR_CLK, c3_p2_cmd_en => WR_CMD_EN(1), c3_p2_cmd_instr => "000", c3_p2_cmd_bl => ( others => '1' ), c3_p2_cmd_byte_addr => WR_CMD_ADDR(1), c3_p2_cmd_empty => open, c3_p2_cmd_full => open, c3_p2_wr_clk => WR_CLK, c3_p2_wr_en => WR_EN(1), c3_p2_wr_mask => ( others => '0' ), c3_p2_wr_data => WR_DATA, c3_p2_wr_full => open, c3_p2_wr_empty => WR_EMPTY(1), c3_p2_wr_count => open, c3_p2_wr_underrun => WR_UNDERRUN(1), c3_p2_wr_error => WR_ERROR(1), c3_p4_cmd_clk => WR_CLK, c3_p4_cmd_en => WR_CMD_EN(2), c3_p4_cmd_instr => "000", c3_p4_cmd_bl => ( others => '1' ), c3_p4_cmd_byte_addr => WR_CMD_ADDR(2), c3_p4_cmd_empty => open, c3_p4_cmd_full => open, c3_p4_wr_clk => WR_CLK, c3_p4_wr_en => WR_EN(2), c3_p4_wr_mask => ( others => '0' ), c3_p4_wr_data => WR_DATA, c3_p4_wr_full => open, c3_p4_wr_empty => WR_EMPTY(2), c3_p4_wr_count => open, c3_p4_wr_underrun => WR_UNDERRUN(2), c3_p4_wr_error => WR_ERROR(2), c3_p1_cmd_clk => RD_CLK, c3_p1_cmd_en => RD_CMD_EN(0), c3_p1_cmd_instr => "001", c3_p1_cmd_bl => ( others => '1' ), c3_p1_cmd_byte_addr => RD_CMD_ADDR(0), c3_p1_cmd_empty => open, c3_p1_cmd_full => open, c3_p1_wr_clk => RD_CLK, c3_p1_wr_en => '0', c3_p1_wr_mask => ( others => '0' ), c3_p1_wr_data => ( others => '0' ), c3_p1_wr_full => open, c3_p1_wr_empty => open, c3_p1_wr_count => open, c3_p1_wr_underrun => open, c3_p1_wr_error => open, c3_p1_rd_clk => RD_CLK, c3_p1_rd_en => RD_EN(0), c3_p1_rd_data => RD_DATA(0), c3_p1_rd_full => open, c3_p1_rd_empty => RD_EMPTY(0), c3_p1_rd_count => open, c3_p1_rd_overflow => RD_OVERFLOW(0), c3_p1_rd_error => RD_ERROR(0), c3_p3_cmd_clk => RD_CLK, c3_p3_cmd_en => RD_CMD_EN(1), c3_p3_cmd_instr => "001", c3_p3_cmd_bl => ( others => '1' ), c3_p3_cmd_byte_addr => RD_CMD_ADDR(1), c3_p3_cmd_empty => open, c3_p3_cmd_full => open, c3_p3_rd_clk => RD_CLK, c3_p3_rd_en => RD_EN(1), c3_p3_rd_data => RD_DATA(1), c3_p3_rd_full => open, c3_p3_rd_empty => RD_EMPTY(1), c3_p3_rd_count => open, c3_p3_rd_overflow => RD_OVERFLOW(1), c3_p3_rd_error => RD_ERROR(1), c3_p5_cmd_clk => RD_CLK, c3_p5_cmd_en => RD_CMD_EN(2), c3_p5_cmd_instr => "001", c3_p5_cmd_bl => ( others => '1' ), c3_p5_cmd_byte_addr => RD_CMD_ADDR(2), c3_p5_cmd_empty => open, c3_p5_cmd_full => open, c3_p5_rd_clk => RD_CLK, c3_p5_rd_en => RD_EN(2), c3_p5_rd_data => RD_DATA(2), c3_p5_rd_full => open, c3_p5_rd_empty => RD_EMPTY(2), c3_p5_rd_count => open, c3_p5_rd_overflow => RD_OVERFLOW(2), c3_p5_rd_error => RD_ERROR(2) ); SLOE <= '1'; SLRD <= '1'; FIFOADR0 <= '0'; FIFOADR1 <= '0'; PKTEND <= '1'; WR_CLK <= CLK; RD_CLK <= IFCLK; -- DCM0_CLK_VALID <= ( DCM0_LOCKED and ( not status_internal(2) ) ); -- RESET0 <= RESET_IN or (not DCM0_LOCKED) or (not DCM0_CLK_VALID); RESET0 <= RESET_IN or (not DCM0_LOCKED); RESET <= RESET0 or (not C3_CALIB_DONE) or C3_RST0; dpCLK: process (CLK, RESET) begin -- reset if RESET = '1' then GEN_CNT <= ( others => '0' ); GEN_PATTERN <= "100101010101010101010101010101"; WR_CMD_EN <= ( others => '0' ); WR_CMD_ADDR(0) <= ( others => '0' ); WR_CMD_ADDR(1) <= ( others => '0' ); WR_CMD_ADDR(2) <= ( others => '0' ); WR_ADDR <= conv_std_logic_vector(3,19); WR_EN <= ( others => '0' ); WR_COUNT(0) <= ( others => '0' ); WR_COUNT(1) <= ( others => '0' ); WR_COUNT(2) <= ( others => '0' ); WR_PORT <= ( others => '0' ); WR_ADDR2 <= ( others => '0' ); RD_ADDR2_BAK1 <= ( others => '0' ); RD_ADDR2_BAK2 <= ( others => '0' ); -- CLK elsif CLK'event and CLK = '1' then WR_CMD_EN <= ( others => '0' ); WR_EN <= ( others => '0' ); WR_CMD_ADDR(conv_integer(WR_PORT))(26 downto 8) <= WR_ADDR; if ( WR_COUNT(conv_integer(WR_PORT)) = conv_std_logic_vector(64,7) ) then -- FF flag = 1 if ( RD_ADDR2_BAK1 = RD_ADDR2_BAK2 ) and ( RD_ADDR2_BAK2 /= WR_ADDR ) then WR_CMD_EN(conv_integer(WR_PORT)) <= '1'; WR_COUNT(conv_integer(WR_PORT)) <= ( others => '0' ); if WR_PORT = "10" then WR_PORT <= "00"; else WR_PORT <= WR_PORT + 1; end if; WR_ADDR <= WR_ADDR + 1; WR_ADDR2 <= WR_ADDR2 + 1; end if; elsif ( WR_COUNT(conv_integer(WR_PORT)) = conv_std_logic_vector(0,7)) and (WR_EMPTY(conv_integer(WR_PORT)) = '0' ) -- write port fifo not empty then -- FF flag = 1 else WR_EN(conv_integer(WR_PORT)) <= '1'; WR_DATA(31) <= '1'; WR_DATA(15) <= '0'; if PC0 = '1' then WR_DATA(30 downto 16) <= GEN_PATTERN(29 downto 15); WR_DATA(14 downto 0) <= GEN_PATTERN(14 downto 0); else WR_DATA(30 downto 16) <= GEN_CNT(29 downto 15); WR_DATA(14 downto 0) <= GEN_CNT(14 downto 0); end if; GEN_CNT <= GEN_CNT + 1; GEN_PATTERN(29) <= GEN_PATTERN(0); GEN_PATTERN(28 downto 0) <= GEN_PATTERN(29 downto 1); -- if ( WR_COUNT(conv_integer(WR_PORT)) = conv_std_logic_vector(63,7) ) and ( RD_ADDR2_BAK1 = RD_ADDR2_BAK2 ) and ( RD_ADDR2_BAK2 /= WR_ADDR ) -- Add code from above here. This saves one clock cylcle and is required for uninterrupred input. -- then -- else WR_COUNT(conv_integer(WR_PORT)) <= WR_COUNT(conv_integer(WR_PORT)) + 1; -- end if; end if; RD_ADDR2_BAK1 <= RD_ADDR2; RD_ADDR2_BAK2 <= RD_ADDR2_BAK1; end if; end process dpCLK; dpIFCLK: process (IFCLK, RESET) begin -- reset if RESET = '1' then FIFO_WORD <= '0'; SLWR <= '1'; RD_CMD_EN <= ( others => '0' ); RD_CMD_ADDR(0) <= ( others => '0' ); RD_CMD_ADDR(1) <= ( others => '0' ); RD_CMD_ADDR(2) <= ( others => '0' ); RD_ADDR <= conv_std_logic_vector(3,19); RD_EN <= ( others => '0' ); RD_COUNT(0) <= conv_std_logic_vector(64,7); RD_COUNT(1) <= conv_std_logic_vector(64,7); RD_COUNT(2) <= conv_std_logic_vector(64,7); RD_PORT <= ( others => '0' ); RD_ADDR2 <= ( others => '0' ); WR_ADDR2_BAK1 <= ( others => '0' ); WR_ADDR2_BAK2 <= ( others => '0' ); RD_STOP <= '1'; -- IFCLK elsif IFCLK'event and IFCLK = '1' then RD_CMD_EN <= ( others => '0' ); RD_CMD_ADDR(conv_integer(RD_PORT))(26 downto 8) <= RD_ADDR; RD_EN(conv_integer(RD_PORT)) <= '0'; if FLAGB = '1' then if ( RD_EMPTY(conv_integer(RD_PORT)) = '1' ) or ( RD_COUNT(conv_integer(RD_PORT)) = conv_std_logic_vector(64,7) ) then SLWR <= '1'; if ( RD_COUNT(conv_integer(RD_PORT)) = conv_std_logic_vector(64,7) ) and ( RD_EMPTY(conv_integer(RD_PORT)) = '1' ) and ( WR_ADDR2_BAK2 = WR_ADDR2_BAK1 ) and ( WR_ADDR2_BAK2 /= RD_ADDR ) and ( RD_STOP = '0' ) then RD_CMD_EN(conv_integer(RD_PORT)) <= '1'; RD_COUNT(conv_integer(RD_PORT)) <= ( others => '0' ); if RD_PORT = "10" then RD_PORT <= "00"; else RD_PORT <= RD_PORT + 1; end if; RD_ADDR <= RD_ADDR + 1; RD_ADDR2 <= RD_ADDR2 + 1; end if; else SLWR <= '0'; if FIFO_WORD = '0' then FD(15 downto 0) <= RD_DATA(conv_integer(RD_PORT))(15 downto 0); FD_TMP <= RD_DATA(conv_integer(RD_PORT))(31 downto 16); RD_EN(conv_integer(RD_PORT)) <= '1'; else FD(15 downto 0) <= FD_TMP; RD_COUNT(conv_integer(RD_PORT)) <= RD_COUNT(conv_integer(RD_PORT)) + 1; end if; FIFO_WORD <= not FIFO_WORD; end if; end if; WR_ADDR2_BAK1 <= WR_ADDR2; WR_ADDR2_BAK2 <= WR_ADDR2_BAK1; if ( WR_ADDR2_BAK1 = WR_ADDR2_BAK2 ) and ( WR_ADDR2_BAK2(3) = '1') then RD_STOP <= '0'; end if; end if; end process dpIFCLK; end RTL;
gpl-3.0
8abfa4dca2a052296032284a6f24eb97
0.492327
2.795193
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/leon3v3/iu3.vhd
1
131,748
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: iu3 -- File: iu3.vhd -- Author: Jiri Gaisler, Edvin Catovic, Gaisler Research -- Description: LEON3 7-stage integer pipline ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.config_types.all; use grlib.config.all; use grlib.sparc.all; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.leon3.all; use gaisler.libiu.all; use gaisler.libfpu.all; use gaisler.arith.all; -- pragma translate_off use grlib.sparc_disas.all; -- pragma translate_on entity iu3 is generic ( nwin : integer range 2 to 32 := 8; isets : integer range 1 to 4 := 1; dsets : integer range 1 to 4 := 1; fpu : integer range 0 to 15 := 0; v8 : integer range 0 to 63 := 0; cp, mac : integer range 0 to 1 := 0; dsu : integer range 0 to 1 := 0; nwp : integer range 0 to 4 := 0; pclow : integer range 0 to 2 := 2; notag : integer range 0 to 1 := 0; index : integer range 0 to 15:= 0; lddel : integer range 1 to 2 := 2; irfwt : integer range 0 to 1 := 0; disas : integer range 0 to 2 := 0; tbuf : integer range 0 to 64 := 0; -- trace buf size in kB (0 - no trace buffer) pwd : integer range 0 to 2 := 0; -- power-down svt : integer range 0 to 1 := 0; -- single-vector trapping rstaddr : integer := 16#00000#; -- reset vector MSB address smp : integer range 0 to 15 := 0; -- support SMP systems fabtech : integer range 0 to NTECH := 0; clk2x : integer := 0; bp : integer range 0 to 2 := 1 ); port ( clk : in std_ulogic; rstn : in std_ulogic; holdn : in std_ulogic; ici : out icache_in_type; ico : in icache_out_type; dci : out dcache_in_type; dco : in dcache_out_type; rfi : out iregfile_in_type; rfo : in iregfile_out_type; irqi : in l3_irq_in_type; irqo : out l3_irq_out_type; dbgi : in l3_debug_in_type; dbgo : out l3_debug_out_type; muli : out mul32_in_type; mulo : in mul32_out_type; divi : out div32_in_type; divo : in div32_out_type; fpo : in fpc_out_type; fpi : out fpc_in_type; cpo : in fpc_out_type; cpi : out fpc_in_type; tbo : in tracebuf_out_type; tbi : out tracebuf_in_type; sclk : in std_ulogic ); attribute sync_set_reset of rstn : signal is "true"; end; architecture rtl of iu3 is constant ISETMSB : integer := log2x(isets)-1; constant DSETMSB : integer := log2x(dsets)-1; constant RFBITS : integer range 6 to 10 := log2(NWIN+1) + 4; constant NWINLOG2 : integer range 1 to 5 := log2(NWIN); constant CWPOPT : boolean := (NWIN = (2**NWINLOG2)); constant CWPMIN : std_logic_vector(NWINLOG2-1 downto 0) := (others => '0'); constant CWPMAX : std_logic_vector(NWINLOG2-1 downto 0) := conv_std_logic_vector(NWIN-1, NWINLOG2); constant FPEN : boolean := (fpu /= 0); constant CPEN : boolean := (cp = 1); constant MULEN : boolean := (v8 /= 0); constant MULTYPE: integer := (v8 / 16); constant DIVEN : boolean := (v8 /= 0); constant MACEN : boolean := (mac = 1); constant MACPIPE: boolean := (mac = 1) and (v8/2 = 1); constant IMPL : integer := 15; constant VER : integer := 3; constant DBGUNIT : boolean := (dsu = 1); constant TRACEBUF : boolean := (tbuf /= 0); constant TBUFBITS : integer := 10 + log2(tbuf) - 4; constant PWRD1 : boolean := false; --(pwd = 1) and not (index /= 0); constant PWRD2 : boolean := (pwd /= 0); --(pwd = 2) or (index /= 0); constant RS1OPT : boolean := (is_fpga(FABTECH) /= 0); constant DYNRST : boolean := (rstaddr = 16#FFFFF#); constant CASAEN : boolean := (notag = 0) and (lddel = 1); signal BPRED : std_logic; subtype word is std_logic_vector(31 downto 0); subtype pctype is std_logic_vector(31 downto PCLOW); subtype rfatype is std_logic_vector(RFBITS-1 downto 0); subtype cwptype is std_logic_vector(NWINLOG2-1 downto 0); type icdtype is array (0 to isets-1) of word; type dcdtype is array (0 to dsets-1) of word; type dc_in_type is record signed, enaddr, read, write, lock, dsuen : std_ulogic; size : std_logic_vector(1 downto 0); asi : std_logic_vector(7 downto 0); end record; type pipeline_ctrl_type is record pc : pctype; inst : word; cnt : std_logic_vector(1 downto 0); rd : rfatype; tt : std_logic_vector(5 downto 0); trap : std_ulogic; annul : std_ulogic; wreg : std_ulogic; wicc : std_ulogic; wy : std_ulogic; ld : std_ulogic; pv : std_ulogic; rett : std_ulogic; end record; type fetch_reg_type is record pc : pctype; branch : std_ulogic; end record; type decode_reg_type is record pc : pctype; inst : icdtype; cwp : cwptype; set : std_logic_vector(ISETMSB downto 0); mexc : std_ulogic; cnt : std_logic_vector(1 downto 0); pv : std_ulogic; annul : std_ulogic; inull : std_ulogic; step : std_ulogic; divrdy: std_ulogic; end record; type regacc_reg_type is record ctrl : pipeline_ctrl_type; rs1 : std_logic_vector(4 downto 0); rfa1, rfa2 : rfatype; rsel1, rsel2 : std_logic_vector(2 downto 0); rfe1, rfe2 : std_ulogic; cwp : cwptype; imm : word; ldcheck1 : std_ulogic; ldcheck2 : std_ulogic; ldchkra : std_ulogic; ldchkex : std_ulogic; su : std_ulogic; et : std_ulogic; wovf : std_ulogic; wunf : std_ulogic; ticc : std_ulogic; jmpl : std_ulogic; step : std_ulogic; mulstart : std_ulogic; divstart : std_ulogic; bp, nobp : std_ulogic; end record; type execute_reg_type is record ctrl : pipeline_ctrl_type; op1 : word; op2 : word; aluop : std_logic_vector(2 downto 0); -- Alu operation alusel : std_logic_vector(1 downto 0); -- Alu result select aluadd : std_ulogic; alucin : std_ulogic; ldbp1, ldbp2 : std_ulogic; invop2 : std_ulogic; shcnt : std_logic_vector(4 downto 0); -- shift count sari : std_ulogic; -- shift msb shleft : std_ulogic; -- shift left/right ymsb : std_ulogic; -- shift left/right rd : std_logic_vector(4 downto 0); jmpl : std_ulogic; su : std_ulogic; et : std_ulogic; cwp : cwptype; icc : std_logic_vector(3 downto 0); mulstep: std_ulogic; mul : std_ulogic; mac : std_ulogic; bp : std_ulogic; rfe1, rfe2 : std_ulogic; end record; type memory_reg_type is record ctrl : pipeline_ctrl_type; result : word; y : word; icc : std_logic_vector(3 downto 0); nalign : std_ulogic; dci : dc_in_type; werr : std_ulogic; wcwp : std_ulogic; irqen : std_ulogic; irqen2 : std_ulogic; mac : std_ulogic; divz : std_ulogic; su : std_ulogic; mul : std_ulogic; casa : std_ulogic; casaz : std_ulogic; end record; type exception_state is (run, trap, dsu1, dsu2); type exception_reg_type is record ctrl : pipeline_ctrl_type; result : word; y : word; icc : std_logic_vector( 3 downto 0); annul_all : std_ulogic; data : dcdtype; set : std_logic_vector(DSETMSB downto 0); mexc : std_ulogic; dci : dc_in_type; laddr : std_logic_vector(1 downto 0); rstate : exception_state; npc : std_logic_vector(2 downto 0); intack : std_ulogic; ipend : std_ulogic; mac : std_ulogic; debug : std_ulogic; nerror : std_ulogic; ipmask : std_ulogic; end record; type dsu_registers is record tt : std_logic_vector(7 downto 0); err : std_ulogic; tbufcnt : std_logic_vector(TBUFBITS-1 downto 0); asi : std_logic_vector(7 downto 0); crdy : std_logic_vector(2 downto 1); -- diag cache access ready end record; type irestart_register is record addr : pctype; pwd : std_ulogic; end record; type pwd_register_type is record pwd : std_ulogic; error : std_ulogic; end record; type special_register_type is record cwp : cwptype; -- current window pointer icc : std_logic_vector(3 downto 0); -- integer condition codes tt : std_logic_vector(7 downto 0); -- trap type tba : std_logic_vector(19 downto 0); -- trap base address wim : std_logic_vector(NWIN-1 downto 0); -- window invalid mask pil : std_logic_vector(3 downto 0); -- processor interrupt level ec : std_ulogic; -- enable CP ef : std_ulogic; -- enable FP ps : std_ulogic; -- previous supervisor flag s : std_ulogic; -- supervisor flag et : std_ulogic; -- enable traps y : word; asr18 : word; svt : std_ulogic; -- enable traps dwt : std_ulogic; -- disable write error trap dbp : std_ulogic; -- disable branch prediction end record; type write_reg_type is record s : special_register_type; result : word; wa : rfatype; wreg : std_ulogic; except : std_ulogic; end record; type registers is record f : fetch_reg_type; d : decode_reg_type; a : regacc_reg_type; e : execute_reg_type; m : memory_reg_type; x : exception_reg_type; w : write_reg_type; end record; type exception_type is record pri : std_ulogic; ill : std_ulogic; fpdis : std_ulogic; cpdis : std_ulogic; wovf : std_ulogic; wunf : std_ulogic; ticc : std_ulogic; end record; type watchpoint_register is record addr : std_logic_vector(31 downto 2); -- watchpoint address mask : std_logic_vector(31 downto 2); -- watchpoint mask exec : std_ulogic; -- trap on instruction load : std_ulogic; -- trap on load store : std_ulogic; -- trap on store end record; type watchpoint_registers is array (0 to 3) of watchpoint_register; function dbgexc(r : registers; dbgi : l3_debug_in_type; trap : std_ulogic; tt : std_logic_vector(7 downto 0)) return std_ulogic is variable dmode : std_ulogic; begin dmode := '0'; if (not r.x.ctrl.annul and trap) = '1' then if (((tt = "00" & TT_WATCH) and (dbgi.bwatch = '1')) or ((dbgi.bsoft = '1') and (tt = "10000001")) or (dbgi.btrapa = '1') or ((dbgi.btrape = '1') and not ((tt(5 downto 0) = TT_PRIV) or (tt(5 downto 0) = TT_FPDIS) or (tt(5 downto 0) = TT_WINOF) or (tt(5 downto 0) = TT_WINUF) or (tt(5 downto 4) = "01") or (tt(7) = '1'))) or (((not r.w.s.et) and dbgi.berror) = '1')) then dmode := '1'; end if; end if; return(dmode); end; function dbgerr(r : registers; dbgi : l3_debug_in_type; tt : std_logic_vector(7 downto 0)) return std_ulogic is variable err : std_ulogic; begin err := not r.w.s.et; if (((dbgi.dbreak = '1') and (tt = ("00" & TT_WATCH))) or ((dbgi.bsoft = '1') and (tt = ("10000001")))) then err := '0'; end if; return(err); end; procedure diagwr(r : in registers; dsur : in dsu_registers; ir : in irestart_register; dbg : in l3_debug_in_type; wpr : in watchpoint_registers; s : out special_register_type; vwpr : out watchpoint_registers; asi : out std_logic_vector(7 downto 0); pc, npc : out pctype; tbufcnt : out std_logic_vector(TBUFBITS-1 downto 0); wr : out std_ulogic; addr : out std_logic_vector(9 downto 0); data : out word; fpcwr : out std_ulogic) is variable i : integer range 0 to 3; begin s := r.w.s; pc := r.f.pc; npc := ir.addr; wr := '0'; vwpr := wpr; asi := dsur.asi; addr := (others => '0'); data := dbg.ddata; tbufcnt := dsur.tbufcnt; fpcwr := '0'; if (dbg.dsuen and dbg.denable and dbg.dwrite) = '1' then case dbg.daddr(23 downto 20) is when "0001" => if (dbg.daddr(16) = '1') and TRACEBUF then -- trace buffer control reg tbufcnt := dbg.ddata(TBUFBITS-1 downto 0); end if; when "0011" => -- IU reg file if dbg.daddr(12) = '0' then wr := '1'; addr := (others => '0'); addr(RFBITS-1 downto 0) := dbg.daddr(RFBITS+1 downto 2); else -- FPC fpcwr := '1'; end if; when "0100" => -- IU special registers case dbg.daddr(7 downto 6) is when "00" => -- IU regs Y - TBUF ctrl reg case dbg.daddr(5 downto 2) is when "0000" => -- Y s.y := dbg.ddata; when "0001" => -- PSR s.cwp := dbg.ddata(NWINLOG2-1 downto 0); s.icc := dbg.ddata(23 downto 20); s.ec := dbg.ddata(13); if FPEN then s.ef := dbg.ddata(12); end if; s.pil := dbg.ddata(11 downto 8); s.s := dbg.ddata(7); s.ps := dbg.ddata(6); s.et := dbg.ddata(5); when "0010" => -- WIM s.wim := dbg.ddata(NWIN-1 downto 0); when "0011" => -- TBR s.tba := dbg.ddata(31 downto 12); s.tt := dbg.ddata(11 downto 4); when "0100" => -- PC pc := dbg.ddata(31 downto PCLOW); when "0101" => -- NPC npc := dbg.ddata(31 downto PCLOW); when "0110" => --FSR fpcwr := '1'; when "0111" => --CFSR when "1001" => -- ASI reg asi := dbg.ddata(7 downto 0); when others => end case; when "01" => -- ASR16 - ASR31 case dbg.daddr(5 downto 2) is when "0001" => -- %ASR17 if bp = 2 then s.dbp := dbg.ddata(27); end if; s.dwt := dbg.ddata(14); s.svt := dbg.ddata(13); when "0010" => -- %ASR18 if MACEN then s.asr18 := dbg.ddata; end if; when "1000" => -- %ASR24 - %ASR31 vwpr(0).addr := dbg.ddata(31 downto 2); vwpr(0).exec := dbg.ddata(0); when "1001" => vwpr(0).mask := dbg.ddata(31 downto 2); vwpr(0).load := dbg.ddata(1); vwpr(0).store := dbg.ddata(0); when "1010" => vwpr(1).addr := dbg.ddata(31 downto 2); vwpr(1).exec := dbg.ddata(0); when "1011" => vwpr(1).mask := dbg.ddata(31 downto 2); vwpr(1).load := dbg.ddata(1); vwpr(1).store := dbg.ddata(0); when "1100" => vwpr(2).addr := dbg.ddata(31 downto 2); vwpr(2).exec := dbg.ddata(0); when "1101" => vwpr(2).mask := dbg.ddata(31 downto 2); vwpr(2).load := dbg.ddata(1); vwpr(2).store := dbg.ddata(0); when "1110" => vwpr(3).addr := dbg.ddata(31 downto 2); vwpr(3).exec := dbg.ddata(0); when "1111" => -- vwpr(3).mask := dbg.ddata(31 downto 2); vwpr(3).load := dbg.ddata(1); vwpr(3).store := dbg.ddata(0); when others => -- end case; -- disabled due to bug in XST -- i := conv_integer(dbg.daddr(4 downto 3)); -- if dbg.daddr(2) = '0' then -- vwpr(i).addr := dbg.ddata(31 downto 2); -- vwpr(i).exec := dbg.ddata(0); -- else -- vwpr(i).mask := dbg.ddata(31 downto 2); -- vwpr(i).load := dbg.ddata(1); -- vwpr(i).store := dbg.ddata(0); -- end if; when others => end case; when others => end case; end if; end; function asr17_gen ( r : in registers) return word is variable asr17 : word; variable fpu2 : integer range 0 to 3; begin asr17 := zero32; asr17(31 downto 28) := conv_std_logic_vector(index, 4); if bp = 2 then asr17(27) := r.w.s.dbp; end if; if notag = 0 then asr17(26) := '1'; end if; -- CASA and tagged arith if (clk2x > 8) then asr17(16 downto 15) := conv_std_logic_vector(clk2x-8, 2); asr17(17) := '1'; elsif (clk2x > 0) then asr17(16 downto 15) := conv_std_logic_vector(clk2x, 2); end if; asr17(14) := r.w.s.dwt; if svt = 1 then asr17(13) := r.w.s.svt; end if; if lddel = 2 then asr17(12) := '1'; end if; if (fpu > 0) and (fpu < 8) then fpu2 := 1; elsif (fpu >= 8) and (fpu < 15) then fpu2 := 3; elsif fpu = 15 then fpu2 := 2; else fpu2 := 0; end if; asr17(11 downto 10) := conv_std_logic_vector(fpu2, 2); if mac = 1 then asr17(9) := '1'; end if; if v8 /= 0 then asr17(8) := '1'; end if; asr17(7 downto 5) := conv_std_logic_vector(nwp, 3); asr17(4 downto 0) := conv_std_logic_vector(nwin-1, 5); return(asr17); end; procedure diagread(dbgi : in l3_debug_in_type; r : in registers; dsur : in dsu_registers; ir : in irestart_register; wpr : in watchpoint_registers; dco : in dcache_out_type; tbufo : in tracebuf_out_type; data : out word) is variable cwp : std_logic_vector(4 downto 0); variable rd : std_logic_vector(4 downto 0); variable i : integer range 0 to 3; begin data := (others => '0'); cwp := (others => '0'); cwp(NWINLOG2-1 downto 0) := r.w.s.cwp; case dbgi.daddr(22 downto 20) is when "001" => -- trace buffer if TRACEBUF then if dbgi.daddr(16) = '1' then -- trace buffer control reg data(TBUFBITS-1 downto 0) := dsur.tbufcnt; else case dbgi.daddr(3 downto 2) is when "00" => data := tbufo.data(127 downto 96); when "01" => data := tbufo.data(95 downto 64); when "10" => data := tbufo.data(63 downto 32); when others => data := tbufo.data(31 downto 0); end case; end if; end if; when "011" => -- IU reg file if dbgi.daddr(12) = '0' then if dbgi.daddr(11) = '0' then data := rfo.data1(31 downto 0); else data := rfo.data2(31 downto 0); end if; else data := fpo.dbg.data; end if; when "100" => -- IU regs case dbgi.daddr(7 downto 6) is when "00" => -- IU regs Y - TBUF ctrl reg case dbgi.daddr(5 downto 2) is when "0000" => data := r.w.s.y; when "0001" => data := conv_std_logic_vector(IMPL, 4) & conv_std_logic_vector(VER, 4) & r.w.s.icc & "000000" & r.w.s.ec & r.w.s.ef & r.w.s.pil & r.w.s.s & r.w.s.ps & r.w.s.et & cwp; when "0010" => data(NWIN-1 downto 0) := r.w.s.wim; when "0011" => data := r.w.s.tba & r.w.s.tt & "0000"; when "0100" => data(31 downto PCLOW) := r.f.pc; when "0101" => data(31 downto PCLOW) := ir.addr; when "0110" => -- FSR data := fpo.dbg.data; when "0111" => -- CPSR when "1000" => -- TT reg data(12 downto 4) := dsur.err & dsur.tt; when "1001" => -- ASI reg data(7 downto 0) := dsur.asi; when others => end case; when "01" => if dbgi.daddr(5) = '0' then if dbgi.daddr(4 downto 2) = "001" then -- %ASR17 data := asr17_gen(r); elsif MACEN and dbgi.daddr(4 downto 2) = "010" then -- %ASR18 data := r.w.s.asr18; end if; else -- %ASR24 - %ASR31 i := conv_integer(dbgi.daddr(4 downto 3)); -- if dbgi.daddr(2) = '0' then data(31 downto 2) := wpr(i).addr; data(0) := wpr(i).exec; else data(31 downto 2) := wpr(i).mask; data(1) := wpr(i).load; data(0) := wpr(i).store; end if; end if; when others => end case; when "111" => data := r.x.data(conv_integer(r.x.set)); when others => end case; end; procedure itrace(r : in registers; dsur : in dsu_registers; vdsu : in dsu_registers; res : in word; exc : in std_ulogic; dbgi : in l3_debug_in_type; error : in std_ulogic; trap : in std_ulogic; tbufcnt : out std_logic_vector(TBUFBITS-1 downto 0); di : out tracebuf_in_type; ierr : in std_ulogic; derr : in std_ulogic ) is variable meminst : std_ulogic; begin di.addr := (others => '0'); di.data := (others => '0'); di.enable := '0'; di.write := (others => '0'); tbufcnt := vdsu.tbufcnt; meminst := r.x.ctrl.inst(31) and r.x.ctrl.inst(30); if TRACEBUF then di.addr(TBUFBITS-1 downto 0) := dsur.tbufcnt; di.data(127) := '0'; di.data(126) := not r.x.ctrl.pv; di.data(125 downto 96) := dbgi.timer(29 downto 0); di.data(95 downto 64) := res; di.data(63 downto 34) := r.x.ctrl.pc(31 downto 2); di.data(33) := trap; di.data(32) := error; di.data(31 downto 0) := r.x.ctrl.inst; if (dbgi.tenable = '0') or (r.x.rstate = dsu2) then if ((dbgi.dsuen and dbgi.denable) = '1') and (dbgi.daddr(23 downto 20) & dbgi.daddr(16) = "00010") then di.enable := '1'; di.addr(TBUFBITS-1 downto 0) := dbgi.daddr(TBUFBITS-1+4 downto 4); if dbgi.dwrite = '1' then case dbgi.daddr(3 downto 2) is when "00" => di.write(3) := '1'; when "01" => di.write(2) := '1'; when "10" => di.write(1) := '1'; when others => di.write(0) := '1'; end case; di.data := dbgi.ddata & dbgi.ddata & dbgi.ddata & dbgi.ddata; end if; end if; elsif (not r.x.ctrl.annul and (r.x.ctrl.pv or meminst) and not r.x.debug) = '1' then di.enable := '1'; di.write := (others => '1'); tbufcnt := dsur.tbufcnt + 1; end if; di.diag := dco.testen & dco.scanen & "00"; if dco.scanen = '1' then di.enable := '0'; end if; end if; end; procedure dbg_cache(holdn : in std_ulogic; dbgi : in l3_debug_in_type; r : in registers; dsur : in dsu_registers; mresult : in word; dci : in dc_in_type; mresult2 : out word; dci2 : out dc_in_type ) is begin mresult2 := mresult; dci2 := dci; dci2.dsuen := '0'; if DBGUNIT then if (r.x.rstate = dsu2) then dci2.asi := dsur.asi; if (dbgi.daddr(22 downto 20) = "111") and (dbgi.dsuen = '1') then dci2.dsuen := (dbgi.denable or r.m.dci.dsuen) and not dsur.crdy(2); dci2.enaddr := dbgi.denable; dci2.size := "10"; dci2.read := '1'; dci2.write := '0'; if (dbgi.denable and not r.m.dci.enaddr) = '1' then mresult2 := (others => '0'); mresult2(19 downto 2) := dbgi.daddr(19 downto 2); else mresult2 := dbgi.ddata; end if; if dbgi.dwrite = '1' then dci2.read := '0'; dci2.write := '1'; end if; end if; end if; end if; end; procedure fpexack(r : in registers; fpexc : out std_ulogic) is begin fpexc := '0'; if FPEN then if r.x.ctrl.tt = TT_FPEXC then fpexc := '1'; end if; end if; end; procedure diagrdy(denable : in std_ulogic; dsur : in dsu_registers; dci : in dc_in_type; mds : in std_ulogic; ico : in icache_out_type; crdy : out std_logic_vector(2 downto 1)) is begin crdy := dsur.crdy(1) & '0'; if dci.dsuen = '1' then case dsur.asi(4 downto 0) is when ASI_ITAG | ASI_IDATA | ASI_UINST | ASI_SINST => crdy(2) := ico.diagrdy and not dsur.crdy(2); when ASI_DTAG | ASI_MMUSNOOP_DTAG | ASI_DDATA | ASI_UDATA | ASI_SDATA => crdy(1) := not denable and dci.enaddr and not dsur.crdy(1); when others => crdy(2) := dci.enaddr and denable; end case; end if; end; constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; constant dc_in_res : dc_in_type := ( signed => '0', enaddr => '0', read => '0', write => '0', lock => '0', dsuen => '0', size => (others => '0'), asi => (others => '0')); constant pipeline_ctrl_res : pipeline_ctrl_type := ( pc => (others => '0'), inst => (others => '0'), cnt => (others => '0'), rd => (others => '0'), tt => (others => '0'), trap => '0', annul => '1', wreg => '0', wicc => '0', wy => '0', ld => '0', pv => '0', rett => '0'); constant fpc_res : pctype := conv_std_logic_vector(rstaddr, 20) & zero32(11 downto PCLOW); constant fetch_reg_res : fetch_reg_type := ( pc => fpc_res, -- Needs special handling branch => '0' ); constant decode_reg_res : decode_reg_type := ( pc => (others => '0'), inst => (others => (others => '0')), cwp => (others => '0'), set => (others => '0'), mexc => '0', cnt => (others => '0'), pv => '0', annul => '1', inull => '0', step => '0', divrdy => '0' ); constant regacc_reg_res : regacc_reg_type := ( ctrl => pipeline_ctrl_res, rs1 => (others => '0'), rfa1 => (others => '0'), rfa2 => (others => '0'), rsel1 => (others => '0'), rsel2 => (others => '0'), rfe1 => '0', rfe2 => '0', cwp => (others => '0'), imm => (others => '0'), ldcheck1 => '0', ldcheck2 => '0', ldchkra => '1', ldchkex => '1', su => '1', et => '0', wovf => '0', wunf => '0', ticc => '0', jmpl => '0', step => '0', mulstart => '0', divstart => '0', bp => '0', nobp => '0' ); constant execute_reg_res : execute_reg_type := ( ctrl => pipeline_ctrl_res, op1 => (others => '0'), op2 => (others => '0'), aluop => (others => '0'), alusel => "11", aluadd => '1', alucin => '0', ldbp1 => '0', ldbp2 => '0', invop2 => '0', shcnt => (others => '0'), sari => '0', shleft => '0', ymsb => '0', rd => (others => '0'), jmpl => '0', su => '0', et => '0', cwp => (others => '0'), icc => (others => '0'), mulstep => '0', mul => '0', mac => '0', bp => '0', rfe1 => '0', rfe2 => '0' ); constant memory_reg_res : memory_reg_type := ( ctrl => pipeline_ctrl_res, result => (others => '0'), y => (others => '0'), icc => (others => '0'), nalign => '0', dci => dc_in_res, werr => '0', wcwp => '0', irqen => '0', irqen2 => '0', mac => '0', divz => '0', su => '0', mul => '0', casa => '0', casaz => '0' ); function xnpc_res return std_logic_vector is begin if v8 /= 0 then return "100"; end if; return "011"; end function xnpc_res; constant exception_reg_res : exception_reg_type := ( ctrl => pipeline_ctrl_res, result => (others => '0'), y => (others => '0'), icc => (others => '0'), annul_all => '1', data => (others => (others => '0')), set => (others => '0'), mexc => '0', dci => dc_in_res, laddr => (others => '0'), rstate => run, -- Has special handling npc => xnpc_res, intack => '0', ipend => '0', mac => '0', debug => '0', -- Has special handling nerror => '0', ipmask => '0' ); constant DRES : dsu_registers := ( tt => (others => '0'), err => '0', tbufcnt => (others => '0'), asi => (others => '0'), crdy => (others => '0') ); constant IRES : irestart_register := ( addr => (others => '0'), pwd => '0' ); constant PRES : pwd_register_type := ( pwd => '0', -- Needs special handling error => '0' ); --constant special_register_res : special_register_type := ( -- cwp => zero32(NWINLOG2-1 downto 0), -- icc => (others => '0'), -- tt => (others => '0'), -- tba => fpc_res(31 downto 12), -- wim => (others => '0'), -- pil => (others => '0'), -- ec => '0', -- ef => '0', -- ps => '1', -- s => '1', -- et => '0', -- y => (others => '0'), -- asr18 => (others => '0'), -- svt => '0', -- dwt => '0', -- dbp => '0' -- ); --XST workaround: function special_register_res return special_register_type is variable s : special_register_type; begin s.cwp := zero32(NWINLOG2-1 downto 0); s.icc := (others => '0'); s.tt := (others => '0'); s.tba := fpc_res(31 downto 12); s.wim := (others => '0'); s.pil := (others => '0'); s.ec := '0'; s.ef := '0'; s.ps := '1'; s.s := '1'; s.et := '0'; s.y := (others => '0'); s.asr18 := (others => '0'); s.svt := '0'; s.dwt := '0'; s.dbp := '0'; return s; end function special_register_res; --constant write_reg_res : write_reg_type := ( -- s => special_register_res, -- result => (others => '0'), -- wa => (others => '0'), -- wreg => '0', -- except => '0' -- ); -- XST workaround: function write_reg_res return write_reg_type is variable w : write_reg_type; begin w.s := special_register_res; w.result := (others => '0'); w.wa := (others => '0'); w.wreg := '0'; w.except := '0'; return w; end function write_reg_res; constant RRES : registers := ( f => fetch_reg_res, d => decode_reg_res, a => regacc_reg_res, e => execute_reg_res, m => memory_reg_res, x => exception_reg_res, w => write_reg_res ); constant exception_res : exception_type := ( pri => '0', ill => '0', fpdis => '0', cpdis => '0', wovf => '0', wunf => '0', ticc => '0' ); constant wpr_none : watchpoint_register := ( addr => zero32(31 downto 2), mask => zero32(31 downto 2), exec => '0', load => '0', store => '0'); signal r, rin : registers; signal wpr, wprin : watchpoint_registers; signal dsur, dsuin : dsu_registers; signal ir, irin : irestart_register; signal rp, rpin : pwd_register_type; -- execute stage operations constant EXE_AND : std_logic_vector(2 downto 0) := "000"; constant EXE_XOR : std_logic_vector(2 downto 0) := "001"; -- must be equal to EXE_PASS2 constant EXE_OR : std_logic_vector(2 downto 0) := "010"; constant EXE_XNOR : std_logic_vector(2 downto 0) := "011"; constant EXE_ANDN : std_logic_vector(2 downto 0) := "100"; constant EXE_ORN : std_logic_vector(2 downto 0) := "101"; constant EXE_DIV : std_logic_vector(2 downto 0) := "110"; constant EXE_PASS1 : std_logic_vector(2 downto 0) := "000"; constant EXE_PASS2 : std_logic_vector(2 downto 0) := "001"; constant EXE_STB : std_logic_vector(2 downto 0) := "010"; constant EXE_STH : std_logic_vector(2 downto 0) := "011"; constant EXE_ONES : std_logic_vector(2 downto 0) := "100"; constant EXE_RDY : std_logic_vector(2 downto 0) := "101"; constant EXE_SPR : std_logic_vector(2 downto 0) := "110"; constant EXE_LINK : std_logic_vector(2 downto 0) := "111"; constant EXE_SLL : std_logic_vector(2 downto 0) := "001"; constant EXE_SRL : std_logic_vector(2 downto 0) := "010"; constant EXE_SRA : std_logic_vector(2 downto 0) := "100"; constant EXE_NOP : std_logic_vector(2 downto 0) := "000"; -- EXE result select constant EXE_RES_ADD : std_logic_vector(1 downto 0) := "00"; constant EXE_RES_SHIFT : std_logic_vector(1 downto 0) := "01"; constant EXE_RES_LOGIC : std_logic_vector(1 downto 0) := "10"; constant EXE_RES_MISC : std_logic_vector(1 downto 0) := "11"; -- Load types constant SZBYTE : std_logic_vector(1 downto 0) := "00"; constant SZHALF : std_logic_vector(1 downto 0) := "01"; constant SZWORD : std_logic_vector(1 downto 0) := "10"; constant SZDBL : std_logic_vector(1 downto 0) := "11"; -- calculate register file address procedure regaddr(cwp : std_logic_vector; reg : std_logic_vector(4 downto 0); rao : out rfatype) is variable ra : rfatype; constant globals : std_logic_vector(RFBITS-5 downto 0) := conv_std_logic_vector(NWIN, RFBITS-4); begin ra := (others => '0'); ra(4 downto 0) := reg; if reg(4 downto 3) = "00" then ra(RFBITS -1 downto 4) := globals; else ra(NWINLOG2+3 downto 4) := cwp + ra(4); if ra(RFBITS-1 downto 4) = globals then ra(RFBITS-1 downto 4) := (others => '0'); end if; end if; rao := ra; end; -- branch adder function branch_address(inst : word; pc : pctype) return std_logic_vector is variable baddr, caddr, tmp : pctype; begin caddr := (others => '0'); caddr(31 downto 2) := inst(29 downto 0); caddr(31 downto 2) := caddr(31 downto 2) + pc(31 downto 2); baddr := (others => '0'); baddr(31 downto 24) := (others => inst(21)); baddr(23 downto 2) := inst(21 downto 0); baddr(31 downto 2) := baddr(31 downto 2) + pc(31 downto 2); if inst(30) = '1' then tmp := caddr; else tmp := baddr; end if; return(tmp); end; -- evaluate branch condition function branch_true(icc : std_logic_vector(3 downto 0); inst : word) return std_ulogic is variable n, z, v, c, branch : std_ulogic; begin n := icc(3); z := icc(2); v := icc(1); c := icc(0); case inst(27 downto 25) is when "000" => branch := inst(28) xor '0'; -- bn, ba when "001" => branch := inst(28) xor z; -- be, bne when "010" => branch := inst(28) xor (z or (n xor v)); -- ble, bg when "011" => branch := inst(28) xor (n xor v); -- bl, bge when "100" => branch := inst(28) xor (c or z); -- bleu, bgu when "101" => branch := inst(28) xor c; -- bcs, bcc when "110" => branch := inst(28) xor n; -- bneg, bpos when others => branch := inst(28) xor v; -- bvs, bvc end case; return(branch); end; -- detect RETT instruction in the pipeline and set the local psr.su and psr.et procedure su_et_select(r : in registers; xc_ps, xc_s, xc_et : in std_ulogic; su, et : out std_ulogic) is begin if ((r.a.ctrl.rett or r.e.ctrl.rett or r.m.ctrl.rett or r.x.ctrl.rett) = '1') and (r.x.annul_all = '0') then su := xc_ps; et := '1'; else su := xc_s; et := xc_et; end if; end; -- detect watchpoint trap function wphit(r : registers; wpr : watchpoint_registers; debug : l3_debug_in_type) return std_ulogic is variable exc : std_ulogic; begin exc := '0'; for i in 1 to NWP loop if ((wpr(i-1).exec and r.a.ctrl.pv and not r.a.ctrl.annul) = '1') then if (((wpr(i-1).addr xor r.a.ctrl.pc(31 downto 2)) and wpr(i-1).mask) = Zero32(31 downto 2)) then exc := '1'; end if; end if; end loop; if DBGUNIT then if (debug.dsuen and not r.a.ctrl.annul) = '1' then exc := exc or (r.a.ctrl.pv and ((debug.dbreak and debug.bwatch) or r.a.step)); end if; end if; return(exc); end; -- 32-bit shifter function shift3(r : registers; aluin1, aluin2 : word) return word is variable shiftin : unsigned(63 downto 0); variable shiftout : unsigned(63 downto 0); variable cnt : natural range 0 to 31; begin cnt := conv_integer(r.e.shcnt); if r.e.shleft = '1' then shiftin(30 downto 0) := (others => '0'); shiftin(63 downto 31) := '0' & unsigned(aluin1); else shiftin(63 downto 32) := (others => r.e.sari); shiftin(31 downto 0) := unsigned(aluin1); end if; shiftout := SHIFT_RIGHT(shiftin, cnt); return(std_logic_vector(shiftout(31 downto 0))); end; function shift2(r : registers; aluin1, aluin2 : word) return word is variable ushiftin : unsigned(31 downto 0); variable sshiftin : signed(32 downto 0); variable cnt : natural range 0 to 31; variable resleft, resright : word; begin cnt := conv_integer(r.e.shcnt); ushiftin := unsigned(aluin1); sshiftin := signed('0' & aluin1); if r.e.shleft = '1' then resleft := std_logic_vector(SHIFT_LEFT(ushiftin, cnt)); return(resleft); else if r.e.sari = '1' then sshiftin(32) := aluin1(31); end if; sshiftin := SHIFT_RIGHT(sshiftin, cnt); resright := std_logic_vector(sshiftin(31 downto 0)); return(resright); end if; end; function shift(r : registers; aluin1, aluin2 : word; shiftcnt : std_logic_vector(4 downto 0); sari : std_ulogic ) return word is variable shiftin : std_logic_vector(63 downto 0); begin shiftin := zero32 & aluin1; if r.e.shleft = '1' then shiftin(31 downto 0) := zero32; shiftin(63 downto 31) := '0' & aluin1; else shiftin(63 downto 32) := (others => sari); end if; if shiftcnt (4) = '1' then shiftin(47 downto 0) := shiftin(63 downto 16); end if; if shiftcnt (3) = '1' then shiftin(39 downto 0) := shiftin(47 downto 8); end if; if shiftcnt (2) = '1' then shiftin(35 downto 0) := shiftin(39 downto 4); end if; if shiftcnt (1) = '1' then shiftin(33 downto 0) := shiftin(35 downto 2); end if; if shiftcnt (0) = '1' then shiftin(31 downto 0) := shiftin(32 downto 1); end if; return(shiftin(31 downto 0)); end; -- Check for illegal and privileged instructions procedure exception_detect(r : registers; wpr : watchpoint_registers; dbgi : l3_debug_in_type; trapin : in std_ulogic; ttin : in std_logic_vector(5 downto 0); trap : out std_ulogic; tt : out std_logic_vector(5 downto 0)) is variable illegal_inst, privileged_inst : std_ulogic; variable cp_disabled, fp_disabled, fpop : std_ulogic; variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable rd : std_logic_vector(4 downto 0); variable inst : word; variable wph : std_ulogic; begin inst := r.a.ctrl.inst; trap := trapin; tt := ttin; if r.a.ctrl.annul = '0' then op := inst(31 downto 30); op2 := inst(24 downto 22); op3 := inst(24 downto 19); rd := inst(29 downto 25); illegal_inst := '0'; privileged_inst := '0'; cp_disabled := '0'; fp_disabled := '0'; fpop := '0'; case op is when CALL => null; when FMT2 => case op2 is when SETHI | BICC => null; when FBFCC => if FPEN then fp_disabled := not r.w.s.ef; else fp_disabled := '1'; end if; when CBCCC => if (not CPEN) or (r.w.s.ec = '0') then cp_disabled := '1'; end if; when others => illegal_inst := '1'; end case; when FMT3 => case op3 is when IAND | ANDCC | ANDN | ANDNCC | IOR | ORCC | ORN | ORNCC | IXOR | XORCC | IXNOR | XNORCC | ISLL | ISRL | ISRA | MULSCC | IADD | ADDX | ADDCC | ADDXCC | ISUB | SUBX | SUBCC | SUBXCC | FLUSH | JMPL | TICC | SAVE | RESTORE | RDY => null; when TADDCC | TADDCCTV | TSUBCC | TSUBCCTV => if notag = 1 then illegal_inst := '1'; end if; when UMAC | SMAC => if not MACEN then illegal_inst := '1'; end if; when UMUL | SMUL | UMULCC | SMULCC => if not MULEN then illegal_inst := '1'; end if; when UDIV | SDIV | UDIVCC | SDIVCC => if not DIVEN then illegal_inst := '1'; end if; when RETT => illegal_inst := r.a.et; privileged_inst := not r.a.su; when RDPSR | RDTBR | RDWIM => privileged_inst := not r.a.su; when WRY => if rd(4) = '1' and rd(3 downto 0) /= "0010" then -- %ASR16-17, %ASR19-31 privileged_inst := not r.a.su; end if; when WRPSR => privileged_inst := not r.a.su; when WRWIM | WRTBR => privileged_inst := not r.a.su; when FPOP1 | FPOP2 => if FPEN then fp_disabled := not r.w.s.ef; fpop := '1'; else fp_disabled := '1'; fpop := '0'; end if; when CPOP1 | CPOP2 => if (not CPEN) or (r.w.s.ec = '0') then cp_disabled := '1'; end if; when others => illegal_inst := '1'; end case; when others => -- LDST case op3 is when LDD | ISTD => illegal_inst := rd(0); -- trap if odd destination register when LD | LDUB | LDSTUB | LDUH | LDSB | LDSH | ST | STB | STH | SWAP => null; when LDDA | STDA => illegal_inst := inst(13) or rd(0); privileged_inst := not r.a.su; when LDA | LDUBA| LDSTUBA | LDUHA | LDSBA | LDSHA | STA | STBA | STHA | SWAPA => illegal_inst := inst(13); privileged_inst := not r.a.su; when CASA => if CASAEN then illegal_inst := inst(13); if (inst(12 downto 5) /= X"0A") then privileged_inst := not r.a.su; end if; else illegal_inst := '1'; end if; when LDDF | STDF | LDF | LDFSR | STF | STFSR => if FPEN then fp_disabled := not r.w.s.ef; else fp_disabled := '1'; end if; when STDFQ => privileged_inst := not r.a.su; if (not FPEN) or (r.w.s.ef = '0') then fp_disabled := '1'; end if; when STDCQ => privileged_inst := not r.a.su; if (not CPEN) or (r.w.s.ec = '0') then cp_disabled := '1'; end if; when LDC | LDCSR | LDDC | STC | STCSR | STDC => if (not CPEN) or (r.w.s.ec = '0') then cp_disabled := '1'; end if; when others => illegal_inst := '1'; end case; end case; wph := wphit(r, wpr, dbgi); trap := '1'; if r.a.ctrl.trap = '1' then tt := r.a.ctrl.tt; elsif privileged_inst = '1' then tt := TT_PRIV; elsif illegal_inst = '1' then tt := TT_IINST; elsif fp_disabled = '1' then tt := TT_FPDIS; elsif cp_disabled = '1' then tt := TT_CPDIS; elsif wph = '1' then tt := TT_WATCH; elsif r.a.wovf= '1' then tt := TT_WINOF; elsif r.a.wunf= '1' then tt := TT_WINUF; elsif r.a.ticc= '1' then tt := TT_TICC; else trap := '0'; tt:= (others => '0'); end if; end if; end; -- instructions that write the condition codes (psr.icc) procedure wicc_y_gen(inst : word; wicc, wy : out std_ulogic) is begin wicc := '0'; wy := '0'; if inst(31 downto 30) = FMT3 then case inst(24 downto 19) is when SUBCC | TSUBCC | TSUBCCTV | ADDCC | ANDCC | ORCC | XORCC | ANDNCC | ORNCC | XNORCC | TADDCC | TADDCCTV | ADDXCC | SUBXCC | WRPSR => wicc := '1'; when WRY => if r.d.inst(conv_integer(r.d.set))(29 downto 25) = "00000" then wy := '1'; end if; when MULSCC => wicc := '1'; wy := '1'; when UMAC | SMAC => if MACEN then wy := '1'; end if; when UMULCC | SMULCC => if MULEN and (((mulo.nready = '1') and (r.d.cnt /= "00")) or (MULTYPE /= 0)) then wicc := '1'; wy := '1'; end if; when UMUL | SMUL => if MULEN and (((mulo.nready = '1') and (r.d.cnt /= "00")) or (MULTYPE /= 0)) then wy := '1'; end if; when UDIVCC | SDIVCC => if DIVEN and (divo.nready = '1') and (r.d.cnt /= "00") then wicc := '1'; end if; when others => end case; end if; end; -- select cwp procedure cwp_gen(r, v : registers; annul, wcwp : std_ulogic; ncwp : cwptype; cwp : out cwptype) is begin if (r.x.rstate = trap) or (r.x.rstate = dsu2) or (rstn = '0') then cwp := v.w.s.cwp; elsif (wcwp = '1') and (annul = '0') then cwp := ncwp; elsif r.m.wcwp = '1' then cwp := r.m.result(NWINLOG2-1 downto 0); else cwp := r.d.cwp; end if; end; -- generate wcwp in ex stage procedure cwp_ex(r : in registers; wcwp : out std_ulogic) is begin if (r.e.ctrl.inst(31 downto 30) = FMT3) and (r.e.ctrl.inst(24 downto 19) = WRPSR) then wcwp := not r.e.ctrl.annul; else wcwp := '0'; end if; end; -- generate next cwp & window under- and overflow traps procedure cwp_ctrl(r : in registers; xc_wim : in std_logic_vector(NWIN-1 downto 0); inst : word; de_cwp : out cwptype; wovf_exc, wunf_exc, wcwp : out std_ulogic) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable wim : word; variable ncwp : cwptype; begin op := inst(31 downto 30); op3 := inst(24 downto 19); wovf_exc := '0'; wunf_exc := '0'; wim := (others => '0'); wim(NWIN-1 downto 0) := xc_wim; ncwp := r.d.cwp; wcwp := '0'; if (op = FMT3) and ((op3 = RETT) or (op3 = RESTORE) or (op3 = SAVE)) then wcwp := '1'; if (op3 = SAVE) then if (not CWPOPT) and (r.d.cwp = CWPMIN) then ncwp := CWPMAX; else ncwp := r.d.cwp - 1 ; end if; else if (not CWPOPT) and (r.d.cwp = CWPMAX) then ncwp := CWPMIN; else ncwp := r.d.cwp + 1; end if; end if; if wim(conv_integer(ncwp)) = '1' then if op3 = SAVE then wovf_exc := '1'; else wunf_exc := '1'; end if; end if; end if; de_cwp := ncwp; end; -- generate register read address 1 procedure rs1_gen(r : registers; inst : word; rs1 : out std_logic_vector(4 downto 0); rs1mod : out std_ulogic) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); begin op := inst(31 downto 30); op3 := inst(24 downto 19); rs1 := inst(18 downto 14); rs1mod := '0'; if (op = LDST) then if ((r.d.cnt = "01") and ((op3(2) and not op3(3)) = '1')) or (r.d.cnt = "10") then rs1mod := '1'; rs1 := inst(29 downto 25); end if; if ((r.d.cnt = "10") and (op3(3 downto 0) = "0111")) then rs1(0) := '1'; end if; end if; end; -- load/icc interlock detection function icc_valid(r : registers) return std_logic is variable not_valid : std_logic; begin not_valid := '0'; if MULEN or DIVEN then not_valid := r.m.ctrl.wicc and (r.m.ctrl.cnt(0) or r.m.mul); end if; not_valid := not_valid or (r.a.ctrl.wicc or r.e.ctrl.wicc); return(not not_valid); end; procedure bp_miss_ex(r : registers; icc : std_logic_vector(3 downto 0); ex_bpmiss, ra_bpannul : out std_logic) is variable miss : std_logic; begin miss := (not r.e.ctrl.annul) and r.e.bp and not branch_true(icc, r.e.ctrl.inst); ra_bpannul := miss and r.e.ctrl.inst(29); ex_bpmiss := miss; end; procedure bp_miss_ra(r : registers; ra_bpmiss, de_bpannul : out std_logic) is variable miss : std_logic; begin miss := ((not r.a.ctrl.annul) and r.a.bp and icc_valid(r) and not branch_true(r.m.icc, r.a.ctrl.inst)); de_bpannul := miss and r.a.ctrl.inst(29); ra_bpmiss := miss; end; procedure lock_gen(r : registers; rs2, rd : std_logic_vector(4 downto 0); rfa1, rfa2, rfrd : rfatype; inst : word; fpc_lock, mulinsn, divinsn, de_wcwp : std_ulogic; lldcheck1, lldcheck2, lldlock, lldchkra, lldchkex, bp, nobp, de_fins_hold : out std_ulogic; iperr : std_logic) is variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable cond : std_logic_vector(3 downto 0); variable rs1 : std_logic_vector(4 downto 0); variable i, ldcheck1, ldcheck2, ldchkra, ldchkex, ldcheck3 : std_ulogic; variable ldlock, icc_check, bicc_hold, chkmul, y_check : std_logic; variable icc_check_bp, y_hold, mul_hold, bicc_hold_bp, fins, call_hold : std_ulogic; variable de_fins_holdx : std_ulogic; begin op := inst(31 downto 30); op3 := inst(24 downto 19); op2 := inst(24 downto 22); cond := inst(28 downto 25); rs1 := inst(18 downto 14); i := inst(13); ldcheck1 := '0'; ldcheck2 := '0'; ldcheck3 := '0'; ldlock := '0'; ldchkra := '1'; ldchkex := '1'; icc_check := '0'; bicc_hold := '0'; y_check := '0'; y_hold := '0'; bp := '0'; mul_hold := '0'; icc_check_bp := '0'; nobp := '0'; fins := '0'; call_hold := '0'; if (r.d.annul = '0') then case op is when CALL => call_hold := '1'; nobp := BPRED; when FMT2 => if (op2 = BICC) and (cond(2 downto 0) /= "000") then icc_check_bp := '1'; end if; if (op2 = BICC) then nobp := BPRED; end if; when FMT3 => ldcheck1 := '1'; ldcheck2 := not i; case op3 is when TICC => if (cond(2 downto 0) /= "000") then icc_check := '1'; end if; nobp := BPRED; when RDY => ldcheck1 := '0'; ldcheck2 := '0'; if MACPIPE then y_check := '1'; end if; when RDWIM | RDTBR => ldcheck1 := '0'; ldcheck2 := '0'; when RDPSR => ldcheck1 := '0'; ldcheck2 := '0'; icc_check := '1'; when SDIV | SDIVCC | UDIV | UDIVCC => if DIVEN then y_check := '1'; nobp := op3(4); end if; -- no BP on divcc when FPOP1 | FPOP2 => ldcheck1:= '0'; ldcheck2 := '0'; fins := BPRED; when JMPL => call_hold := '1'; nobp := BPRED; when others => end case; when LDST => ldcheck1 := '1'; ldchkra := '0'; case r.d.cnt is when "00" => if (lddel = 2) and (op3(2) = '1') and (op3(5) = '0') then ldcheck3 := '1'; end if; ldcheck2 := not i; ldchkra := '1'; when "01" => ldcheck2 := not i; if (op3(5) and op3(2) and not op3(3)) = '1' then ldcheck1 := '0'; ldcheck2 := '0'; end if; -- STF/STC when others => ldchkex := '0'; if CASAEN and (op3(5 downto 3) = "111") then ldcheck2 := '1'; elsif (op3(5) = '1') or ((op3(5) & op3(3 downto 1)) = "0110") -- LDST then ldcheck1 := '0'; ldcheck2 := '0'; end if; end case; if op3(5) = '1' then fins := BPRED; end if; -- no BP on FPU/CP LD/ST when others => null; end case; end if; if MULEN or DIVEN then chkmul := mulinsn; mul_hold := (r.a.mulstart and r.a.ctrl.wicc) or (r.m.ctrl.wicc and (r.m.ctrl.cnt(0) or r.m.mul)); if (MULTYPE = 0) and ((icc_check_bp and BPRED and r.a.ctrl.wicc and r.a.ctrl.wy) = '1') then mul_hold := '1'; end if; else chkmul := '0'; end if; if DIVEN then y_hold := y_check and (r.a.ctrl.wy or r.e.ctrl.wy); chkmul := chkmul or divinsn; end if; bicc_hold := icc_check and not icc_valid(r); bicc_hold_bp := icc_check_bp and not icc_valid(r); if (((r.a.ctrl.ld or chkmul) and r.a.ctrl.wreg and ldchkra) = '1') and (((ldcheck1 = '1') and (r.a.ctrl.rd = rfa1)) or ((ldcheck2 = '1') and (r.a.ctrl.rd = rfa2)) or ((ldcheck3 = '1') and (r.a.ctrl.rd = rfrd))) then ldlock := '1'; end if; if (((r.e.ctrl.ld or r.e.mac) and r.e.ctrl.wreg and ldchkex) = '1') and ((lddel = 2) or (MACPIPE and (r.e.mac = '1')) or ((MULTYPE = 3) and (r.e.mul = '1'))) and (((ldcheck1 = '1') and (r.e.ctrl.rd = rfa1)) or ((ldcheck2 = '1') and (r.e.ctrl.rd = rfa2))) then ldlock := '1'; end if; de_fins_holdx := BPRED and fins and (r.a.bp or r.e.bp); -- skip BP on FPU inst in branch target address de_fins_hold := de_fins_holdx; ldlock := ldlock or y_hold or fpc_lock or (BPRED and r.a.bp and r.a.ctrl.inst(29) and de_wcwp) or de_fins_holdx; if ((icc_check_bp and BPRED) = '1') and ((r.a.nobp or mul_hold) = '0') then bp := bicc_hold_bp; else ldlock := ldlock or bicc_hold or bicc_hold_bp; end if; lldcheck1 := ldcheck1; lldcheck2:= ldcheck2; lldlock := ldlock; lldchkra := ldchkra; lldchkex := ldchkex; end; procedure fpbranch(inst : in word; fcc : in std_logic_vector(1 downto 0); branch : out std_ulogic) is variable cond : std_logic_vector(3 downto 0); variable fbres : std_ulogic; begin cond := inst(28 downto 25); case cond(2 downto 0) is when "000" => fbres := '0'; -- fba, fbn when "001" => fbres := fcc(1) or fcc(0); when "010" => fbres := fcc(1) xor fcc(0); when "011" => fbres := fcc(0); when "100" => fbres := (not fcc(1)) and fcc(0); when "101" => fbres := fcc(1); when "110" => fbres := fcc(1) and not fcc(0); when others => fbres := fcc(1) and fcc(0); end case; branch := cond(3) xor fbres; end; -- PC generation procedure ic_ctrl(r : registers; inst : word; annul_all, ldlock, branch_true, fbranch_true, cbranch_true, fccv, cccv : in std_ulogic; cnt : out std_logic_vector(1 downto 0); de_pc : out pctype; de_branch, ctrl_annul, de_annul, jmpl_inst, inull, de_pv, ctrl_pv, de_hold_pc, ticc_exception, rett_inst, mulstart, divstart : out std_ulogic; rabpmiss, exbpmiss, iperr : std_logic) is variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable cond : std_logic_vector(3 downto 0); variable hold_pc, annul_current, annul_next, branch, annul, pv : std_ulogic; variable de_jmpl, inhibit_current : std_ulogic; begin branch := '0'; annul_next := '0'; annul_current := '0'; pv := '1'; hold_pc := '0'; ticc_exception := '0'; rett_inst := '0'; op := inst(31 downto 30); op3 := inst(24 downto 19); op2 := inst(24 downto 22); cond := inst(28 downto 25); annul := inst(29); de_jmpl := '0'; cnt := "00"; mulstart := '0'; divstart := '0'; inhibit_current := '0'; if (r.d.annul = '0') then case inst(31 downto 30) is when CALL => branch := '1'; if r.d.inull = '1' then hold_pc := '1'; annul_current := '1'; end if; when FMT2 => if (op2 = BICC) or (FPEN and (op2 = FBFCC)) or (CPEN and (op2 = CBCCC)) then if (FPEN and (op2 = FBFCC)) then branch := fbranch_true; if fccv /= '1' then hold_pc := '1'; annul_current := '1'; end if; elsif (CPEN and (op2 = CBCCC)) then branch := cbranch_true; if cccv /= '1' then hold_pc := '1'; annul_current := '1'; end if; else branch := branch_true or (BPRED and orv(cond) and not icc_valid(r)); end if; if hold_pc = '0' then if (branch = '1') then if (cond = BA) and (annul = '1') then annul_next := '1'; end if; else annul_next := annul_next or annul; end if; if r.d.inull = '1' then -- contention with JMPL hold_pc := '1'; annul_current := '1'; annul_next := '0'; end if; end if; end if; when FMT3 => case op3 is when UMUL | SMUL | UMULCC | SMULCC => if MULEN and (MULTYPE /= 0) then mulstart := '1'; end if; if MULEN and (MULTYPE = 0) then case r.d.cnt is when "00" => cnt := "01"; hold_pc := '1'; pv := '0'; mulstart := '1'; when "01" => if mulo.nready = '1' then cnt := "00"; else cnt := "01"; pv := '0'; hold_pc := '1'; end if; when others => null; end case; end if; when UDIV | SDIV | UDIVCC | SDIVCC => if DIVEN then case r.d.cnt is when "00" => hold_pc := '1'; pv := '0'; if r.d.divrdy = '0' then cnt := "01"; divstart := '1'; end if; when "01" => if divo.nready = '1' then cnt := "00"; else cnt := "01"; pv := '0'; hold_pc := '1'; end if; when others => null; end case; end if; when TICC => if branch_true = '1' then ticc_exception := '1'; end if; when RETT => rett_inst := '1'; --su := sregs.ps; when JMPL => de_jmpl := '1'; when WRY => if PWRD1 then if inst(29 downto 25) = "10011" then -- %ASR19 case r.d.cnt is when "00" => pv := '0'; cnt := "00"; hold_pc := '1'; if r.x.ipend = '1' then cnt := "01"; end if; when "01" => cnt := "00"; when others => end case; end if; end if; when others => null; end case; when others => -- LDST case r.d.cnt is when "00" => if (op3(2) = '1') or (op3(1 downto 0) = "11") then -- ST/LDST/SWAP/LDD/CASA cnt := "01"; hold_pc := '1'; pv := '0'; end if; when "01" => if (op3(2 downto 0) = "111") or (op3(3 downto 0) = "1101") or (CASAEN and (op3(5 downto 4) = "11")) or -- CASA ((CPEN or FPEN) and ((op3(5) & op3(2 downto 0)) = "1110")) then -- LDD/STD/LDSTUB/SWAP cnt := "10"; pv := '0'; hold_pc := '1'; else cnt := "00"; end if; when "10" => cnt := "00"; when others => null; end case; end case; end if; if ldlock = '1' then cnt := r.d.cnt; annul_next := '0'; pv := '1'; end if; hold_pc := (hold_pc or ldlock) and not annul_all; if ((exbpmiss and r.a.ctrl.annul and r.d.pv and not hold_pc) = '1') then annul_next := '1'; pv := '0'; end if; if ((exbpmiss and not r.a.ctrl.annul and r.d.pv) = '1') then annul_next := '1'; pv := '0'; annul_current := '1'; end if; if ((exbpmiss and not r.a.ctrl.annul and not r.d.pv and not hold_pc) = '1') then annul_next := '1'; pv := '0'; end if; if ((exbpmiss and r.e.ctrl.inst(29) and not r.a.ctrl.annul and not r.d.pv ) = '1') and (r.d.cnt = "01") then annul_next := '1'; annul_current := '1'; pv := '0'; end if; if (exbpmiss and r.e.ctrl.inst(29) and r.a.ctrl.annul and r.d.pv) = '1' then annul_next := '1'; pv := '0'; inhibit_current := '1'; end if; if (rabpmiss and not r.a.ctrl.inst(29) and not r.d.annul and r.d.pv and not hold_pc) = '1' then annul_next := '1'; pv := '0'; end if; if (rabpmiss and r.a.ctrl.inst(29) and not r.d.annul and r.d.pv ) = '1' then annul_next := '1'; pv := '0'; inhibit_current := '1'; end if; if hold_pc = '1' then de_pc := r.d.pc; else de_pc := r.f.pc; end if; annul_current := (annul_current or (ldlock and not inhibit_current) or annul_all); ctrl_annul := r.d.annul or annul_all or annul_current or inhibit_current; pv := pv and not ((r.d.inull and not hold_pc) or annul_all); jmpl_inst := de_jmpl and not annul_current and not inhibit_current; annul_next := (r.d.inull and not hold_pc) or annul_next or annul_all; if (annul_next = '1') or (rstn = '0') then cnt := (others => '0'); end if; de_hold_pc := hold_pc; de_branch := branch; de_annul := annul_next; de_pv := pv; ctrl_pv := r.d.pv and not ((r.d.annul and not r.d.pv) or annul_all or annul_current); inull := (not rstn) or r.d.inull or hold_pc or annul_all; end; -- register write address generation procedure rd_gen(r : registers; inst : word; wreg, ld : out std_ulogic; rdo : out std_logic_vector(4 downto 0)) is variable write_reg : std_ulogic; variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable rd : std_logic_vector(4 downto 0); begin op := inst(31 downto 30); op2 := inst(24 downto 22); op3 := inst(24 downto 19); write_reg := '0'; rd := inst(29 downto 25); ld := '0'; case op is when CALL => write_reg := '1'; rd := "01111"; -- CALL saves PC in r[15] (%o7) when FMT2 => if (op2 = SETHI) then write_reg := '1'; end if; when FMT3 => case op3 is when UMUL | SMUL | UMULCC | SMULCC => if MULEN then if (((mulo.nready = '1') and (r.d.cnt /= "00")) or (MULTYPE /= 0)) then write_reg := '1'; end if; else write_reg := '1'; end if; when UDIV | SDIV | UDIVCC | SDIVCC => if DIVEN then if (divo.nready = '1') and (r.d.cnt /= "00") then write_reg := '1'; end if; else write_reg := '1'; end if; when RETT | WRPSR | WRY | WRWIM | WRTBR | TICC | FLUSH => null; when FPOP1 | FPOP2 => null; when CPOP1 | CPOP2 => null; when others => write_reg := '1'; end case; when others => -- LDST ld := not op3(2); if (op3(2) = '0') and not ((CPEN or FPEN) and (op3(5) = '1')) then write_reg := '1'; end if; case op3 is when SWAP | SWAPA | LDSTUB | LDSTUBA | CASA => if r.d.cnt = "00" then write_reg := '1'; ld := '1'; end if; when others => null; end case; if r.d.cnt = "01" then case op3 is when LDD | LDDA | LDDC | LDDF => rd(0) := '1'; when others => end case; end if; end case; if (rd = "00000") then write_reg := '0'; end if; wreg := write_reg; rdo := rd; end; -- immediate data generation function imm_data (r : registers; insn : word) return word is variable immediate_data, inst : word; begin immediate_data := (others => '0'); inst := insn; case inst(31 downto 30) is when FMT2 => immediate_data := inst(21 downto 0) & "0000000000"; when others => -- LDST immediate_data(31 downto 13) := (others => inst(12)); immediate_data(12 downto 0) := inst(12 downto 0); end case; return(immediate_data); end; -- read special registers function get_spr (r : registers) return word is variable spr : word; begin spr := (others => '0'); case r.e.ctrl.inst(24 downto 19) is when RDPSR => spr(31 downto 5) := conv_std_logic_vector(IMPL,4) & conv_std_logic_vector(VER,4) & r.m.icc & "000000" & r.w.s.ec & r.w.s.ef & r.w.s.pil & r.e.su & r.w.s.ps & r.e.et; spr(NWINLOG2-1 downto 0) := r.e.cwp; when RDTBR => spr(31 downto 4) := r.w.s.tba & r.w.s.tt; when RDWIM => spr(NWIN-1 downto 0) := r.w.s.wim; when others => end case; return(spr); end; -- immediate data select function imm_select(inst : word) return boolean is variable imm : boolean; begin imm := false; case inst(31 downto 30) is when FMT2 => case inst(24 downto 22) is when SETHI => imm := true; when others => end case; when FMT3 => case inst(24 downto 19) is when RDWIM | RDPSR | RDTBR => imm := true; when others => if (inst(13) = '1') then imm := true; end if; end case; when LDST => if (inst(13) = '1') then imm := true; end if; when others => end case; return(imm); end; -- EXE operation procedure alu_op(r : in registers; iop1, iop2 : in word; me_icc : std_logic_vector(3 downto 0); my, ldbp : std_ulogic; aop1, aop2 : out word; aluop : out std_logic_vector(2 downto 0); alusel : out std_logic_vector(1 downto 0); aluadd : out std_ulogic; shcnt : out std_logic_vector(4 downto 0); sari, shleft, ymsb, mulins, divins, mulstep, macins, ldbp2, invop2 : out std_logic ) is variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable rs1, rs2, rd : std_logic_vector(4 downto 0); variable icc : std_logic_vector(3 downto 0); variable y0, i : std_ulogic; begin op := r.a.ctrl.inst(31 downto 30); op2 := r.a.ctrl.inst(24 downto 22); op3 := r.a.ctrl.inst(24 downto 19); rs1 := r.a.ctrl.inst(18 downto 14); i := r.a.ctrl.inst(13); rs2 := r.a.ctrl.inst(4 downto 0); rd := r.a.ctrl.inst(29 downto 25); aop1 := iop1; aop2 := iop2; ldbp2 := ldbp; aluop := EXE_NOP; alusel := EXE_RES_MISC; aluadd := '1'; shcnt := iop2(4 downto 0); sari := '0'; shleft := '0'; invop2 := '0'; ymsb := iop1(0); mulins := '0'; divins := '0'; mulstep := '0'; macins := '0'; if r.e.ctrl.wy = '1' then y0 := my; elsif r.m.ctrl.wy = '1' then y0 := r.m.y(0); elsif r.x.ctrl.wy = '1' then y0 := r.x.y(0); else y0 := r.w.s.y(0); end if; if r.e.ctrl.wicc = '1' then icc := me_icc; elsif r.m.ctrl.wicc = '1' then icc := r.m.icc; elsif r.x.ctrl.wicc = '1' then icc := r.x.icc; else icc := r.w.s.icc; end if; case op is when CALL => aluop := EXE_LINK; when FMT2 => case op2 is when SETHI => aluop := EXE_PASS2; when others => end case; when FMT3 => case op3 is when IADD | ADDX | ADDCC | ADDXCC | TADDCC | TADDCCTV | SAVE | RESTORE | TICC | JMPL | RETT => alusel := EXE_RES_ADD; when ISUB | SUBX | SUBCC | SUBXCC | TSUBCC | TSUBCCTV => alusel := EXE_RES_ADD; aluadd := '0'; aop2 := not iop2; invop2 := '1'; when MULSCC => alusel := EXE_RES_ADD; aop1 := (icc(3) xor icc(1)) & iop1(31 downto 1); if y0 = '0' then aop2 := (others => '0'); ldbp2 := '0'; end if; mulstep := '1'; when UMUL | UMULCC | SMUL | SMULCC => if MULEN then mulins := '1'; end if; when UMAC | SMAC => if MACEN then mulins := '1'; macins := '1'; end if; when UDIV | UDIVCC | SDIV | SDIVCC => if DIVEN then aluop := EXE_DIV; alusel := EXE_RES_LOGIC; divins := '1'; end if; when IAND | ANDCC => aluop := EXE_AND; alusel := EXE_RES_LOGIC; when ANDN | ANDNCC => aluop := EXE_ANDN; alusel := EXE_RES_LOGIC; when IOR | ORCC => aluop := EXE_OR; alusel := EXE_RES_LOGIC; when ORN | ORNCC => aluop := EXE_ORN; alusel := EXE_RES_LOGIC; when IXNOR | XNORCC => aluop := EXE_XNOR; alusel := EXE_RES_LOGIC; when XORCC | IXOR | WRPSR | WRWIM | WRTBR | WRY => aluop := EXE_XOR; alusel := EXE_RES_LOGIC; when RDPSR | RDTBR | RDWIM => aluop := EXE_SPR; when RDY => aluop := EXE_RDY; when ISLL => aluop := EXE_SLL; alusel := EXE_RES_SHIFT; shleft := '1'; shcnt := not iop2(4 downto 0); invop2 := '1'; when ISRL => aluop := EXE_SRL; alusel := EXE_RES_SHIFT; when ISRA => aluop := EXE_SRA; alusel := EXE_RES_SHIFT; sari := iop1(31); when FPOP1 | FPOP2 => when others => end case; when others => -- LDST case r.a.ctrl.cnt is when "00" => alusel := EXE_RES_ADD; when "01" => case op3 is when LDD | LDDA | LDDC => alusel := EXE_RES_ADD; when LDDF => alusel := EXE_RES_ADD; when SWAP | SWAPA | LDSTUB | LDSTUBA | CASA => alusel := EXE_RES_ADD; when STF | STDF => when others => aluop := EXE_PASS1; if op3(2) = '1' then if op3(1 downto 0) = "01" then aluop := EXE_STB; elsif op3(1 downto 0) = "10" then aluop := EXE_STH; end if; end if; end case; when "10" => aluop := EXE_PASS1; if op3(2) = '1' then -- ST if (op3(3) and not op3(5) and not op3(1))= '1' then aluop := EXE_ONES; end if; -- LDSTUB end if; if CASAEN and (r.m.casa = '1') then alusel := EXE_RES_ADD; aluadd := '0'; aop2 := not iop2; invop2 := '1'; end if; when others => end case; end case; end; function ra_inull_gen(r, v : registers) return std_ulogic is variable de_inull : std_ulogic; begin de_inull := '0'; if ((v.e.jmpl or v.e.ctrl.rett) and not v.e.ctrl.annul and not (r.e.jmpl and not r.e.ctrl.annul)) = '1' then de_inull := '1'; end if; if ((v.a.jmpl or v.a.ctrl.rett) and not v.a.ctrl.annul and not (r.a.jmpl and not r.a.ctrl.annul)) = '1' then de_inull := '1'; end if; return(de_inull); end; -- operand generation procedure op_mux(r : in registers; rfd, ed, md, xd, im : in word; rsel : in std_logic_vector(2 downto 0); ldbp : out std_ulogic; d : out word; id : std_logic) is begin ldbp := '0'; case rsel is when "000" => d := rfd; when "001" => d := ed; when "010" => d := md; if lddel = 1 then ldbp := r.m.ctrl.ld; end if; when "011" => d := xd; when "100" => d := im; when "101" => d := (others => '0'); when "110" => d := r.w.result; when others => d := (others => '-'); end case; if CASAEN and (r.a.ctrl.cnt = "10") and ((r.m.casa and not id) = '1') then ldbp := '1'; end if; end; procedure op_find(r : in registers; ldchkra : std_ulogic; ldchkex : std_ulogic; rs1 : std_logic_vector(4 downto 0); ra : rfatype; im : boolean; rfe : out std_ulogic; osel : out std_logic_vector(2 downto 0); ldcheck : std_ulogic) is begin rfe := '0'; if im then osel := "100"; elsif rs1 = "00000" then osel := "101"; -- %g0 elsif ((r.a.ctrl.wreg and ldchkra) = '1') and (ra = r.a.ctrl.rd) then osel := "001"; elsif ((r.e.ctrl.wreg and ldchkex) = '1') and (ra = r.e.ctrl.rd) then osel := "010"; elsif (r.m.ctrl.wreg = '1') and (ra = r.m.ctrl.rd) then osel := "011"; elsif (irfwt = 0) and (r.x.ctrl.wreg = '1') and (ra = r.x.ctrl.rd) then osel := "110"; else osel := "000"; rfe := ldcheck; end if; end; -- generate carry-in for alu procedure cin_gen(r : registers; me_cin : in std_ulogic; cin : out std_ulogic) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable ncin : std_ulogic; begin op := r.a.ctrl.inst(31 downto 30); op3 := r.a.ctrl.inst(24 downto 19); if r.e.ctrl.wicc = '1' then ncin := me_cin; else ncin := r.m.icc(0); end if; cin := '0'; case op is when FMT3 => case op3 is when ISUB | SUBCC | TSUBCC | TSUBCCTV => cin := '1'; when ADDX | ADDXCC => cin := ncin; when SUBX | SUBXCC => cin := not ncin; when others => null; end case; when LDST => if CASAEN and (r.m.casa = '1') and (r.a.ctrl.cnt = "10") then cin := '1'; end if; when others => null; end case; end; procedure logic_op(r : registers; aluin1, aluin2, mey : word; ymsb : std_ulogic; logicres, y : out word) is variable logicout : word; begin case r.e.aluop is when EXE_AND => logicout := aluin1 and aluin2; when EXE_ANDN => logicout := aluin1 and not aluin2; when EXE_OR => logicout := aluin1 or aluin2; when EXE_ORN => logicout := aluin1 or not aluin2; when EXE_XOR => logicout := aluin1 xor aluin2; when EXE_XNOR => logicout := aluin1 xor not aluin2; when EXE_DIV => if DIVEN then logicout := aluin2; else logicout := (others => '-'); end if; when others => logicout := (others => '-'); end case; if (r.e.ctrl.wy and r.e.mulstep) = '1' then y := ymsb & r.m.y(31 downto 1); elsif r.e.ctrl.wy = '1' then y := logicout; elsif r.m.ctrl.wy = '1' then y := mey; elsif MACPIPE and (r.x.mac = '1') then y := mulo.result(63 downto 32); elsif r.x.ctrl.wy = '1' then y := r.x.y; else y := r.w.s.y; end if; logicres := logicout; end; function st_align(size : std_logic_vector(1 downto 0); bpdata : word) return word is variable edata : word; begin case size is when "01" => edata := bpdata(7 downto 0) & bpdata(7 downto 0) & bpdata(7 downto 0) & bpdata(7 downto 0); when "10" => edata := bpdata(15 downto 0) & bpdata(15 downto 0); when others => edata := bpdata; end case; return(edata); end; procedure misc_op(r : registers; wpr : watchpoint_registers; aluin1, aluin2, ldata, mey : word; mout, edata : out word) is variable miscout, bpdata, stdata : word; variable wpi : integer; begin wpi := 0; miscout := r.e.ctrl.pc(31 downto 2) & "00"; edata := aluin1; bpdata := aluin1; if ((r.x.ctrl.wreg and r.x.ctrl.ld and not r.x.ctrl.annul) = '1') and (r.x.ctrl.rd = r.e.ctrl.rd) and (r.e.ctrl.inst(31 downto 30) = LDST) and (r.e.ctrl.cnt /= "10") then bpdata := ldata; end if; case r.e.aluop is when EXE_STB => miscout := bpdata(7 downto 0) & bpdata(7 downto 0) & bpdata(7 downto 0) & bpdata(7 downto 0); edata := miscout; when EXE_STH => miscout := bpdata(15 downto 0) & bpdata(15 downto 0); edata := miscout; when EXE_PASS1 => miscout := bpdata; edata := miscout; when EXE_PASS2 => miscout := aluin2; when EXE_ONES => miscout := (others => '1'); edata := miscout; when EXE_RDY => if MULEN and (r.m.ctrl.wy = '1') then miscout := mey; else miscout := r.m.y; end if; if (NWP > 0) and (r.e.ctrl.inst(18 downto 17) = "11") then wpi := conv_integer(r.e.ctrl.inst(16 downto 15)); if r.e.ctrl.inst(14) = '0' then miscout := wpr(wpi).addr & '0' & wpr(wpi).exec; else miscout := wpr(wpi).mask & wpr(wpi).load & wpr(wpi).store; end if; end if; if (r.e.ctrl.inst(18 downto 17) = "10") and (r.e.ctrl.inst(14) = '1') then --%ASR17 miscout := asr17_gen(r); end if; if MACEN then if (r.e.ctrl.inst(18 downto 14) = "10010") then --%ASR18 if ((r.m.mac = '1') and not MACPIPE) or ((r.x.mac = '1') and MACPIPE) then miscout := mulo.result(31 downto 0); -- data forward of asr18 else miscout := r.w.s.asr18; end if; else if ((r.m.mac = '1') and not MACPIPE) or ((r.x.mac = '1') and MACPIPE) then miscout := mulo.result(63 downto 32); -- data forward Y end if; end if; end if; when EXE_SPR => miscout := get_spr(r); when others => null; end case; mout := miscout; end; procedure alu_select(r : registers; addout : std_logic_vector(32 downto 0); op1, op2 : word; shiftout, logicout, miscout : word; res : out word; me_icc : std_logic_vector(3 downto 0); icco : out std_logic_vector(3 downto 0); divz, mzero : out std_ulogic) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable icc : std_logic_vector(3 downto 0); variable aluresult : word; variable azero : std_logic; begin op := r.e.ctrl.inst(31 downto 30); op3 := r.e.ctrl.inst(24 downto 19); icc := (others => '0'); if addout(32 downto 1) = zero32 then azero := '1'; else azero := '0'; end if; mzero := azero; case r.e.alusel is when EXE_RES_ADD => aluresult := addout(32 downto 1); if r.e.aluadd = '0' then icc(0) := ((not op1(31)) and not op2(31)) or -- Carry (addout(32) and ((not op1(31)) or not op2(31))); icc(1) := (op1(31) and (op2(31)) and not addout(32)) or -- Overflow (addout(32) and (not op1(31)) and not op2(31)); else icc(0) := (op1(31) and op2(31)) or -- Carry ((not addout(32)) and (op1(31) or op2(31))); icc(1) := (op1(31) and op2(31) and not addout(32)) or -- Overflow (addout(32) and (not op1(31)) and (not op2(31))); end if; if notag = 0 then case op is when FMT3 => case op3 is when TADDCC | TADDCCTV => icc(1) := op1(0) or op1(1) or op2(0) or op2(1) or icc(1); when TSUBCC | TSUBCCTV => icc(1) := op1(0) or op1(1) or (not op2(0)) or (not op2(1)) or icc(1); when others => null; end case; when others => null; end case; end if; -- if aluresult = zero32 then icc(2) := '1'; end if; icc(2) := azero; when EXE_RES_SHIFT => aluresult := shiftout; when EXE_RES_LOGIC => aluresult := logicout; if aluresult = zero32 then icc(2) := '1'; end if; when others => aluresult := miscout; end case; if r.e.jmpl = '1' then aluresult := r.e.ctrl.pc(31 downto 2) & "00"; end if; icc(3) := aluresult(31); divz := icc(2); if r.e.ctrl.wicc = '1' then if (op = FMT3) and (op3 = WRPSR) then icco := logicout(23 downto 20); else icco := icc; end if; elsif r.m.ctrl.wicc = '1' then icco := me_icc; elsif r.x.ctrl.wicc = '1' then icco := r.x.icc; else icco := r.w.s.icc; end if; res := aluresult; end; procedure dcache_gen(r, v : registers; dci : out dc_in_type; link_pc, jump, force_a2, load, mcasa : out std_ulogic) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable su, lock : std_ulogic; begin op := r.e.ctrl.inst(31 downto 30); op3 := r.e.ctrl.inst(24 downto 19); dci.signed := '0'; dci.lock := '0'; dci.dsuen := '0'; dci.size := SZWORD; mcasa := '0'; if op = LDST then case op3 is when LDUB | LDUBA => dci.size := SZBYTE; when LDSTUB | LDSTUBA => dci.size := SZBYTE; dci.lock := '1'; when LDUH | LDUHA => dci.size := SZHALF; when LDSB | LDSBA => dci.size := SZBYTE; dci.signed := '1'; when LDSH | LDSHA => dci.size := SZHALF; dci.signed := '1'; when LD | LDA | LDF | LDC => dci.size := SZWORD; when SWAP | SWAPA => dci.size := SZWORD; dci.lock := '1'; when CASA => if CASAEN then dci.size := SZWORD; dci.lock := '1'; end if; when LDD | LDDA | LDDF | LDDC => dci.size := SZDBL; when STB | STBA => dci.size := SZBYTE; when STH | STHA => dci.size := SZHALF; when ST | STA | STF => dci.size := SZWORD; when ISTD | STDA => dci.size := SZDBL; when STDF | STDFQ => if FPEN then dci.size := SZDBL; end if; when STDC | STDCQ => if CPEN then dci.size := SZDBL; end if; when others => dci.size := SZWORD; dci.lock := '0'; dci.signed := '0'; end case; end if; link_pc := '0'; jump:= '0'; force_a2 := '0'; load := '0'; dci.write := '0'; dci.enaddr := '0'; dci.read := not op3(2); -- load/store control decoding if (r.e.ctrl.annul or r.e.ctrl.trap) = '0' then case op is when CALL => link_pc := '1'; when FMT3 => if r.e.ctrl.trap = '0' then case op3 is when JMPL => jump := '1'; link_pc := '1'; when RETT => jump := '1'; when others => null; end case; end if; when LDST => case r.e.ctrl.cnt is when "00" => dci.read := op3(3) or not op3(2); -- LD/LDST/SWAP/CASA load := op3(3) or not op3(2); --dci.enaddr := '1'; dci.enaddr := (not op3(2)) or op3(2) or (op3(3) and op3(2)); when "01" => force_a2 := not op3(2); -- LDD load := not op3(2); dci.enaddr := not op3(2); if op3(3 downto 2) = "01" then -- ST/STD dci.write := '1'; end if; if (CASAEN and (op3(5 downto 4) = "11")) or -- CASA (op3(3 downto 2) = "11") then -- LDST/SWAP dci.enaddr := '1'; end if; when "10" => -- STD/LDST/SWAP/CASA dci.write := '1'; when others => null; end case; if (r.e.ctrl.trap or (v.x.ctrl.trap and not v.x.ctrl.annul)) = '1' then dci.enaddr := '0'; end if; if (CASAEN and (op3(5 downto 4) = "11")) then mcasa := '1'; end if; when others => null; end case; end if; if ((r.x.ctrl.rett and not r.x.ctrl.annul) = '1') then su := r.w.s.ps; else su := r.w.s.s; end if; if su = '1' then dci.asi := "00001011"; else dci.asi := "00001010"; end if; if (op3(4) = '1') and ((op3(5) = '0') or not CPEN) then dci.asi := r.e.ctrl.inst(12 downto 5); end if; end; procedure fpstdata(r : in registers; edata, eres : in word; fpstdata : in std_logic_vector(31 downto 0); edata2, eres2 : out word) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); begin edata2 := edata; eres2 := eres; op := r.e.ctrl.inst(31 downto 30); op3 := r.e.ctrl.inst(24 downto 19); if FPEN then if FPEN and (op = LDST) and ((op3(5 downto 4) & op3(2)) = "101") and (r.e.ctrl.cnt /= "00") then edata2 := fpstdata; eres2 := fpstdata; end if; end if; if CASAEN and (r.m.casa = '1') and (r.e.ctrl.cnt = "10") then edata2 := r.e.op1; eres2 := r.e.op1; end if; end; function ld_align(data : dcdtype; set : std_logic_vector(DSETMSB downto 0); size, laddr : std_logic_vector(1 downto 0); signed : std_ulogic) return word is variable align_data, rdata : word; begin align_data := data(conv_integer(set)); rdata := (others => '0'); case size is when "00" => -- byte read case laddr is when "00" => rdata(7 downto 0) := align_data(31 downto 24); if signed = '1' then rdata(31 downto 8) := (others => align_data(31)); end if; when "01" => rdata(7 downto 0) := align_data(23 downto 16); if signed = '1' then rdata(31 downto 8) := (others => align_data(23)); end if; when "10" => rdata(7 downto 0) := align_data(15 downto 8); if signed = '1' then rdata(31 downto 8) := (others => align_data(15)); end if; when others => rdata(7 downto 0) := align_data(7 downto 0); if signed = '1' then rdata(31 downto 8) := (others => align_data(7)); end if; end case; when "01" => -- half-word read if laddr(1) = '1' then rdata(15 downto 0) := align_data(15 downto 0); if signed = '1' then rdata(31 downto 15) := (others => align_data(15)); end if; else rdata(15 downto 0) := align_data(31 downto 16); if signed = '1' then rdata(31 downto 15) := (others => align_data(31)); end if; end if; when others => -- single and double word read rdata := align_data; end case; return(rdata); end; procedure mem_trap(r : registers; wpr : watchpoint_registers; annul, holdn : in std_ulogic; trapout, iflush, nullify, werrout : out std_ulogic; tt : out std_logic_vector(5 downto 0)) is variable cwp : std_logic_vector(NWINLOG2-1 downto 0); variable cwpx : std_logic_vector(5 downto NWINLOG2); variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable nalign_d : std_ulogic; variable trap, werr : std_ulogic; begin op := r.m.ctrl.inst(31 downto 30); op2 := r.m.ctrl.inst(24 downto 22); op3 := r.m.ctrl.inst(24 downto 19); cwpx := r.m.result(5 downto NWINLOG2); cwpx(5) := '0'; iflush := '0'; trap := r.m.ctrl.trap; nullify := annul; tt := r.m.ctrl.tt; werr := (dco.werr or r.m.werr) and not r.w.s.dwt; nalign_d := r.m.nalign or r.m.result(2); if (trap = '1') and (r.m.ctrl.pv = '1') then if op = LDST then nullify := '1'; end if; end if; if ((annul or trap) /= '1') and (r.m.ctrl.pv = '1') then if (werr and holdn) = '1' then trap := '1'; tt := TT_DSEX; werr := '0'; if op = LDST then nullify := '1'; end if; end if; end if; if ((annul or trap) /= '1') then case op is when FMT2 => case op2 is when FBFCC => if FPEN and (fpo.exc = '1') then trap := '1'; tt := TT_FPEXC; end if; when CBCCC => if CPEN and (cpo.exc = '1') then trap := '1'; tt := TT_CPEXC; end if; when others => null; end case; when FMT3 => case op3 is when WRPSR => if (orv(cwpx) = '1') then trap := '1'; tt := TT_IINST; end if; when UDIV | SDIV | UDIVCC | SDIVCC => if DIVEN then if r.m.divz = '1' then trap := '1'; tt := TT_DIV; end if; end if; when JMPL | RETT => if r.m.nalign = '1' then trap := '1'; tt := TT_UNALA; end if; when TADDCCTV | TSUBCCTV => if (notag = 0) and (r.m.icc(1) = '1') then trap := '1'; tt := TT_TAG; end if; when FLUSH => iflush := '1'; when FPOP1 | FPOP2 => if FPEN and (fpo.exc = '1') then trap := '1'; tt := TT_FPEXC; end if; when CPOP1 | CPOP2 => if CPEN and (cpo.exc = '1') then trap := '1'; tt := TT_CPEXC; end if; when others => null; end case; when LDST => if r.m.ctrl.cnt = "00" then case op3 is when LDDF | STDF | STDFQ => if FPEN then if nalign_d = '1' then trap := '1'; tt := TT_UNALA; nullify := '1'; elsif (fpo.exc and r.m.ctrl.pv) = '1' then trap := '1'; tt := TT_FPEXC; nullify := '1'; end if; end if; when LDDC | STDC | STDCQ => if CPEN then if nalign_d = '1' then trap := '1'; tt := TT_UNALA; nullify := '1'; elsif ((cpo.exc and r.m.ctrl.pv) = '1') then trap := '1'; tt := TT_CPEXC; nullify := '1'; end if; end if; when LDD | ISTD | LDDA | STDA => if r.m.result(2 downto 0) /= "000" then trap := '1'; tt := TT_UNALA; nullify := '1'; end if; when LDF | LDFSR | STFSR | STF => if FPEN and (r.m.nalign = '1') then trap := '1'; tt := TT_UNALA; nullify := '1'; elsif FPEN and ((fpo.exc and r.m.ctrl.pv) = '1') then trap := '1'; tt := TT_FPEXC; nullify := '1'; end if; when LDC | LDCSR | STCSR | STC => if CPEN and (r.m.nalign = '1') then trap := '1'; tt := TT_UNALA; nullify := '1'; elsif CPEN and ((cpo.exc and r.m.ctrl.pv) = '1') then trap := '1'; tt := TT_CPEXC; nullify := '1'; end if; when LD | LDA | ST | STA | SWAP | SWAPA | CASA => if r.m.result(1 downto 0) /= "00" then trap := '1'; tt := TT_UNALA; nullify := '1'; end if; when LDUH | LDUHA | LDSH | LDSHA | STH | STHA => if r.m.result(0) /= '0' then trap := '1'; tt := TT_UNALA; nullify := '1'; end if; when others => null; end case; for i in 1 to NWP loop if ((((wpr(i-1).load and not op3(2)) or (wpr(i-1).store and op3(2))) = '1') and (((wpr(i-1).addr xor r.m.result(31 downto 2)) and wpr(i-1).mask) = zero32(31 downto 2))) then trap := '1'; tt := TT_WATCH; nullify := '1'; end if; end loop; end if; when others => null; end case; end if; if (rstn = '0') or (r.x.rstate = dsu2) then werr := '0'; end if; trapout := trap; werrout := werr; end; procedure irq_trap(r : in registers; ir : in irestart_register; irl : in std_logic_vector(3 downto 0); annul : in std_ulogic; pv : in std_ulogic; trap : in std_ulogic; tt : in std_logic_vector(5 downto 0); nullify : in std_ulogic; irqen : out std_ulogic; irqen2 : out std_ulogic; nullify2 : out std_ulogic; trap2, ipend : out std_ulogic; tt2 : out std_logic_vector(5 downto 0)) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable pend : std_ulogic; begin nullify2 := nullify; trap2 := trap; tt2 := tt; op := r.m.ctrl.inst(31 downto 30); op3 := r.m.ctrl.inst(24 downto 19); irqen := '1'; irqen2 := r.m.irqen; if (annul or trap) = '0' then if ((op = FMT3) and (op3 = WRPSR)) then irqen := '0'; end if; end if; if (irl = "1111") or (irl > r.w.s.pil) then pend := r.m.irqen and r.m.irqen2 and r.w.s.et and not ir.pwd ; else pend := '0'; end if; ipend := pend; if ((not annul) and pv and (not trap) and pend) = '1' then trap2 := '1'; tt2 := "01" & irl; if op = LDST then nullify2 := '1'; end if; end if; end; procedure irq_intack(r : in registers; holdn : in std_ulogic; intack: out std_ulogic) is begin intack := '0'; if r.x.rstate = trap then if r.w.s.tt(7 downto 4) = "0001" then intack := '1'; end if; end if; end; -- write special registers procedure sp_write (r : registers; wpr : watchpoint_registers; s : out special_register_type; vwpr : out watchpoint_registers) is variable op : std_logic_vector(1 downto 0); variable op2 : std_logic_vector(2 downto 0); variable op3 : std_logic_vector(5 downto 0); variable rd : std_logic_vector(4 downto 0); variable i : integer range 0 to 3; begin op := r.x.ctrl.inst(31 downto 30); op2 := r.x.ctrl.inst(24 downto 22); op3 := r.x.ctrl.inst(24 downto 19); s := r.w.s; rd := r.x.ctrl.inst(29 downto 25); vwpr := wpr; case op is when FMT3 => case op3 is when WRY => if rd = "00000" then s.y := r.x.result; elsif MACEN and (rd = "10010") then s.asr18 := r.x.result; elsif (rd = "10001") then if bp = 2 then s.dbp := r.x.result(27); end if; s.dwt := r.x.result(14); if (svt = 1) then s.svt := r.x.result(13); end if; elsif rd(4 downto 3) = "11" then -- %ASR24 - %ASR31 case rd(2 downto 0) is when "000" => vwpr(0).addr := r.x.result(31 downto 2); vwpr(0).exec := r.x.result(0); when "001" => vwpr(0).mask := r.x.result(31 downto 2); vwpr(0).load := r.x.result(1); vwpr(0).store := r.x.result(0); when "010" => vwpr(1).addr := r.x.result(31 downto 2); vwpr(1).exec := r.x.result(0); when "011" => vwpr(1).mask := r.x.result(31 downto 2); vwpr(1).load := r.x.result(1); vwpr(1).store := r.x.result(0); when "100" => vwpr(2).addr := r.x.result(31 downto 2); vwpr(2).exec := r.x.result(0); when "101" => vwpr(2).mask := r.x.result(31 downto 2); vwpr(2).load := r.x.result(1); vwpr(2).store := r.x.result(0); when "110" => vwpr(3).addr := r.x.result(31 downto 2); vwpr(3).exec := r.x.result(0); when others => -- "111" vwpr(3).mask := r.x.result(31 downto 2); vwpr(3).load := r.x.result(1); vwpr(3).store := r.x.result(0); end case; end if; when WRPSR => s.cwp := r.x.result(NWINLOG2-1 downto 0); s.icc := r.x.result(23 downto 20); s.ec := r.x.result(13); if FPEN then s.ef := r.x.result(12); end if; s.pil := r.x.result(11 downto 8); s.s := r.x.result(7); s.ps := r.x.result(6); s.et := r.x.result(5); when WRWIM => s.wim := r.x.result(NWIN-1 downto 0); when WRTBR => s.tba := r.x.result(31 downto 12); when SAVE => if (not CWPOPT) and (r.w.s.cwp = CWPMIN) then s.cwp := CWPMAX; else s.cwp := r.w.s.cwp - 1 ; end if; when RESTORE => if (not CWPOPT) and (r.w.s.cwp = CWPMAX) then s.cwp := CWPMIN; else s.cwp := r.w.s.cwp + 1; end if; when RETT => if (not CWPOPT) and (r.w.s.cwp = CWPMAX) then s.cwp := CWPMIN; else s.cwp := r.w.s.cwp + 1; end if; s.s := r.w.s.ps; s.et := '1'; when others => null; end case; when others => null; end case; if r.x.ctrl.wicc = '1' then s.icc := r.x.icc; end if; if r.x.ctrl.wy = '1' then s.y := r.x.y; end if; if MACPIPE and (r.x.mac = '1') then s.asr18 := mulo.result(31 downto 0); s.y := mulo.result(63 downto 32); end if; end; function npc_find (r : registers) return std_logic_vector is variable npc : std_logic_vector(2 downto 0); begin npc := "011"; if r.m.ctrl.pv = '1' then npc := "000"; elsif r.e.ctrl.pv = '1' then npc := "001"; elsif r.a.ctrl.pv = '1' then npc := "010"; elsif r.d.pv = '1' then npc := "011"; elsif v8 /= 0 then npc := "100"; end if; return(npc); end; function npc_gen (r : registers) return word is variable npc : std_logic_vector(31 downto 0); begin npc := r.a.ctrl.pc(31 downto 2) & "00"; case r.x.npc is when "000" => npc(31 downto 2) := r.x.ctrl.pc(31 downto 2); when "001" => npc(31 downto 2) := r.m.ctrl.pc(31 downto 2); when "010" => npc(31 downto 2) := r.e.ctrl.pc(31 downto 2); when "011" => npc(31 downto 2) := r.a.ctrl.pc(31 downto 2); when others => if v8 /= 0 then npc(31 downto 2) := r.d.pc(31 downto 2); end if; end case; return(npc); end; procedure mul_res(r : registers; asr18in : word; result, y, asr18 : out word; icc : out std_logic_vector(3 downto 0)) is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); begin op := r.m.ctrl.inst(31 downto 30); op3 := r.m.ctrl.inst(24 downto 19); result := r.m.result; y := r.m.y; icc := r.m.icc; asr18 := asr18in; case op is when FMT3 => case op3 is when UMUL | SMUL => if MULEN then result := mulo.result(31 downto 0); y := mulo.result(63 downto 32); end if; when UMULCC | SMULCC => if MULEN then result := mulo.result(31 downto 0); icc := mulo.icc; y := mulo.result(63 downto 32); end if; when UMAC | SMAC => if MACEN and not MACPIPE then result := mulo.result(31 downto 0); asr18 := mulo.result(31 downto 0); y := mulo.result(63 downto 32); end if; when UDIV | SDIV => if DIVEN then result := divo.result(31 downto 0); end if; when UDIVCC | SDIVCC => if DIVEN then result := divo.result(31 downto 0); icc := divo.icc; end if; when others => null; end case; when others => null; end case; end; function powerdwn(r : registers; trap : std_ulogic; rp : pwd_register_type) return std_ulogic is variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable rd : std_logic_vector(4 downto 0); variable pd : std_ulogic; begin op := r.x.ctrl.inst(31 downto 30); op3 := r.x.ctrl.inst(24 downto 19); rd := r.x.ctrl.inst(29 downto 25); pd := '0'; if (not (r.x.ctrl.annul or trap) and r.x.ctrl.pv) = '1' then if ((op = FMT3) and (op3 = WRY) and (rd = "10011")) then pd := '1'; end if; pd := pd or rp.pwd; end if; return(pd); end; signal dummy : std_ulogic; signal cpu_index : std_logic_vector(3 downto 0); signal disasen : std_ulogic; begin BPRED <= '0' when bp = 0 else '1' when bp = 1 else not r.w.s.dbp; comb : process(ico, dco, rfo, r, wpr, ir, dsur, rstn, holdn, irqi, dbgi, fpo, cpo, tbo, mulo, divo, dummy, rp, BPRED) variable v : registers; variable vp : pwd_register_type; variable vwpr : watchpoint_registers; variable vdsu : dsu_registers; variable fe_pc, fe_npc : std_logic_vector(31 downto PCLOW); variable npc : std_logic_vector(31 downto PCLOW); variable de_raddr1, de_raddr2 : std_logic_vector(9 downto 0); variable de_rs2, de_rd : std_logic_vector(4 downto 0); variable de_hold_pc, de_branch, de_ldlock : std_ulogic; variable de_cwp, de_cwp2 : cwptype; variable de_inull : std_ulogic; variable de_ren1, de_ren2 : std_ulogic; variable de_wcwp : std_ulogic; variable de_inst : word; variable de_icc : std_logic_vector(3 downto 0); variable de_fbranch, de_cbranch : std_ulogic; variable de_rs1mod : std_ulogic; variable de_bpannul : std_ulogic; variable de_fins_hold : std_ulogic; variable de_iperr : std_ulogic; variable ra_op1, ra_op2 : word; variable ra_div : std_ulogic; variable ra_bpmiss : std_ulogic; variable ra_bpannul : std_ulogic; variable ex_jump, ex_link_pc : std_ulogic; variable ex_jump_address : pctype; variable ex_add_res : std_logic_vector(32 downto 0); variable ex_shift_res, ex_logic_res, ex_misc_res : word; variable ex_edata, ex_edata2 : word; variable ex_dci : dc_in_type; variable ex_force_a2, ex_load, ex_ymsb : std_ulogic; variable ex_op1, ex_op2, ex_result, ex_result2, ex_result3, mul_op2 : word; variable ex_shcnt : std_logic_vector(4 downto 0); variable ex_dsuen : std_ulogic; variable ex_ldbp2 : std_ulogic; variable ex_sari : std_ulogic; variable ex_bpmiss : std_ulogic; variable ex_cdata : std_logic_vector(31 downto 0); variable ex_mulop1, ex_mulop2 : std_logic_vector(32 downto 0); variable me_bp_res : word; variable me_inull, me_nullify, me_nullify2 : std_ulogic; variable me_iflush : std_ulogic; variable me_newtt : std_logic_vector(5 downto 0); variable me_asr18 : word; variable me_signed : std_ulogic; variable me_size, me_laddr : std_logic_vector(1 downto 0); variable me_icc : std_logic_vector(3 downto 0); variable xc_result : word; variable xc_df_result : word; variable xc_waddr : std_logic_vector(9 downto 0); variable xc_exception, xc_wreg : std_ulogic; variable xc_trap_address : pctype; variable xc_newtt, xc_vectt : std_logic_vector(7 downto 0); variable xc_trap : std_ulogic; variable xc_fpexack : std_ulogic; variable xc_rstn, xc_halt : std_ulogic; variable diagdata : word; variable tbufi : tracebuf_in_type; variable dbgm : std_ulogic; variable fpcdbgwr : std_ulogic; variable vfpi : fpc_in_type; variable dsign : std_ulogic; variable pwrd, sidle : std_ulogic; variable vir : irestart_register; variable xc_dflushl : std_ulogic; variable xc_dcperr : std_ulogic; variable st : std_ulogic; variable icnt, fcnt : std_ulogic; variable tbufcntx : std_logic_vector(TBUFBITS-1 downto 0); variable bpmiss : std_ulogic; begin v := r; vwpr := wpr; vdsu := dsur; vp := rp; xc_fpexack := '0'; sidle := '0'; fpcdbgwr := '0'; vir := ir; xc_rstn := rstn; ----------------------------------------------------------------------- -- EXCEPTION STAGE ----------------------------------------------------------------------- xc_exception := '0'; xc_halt := '0'; icnt := '0'; fcnt := '0'; xc_waddr := (others => '0'); xc_waddr(RFBITS-1 downto 0) := r.x.ctrl.rd(RFBITS-1 downto 0); xc_trap := r.x.mexc or r.x.ctrl.trap; v.x.nerror := rp.error; xc_dflushl := '0'; if r.x.mexc = '1' then xc_vectt := "00" & TT_DAEX; elsif r.x.ctrl.tt = TT_TICC then xc_vectt := '1' & r.x.result(6 downto 0); else xc_vectt := "00" & r.x.ctrl.tt; end if; if r.w.s.svt = '0' then xc_trap_address(31 downto 2) := r.w.s.tba & xc_vectt & "00"; else xc_trap_address(31 downto 2) := r.w.s.tba & "00000000" & "00"; end if; xc_trap_address(2 downto PCLOW) := (others => '0'); xc_wreg := '0'; v.x.annul_all := '0'; if (not r.x.ctrl.annul and r.x.ctrl.ld) = '1' then if (lddel = 2) then xc_result := ld_align(r.x.data, r.x.set, r.x.dci.size, r.x.laddr, r.x.dci.signed); else xc_result := r.x.data(0); end if; elsif MACEN and MACPIPE and ((not r.x.ctrl.annul and r.x.mac) = '1') then xc_result := mulo.result(31 downto 0); else xc_result := r.x.result; end if; xc_df_result := xc_result; if DBGUNIT then dbgm := dbgexc(r, dbgi, xc_trap, xc_vectt); if (dbgi.dsuen and dbgi.dbreak) = '0'then v.x.debug := '0'; end if; else dbgm := '0'; v.x.debug := '0'; end if; if PWRD2 then pwrd := powerdwn(r, xc_trap, rp); else pwrd := '0'; end if; case r.x.rstate is when run => if (dbgm ) /= '0' then v.x.annul_all := '1'; vir.addr := r.x.ctrl.pc; v.x.rstate := dsu1; v.x.debug := '1'; v.x.npc := npc_find(r); vdsu.tt := xc_vectt; vdsu.err := dbgerr(r, dbgi, xc_vectt); elsif (pwrd = '1') and (ir.pwd = '0') then v.x.annul_all := '1'; vir.addr := r.x.ctrl.pc; v.x.rstate := dsu1; v.x.npc := npc_find(r); vp.pwd := '1'; elsif (r.x.ctrl.annul or xc_trap) = '0' then xc_wreg := r.x.ctrl.wreg; sp_write (r, wpr, v.w.s, vwpr); vir.pwd := '0'; if (r.x.ctrl.pv and not r.x.debug) = '1' then icnt := holdn; if (r.x.ctrl.inst(31 downto 30) = FMT3) and ((r.x.ctrl.inst(24 downto 19) = FPOP1) or (r.x.ctrl.inst(24 downto 19) = FPOP2)) then fcnt := holdn; end if; end if; elsif ((not r.x.ctrl.annul) and xc_trap) = '1' then xc_exception := '1'; xc_result := r.x.ctrl.pc(31 downto 2) & "00"; xc_wreg := '1'; v.w.s.tt := xc_vectt; v.w.s.ps := r.w.s.s; v.w.s.s := '1'; v.x.annul_all := '1'; v.x.rstate := trap; xc_waddr := (others => '0'); xc_waddr(NWINLOG2 + 3 downto 0) := r.w.s.cwp & "0001"; v.x.npc := npc_find(r); fpexack(r, xc_fpexack); if r.w.s.et = '0' then -- v.x.rstate := dsu1; xc_wreg := '0'; vp.error := '1'; xc_wreg := '0'; end if; end if; when trap => xc_result := npc_gen(r); xc_wreg := '1'; xc_waddr := (others => '0'); xc_waddr(NWINLOG2 + 3 downto 0) := r.w.s.cwp & "0010"; if r.w.s.et = '1' then v.w.s.et := '0'; v.x.rstate := run; if (not CWPOPT) and (r.w.s.cwp = CWPMIN) then v.w.s.cwp := CWPMAX; else v.w.s.cwp := r.w.s.cwp - 1 ; end if; else v.x.rstate := dsu1; xc_wreg := '0'; vp.error := '1'; end if; when dsu1 => xc_exception := '1'; v.x.annul_all := '1'; xc_trap_address(31 downto PCLOW) := r.f.pc; if DBGUNIT or PWRD2 or (smp /= 0) then xc_trap_address(31 downto PCLOW) := ir.addr; vir.addr := npc_gen(r)(31 downto PCLOW); v.x.rstate := dsu2; end if; if DBGUNIT then v.x.debug := r.x.debug; end if; when dsu2 => xc_exception := '1'; v.x.annul_all := '1'; xc_trap_address(31 downto PCLOW) := r.f.pc; if DBGUNIT or PWRD2 or (smp /= 0) then sidle := (rp.pwd or rp.error) and ico.idle and dco.idle and not r.x.debug; if DBGUNIT then if dbgi.reset = '1' then if smp /=0 then vp.pwd := not irqi.run; else vp.pwd := '0'; end if; vp.error := '0'; end if; if (dbgi.dsuen and dbgi.dbreak) = '1'then v.x.debug := '1'; end if; diagwr(r, dsur, ir, dbgi, wpr, v.w.s, vwpr, vdsu.asi, xc_trap_address, vir.addr, vdsu.tbufcnt, xc_wreg, xc_waddr, xc_result, fpcdbgwr); xc_halt := dbgi.halt; end if; if r.x.ipend = '1' then vp.pwd := '0'; end if; if (rp.error or rp.pwd or r.x.debug or xc_halt) = '0' then v.x.rstate := run; v.x.annul_all := '0'; vp.error := '0'; xc_trap_address(31 downto PCLOW) := ir.addr; v.x.debug := '0'; vir.pwd := '1'; end if; if (smp /= 0) and (irqi.rst = '1') then vp.pwd := '0'; vp.error := '0'; end if; end if; when others => end case; dci.flushl <= xc_dflushl; irq_intack(r, holdn, v.x.intack); itrace(r, dsur, vdsu, xc_result, xc_exception, dbgi, rp.error, xc_trap, tbufcntx, tbufi, '0', xc_dcperr); vdsu.tbufcnt := tbufcntx; v.w.except := xc_exception; v.w.result := xc_result; if (r.x.rstate = dsu2) then v.w.except := '0'; end if; v.w.wa := xc_waddr(RFBITS-1 downto 0); v.w.wreg := xc_wreg and holdn; rfi.diag <= dco.testen & dco.scanen & "00"; rfi.wdata <= xc_result; rfi.waddr <= xc_waddr; irqo.intack <= r.x.intack and holdn; irqo.irl <= r.w.s.tt(3 downto 0); irqo.pwd <= rp.pwd; irqo.fpen <= r.w.s.ef; irqo.idle <= '0'; dbgo.halt <= xc_halt; dbgo.pwd <= rp.pwd; dbgo.idle <= sidle; dbgo.icnt <= icnt; dbgo.fcnt <= fcnt; dbgo.optype <= r.x.ctrl.inst(31 downto 30) & r.x.ctrl.inst(24 downto 21); dci.intack <= r.x.intack and holdn; if (not RESET_ALL) and (xc_rstn = '0') then v.w.except := RRES.w.except; v.w.s.et := RRES.w.s.et; v.w.s.svt := RRES.w.s.svt; v.w.s.dwt := RRES.w.s.dwt; v.w.s.ef := RRES.w.s.ef; if need_extra_sync_reset(fabtech) /= 0 then v.w.s.cwp := RRES.w.s.cwp; v.w.s.icc := RRES.w.s.icc; end if; v.w.s.dbp := RRES.w.s.dbp; v.x.ipmask := RRES.x.ipmask; v.w.s.tba := RRES.w.s.tba; v.x.annul_all := RRES.x.annul_all; v.x.rstate := RRES.x.rstate; vir.pwd := IRES.pwd; vp.pwd := PRES.pwd; v.x.debug := RRES.x.debug; v.x.nerror := RRES.x.nerror; if svt = 1 then v.w.s.tt := RRES.w.s.tt; end if; if DBGUNIT then if (dbgi.dsuen and dbgi.dbreak) = '1' then v.x.rstate := dsu1; v.x.debug := '1'; end if; end if; if (index /= 0) and (irqi.run = '0') and (rstn = '0') then v.x.rstate := dsu1; vp.pwd := '1'; end if; v.x.npc := "100"; end if; -- kill off unused regs if not FPEN then v.w.s.ef := '0'; end if; if not CPEN then v.w.s.ec := '0'; end if; ----------------------------------------------------------------------- -- MEMORY STAGE ----------------------------------------------------------------------- v.x.ctrl := r.m.ctrl; v.x.dci := r.m.dci; v.x.ctrl.rett := r.m.ctrl.rett and not r.m.ctrl.annul; v.x.mac := r.m.mac; v.x.laddr := r.m.result(1 downto 0); v.x.ctrl.annul := r.m.ctrl.annul or v.x.annul_all; st := '0'; if CASAEN and (r.m.casa = '1') and (r.m.ctrl.cnt = "00") then v.x.ctrl.inst(4 downto 0) := r.a.ctrl.inst(4 downto 0); -- restore rs2 for trace log end if; mul_res(r, v.w.s.asr18, v.x.result, v.x.y, me_asr18, me_icc); mem_trap(r, wpr, v.x.ctrl.annul, holdn, v.x.ctrl.trap, me_iflush, me_nullify, v.m.werr, v.x.ctrl.tt); me_newtt := v.x.ctrl.tt; irq_trap(r, ir, irqi.irl, v.x.ctrl.annul, v.x.ctrl.pv, v.x.ctrl.trap, me_newtt, me_nullify, v.m.irqen, v.m.irqen2, me_nullify2, v.x.ctrl.trap, v.x.ipend, v.x.ctrl.tt); if (r.m.ctrl.ld or st or not dco.mds) = '1' then for i in 0 to dsets-1 loop v.x.data(i) := dco.data(i); end loop; v.x.set := dco.set(DSETMSB downto 0); if dco.mds = '0' then me_size := r.x.dci.size; me_laddr := r.x.laddr; me_signed := r.x.dci.signed; else me_size := v.x.dci.size; me_laddr := v.x.laddr; me_signed := v.x.dci.signed; end if; if (lddel /= 2) then v.x.data(0) := ld_align(v.x.data, v.x.set, me_size, me_laddr, me_signed); end if; end if; if (not RESET_ALL) and (is_fpga(fabtech) = 0) and (xc_rstn = '0') then v.x.data := (others => (others => '0')); --v.x.ldc := '0'; end if; v.x.mexc := dco.mexc; v.x.icc := me_icc; v.x.ctrl.wicc := r.m.ctrl.wicc and not v.x.annul_all; if MACEN and ((v.x.ctrl.annul or v.x.ctrl.trap) = '0') then v.w.s.asr18 := me_asr18; end if; if (r.x.rstate = dsu2) then me_nullify2 := '0'; v.x.set := dco.set(DSETMSB downto 0); end if; if (not RESET_ALL) and (xc_rstn = '0') then v.x.ctrl.trap := '0'; v.x.ctrl.annul := '1'; end if; dci.maddress <= r.m.result; dci.enaddr <= r.m.dci.enaddr; dci.asi <= r.m.dci.asi; dci.size <= r.m.dci.size; dci.lock <= (r.m.dci.lock and not r.m.ctrl.annul); dci.read <= r.m.dci.read; dci.write <= r.m.dci.write; dci.flush <= me_iflush; dci.dsuen <= r.m.dci.dsuen; dci.msu <= r.m.su; dci.esu <= r.e.su; dbgo.ipend <= v.x.ipend; ----------------------------------------------------------------------- -- EXECUTE STAGE ----------------------------------------------------------------------- v.m.ctrl := r.e.ctrl; ex_op1 := r.e.op1; ex_op2 := r.e.op2; v.m.ctrl.rett := r.e.ctrl.rett and not r.e.ctrl.annul; v.m.ctrl.wreg := r.e.ctrl.wreg and not v.x.annul_all; ex_ymsb := r.e.ymsb; mul_op2 := ex_op2; ex_shcnt := r.e.shcnt; v.e.cwp := r.a.cwp; ex_sari := r.e.sari; v.m.su := r.e.su; if MULTYPE = 3 then v.m.mul := r.e.mul; else v.m.mul := '0'; end if; if lddel = 1 then if r.e.ldbp1 = '1' then ex_op1 := r.x.data(0); ex_sari := r.x.data(0)(31) and r.e.ctrl.inst(19) and r.e.ctrl.inst(20); end if; if r.e.ldbp2 = '1' then ex_op2 := r.x.data(0); ex_ymsb := r.x.data(0)(0); mul_op2 := ex_op2; ex_shcnt := r.x.data(0)(4 downto 0); if r.e.invop2 = '1' then ex_op2 := not ex_op2; ex_shcnt := not ex_shcnt; end if; end if; end if; ex_add_res := (ex_op1 & '1') + (ex_op2 & r.e.alucin); if ex_add_res(2 downto 1) = "00" then v.m.nalign := '0'; else v.m.nalign := '1'; end if; dcache_gen(r, v, ex_dci, ex_link_pc, ex_jump, ex_force_a2, ex_load, v.m.casa); ex_jump_address := ex_add_res(32 downto PCLOW+1); logic_op(r, ex_op1, ex_op2, v.x.y, ex_ymsb, ex_logic_res, v.m.y); ex_shift_res := shift(r, ex_op1, ex_op2, ex_shcnt, ex_sari); misc_op(r, wpr, ex_op1, ex_op2, xc_df_result, v.x.y, ex_misc_res, ex_edata); ex_add_res(3):= ex_add_res(3) or ex_force_a2; alu_select(r, ex_add_res, ex_op1, ex_op2, ex_shift_res, ex_logic_res, ex_misc_res, ex_result, me_icc, v.m.icc, v.m.divz, v.m.casaz); dbg_cache(holdn, dbgi, r, dsur, ex_result, ex_dci, ex_result2, v.m.dci); fpstdata(r, ex_edata, ex_result2, fpo.data, ex_edata2, ex_result3); v.m.result := ex_result3; cwp_ex(r, v.m.wcwp); if CASAEN and (r.e.ctrl.cnt = "10") and ((r.m.casa and not v.m.casaz) = '1') then me_nullify2 := '1'; end if; dci.nullify <= me_nullify2; ex_mulop1 := (ex_op1(31) and r.e.ctrl.inst(19)) & ex_op1; ex_mulop2 := (mul_op2(31) and r.e.ctrl.inst(19)) & mul_op2; if is_fpga(fabtech) = 0 and (r.e.mul = '0') then -- power-save for mul -- if (r.e.mul = '0') then ex_mulop1 := (others => '0'); ex_mulop2 := (others => '0'); end if; v.m.ctrl.annul := v.m.ctrl.annul or v.x.annul_all; v.m.ctrl.wicc := r.e.ctrl.wicc and not v.x.annul_all; v.m.mac := r.e.mac; if (DBGUNIT and (r.x.rstate = dsu2)) then v.m.ctrl.ld := '1'; end if; dci.eenaddr <= v.m.dci.enaddr; dci.eaddress <= ex_add_res(32 downto 1); dci.edata <= ex_edata2; bp_miss_ex(r, r.m.icc, ex_bpmiss, ra_bpannul); ----------------------------------------------------------------------- -- REGFILE STAGE ----------------------------------------------------------------------- v.e.ctrl := r.a.ctrl; v.e.jmpl := r.a.jmpl and not r.a.ctrl.trap; v.e.ctrl.annul := r.a.ctrl.annul or ra_bpannul or v.x.annul_all; v.e.ctrl.rett := r.a.ctrl.rett and not r.a.ctrl.annul and not r.a.ctrl.trap; v.e.ctrl.wreg := r.a.ctrl.wreg and not (ra_bpannul or v.x.annul_all); v.e.su := r.a.su; v.e.et := r.a.et; v.e.ctrl.wicc := r.a.ctrl.wicc and not (ra_bpannul or v.x.annul_all); v.e.rfe1 := r.a.rfe1; v.e.rfe2 := r.a.rfe2; exception_detect(r, wpr, dbgi, r.a.ctrl.trap, r.a.ctrl.tt, v.e.ctrl.trap, v.e.ctrl.tt); op_mux(r, rfo.data1, ex_result3, v.x.result, xc_df_result, zero32, r.a.rsel1, v.e.ldbp1, ra_op1, '0'); op_mux(r, rfo.data2, ex_result3, v.x.result, xc_df_result, r.a.imm, r.a.rsel2, ex_ldbp2, ra_op2, '1'); alu_op(r, ra_op1, ra_op2, v.m.icc, v.m.y(0), ex_ldbp2, v.e.op1, v.e.op2, v.e.aluop, v.e.alusel, v.e.aluadd, v.e.shcnt, v.e.sari, v.e.shleft, v.e.ymsb, v.e.mul, ra_div, v.e.mulstep, v.e.mac, v.e.ldbp2, v.e.invop2 ); cin_gen(r, v.m.icc(0), v.e.alucin); bp_miss_ra(r, ra_bpmiss, de_bpannul); v.e.bp := r.a.bp and not ra_bpmiss; ----------------------------------------------------------------------- -- DECODE STAGE ----------------------------------------------------------------------- if ISETS > 1 then de_inst := r.d.inst(conv_integer(r.d.set)); else de_inst := r.d.inst(0); end if; de_icc := r.m.icc; v.a.cwp := r.d.cwp; su_et_select(r, v.w.s.ps, v.w.s.s, v.w.s.et, v.a.su, v.a.et); wicc_y_gen(de_inst, v.a.ctrl.wicc, v.a.ctrl.wy); cwp_ctrl(r, v.w.s.wim, de_inst, de_cwp, v.a.wovf, v.a.wunf, de_wcwp); if CASAEN and (de_inst(31 downto 30) = LDST) and (de_inst(24 downto 19) = CASA) then case r.d.cnt is when "00" | "01" => de_inst(4 downto 0) := "00000"; -- rs2=0 when others => end case; end if; rs1_gen(r, de_inst, v.a.rs1, de_rs1mod); de_rs2 := de_inst(4 downto 0); de_raddr1 := (others => '0'); de_raddr2 := (others => '0'); if RS1OPT then if de_rs1mod = '1' then regaddr(r.d.cwp, de_inst(29 downto 26) & v.a.rs1(0), de_raddr1(RFBITS-1 downto 0)); else regaddr(r.d.cwp, de_inst(18 downto 15) & v.a.rs1(0), de_raddr1(RFBITS-1 downto 0)); end if; else regaddr(r.d.cwp, v.a.rs1, de_raddr1(RFBITS-1 downto 0)); end if; regaddr(r.d.cwp, de_rs2, de_raddr2(RFBITS-1 downto 0)); v.a.rfa1 := de_raddr1(RFBITS-1 downto 0); v.a.rfa2 := de_raddr2(RFBITS-1 downto 0); rd_gen(r, de_inst, v.a.ctrl.wreg, v.a.ctrl.ld, de_rd); regaddr(de_cwp, de_rd, v.a.ctrl.rd); fpbranch(de_inst, fpo.cc, de_fbranch); fpbranch(de_inst, cpo.cc, de_cbranch); v.a.imm := imm_data(r, de_inst); de_iperr := '0'; lock_gen(r, de_rs2, de_rd, v.a.rfa1, v.a.rfa2, v.a.ctrl.rd, de_inst, fpo.ldlock, v.e.mul, ra_div, de_wcwp, v.a.ldcheck1, v.a.ldcheck2, de_ldlock, v.a.ldchkra, v.a.ldchkex, v.a.bp, v.a.nobp, de_fins_hold, de_iperr); ic_ctrl(r, de_inst, v.x.annul_all, de_ldlock, branch_true(de_icc, de_inst), de_fbranch, de_cbranch, fpo.ccv, cpo.ccv, v.d.cnt, v.d.pc, de_branch, v.a.ctrl.annul, v.d.annul, v.a.jmpl, de_inull, v.d.pv, v.a.ctrl.pv, de_hold_pc, v.a.ticc, v.a.ctrl.rett, v.a.mulstart, v.a.divstart, ra_bpmiss, ex_bpmiss, de_iperr); v.a.bp := v.a.bp and not v.a.ctrl.annul; v.a.nobp := v.a.nobp and not v.a.ctrl.annul; v.a.ctrl.inst := de_inst; cwp_gen(r, v, v.a.ctrl.annul, de_wcwp, de_cwp, v.d.cwp); v.d.inull := ra_inull_gen(r, v); op_find(r, v.a.ldchkra, v.a.ldchkex, v.a.rs1, v.a.rfa1, false, v.a.rfe1, v.a.rsel1, v.a.ldcheck1); op_find(r, v.a.ldchkra, v.a.ldchkex, de_rs2, v.a.rfa2, imm_select(de_inst), v.a.rfe2, v.a.rsel2, v.a.ldcheck2); v.a.ctrl.wicc := v.a.ctrl.wicc and (not v.a.ctrl.annul) ; v.a.ctrl.wreg := v.a.ctrl.wreg and (not v.a.ctrl.annul) ; v.a.ctrl.rett := v.a.ctrl.rett and (not v.a.ctrl.annul) ; v.a.ctrl.wy := v.a.ctrl.wy and (not v.a.ctrl.annul) ; v.a.ctrl.trap := r.d.mexc ; v.a.ctrl.tt := "000000"; if r.d.mexc = '1' then v.a.ctrl.tt := "000001"; end if; v.a.ctrl.pc := r.d.pc; v.a.ctrl.cnt := r.d.cnt; v.a.step := r.d.step; if holdn = '0' then de_raddr1(RFBITS-1 downto 0) := r.a.rfa1; de_raddr2(RFBITS-1 downto 0) := r.a.rfa2; de_ren1 := r.a.rfe1; de_ren2 := r.a.rfe2; else de_ren1 := v.a.rfe1; de_ren2 := v.a.rfe2; end if; if DBGUNIT then if (dbgi.denable = '1') and (r.x.rstate = dsu2) then de_raddr1(RFBITS-1 downto 0) := dbgi.daddr(RFBITS+1 downto 2); de_ren1 := '1'; de_raddr2 := de_raddr1; de_ren2 := '1'; end if; v.d.step := dbgi.step and not r.d.annul; end if; rfi.wren <= (xc_wreg and holdn) and not dco.scanen; rfi.raddr1 <= de_raddr1; rfi.raddr2 <= de_raddr2; rfi.ren1 <= de_ren1 and not dco.scanen; rfi.ren2 <= de_ren2 and not dco.scanen; ici.inull <= de_inull ; ici.flush <= me_iflush; v.d.divrdy := divo.nready; ici.fline <= r.x.ctrl.pc(31 downto 3); dbgo.bpmiss <= bpmiss and holdn; if (xc_rstn = '0') then v.d.cnt := (others => '0'); if need_extra_sync_reset(fabtech) /= 0 then v.d.cwp := (others => '0'); end if; end if; ----------------------------------------------------------------------- -- FETCH STAGE ----------------------------------------------------------------------- bpmiss := ex_bpmiss or ra_bpmiss; npc := r.f.pc; fe_pc := r.f.pc; if ra_bpmiss = '1' then fe_pc := r.d.pc; end if; if ex_bpmiss = '1' then fe_pc := r.a.ctrl.pc; end if; fe_npc := zero32(31 downto PCLOW); fe_npc(31 downto 2) := fe_pc(31 downto 2) + 1; -- Address incrementer if (xc_rstn = '0') then if (not RESET_ALL) then v.f.pc := (others => '0'); v.f.branch := '0'; if DYNRST then v.f.pc(31 downto 12) := irqi.rstvec; else v.f.pc(31 downto 12) := conv_std_logic_vector(rstaddr, 20); end if; end if; elsif xc_exception = '1' then -- exception v.f.branch := '1'; v.f.pc := xc_trap_address; npc := v.f.pc; elsif de_hold_pc = '1' then v.f.pc := r.f.pc; v.f.branch := r.f.branch; if bpmiss = '1' then v.f.pc := fe_npc; v.f.branch := '1'; npc := v.f.pc; elsif ex_jump = '1' then v.f.pc := ex_jump_address; v.f.branch := '1'; npc := v.f.pc; end if; elsif (ex_jump and not bpmiss) = '1' then v.f.pc := ex_jump_address; v.f.branch := '1'; npc := v.f.pc; elsif (de_branch and not bpmiss ) = '1' then v.f.pc := branch_address(de_inst, r.d.pc); v.f.branch := '1'; npc := v.f.pc; else v.f.branch := bpmiss; v.f.pc := fe_npc; npc := v.f.pc; end if; ici.dpc <= r.d.pc(31 downto 2) & "00"; ici.fpc <= r.f.pc(31 downto 2) & "00"; ici.rpc <= npc(31 downto 2) & "00"; ici.fbranch <= r.f.branch; ici.rbranch <= v.f.branch; ici.su <= v.a.su; if (ico.mds and de_hold_pc) = '0' then for i in 0 to isets-1 loop v.d.inst(i) := ico.data(i); -- latch instruction end loop; v.d.set := ico.set(ISETMSB downto 0); -- latch instruction v.d.mexc := ico.mexc; -- latch instruction end if; ----------------------------------------------------------------------- ----------------------------------------------------------------------- if DBGUNIT then -- DSU diagnostic read diagread(dbgi, r, dsur, ir, wpr, dco, tbo, diagdata); diagrdy(dbgi.denable, dsur, r.m.dci, dco.mds, ico, vdsu.crdy); end if; ----------------------------------------------------------------------- -- OUTPUTS ----------------------------------------------------------------------- rin <= v; wprin <= vwpr; dsuin <= vdsu; irin <= vir; muli.start <= r.a.mulstart and not r.a.ctrl.annul and not r.a.ctrl.trap and not ra_bpannul; muli.signed <= r.e.ctrl.inst(19); muli.op1 <= ex_mulop1; --(ex_op1(31) and r.e.ctrl.inst(19)) & ex_op1; muli.op2 <= ex_mulop2; --(mul_op2(31) and r.e.ctrl.inst(19)) & mul_op2; muli.mac <= r.e.ctrl.inst(24); if MACPIPE then muli.acc(39 downto 32) <= r.w.s.y(7 downto 0); else muli.acc(39 downto 32) <= r.x.y(7 downto 0); end if; muli.acc(31 downto 0) <= r.w.s.asr18; muli.flush <= r.x.annul_all; divi.start <= r.a.divstart and not r.a.ctrl.annul and not r.a.ctrl.trap and not ra_bpannul; divi.signed <= r.e.ctrl.inst(19); divi.flush <= r.x.annul_all; divi.op1 <= (ex_op1(31) and r.e.ctrl.inst(19)) & ex_op1; divi.op2 <= (ex_op2(31) and r.e.ctrl.inst(19)) & ex_op2; if (r.a.divstart and not r.a.ctrl.annul) = '1' then dsign := r.a.ctrl.inst(19); else dsign := r.e.ctrl.inst(19); end if; divi.y <= (r.m.y(31) and dsign) & r.m.y; rpin <= vp; if DBGUNIT then dbgo.dsu <= '1'; dbgo.dsumode <= r.x.debug; dbgo.crdy <= dsur.crdy(2); dbgo.data <= diagdata; if TRACEBUF then tbi <= tbufi; else tbi.addr <= (others => '0'); tbi.data <= (others => '0'); tbi.enable <= '0'; tbi.write <= (others => '0'); tbi.diag <= "0000"; end if; else dbgo.dsu <= '0'; dbgo.data <= (others => '0'); dbgo.crdy <= '0'; dbgo.dsumode <= '0'; tbi.addr <= (others => '0'); tbi.data <= (others => '0'); tbi.enable <= '0'; tbi.write <= (others => '0'); tbi.diag <= "0000"; end if; dbgo.error <= dummy and not r.x.nerror; dbgo.wbhold <= '0'; --dco.wbhold; dbgo.su <= r.w.s.s; dbgo.istat <= ('0', '0', '0', '0'); dbgo.dstat <= ('0', '0', '0', '0'); if FPEN then if (r.x.rstate = dsu2) then vfpi.flush := '1'; else vfpi.flush := v.x.annul_all and holdn; end if; vfpi.exack := xc_fpexack; vfpi.a_rs1 := r.a.rs1; vfpi.d.inst := de_inst; vfpi.d.cnt := r.d.cnt; vfpi.d.annul := v.x.annul_all or de_bpannul or r.d.annul or de_fins_hold ; vfpi.d.trap := r.d.mexc; vfpi.d.pc(1 downto 0) := (others => '0'); vfpi.d.pc(31 downto PCLOW) := r.d.pc(31 downto PCLOW); vfpi.d.pv := r.d.pv; vfpi.a.pc(1 downto 0) := (others => '0'); vfpi.a.pc(31 downto PCLOW) := r.a.ctrl.pc(31 downto PCLOW); vfpi.a.inst := r.a.ctrl.inst; vfpi.a.cnt := r.a.ctrl.cnt; vfpi.a.trap := r.a.ctrl.trap; vfpi.a.annul := r.a.ctrl.annul or (ex_bpmiss and r.e.ctrl.inst(29)) ; vfpi.a.pv := r.a.ctrl.pv; vfpi.e.pc(1 downto 0) := (others => '0'); vfpi.e.pc(31 downto PCLOW) := r.e.ctrl.pc(31 downto PCLOW); vfpi.e.inst := r.e.ctrl.inst; vfpi.e.cnt := r.e.ctrl.cnt; vfpi.e.trap := r.e.ctrl.trap; vfpi.e.annul := r.e.ctrl.annul; vfpi.e.pv := r.e.ctrl.pv; vfpi.m.pc(1 downto 0) := (others => '0'); vfpi.m.pc(31 downto PCLOW) := r.m.ctrl.pc(31 downto PCLOW); vfpi.m.inst := r.m.ctrl.inst; vfpi.m.cnt := r.m.ctrl.cnt; vfpi.m.trap := r.m.ctrl.trap; vfpi.m.annul := r.m.ctrl.annul; vfpi.m.pv := r.m.ctrl.pv; vfpi.x.pc(1 downto 0) := (others => '0'); vfpi.x.pc(31 downto PCLOW) := r.x.ctrl.pc(31 downto PCLOW); vfpi.x.inst := r.x.ctrl.inst; vfpi.x.cnt := r.x.ctrl.cnt; vfpi.x.trap := xc_trap; vfpi.x.annul := r.x.ctrl.annul; vfpi.x.pv := r.x.ctrl.pv; if (lddel = 2) then vfpi.lddata := r.x.data(conv_integer(r.x.set)); else vfpi.lddata := r.x.data(0); end if; if (r.x.rstate = dsu2) then vfpi.dbg.enable := dbgi.denable; else vfpi.dbg.enable := '0'; end if; vfpi.dbg.write := fpcdbgwr; vfpi.dbg.fsr := dbgi.daddr(22); -- IU reg access vfpi.dbg.addr := dbgi.daddr(6 downto 2); vfpi.dbg.data := dbgi.ddata; fpi <= vfpi; cpi <= vfpi; -- dummy, just to kill some warnings ... end if; end process; preg : process (sclk) begin if rising_edge(sclk) then rp <= rpin; if rstn = '0' then rp.error <= PRES.error; if RESET_ALL then if (index /= 0) and (irqi.run = '0') then rp.pwd <= '1'; else rp.pwd <= '0'; end if; end if; end if; end if; end process; reg : process (clk) begin if rising_edge(clk) then if (holdn = '1') then r <= rin; else r.x.ipend <= rin.x.ipend; r.m.werr <= rin.m.werr; if (holdn or ico.mds) = '0' then r.d.inst <= rin.d.inst; r.d.mexc <= rin.d.mexc; r.d.set <= rin.d.set; end if; if (holdn or dco.mds) = '0' then r.x.data <= rin.x.data; r.x.mexc <= rin.x.mexc; r.x.set <= rin.x.set; end if; end if; if rstn = '0' then if RESET_ALL then r <= RRES; if DYNRST then r.f.pc(31 downto 12) <= irqi.rstvec; r.w.s.tba <= irqi.rstvec; end if; if DBGUNIT then if (dbgi.dsuen and dbgi.dbreak) = '1' then r.x.rstate <= dsu1; r.x.debug <= '1'; end if; end if; if (index /= 0) and irqi.run = '0' then r.x.rstate <= dsu1; end if; else r.w.s.s <= '1'; r.w.s.ps <= '1'; if need_extra_sync_reset(fabtech) /= 0 then r.d.inst <= (others => (others => '0')); r.x.mexc <= '0'; end if; end if; end if; end if; end process; dsugen : if DBGUNIT generate dsureg : process(clk) begin if rising_edge(clk) then if holdn = '1' then dsur <= dsuin; else dsur.crdy <= dsuin.crdy; end if; if rstn = '0' then if RESET_ALL then dsur <= DRES; elsif need_extra_sync_reset(fabtech) /= 0 then dsur.err <= '0'; dsur.tbufcnt <= (others => '0'); dsur.tt <= (others => '0'); dsur.asi <= (others => '0'); dsur.crdy <= (others => '0'); end if; end if; end if; end process; end generate; nodsugen : if not DBGUNIT generate dsur.err <= '0'; dsur.tbufcnt <= (others => '0'); dsur.tt <= (others => '0'); dsur.asi <= (others => '0'); dsur.crdy <= (others => '0'); end generate; irreg : if DBGUNIT or PWRD2 generate dsureg : process(clk) begin if rising_edge(clk) then if holdn = '1' then ir <= irin; end if; if RESET_ALL and rstn = '0' then ir <= IRES; end if; end if; end process; end generate; nirreg : if not (DBGUNIT or PWRD2 ) generate ir.pwd <= '0'; ir.addr <= (others => '0'); end generate; wpgen : for i in 0 to 3 generate wpg0 : if nwp > i generate wpreg : process(clk) begin if rising_edge(clk) then if holdn = '1' then wpr(i) <= wprin(i); end if; if rstn = '0' then if RESET_ALL then wpr(i) <= wpr_none; else wpr(i).exec <= '0'; wpr(i).load <= '0'; wpr(i).store <= '0'; end if; end if; end if; end process; end generate; wpg1 : if nwp <= i generate wpr(i) <= wpr_none; end generate; end generate; -- pragma translate_off trc : process(clk) variable valid : boolean; variable op : std_logic_vector(1 downto 0); variable op3 : std_logic_vector(5 downto 0); variable fpins, fpld : boolean; begin if (fpu /= 0) then op := r.x.ctrl.inst(31 downto 30); op3 := r.x.ctrl.inst(24 downto 19); fpins := (op = FMT3) and ((op3 = FPOP1) or (op3 = FPOP2)); fpld := (op = LDST) and ((op3 = LDF) or (op3 = LDDF) or (op3 = LDFSR)); else fpins := false; fpld := false; end if; valid := (((not r.x.ctrl.annul) and r.x.ctrl.pv) = '1') and (not ((fpins or fpld) and (r.x.ctrl.trap = '0'))); valid := valid and (holdn = '1'); if (disas = 1) and rising_edge(clk) and (rstn = '1') then print_insn (index, r.x.ctrl.pc(31 downto 2) & "00", r.x.ctrl.inst, rin.w.result, valid, r.x.ctrl.trap = '1', rin.w.wreg = '1', rin.x.ipmask = '1'); end if; end process; -- pragma translate_on dis0 : if disas < 2 generate dummy <= '1'; end generate; dis2 : if disas > 1 generate disasen <= '1' when disas /= 0 else '0'; cpu_index <= conv_std_logic_vector(index, 4); x0 : cpu_disasx port map (clk, rstn, dummy, r.x.ctrl.inst, r.x.ctrl.pc(31 downto 2), rin.w.result, cpu_index, rin.w.wreg, r.x.ctrl.annul, holdn, r.x.ctrl.pv, r.x.ctrl.trap, disasen); end generate; end;
gpl-2.0
cc28a58ecf7036919a44f3364504b216
0.513632
3.126139
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_timer_v2_0/3147922d/hdl/src/vhdl/tc_types.vhd
10
6,731
------------------------------------------------------------------------------- -- TC_TYPES - package ------------------------------------------------------------------------------- -- -- *************************************************************************** -- DISCLAIMER OF LIABILITY -- -- This file contains proprietary and confidential information of -- Xilinx, Inc. ("Xilinx"), that is distributed under a license -- from Xilinx, and may be used, copied and/or disclosed only -- pursuant to the terms of a valid license agreement with Xilinx. -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION -- ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -- EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT -- LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT, -- MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx -- does not warrant that functions included in the Materials will -- meet the requirements of Licensee, or that the operation of the -- Materials will be uninterrupted or error-free, or that defects -- in the Materials will be corrected. Furthermore, Xilinx does -- not warrant or make any representations regarding use, or the -- results of the use, of the Materials in terms of correctness, -- accuracy, reliability or otherwise. -- -- Xilinx products are not designed or intended to be fail-safe, -- or for use in any application requiring fail-safe performance, -- such as life-support or safety devices or systems, Class III -- medical devices, nuclear facilities, applications related to -- the deployment of airbags, or any other applications that could -- lead to death, personal injury or severe property or -- environmental damage (individually and collectively, "critical -- applications"). Customer assumes the sole risk and liability -- of any use of Xilinx products in critical applications, -- subject only to applicable laws and regulations governing -- limitations on product liability. -- -- Copyright 2001, 2002, 2003, 2004, 2008, 2009 Xilinx, Inc. -- All rights reserved. -- -- This disclaimer and copyright notice must be retained as part -- of this file at all times. -- *************************************************************************** -- ------------------------------------------------------------------------------- -- Filename :tc_types.vhd -- Company :Xilinx -- Version :v2.0 -- Description :Type definitions for Timer/Counter -- Standard :VHDL-93 -- ------------------------------------------------------------------------------- -- Structure: -- -- tc_types.vhd ------------------------------------------------------------------------------- -- ^^^^^^ -- Author: BSB -- History: -- BSB 03/18/2010 -- Ceated the version v1.00.a -- ^^^^^^ -- Author: BSB -- History: -- BSB 09/18/2010 -- Ceated the version v1.01.a -- -- axi lite ipif v1.01.a used -- ^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; ------------------------------------------------------------------------------- --Package Declaration ------------------------------------------------------------------------------- package TC_Types is subtype QUADLET_TYPE is std_logic_vector(0 to 31); subtype ELEVEN_BIT_TYPE is std_logic_vector(21 to 31); subtype TWELVE_BIT_TYPE is std_logic_vector(20 to 31); subtype QUADLET_PLUS1_TYPE is std_logic_vector(0 to 32); subtype BYTE_TYPE is std_logic_vector(0 to 7); subtype ALU_OP_TYPE is std_logic_vector(0 to 1); subtype ADDR_WORD_TYPE is std_logic_vector(0 to 31); subtype BYTE_ENABLE_TYPE is std_logic_vector(0 to 3); subtype DATA_WORD_TYPE is QUADLET_TYPE; subtype INSTRUCTION_WORD_TYPE is QUADLET_TYPE; -- Bus interface data types subtype PLB_DWIDTH_TYPE is QUADLET_TYPE; subtype PLB_AWIDTH_TYPE is QUADLET_TYPE; subtype PLB_BEWIDTH_TYPE is std_logic_vector(0 to 3); subtype BYTE_PLUS1_TYPE is std_logic_vector(0 to 8); subtype NIBBLE_TYPE is std_logic_vector(0 to 3); type TWO_QUADLET_TYPE is array (0 to 1) of QUADLET_TYPE; constant CASC_POS : integer := 20; constant ENALL_POS : integer := 21; constant PWMA0_POS : integer := 22; constant T0INT_POS : integer := 23; constant ENT0_POS : integer := 24; constant ENIT0_POS : integer := 25; constant LOAD0_POS : integer := 26; constant ARHT0_POS : integer := 27; constant CAPT0_POS : integer := 28; constant CMPT0_POS : integer := 29; constant UDT0_POS : integer := 30; constant MDT0_POS : integer := 31; constant PWMB0_POS : integer := 22; constant T1INT_POS : integer := 23; constant ENT1_POS : integer := 24; constant ENIT1_POS : integer := 25; constant LOAD1_POS : integer := 26; constant ARHT1_POS : integer := 27; constant CAPT1_POS : integer := 28; constant CMPT1_POS : integer := 29; constant UDT1_POS : integer := 30; constant MDT1_POS : integer := 31; constant LS_ADDR : std_logic_vector(0 to 1) := "11"; constant NEXT_MSB_BIT : integer := -1; constant NEXT_LSB_BIT : integer := 1; -- The following four constants arer reversed from what's -- in microblaze_isa_be_pkg.vhd constant BYTE_ENABLE_BYTE_0 : natural := 0; constant BYTE_ENABLE_BYTE_1 : natural := 1; constant BYTE_ENABLE_BYTE_2 : natural := 2; constant BYTE_ENABLE_BYTE_3 : natural := 3; end package TC_TYPES;
gpl-3.0
60a6e7799c2b9e60f704595789cc6794
0.535136
4.481358
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_src0_data_stream_2_V.vhd
2
4,621
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_src0_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_src0_data_stream_2_V_shiftReg; architecture rtl of FIFO_image_filter_src0_data_stream_2_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_src0_data_stream_2_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_src0_data_stream_2_V is component FIFO_image_filter_src0_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_src0_data_stream_2_V_shiftReg : FIFO_image_filter_src0_data_stream_2_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
0ddac62f009201f54355841b3a82e198
0.538628
3.464018
false
false
false
false
Luisda199824/ProcesadorMonociclo
PC_Mux.vhd
1
819
library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity PC_Mux is Port ( clk : in STD_LOGIC; PcSource : in STD_LOGIC_VECTOR (1 downto 0); AluResult : in STD_LOGIC_VECTOR (31 downto 0); Pc : in STD_LOGIC_VECTOR (31 downto 0); Pc_Disp22 : in STD_LOGIC_VECTOR (31 downto 0); Pc_Disp30 : in STD_LOGIC_VECTOR (31 downto 0); nPC_Source : out STD_LOGIC_VECTOR (31 downto 0)); end PC_Mux; architecture Behavioral of PC_Mux is begin process(clk) begin if rising_edge(clk)then case PcSource is when "00" => nPC_Source <= Pc; when "01" => nPC_Source <= Pc_Disp22; when "10" => nPC_Source <= Pc_Disp30; when "11" => nPC_Source <= AluResult; when others => nPC_Source <= Pc; end case; end if; end process; end Behavioral;
mit
69aaa8ebeba8b81dd5bb2d26aec701be
0.600733
3.011029
false
false
false
false
mistryalok/Zedboard
learning/training/Microsystem/axi_interface_part2/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_bram_ctrl_v4_0/b6365b74/hdl/vhdl/axi_bram_ctrl.vhd
4
43,388
------------------------------------------------------------------------------- -- axi_bram_ctrl.vhd ------------------------------------------------------------------------------- -- -- -- (c) Copyright [2010 - 2013] Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- ------------------------------------------------------------------------------- -- Filename: axi_bram_ctrl_wrapper.vhd -- -- Description: This file is the top level module for the AXI BRAM -- controller IP core. -- -- VHDL-Standard: VHDL'93 -- ------------------------------------------------------------------------------- -- Structure: -- axi_bram_ctrl.vhd (v4_0) -- | -- |--axi_bram_ctrl_top.vhd -- | -- |-- full_axi.vhd -- | -- sng_port_arb.vhd -- | -- lite_ecc_reg.vhd -- | -- axi_lite_if.vhd -- | -- wr_chnl.vhd -- | -- wrap_brst.vhd -- | -- ua_narrow.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- checkbit_handler_64.vhd -- | -- (same helper components as checkbit_handler) -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- correct_one_bit_64.vhd -- | -- ecc_gen.vhd -- | -- | -- rd_chnl.vhd -- | -- wrap_brst.vhd -- | -- ua_narrow.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- checkbit_handler_64.vhd -- | -- (same helper components as checkbit_handler) -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- correct_one_bit_64.vhd -- | -- ecc_gen.vhd -- | -- |-- axi_lite.vhd -- | -- lite_ecc_reg.vhd -- | -- axi_lite_if.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- ecc_gen.vhd -- ------------------------------------------------------------------------------- -- Library declarations library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.numeric_std.all; library work; use work.axi_bram_ctrl_top; use work.axi_bram_ctrl_funcs.all; --use work.coregen_comp_defs.all; library blk_mem_gen_v8_2; use blk_mem_gen_v8_2.all; ------------------------------------------------------------------------------ entity axi_bram_ctrl is generic ( C_BRAM_INST_MODE : string := "EXTERNAL"; -- external ; internal --determines whether the bmg is external or internal to axi bram ctrl wrapper C_MEMORY_DEPTH : integer := 4096; --Memory depth specified by the user C_BRAM_ADDR_WIDTH : integer := 12; -- Width of AXI address bus (in bits) C_S_AXI_ADDR_WIDTH : integer := 32; -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH : integer := 32; -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH : INTEGER := 4; -- AXI ID vector width C_S_AXI_PROTOCOL : string := "AXI4"; -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST : INTEGER := 1; -- Support for narrow burst operations C_SINGLE_PORT_BRAM : INTEGER := 0; -- Enable single port usage of BRAM C_FAMILY : string := "virtex7"; -- Specify the target architecture type -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH : integer := 32; -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH : integer := 32; -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC : integer := 0; -- Enables or disables ECC functionality C_ECC_TYPE : integer := 1; C_FAULT_INJECT : integer := 0; -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE : integer := 1 -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ); port ( -- AXI Interface Signals -- AXI Clock and Reset s_axi_aclk : in std_logic; s_axi_aresetn : in std_logic; ecc_interrupt : out std_logic := '0'; ecc_ue : out std_logic := '0'; -- axi write address channel Signals (AW) s_axi_awid : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_awaddr : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); s_axi_awlen : in std_logic_vector(7 downto 0); s_axi_awsize : in std_logic_vector(2 downto 0); s_axi_awburst : in std_logic_vector(1 downto 0); s_axi_awlock : in std_logic; s_axi_awcache : in std_logic_vector(3 downto 0); s_axi_awprot : in std_logic_vector(2 downto 0); s_axi_awvalid : in std_logic; s_axi_awready : out std_logic; -- axi write data channel Signals (W) s_axi_wdata : in std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0); s_axi_wstrb : in std_logic_vector(C_S_AXI_DATA_WIDTH/8-1 downto 0); s_axi_wlast : in std_logic; s_axi_wvalid : in std_logic; s_axi_wready : out std_logic; -- axi write data response Channel Signals (B) s_axi_bid : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_bresp : out std_logic_vector(1 downto 0); s_axi_bvalid : out std_logic; s_axi_bready : in std_logic; -- axi read address channel Signals (AR) s_axi_arid : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_araddr : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); s_axi_arlen : in std_logic_vector(7 downto 0); s_axi_arsize : in std_logic_vector(2 downto 0); s_axi_arburst : in std_logic_vector(1 downto 0); s_axi_arlock : in std_logic; s_axi_arcache : in std_logic_vector(3 downto 0); s_axi_arprot : in std_logic_vector(2 downto 0); s_axi_arvalid : in std_logic; s_axi_arready : out std_logic; -- axi read data channel Signals (R) s_axi_rid : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_rdata : out std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0); s_axi_rresp : out std_logic_vector(1 downto 0); s_axi_rlast : out std_logic; s_axi_rvalid : out std_logic; s_axi_rready : in std_logic; -- axi-lite ecc register Interface Signals -- axi-lite clock and Reset -- note: axi-lite control IF and AXI IF share the same clock. -- s_axi_ctrl_aclk : in std_logic; -- s_axi_ctrl_aresetn : in std_logic; -- axi-lite write address Channel Signals (AW) s_axi_ctrl_awvalid : in std_logic; s_axi_ctrl_awready : out std_logic; s_axi_ctrl_awaddr : in std_logic_vector(C_S_AXI_CTRL_ADDR_WIDTH-1 downto 0); -- axi-lite write data Channel Signals (W) s_axi_ctrl_wdata : in std_logic_vector(C_S_AXI_CTRL_DATA_WIDTH-1 downto 0); s_axi_ctrl_wvalid : in std_logic; s_axi_ctrl_wready : out std_logic; -- axi-lite write data Response Channel Signals (B) s_axi_ctrl_bresp : out std_logic_vector(1 downto 0); s_axi_ctrl_bvalid : out std_logic; s_axi_ctrl_bready : in std_logic; -- axi-lite read address Channel Signals (AR) s_axi_ctrl_araddr : in std_logic_vector(C_S_AXI_CTRL_ADDR_WIDTH-1 downto 0); s_axi_ctrl_arvalid : in std_logic; s_axi_ctrl_arready : out std_logic; -- axi-lite read data Channel Signals (R) s_axi_ctrl_rdata : out std_logic_vector(C_S_AXI_CTRL_DATA_WIDTH-1 downto 0); s_axi_ctrl_rresp : out std_logic_vector(1 downto 0); s_axi_ctrl_rvalid : out std_logic; s_axi_ctrl_rready : in std_logic; -- bram interface signals (Port A) bram_rst_a : out std_logic; bram_clk_a : out std_logic; bram_en_a : out std_logic; bram_we_a : out std_logic_vector (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_addr_a : out std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); bram_wrdata_a : out std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_rddata_a : in std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); -- bram interface signals (Port B) bram_rst_b : out std_logic; bram_clk_b : out std_logic; bram_en_b : out std_logic; bram_we_b : out std_logic_vector (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_addr_b : out std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); bram_wrdata_b : out std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_rddata_b : in std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) ); end entity axi_bram_ctrl; ------------------------------------------------------------------------------- architecture implementation of axi_bram_ctrl is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------ -- FUNCTION: if_then_else -- This function is used to implement an IF..THEN when such a statement is not -- allowed. ------------------------------------------------------------------------------ FUNCTION if_then_else ( condition : BOOLEAN; true_case : INTEGER; false_case : INTEGER) RETURN INTEGER IS VARIABLE retval : INTEGER := 0; BEGIN IF NOT condition THEN retval:=false_case; ELSE retval:=true_case; END IF; RETURN retval; END if_then_else; --------------------------------------------------------------------------- -- FUNCTION : log2roundup --------------------------------------------------------------------------- FUNCTION log2roundup (data_value : integer) RETURN integer IS VARIABLE width : integer := 0; VARIABLE cnt : integer := 1; CONSTANT lower_limit : integer := 1; CONSTANT upper_limit : integer := 8; BEGIN IF (data_value <= 1) THEN width := 0; ELSE WHILE (cnt < data_value) LOOP width := width + 1; cnt := cnt *2; END LOOP; END IF; RETURN width; END log2roundup; ------------------------------------------------------------------------------- -- Constants ------------------------------------------------------------------------------- -- Only instantiate logic based on C_S_AXI_PROTOCOL. -- Determine external ECC width. -- Use function defined in axi_bram_ctrl_funcs package. -- Set internal parameters for ECC register enabling when C_ECC = 1 -- Catastrophic error indicated with ECC_UE & Interrupt flags. -- Counter only sized when C_ECC = 1. -- Selects CE counter width/threshold to assert ECC_Interrupt -- Hard coded at 8-bits to capture and count up to 256 correctable errors. -- ECC algorithm format, 0 = Hamming code, 1 = Hsiao code constant GND : std_logic := '0'; constant VCC : std_logic := '1'; constant ZERO1 : std_logic_vector(0 downto 0) := (others => '0'); constant ZERO2 : std_logic_vector(1 downto 0) := (others => '0'); constant ZERO3 : std_logic_vector(2 downto 0) := (others => '0'); constant ZERO4 : std_logic_vector(3 downto 0) := (others => '0'); constant ZERO8 : std_logic_vector(7 downto 0) := (others => '0'); constant WSTRB_ZERO : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); constant ZERO16 : std_logic_vector(15 downto 0) := (others => '0'); constant ZERO32 : std_logic_vector(31 downto 0) := (others => '0'); constant ZERO64 : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); CONSTANT MEM_TYPE : INTEGER := if_then_else((C_SINGLE_PORT_BRAM=1),0,2); CONSTANT BWE_B : INTEGER := if_then_else((C_SINGLE_PORT_BRAM=1),0,1); CONSTANT BMG_ADDR_WIDTH : INTEGER := log2roundup(C_MEMORY_DEPTH) + log2roundup(C_S_AXI_DATA_WIDTH/8) ; ------------------------------------------------------------------------------- -- Signals ------------------------------------------------------------------------------- signal clka_bram_clka_i : std_logic := '0'; signal rsta_bram_rsta_i : std_logic := '0'; signal ena_bram_ena_i : std_logic := '0'; signal REGCEA : std_logic := '0'; signal wea_bram_wea_i : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal addra_bram_addra_i : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal dina_bram_dina_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal douta_bram_douta_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); signal clkb_bram_clkb_i : std_logic := '0'; signal rstb_bram_rstb_i : std_logic := '0'; signal enb_bram_enb_i : std_logic := '0'; signal REGCEB : std_logic := '0'; signal web_bram_web_i : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal addrb_bram_addrb_i : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal dinb_bram_dinb_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal doutb_bram_doutb_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); ----------------------------------------------------------------------- -- Architecture Body ----------------------------------------------------------------------- begin gint_inst: IF (C_BRAM_INST_MODE = "INTERNAL" ) GENERATE constant c_addrb_width : INTEGER := log2roundup(C_MEMORY_DEPTH); constant C_WEA_WIDTH_I : INTEGER := (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) ; constant C_WRITE_WIDTH_A_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) ; constant C_READ_WIDTH_A_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_ADDRA_WIDTH_I : INTEGER := log2roundup(C_MEMORY_DEPTH); constant C_WEB_WIDTH_I : INTEGER := (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_WRITE_WIDTH_B_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_READ_WIDTH_B_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); signal s_axi_rdaddrecc_bmg_int : STD_LOGIC_VECTOR(c_addrb_width-1 DOWNTO 0); signal s_axi_dbiterr_bmg_int : STD_LOGIC; signal s_axi_sbiterr_bmg_int : STD_LOGIC; signal s_axi_rvalid_bmg_int : STD_LOGIC; signal s_axi_rlast_bmg_int : STD_LOGIC; signal s_axi_rresp_bmg_int : STD_LOGIC_VECTOR(1 DOWNTO 0); signal s_axi_rdata_bmg_int : STD_LOGIC_VECTOR(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); signal s_axi_rid_bmg_int : STD_LOGIC_VECTOR(3 DOWNTO 0); signal s_axi_arready_bmg_int : STD_LOGIC; signal s_axi_bvalid_bmg_int : STD_LOGIC; signal s_axi_bresp_bmg_int : STD_LOGIC_VECTOR(1 DOWNTO 0); signal s_axi_bid_bmg_int : STD_LOGIC_VECTOR(3 DOWNTO 0); signal s_axi_wready_bmg_int : STD_LOGIC; signal s_axi_awready_bmg_int : STD_LOGIC; signal rdaddrecc_bmg_int : STD_LOGIC_VECTOR(c_addrb_width-1 DOWNTO 0); signal dbiterr_bmg_int : STD_LOGIC; signal sbiterr_bmg_int : STD_LOGIC; begin bmgv81_inst : entity blk_mem_gen_v8_2.blk_mem_gen_v8_2 GENERIC MAP( ---------------------------------------------------------------------------- -- Generic Declarations ---------------------------------------------------------------------------- --Device Family & Elaboration Directory Parameters: C_FAMILY => C_FAMILY, C_XDEVICEFAMILY => C_FAMILY, ---- C_ELABORATION_DIR => "NULL" , C_INTERFACE_TYPE => 0 , --General Memory Parameters: ----- C_ENABLE_32BIT_ADDRESS => 0 , C_MEM_TYPE => MEM_TYPE , C_BYTE_SIZE => 8 , C_ALGORITHM => 1 , C_PRIM_TYPE => 1 , --Memory Initialization Parameters: C_LOAD_INIT_FILE => 0 , C_INIT_FILE_NAME => "no_coe_file_loaded" , C_USE_DEFAULT_DATA => 0 , C_DEFAULT_DATA => "NULL" , --Port A Parameters: --Reset Parameters: C_HAS_RSTA => 0 , --Enable Parameters: C_HAS_ENA => 1 , C_HAS_REGCEA => 0 , --Byte Write Enable Parameters: C_USE_BYTE_WEA => 1 , C_WEA_WIDTH => C_WEA_WIDTH_I, --(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) , --Write Mode: C_WRITE_MODE_A => "WRITE_FIRST" , --Data-Addr Width Parameters: C_WRITE_WIDTH_A => C_WRITE_WIDTH_A_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_READ_WIDTH_A => C_READ_WIDTH_A_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_WRITE_DEPTH_A => C_MEMORY_DEPTH , C_READ_DEPTH_A => C_MEMORY_DEPTH , C_ADDRA_WIDTH => C_ADDRA_WIDTH_I,--log2roundup(C_MEMORY_DEPTH) , --Port B Parameters: --Reset Parameters: C_HAS_RSTB => 0 , --Enable Parameters: C_HAS_ENB => 1 , C_HAS_REGCEB => 0 , --Byte Write Enable Parameters: C_USE_BYTE_WEB => BWE_B , C_WEB_WIDTH => C_WEB_WIDTH_I,--(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) , --Write Mode: C_WRITE_MODE_B => "WRITE_FIRST" , --Data-Addr Width Parameters: C_WRITE_WIDTH_B => C_WRITE_WIDTH_B_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_READ_WIDTH_B => C_READ_WIDTH_B_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_WRITE_DEPTH_B => C_MEMORY_DEPTH , C_READ_DEPTH_B => C_MEMORY_DEPTH , C_ADDRB_WIDTH => C_ADDRB_WIDTH,--log2roundup(C_MEMORY_DEPTH) , --Output Registers/ Pipelining Parameters: C_HAS_MEM_OUTPUT_REGS_A => 0 , C_HAS_MEM_OUTPUT_REGS_B => 0 , C_HAS_MUX_OUTPUT_REGS_A => 0 , C_HAS_MUX_OUTPUT_REGS_B => 0 , C_MUX_PIPELINE_STAGES => 0 , --Input/Output Registers for SoftECC : C_HAS_SOFTECC_INPUT_REGS_A => 0 , C_HAS_SOFTECC_OUTPUT_REGS_B=> 0 , --ECC Parameters C_USE_ECC => 0 , C_USE_SOFTECC => 0 , C_HAS_INJECTERR => 0 , C_EN_ECC_PIPE => 0, C_EN_SLEEP_PIN => 0, --Simulation Model Parameters: C_SIM_COLLISION_CHECK => "NONE" , C_COMMON_CLK => 1 , C_DISABLE_WARN_BHV_COLL => 1 , C_DISABLE_WARN_BHV_RANGE => 1 ) PORT MAP( ---------------------------------------------------------------------------- -- Input and Output Declarations ---------------------------------------------------------------------------- -- Native BMG Input and Output Port Declarations --Port A: clka => clka_bram_clka_i , rsta => rsta_bram_rsta_i , ena => ena_bram_ena_i , regcea => GND , wea => wea_bram_wea_i , addra => addra_bram_addra_i(BMG_ADDR_WIDTH-1 downto (BMG_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , --addra => addra_bram_addra_i(C_S_AXI_ADDR_WIDTH-1 downto (C_S_AXI_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , dina => dina_bram_dina_i , douta => douta_bram_douta_i , --port b: clkb => clkb_bram_clkb_i , rstb => rstb_bram_rstb_i , enb => enb_bram_enb_i , regceb => GND , web => web_bram_web_i , addrb => addrb_bram_addrb_i(BMG_ADDR_WIDTH-1 downto (BMG_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , --addrb => addrb_bram_addrb_i(C_S_AXI_ADDR_WIDTH-1 downto (C_S_AXI_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , dinb => dinb_bram_dinb_i , doutb => doutb_bram_doutb_i , --ecc: injectsbiterr => GND , injectdbiterr => GND , sbiterr => sbiterr_bmg_int, dbiterr => dbiterr_bmg_int, rdaddrecc => rdaddrecc_bmg_int, eccpipece => GND, sleep => GND, -- axi bmg input and output Port Declarations -- axi global signals s_aclk => GND , s_aresetn => GND , -- axi full/lite slave write (write side) s_axi_awid => ZERO4 , s_axi_awaddr => ZERO32 , s_axi_awlen => ZERO8 , s_axi_awsize => ZERO3 , s_axi_awburst => ZERO2 , s_axi_awvalid => GND , s_axi_awready => s_axi_awready_bmg_int, s_axi_wdata => ZERO64 , s_axi_wstrb => WSTRB_ZERO, s_axi_wlast => GND , s_axi_wvalid => GND , s_axi_wready => s_axi_wready_bmg_int, s_axi_bid => s_axi_bid_bmg_int, s_axi_bresp => s_axi_bresp_bmg_int, s_axi_bvalid => s_axi_bvalid_bmg_int, s_axi_bready => GND , -- axi full/lite slave read (Write side) s_axi_arid => ZERO4, s_axi_araddr => "00000000000000000000000000000000", s_axi_arlen => "00000000", s_axi_arsize => "000", s_axi_arburst => "00", s_axi_arvalid => '0', s_axi_arready => s_axi_arready_bmg_int, s_axi_rid => s_axi_rid_bmg_int, s_axi_rdata => s_axi_rdata_bmg_int, s_axi_rresp => s_axi_rresp_bmg_int, s_axi_rlast => s_axi_rlast_bmg_int, s_axi_rvalid => s_axi_rvalid_bmg_int, s_axi_rready => GND , -- axi full/lite sideband Signals s_axi_injectsbiterr => GND , s_axi_injectdbiterr => GND , s_axi_sbiterr => s_axi_sbiterr_bmg_int, s_axi_dbiterr => s_axi_dbiterr_bmg_int, s_axi_rdaddrecc => s_axi_rdaddrecc_bmg_int ); abcv4_0_int_inst : entity work.axi_bram_ctrl_top generic map( -- AXI Parameters C_BRAM_ADDR_WIDTH => C_BRAM_ADDR_WIDTH , C_S_AXI_ADDR_WIDTH => C_S_AXI_ADDR_WIDTH , -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH => C_S_AXI_DATA_WIDTH , -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH => C_S_AXI_ID_WIDTH , -- AXI ID vector width C_S_AXI_PROTOCOL => C_S_AXI_PROTOCOL , -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST => C_S_AXI_SUPPORTS_NARROW_BURST , -- Support for narrow burst operations C_SINGLE_PORT_BRAM => C_SINGLE_PORT_BRAM , -- Enable single port usage of BRAM -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH => C_S_AXI_CTRL_ADDR_WIDTH , -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH => C_S_AXI_CTRL_DATA_WIDTH , -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC => C_ECC , -- Enables or disables ECC functionality C_ECC_TYPE => C_ECC_TYPE , C_FAULT_INJECT => C_FAULT_INJECT , -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE => C_ECC_ONOFF_RESET_VALUE -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ) port map( -- AXI Interface Signals -- AXI Clock and Reset S_AXI_ACLK => S_AXI_ACLK , S_AXI_ARESETN => S_AXI_ARESETN , ECC_Interrupt => ECC_Interrupt , ECC_UE => ECC_UE , -- AXI Write Address Channel Signals (AW) S_AXI_AWID => S_AXI_AWID , S_AXI_AWADDR => S_AXI_AWADDR , S_AXI_AWLEN => S_AXI_AWLEN , S_AXI_AWSIZE => S_AXI_AWSIZE , S_AXI_AWBURST => S_AXI_AWBURST , S_AXI_AWLOCK => S_AXI_AWLOCK , S_AXI_AWCACHE => S_AXI_AWCACHE , S_AXI_AWPROT => S_AXI_AWPROT , S_AXI_AWVALID => S_AXI_AWVALID , S_AXI_AWREADY => S_AXI_AWREADY , -- AXI Write Data Channel Signals (W) S_AXI_WDATA => S_AXI_WDATA , S_AXI_WSTRB => S_AXI_WSTRB , S_AXI_WLAST => S_AXI_WLAST , S_AXI_WVALID => S_AXI_WVALID , S_AXI_WREADY => S_AXI_WREADY , -- AXI Write Data Response Channel Signals (B) S_AXI_BID => S_AXI_BID , S_AXI_BRESP => S_AXI_BRESP , S_AXI_BVALID => S_AXI_BVALID , S_AXI_BREADY => S_AXI_BREADY , -- AXI Read Address Channel Signals (AR) S_AXI_ARID => S_AXI_ARID , S_AXI_ARADDR => S_AXI_ARADDR , S_AXI_ARLEN => S_AXI_ARLEN , S_AXI_ARSIZE => S_AXI_ARSIZE , S_AXI_ARBURST => S_AXI_ARBURST , S_AXI_ARLOCK => S_AXI_ARLOCK , S_AXI_ARCACHE => S_AXI_ARCACHE , S_AXI_ARPROT => S_AXI_ARPROT , S_AXI_ARVALID => S_AXI_ARVALID , S_AXI_ARREADY => S_AXI_ARREADY , -- AXI Read Data Channel Signals (R) S_AXI_RID => S_AXI_RID , S_AXI_RDATA => S_AXI_RDATA , S_AXI_RRESP => S_AXI_RRESP , S_AXI_RLAST => S_AXI_RLAST , S_AXI_RVALID => S_AXI_RVALID , S_AXI_RREADY => S_AXI_RREADY , -- AXI-Lite ECC Register Interface Signals -- AXI-Lite Write Address Channel Signals (AW) S_AXI_CTRL_AWVALID => S_AXI_CTRL_AWVALID , S_AXI_CTRL_AWREADY => S_AXI_CTRL_AWREADY , S_AXI_CTRL_AWADDR => S_AXI_CTRL_AWADDR , -- AXI-Lite Write Data Channel Signals (W) S_AXI_CTRL_WDATA => S_AXI_CTRL_WDATA , S_AXI_CTRL_WVALID => S_AXI_CTRL_WVALID , S_AXI_CTRL_WREADY => S_AXI_CTRL_WREADY , -- AXI-Lite Write Data Response Channel Signals (B) S_AXI_CTRL_BRESP => S_AXI_CTRL_BRESP , S_AXI_CTRL_BVALID => S_AXI_CTRL_BVALID , S_AXI_CTRL_BREADY => S_AXI_CTRL_BREADY , -- AXI-Lite Read Address Channel Signals (AR) S_AXI_CTRL_ARADDR => S_AXI_CTRL_ARADDR , S_AXI_CTRL_ARVALID => S_AXI_CTRL_ARVALID , S_AXI_CTRL_ARREADY => S_AXI_CTRL_ARREADY , -- AXI-Lite Read Data Channel Signals (R) S_AXI_CTRL_RDATA => S_AXI_CTRL_RDATA , S_AXI_CTRL_RRESP => S_AXI_CTRL_RRESP , S_AXI_CTRL_RVALID => S_AXI_CTRL_RVALID , S_AXI_CTRL_RREADY => S_AXI_CTRL_RREADY , -- BRAM Interface Signals (Port A) BRAM_Rst_A => rsta_bram_rsta_i , BRAM_Clk_A => clka_bram_clka_i , BRAM_En_A => ena_bram_ena_i , BRAM_WE_A => wea_bram_wea_i , BRAM_Addr_A => addra_bram_addra_i, BRAM_WrData_A => dina_bram_dina_i , BRAM_RdData_A => douta_bram_douta_i , -- BRAM Interface Signals (Port B) BRAM_Rst_B => rstb_bram_rstb_i , BRAM_Clk_B => clkb_bram_clkb_i , BRAM_En_B => enb_bram_enb_i , BRAM_WE_B => web_bram_web_i , BRAM_Addr_B => addrb_bram_addrb_i , BRAM_WrData_B => dinb_bram_dinb_i , BRAM_RdData_B => doutb_bram_doutb_i ); -- The following signals are driven 0's to remove the synthesis warnings bram_rst_a <= '0'; bram_clk_a <= '0'; bram_en_a <= '0'; bram_we_a <= (others => '0'); bram_addr_a <= (others => '0'); bram_wrdata_a <= (others => '0'); bram_rst_b <= '0'; bram_clk_b <= '0'; bram_en_b <= '0'; bram_we_b <= (others => '0'); bram_addr_b <= (others => '0'); bram_wrdata_b <= (others => '0'); END GENERATE gint_inst; -- End of internal bram instance gext_inst: IF (C_BRAM_INST_MODE = "EXTERNAL" ) GENERATE abcv4_0_ext_inst : entity work.axi_bram_ctrl_top generic map( -- AXI Parameters C_BRAM_ADDR_WIDTH => C_BRAM_ADDR_WIDTH , C_S_AXI_ADDR_WIDTH => C_S_AXI_ADDR_WIDTH , -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH => C_S_AXI_DATA_WIDTH , -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH => C_S_AXI_ID_WIDTH , -- AXI ID vector width C_S_AXI_PROTOCOL => C_S_AXI_PROTOCOL , -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST => C_S_AXI_SUPPORTS_NARROW_BURST , -- Support for narrow burst operations C_SINGLE_PORT_BRAM => C_SINGLE_PORT_BRAM , -- Enable single port usage of BRAM -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH => C_S_AXI_CTRL_ADDR_WIDTH , -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH => C_S_AXI_CTRL_DATA_WIDTH , -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC => C_ECC , -- Enables or disables ECC functionality C_ECC_TYPE => C_ECC_TYPE , C_FAULT_INJECT => C_FAULT_INJECT , -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE => C_ECC_ONOFF_RESET_VALUE -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ) port map( -- AXI Interface Signals -- AXI Clock and Reset s_axi_aclk => s_axi_aclk , s_axi_aresetn => s_axi_aresetn , ecc_interrupt => ecc_interrupt , ecc_ue => ecc_ue , -- axi write address channel signals (aw) s_axi_awid => s_axi_awid , s_axi_awaddr => s_axi_awaddr , s_axi_awlen => s_axi_awlen , s_axi_awsize => s_axi_awsize , s_axi_awburst => s_axi_awburst , s_axi_awlock => s_axi_awlock , s_axi_awcache => s_axi_awcache , s_axi_awprot => s_axi_awprot , s_axi_awvalid => s_axi_awvalid , s_axi_awready => s_axi_awready , -- axi write data channel signals (w) s_axi_wdata => s_axi_wdata , s_axi_wstrb => s_axi_wstrb , s_axi_wlast => s_axi_wlast , s_axi_wvalid => s_axi_wvalid , s_axi_wready => s_axi_wready , -- axi write data response channel signals (b) s_axi_bid => s_axi_bid , s_axi_bresp => s_axi_bresp , s_axi_bvalid => s_axi_bvalid , s_axi_bready => s_axi_bready , -- axi read address channel signals (ar) s_axi_arid => s_axi_arid , s_axi_araddr => s_axi_araddr , s_axi_arlen => s_axi_arlen , s_axi_arsize => s_axi_arsize , s_axi_arburst => s_axi_arburst , s_axi_arlock => s_axi_arlock , s_axi_arcache => s_axi_arcache , s_axi_arprot => s_axi_arprot , s_axi_arvalid => s_axi_arvalid , s_axi_arready => s_axi_arready , -- axi read data channel signals (r) s_axi_rid => s_axi_rid , s_axi_rdata => s_axi_rdata , s_axi_rresp => s_axi_rresp , s_axi_rlast => s_axi_rlast , s_axi_rvalid => s_axi_rvalid , s_axi_rready => s_axi_rready , -- axi-lite ecc register interface signals -- axi-lite write address channel signals (aw) s_axi_ctrl_awvalid => s_axi_ctrl_awvalid , s_axi_ctrl_awready => s_axi_ctrl_awready , s_axi_ctrl_awaddr => s_axi_ctrl_awaddr , -- axi-lite write data channel signals (w) s_axi_ctrl_wdata => s_axi_ctrl_wdata , s_axi_ctrl_wvalid => s_axi_ctrl_wvalid , s_axi_ctrl_wready => s_axi_ctrl_wready , -- axi-lite write data response channel signals (b) s_axi_ctrl_bresp => s_axi_ctrl_bresp , s_axi_ctrl_bvalid => s_axi_ctrl_bvalid , s_axi_ctrl_bready => s_axi_ctrl_bready , -- axi-lite read address channel signals (ar) s_axi_ctrl_araddr => s_axi_ctrl_araddr , s_axi_ctrl_arvalid => s_axi_ctrl_arvalid , s_axi_ctrl_arready => s_axi_ctrl_arready , -- axi-lite read data channel signals (r) s_axi_ctrl_rdata => s_axi_ctrl_rdata , s_axi_ctrl_rresp => s_axi_ctrl_rresp , s_axi_ctrl_rvalid => s_axi_ctrl_rvalid , s_axi_ctrl_rready => s_axi_ctrl_rready , -- bram interface signals (port a) bram_rst_a => bram_rst_a , bram_clk_a => bram_clk_a , bram_en_a => bram_en_a , bram_we_a => bram_we_a , bram_addr_a => bram_addr_a , bram_wrdata_a => bram_wrdata_a , bram_rddata_a => bram_rddata_a , -- bram interface signals (port b) bram_rst_b => bram_rst_b , bram_clk_b => bram_clk_b , bram_en_b => bram_en_b , bram_we_b => bram_we_b , bram_addr_b => bram_addr_b , bram_wrdata_b => bram_wrdata_b , bram_rddata_b => bram_rddata_b ); END GENERATE gext_inst; -- End of internal bram instance end architecture implementation;
gpl-3.0
8db6016643673d925ab854574e92a058
0.444362
3.911648
false
false
false
false
pdt/ttask
test/xilinx-ise/rtl/my_fpga.vhdl
3
549
-- -- my_fpga.vhdl -- library ieee; use ieee.std_logic_1164.all; library my_lib; entity my_fpga is port ( in1 : in std_logic; in2 : in std_logic; out1 : out std_logic; out2 : out std_logic ); end entity my_fpga; architecture rtl of my_fpga is begin u1_or_gate : entity my_lib.or_gate port map ( a => in1, b => in2, c => out1 ); u1_and_gate : entity my_lib.and_gate port map ( a => in1, b => in2, c => out2 ); end;
mit
d708f5a6a152af07b20da123bebe28e9
0.489982
3.05
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_src0_rows_V.vhd
2
4,556
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_src0_rows_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_src0_rows_V_shiftReg; architecture rtl of FIFO_image_filter_src0_rows_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_src0_rows_V is generic ( MEM_STYLE : string := "shiftreg"; DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_src0_rows_V is component FIFO_image_filter_src0_rows_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_src0_rows_V_shiftReg : FIFO_image_filter_src0_rows_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
047763acd9ea354ddb28ef6cf092fbd4
0.535558
3.499232
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/image_filter_FAST_t_opr_k_buf_val_0_V.vhd
2
3,674
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== -- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity image_filter_FAST_t_opr_k_buf_val_0_V_ram is generic( mem_type : string := "block"; dwidth : integer := 8; awidth : integer := 11; mem_size : integer := 1920 ); port ( addr0 : in std_logic_vector(awidth-1 downto 0); ce0 : in std_logic; q0 : out std_logic_vector(dwidth-1 downto 0); addr1 : in std_logic_vector(awidth-1 downto 0); ce1 : in std_logic; d1 : in std_logic_vector(dwidth-1 downto 0); we1 : in std_logic; clk : in std_logic ); end entity; architecture rtl of image_filter_FAST_t_opr_k_buf_val_0_V_ram is signal addr0_tmp : std_logic_vector(awidth-1 downto 0); type mem_array is array (0 to mem_size-1) of std_logic_vector (dwidth-1 downto 0); shared variable ram : mem_array; attribute syn_ramstyle : string; attribute syn_ramstyle of ram : variable is "block_ram"; attribute ram_style : string; attribute ram_style of ram : variable is mem_type; attribute EQUIVALENT_REGISTER_REMOVAL : string; begin memory_access_guard_0: process (addr0) begin addr0_tmp <= addr0; --synthesis translate_off if (CONV_INTEGER(addr0) > mem_size-1) then addr0_tmp <= (others => '0'); else addr0_tmp <= addr0; end if; --synthesis translate_on end process; p_memory_access_0: process (clk) begin if (clk'event and clk = '1') then if (ce0 = '1') then q0 <= ram(CONV_INTEGER(addr0_tmp)); end if; end if; end process; p_memory_access_1: process (clk) begin if (clk'event and clk = '1') then if (ce1 = '1') then if (we1 = '1') then ram(CONV_INTEGER(addr1)) := d1; end if; end if; end if; end process; end rtl; Library IEEE; use IEEE.std_logic_1164.all; entity image_filter_FAST_t_opr_k_buf_val_0_V is generic ( DataWidth : INTEGER := 8; AddressRange : INTEGER := 1920; AddressWidth : INTEGER := 11); port ( reset : IN STD_LOGIC; clk : IN STD_LOGIC; address0 : IN STD_LOGIC_VECTOR(AddressWidth - 1 DOWNTO 0); ce0 : IN STD_LOGIC; q0 : OUT STD_LOGIC_VECTOR(DataWidth - 1 DOWNTO 0); address1 : IN STD_LOGIC_VECTOR(AddressWidth - 1 DOWNTO 0); ce1 : IN STD_LOGIC; we1 : IN STD_LOGIC; d1 : IN STD_LOGIC_VECTOR(DataWidth - 1 DOWNTO 0)); end entity; architecture arch of image_filter_FAST_t_opr_k_buf_val_0_V is component image_filter_FAST_t_opr_k_buf_val_0_V_ram is port ( clk : IN STD_LOGIC; addr0 : IN STD_LOGIC_VECTOR; ce0 : IN STD_LOGIC; q0 : OUT STD_LOGIC_VECTOR; addr1 : IN STD_LOGIC_VECTOR; ce1 : IN STD_LOGIC; d1 : IN STD_LOGIC_VECTOR; we1 : IN STD_LOGIC); end component; begin image_filter_FAST_t_opr_k_buf_val_0_V_ram_U : component image_filter_FAST_t_opr_k_buf_val_0_V_ram port map ( clk => clk, addr0 => address0, ce0 => ce0, q0 => q0, addr1 => address1, ce1 => ce1, d1 => d1, we1 => we1); end architecture;
gpl-3.0
0fb1c455243a13945ec360634b47dd20
0.543549
3.373737
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/saed32/pads_saed32.vhd
1
12,070
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: saed32pads -- File: pads_saed32.vhd -- Author: Fredrik Ringhage - Aeroflex Gaisler AB -- Description: SAED32 pad wrappers ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; package saed32pads is -- input pad component I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; VDDIO : inout std_logic; VDD : inout std_logic; R_EN : in std_logic; VSSIO : inout std_logic;DOUT : out std_logic); end component; -- input pad with pull-up and pull-down component B4I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT: out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; -- schmitt input pad component ISH1025_EW port(PADIO : inout std_logic; VSS : inout std_logic; VDDIO : inout std_logic; VDD : inout std_logic; R_EN : in std_logic; VSSIO : inout std_logic; DOUT : out std_logic); end component; -- output pads component D4I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; component D12I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; component D16I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; -- bidirectional pads (and tri-state output pads) component B4ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B12ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B16ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; end; library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; library work; use work.all; -- pragma translate_off library saed32; use saed32.I1025_NS; use saed32.B4I1025_NS; use saed32.ISH1025_EW; -- pragma translate_on entity saed32_inpad is generic (level : integer := 0; voltage : integer := 0; filter : integer := 0); port (pad : in std_logic; o : out std_logic); end; architecture rtl of saed32_inpad is component I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; VDDIO : inout std_logic; VDD : inout std_logic; R_EN : in std_logic; VSSIO : inout std_logic; DOUT : out std_logic); end component; component B4I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT: out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component ISH1025_EW port(PADIO : inout std_logic; VSS : inout std_logic; VDDIO : inout std_logic; VDD : inout std_logic; R_EN : in std_logic; VSSIO : inout std_logic; DOUT : out std_logic); end component; signal localout,localpad : std_logic; begin norm : if filter = 0 generate ip : I1025_NS port map (PADIO => localpad, DOUT => localout, VSS => OPEN, R_EN => '1', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; pu : if filter = pullup generate ip : B4I1025_NS port map (PADIO => localpad, PULL_UP => '1', PULL_DOWN => '0', DOUT => localout, DIN => '0', VSS => OPEN, R_EN => '1', EN => '0', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; pd : if filter = pulldown generate ip : B4I1025_NS port map (PADIO => localpad, PULL_UP => '0', PULL_DOWN => '1', DOUT => localout, DIN => '0', VSS => OPEN, R_EN => '1', EN => '0', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; sch : if filter = schmitt generate ip : ISH1025_EW port map (PADIO => localpad, DOUT => localout, VSS => OPEN, R_EN => '1', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; o <= localout; localpad <= pad; end; library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; library work; use work.all; -- pragma translate_off library saed32; use saed32.B4ISH1025_NS; use saed32.B12ISH1025_NS; use saed32.B16ISH1025_NS; -- pragma translate_on entity saed32_iopad is generic (level : integer := 0; slew : integer := 0; voltage : integer := 0; strength : integer := 0); port (pad : inout std_logic; i, en : in std_logic; o : out std_logic); end ; architecture rtl of saed32_iopad is component B4ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B12ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B16ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; signal localen : std_logic; signal localout,localpad : std_logic; begin localen <= not en; f4 : if (strength <= 4) generate op : B4ISH1025_NS port map (DIN => i,PADIO => localpad, DOUT => o, VSS => OPEN, R_EN => localen, EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; f12 : if (strength > 4) and (strength <= 12) generate op : B12ISH1025_NS port map (DIN => i, PADIO => localpad, DOUT => o, VSS => OPEN, R_EN => localen, EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; f16 : if (strength > 12) generate op : B16ISH1025_NS port map (DIN => i, PADIO => localpad, DOUT => o, VSS => OPEN, R_EN => localen, EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; pad <= localpad; end; library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; library work; use work.all; -- pragma translate_off library saed32; use saed32.D4I1025_NS; use saed32.D12I1025_NS; use saed32.D16I1025_NS; -- pragma translate_on entity saed32_outpad is generic (level : integer := 0; slew : integer := 0; voltage : integer := 0; strength : integer := 0); port (pad : out std_logic; i : in std_logic); end ; architecture rtl of saed32_outpad is component D4I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; component D12I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; component D16I1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; EN : in std_logic; VDDIO : inout std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DIN : in std_logic); end component; signal localout,localpad : std_logic; begin f4 : if (strength <= 4) generate op : D4I1025_NS port map (DIN => i, PADIO => localpad, VSS => OPEN, EN => '1', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; f12 : if (strength > 4) and (strength <= 12) generate op : D12I1025_NS port map (DIN => i, PADIO => localpad, VSS => OPEN, EN => '1', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; f16 : if (strength > 12) generate op : D16I1025_NS port map (DIN => i, PADIO => localpad, VSS => OPEN, EN => '1', VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN); end generate; pad <= localpad; end; library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; library work; use work.all; -- pragma translate_off library saed32; use saed32.B4ISH1025_NS; use saed32.B12ISH1025_NS; use saed32.B16ISH1025_NS; -- pragma translate_on entity saed32_toutpad is generic (level : integer := 0; slew : integer := 0; voltage : integer := 0; strength : integer := 0); port (pad : out std_logic; i, en : in std_logic); end ; architecture rtl of saed32_toutpad is component B4ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B12ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; component B16ISH1025_NS port(PADIO : inout std_logic; VSS : inout std_logic; PULL_UP : in std_logic; VDDIO : inout std_logic; EN : in std_logic; VDD : inout std_logic; VSSIO : inout std_logic; DOUT : out std_logic; DIN : in std_logic; PULL_DOWN : in std_logic; R_EN : in std_logic); end component; signal localpad : std_logic; begin f4 : if (strength <= 4) generate op : B4ISH1025_NS port map (DIN => i,PADIO => localpad, DOUT => OPEN, VSS => OPEN, R_EN => '0', EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; f12 : if (strength > 4) and (strength <= 12) generate op : B12ISH1025_NS port map (DIN => i, PADIO => localpad, DOUT => OPEN, VSS => OPEN, R_EN => '0', EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; f16 : if (strength > 12) generate op : B16ISH1025_NS port map (DIN => i, PADIO => localpad, DOUT => OPEN, VSS => OPEN, R_EN => '0', EN => en, VDDIO => OPEN, VDD => OPEN, VSSIO => OPEN, PULL_UP => '0', PULL_DOWN => '0'); end generate; pad <= localpad; end;
gpl-2.0
4bced64ff04169800b925f6baa9be1c9
0.656172
3.241139
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/stdlib/testlib.vhd
1
31,840
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- package: testlib -- file: testlib.vhd -- author: Marko Isomaki - Aeroflex Gaisler -- description: package for common vhdl functions for testbenches ------------------------------------------------------------------------------ -- pragma translate_off library std; use std.standard.all; use std.textio.all; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.math_real.all; library grlib; use grlib.stdio.all; use grlib.stdlib.tost; -- pragma translate_on package testlib is -- pragma translate_off type octet_vector is array (natural range <>) of std_logic_vector(7 downto 0); subtype data_vector8 is octet_vector; type data_vector16 is array (natural range <>) of std_logic_vector(15 downto 0); type data_vector32 is array (natural range <>) of std_logic_vector(31 downto 0); type data_vector64 is array (natural range <>) of std_logic_vector(63 downto 0); type data_vector128 is array (natural range <>) of std_logic_vector(127 downto 0); type data_vector256 is array (natural range <>) of std_logic_vector(255 downto 0); type nibble_vector is array (natural range <>) of std_logic_vector(3 downto 0); subtype data_vector is data_vector32; ----------------------------------------------------------------------------- -- compare function handling '-'. c is the expected data parameter. If it is --'-' or 'U' then this bit is not compared. Returns true if the vectors match ----------------------------------------------------------------------------- function compare(o, c: in std_logic_vector) return boolean; ----------------------------------------------------------------------------- -- compare function handling '-' ----------------------------------------------------------------------------- function compare(o, c: in std_ulogic_vector) return boolean; ----------------------------------------------------------------------------- -- this procedure prints a message to standard output. Also includes the time -- at which it occurs. ----------------------------------------------------------------------------- procedure print( constant comment: in string := "-"; constant severe: in severity_level := note; constant screen: in boolean := true); ----------------------------------------------------------------------------- -- synchronisation with respect to clock and with output offset ----------------------------------------------------------------------------- procedure synchronise( signal clock: in std_ulogic; constant offset: in time := 5 ns; constant enable: in boolean := true); ----------------------------------------------------------------------------- -- this procedure initialises the test error counters. Used in testbenches -- with a test variable to check if a subtest has failed and at the end how -- many subtests have failed. This procedure is called before the first -- subtest ----------------------------------------------------------------------------- procedure tinitialise( variable test: inout boolean; variable testcount: inout integer); ----------------------------------------------------------------------------- -- this procedure completes the sub-test. Called at the end of each subtest ----------------------------------------------------------------------------- procedure tintermediate( variable test: inout boolean; variable testcount: inout integer); ----------------------------------------------------------------------------- -- this procedure completes the test. Called at the end of the complete test ----------------------------------------------------------------------------- procedure tterminate( variable test: inout boolean; variable testcount: inout integer); ----------------------------------------------------------------------------- -- check std_logic_vector array ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_logic_vector; constant expected: in std_logic_vector; constant message: in string := ""); ----------------------------------------------------------------------------- -- check std_logic ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_logic; constant expected: in std_logic; constant message: in string := ""); ----------------------------------------------------------------------------- -- check std_ulogic_vector array ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_ulogic_vector; constant expected: in std_ulogic_vector; constant message: in string := ""); ----------------------------------------------------------------------------- -- check natural ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in natural; constant expected: in natural; constant message: in string := ""); ----------------------------------------------------------------------------- -- check time ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in time; constant expected: in time; constant spread: in time; constant message: in string := ""); ----------------------------------------------------------------------------- -- check boolean ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in boolean; constant expected: in boolean; constant message: in string := ""); ----------------------------------------------------------------------------- -- Convert Data_Vector to Octet_Vector ----------------------------------------------------------------------------- function conv_octet_vector( constant d: in data_vector) return octet_vector; ----------------------------------------------------------------------------- -- Convert Octet_Vector to Data_Vector, with padding ----------------------------------------------------------------------------- function conv_data_vector( constant o: in octet_vector) return data_vector; procedure compare( constant data: in octet_vector; constant cxdata: in octet_vector; variable tP: inout boolean); ---------------------------------------------------------------------------- -- Read file contents to octet vector ---------------------------------------------------------------------------- --Expects data only in hex with four bytes on each line. procedure readfile( constant filename: in string := ""; constant filetype: in integer := 0; constant size: in integer := 0; variable dataout: out octet_vector); --Reads bytes from a file with the format packets are output from ethereal procedure readfile( constant filename: in string := ""; constant size: in integer := 0; variable dataout: out octet_vector); ---------------------------------------------------------------------------- -- Read file contents to data_vector ---------------------------------------------------------------------------- --Expects data only in hex with four bytes on each line. procedure readfile( constant filename: in string := ""; constant size: in integer := 0; variable dataout: out data_vector); --generates an random integer from 0 to the maximum value specified with max procedure gen_rand_int( constant max : in real; variable seed1 : inout positive; variable seed2 : inout positive; variable rand : out integer); --reverses std_logic_vector function reverse(din : std_logic_vector) return std_logic_vector; -- Returns offset to start of valid data for an access of size 'size' in -- AMBA data vector function ahb_doff ( constant dw : integer; constant size : integer; -- access size constant addr : std_logic_vector(4 downto 0)) return integer; -- pragma translate_on end package testlib; -- pragma translate_off --============================================================================-- package body testlib is ----------------------------------------------------------------------------- -- compare function handling '-' ----------------------------------------------------------------------------- function compare(o, c: in std_logic_vector) return boolean is variable t: std_logic_vector(o'range) := c; variable result: boolean; begin result := true; for i in o'range loop if not (o(i)=t(i) or t(i)='-' or t(i)='U') then result := false; end if; end loop; return result; end function compare; ----------------------------------------------------------------------------- -- compare function handling '-' ----------------------------------------------------------------------------- function compare(o, c: in std_ulogic_vector) return boolean is variable t: std_ulogic_vector(o'range) := c; variable result: boolean; begin result := true; for i in o'range loop if not (o(i)=t(i) or t(i)='-' or t(i)='U') then result := false; end if; end loop; return result; end function compare; ----------------------------------------------------------------------------- -- this procedure prints a message to standard output ----------------------------------------------------------------------------- procedure print( constant comment: in string := "-"; constant severe: in severity_level := note; constant screen: in boolean := true) is variable l: line; begin if screen then write(l, now, right, 15); write(l, " : " & comment); if severe = warning then write(l, string'(" # warning, ")); elsif severe = error then write(l, string'(" # error, ")); elsif severe = failure then write(l, string'(" # failure, ")); end if; writeline(output, l); end if; end procedure print; ----------------------------------------------------------------------------- -- synchronisation with respect to clock and with output offset ----------------------------------------------------------------------------- procedure synchronise( signal clock: in std_ulogic; constant offset: in time := 5 ns; constant enable: in boolean := true) is begin if enable then wait until clock = '1'; -- synchronise wait for offset; -- output offset delay end if; end procedure synchronise; ----------------------------------------------------------------------------- -- this procedure initialises the test error counters ----------------------------------------------------------------------------- procedure tinitialise( variable test: inout boolean; variable testcount: inout integer) is begin -------------------------------------------------------------------------- -- initialise test status -------------------------------------------------------------------------- test := true; -- reset any errors testcount := 0; print("--=========================================================--"); print("*** test initialised ¨ ***"); print("--=========================================================--"); end procedure tinitialise; ----------------------------------------------------------------------------- -- this procedure completes the sub-test ----------------------------------------------------------------------------- procedure tintermediate( variable test: inout boolean; variable testcount: inout integer) is variable l: line; begin -------------------------------------------------------------------------- -- report test status -------------------------------------------------------------------------- wait for 10 us; print("--=========================================================--"); if test then print("*** sub-test completed successfully ***"); if testcount > 0 then write(l, now, right, 15); write(l, string'(" : ")); write(l, testcount); write(l, string'(" sub-test(s) ended with one or more errors.")); writeline(output, l); end if; else print("*** sub-test completed with errors -- # error # -- ***"); testcount := testcount + 1; test := true; if testcount > 0 then write(l, now, right, 15); write(l, string'(" : ")); write(l, testcount); write(l, string'(" sub-test(s) ended with one or more errors.")); writeline(output, l); end if; end if; print("--=========================================================--"); end procedure tintermediate; ----------------------------------------------------------------------------- -- this procedure completes the test ----------------------------------------------------------------------------- procedure tterminate( variable test: inout boolean; variable testcount: inout integer) is variable l: line; begin -------------------------------------------------------------------------- -- end of test -------------------------------------------------------------------------- wait for 1 ms; print("--=========================================================--"); if testcount = 0 then print("*** test completed successfully ***"); else print("*** test completed with errors -- # error # -- ***"); write(l, now, right, 15); write(l, string'(" : ")); write(l, testcount); write(l, string'(" sub-test(s) ended with one or more errors.")); writeline(output, l); end if; print("--=========================================================--"); report "---- end of test ----" severity failure; wait; end procedure tterminate; ----------------------------------------------------------------------------- -- check std_logic_vector array ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_logic_vector; constant expected: in std_logic_vector; constant message: in string := "") is variable l: line; constant padding: std_logic_vector(1 to (4-(received'length mod 4))) := (others => '0'); begin if not compare(received, expected) then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); if padding'length > 0 and padding'length < 4 then hwrite(l, padding & std_logic_vector(received)); else hwrite(l, std_logic_vector(received)); end if; write(l, string'(" expected: ")); if padding'length > 0 and padding'length < 4 then hwrite(l, padding & std_logic_vector(expected)); else hwrite(l, std_logic_vector(expected)); end if; write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- check std_logic ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_logic; constant expected: in std_logic; constant message: in string := "") is variable l: line; begin if not (to_x01z(received)=to_x01z(expected)) then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); write(l, received); write(l, string'(" expected: ")); write(l, expected); write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- check std_ulogic_vector array ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in std_ulogic_vector; constant expected: in std_ulogic_vector; constant message: in string := "") is variable l: line; constant padding: std_ulogic_vector(1 to (4-(received'length mod 4))) := (others => '0'); begin if not compare(received, expected) then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); if padding'length > 0 and padding'length < 4 then hwrite(l, std_logic_vector(padding) & std_logic_vector(received)); else hwrite(l, std_logic_vector(received)); end if; write(l, string'(" expected: ")); if padding'length > 0 and padding'length < 4 then hwrite(l, std_logic_vector(padding) & std_logic_vector(expected)); else hwrite(l, std_logic_vector(expected)); end if; write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- check natural ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in natural; constant expected: in natural; constant message: in string := "") is variable l: line; begin if received /= expected then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); write(l, received); write(l, string'(" expected: ")); write(l, expected); write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- check time ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in time; constant expected: in time; constant spread: in time; constant message: in string := "") is variable l: line; begin if (received > expected+spread) or (received < expected-spread) then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); write(l, received); write(l, string'(" expected: ")); write(l, expected); write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- check boolean ----------------------------------------------------------------------------- procedure check( variable tp: inout boolean; constant received: in boolean; constant expected: in boolean; constant message: in string := "") is variable l: line; begin if received /= expected then write(l, now, right, 15); write(l, string'(" : ") & message & string'(" :")); write(l, string'(" received: ")); write(l, received); write(l, string'(" expected: ")); write(l, expected); write(l, string'(" # error")); writeline(output, l); tp := false; end if; end procedure check; ----------------------------------------------------------------------------- -- Convert Data_Vector to Octet_Vector ----------------------------------------------------------------------------- function conv_octet_vector( constant d: in data_vector) return octet_vector is variable o: octet_vector(0 to d'Length*4-1); begin for i in o'range loop o(i) := d(i/4)((3-(i mod 4))*8+7 downto (3-(i mod 4))*8); end loop; return o; end function conv_octet_vector; ----------------------------------------------------------------------------- -- Convert Octet_Vector to Data_Vector, with padding ----------------------------------------------------------------------------- function conv_data_vector( constant o: in octet_vector) return data_vector is variable d: data_vector(0 to (1+(o'Length-1)/4)-1); begin for i in o'Range loop d(i/4)((3-(i mod 4))*8+7 downto (3-(i mod 4))*8) := o(i); end loop; return d; end function conv_data_vector; procedure compare( constant data: in octet_vector; constant cxdata: in octet_vector; variable tp: inout boolean) is begin if (data'length /= cxdata'length) then tp := false; print("compare error: lengths do not match"); else for i in data'low to data'low+data'length-1 loop if not compare(data(i), cxdata(i)) then tp := false; print("compare error. index: " & tost(i) & " data: " & tost(data(i)) & " expected: " & tost(cxdata(i))); end if; end loop; end if; end compare; function FromChar(C: Character) return Std_Logic_Vector is variable R: Std_Logic_Vector(0 to 3); begin case C is when '0' => R := "0000"; when '1' => R := "0001"; when '2' => R := "0010"; when '3' => R := "0011"; when '4' => R := "0100"; when '5' => R := "0101"; when '6' => R := "0110"; when '7' => R := "0111"; when '8' => R := "1000"; when '9' => R := "1001"; when 'A' => R := "1010"; when 'B' => R := "1011"; when 'C' => R := "1100"; when 'D' => R := "1101"; when 'E' => R := "1110"; when 'F' => R := "1111"; when 'a' => R := "1010"; when 'b' => R := "1011"; when 'c' => R := "1100"; when 'd' => R := "1101"; when 'e' => R := "1110"; when 'f' => R := "1111"; when others => R := "XXXX"; end case; return R; end FromChar; procedure readfile( constant filename: in string := ""; constant filetype: in integer := 0; constant size: in integer := 0; variable dataout: out octet_vector) is file readfile: text; variable l: line; variable test: boolean := true; variable count: integer := 0; variable dtmp: std_logic_vector(31 downto 0); variable data: octet_vector(0 to size-1); variable i: integer := 0; variable good: boolean := true; variable c: character; begin if size /= 0 then if filename = "" then print("no file given"); else if filetype = 0 then file_open(readfile, filename, read_mode); while not endfile(readfile) loop readline(readfile, l); hread(l, dtmp, test); if (not test) then print("illegal data in file"); exit; end if; for i in 0 to 3 loop data(count) := dtmp(31-i*8 downto 24-i*8); count := count + 1; if count >= size then exit; end if; end loop; if count >= size then exit; end if; end loop; if count < size then print("not enough data in file"); else for i in 0 to size-1 loop dataout(dataout'low+i) := data(i); end loop; end if; else file_open(readfile, filename, read_mode); while not endfile(readfile) loop readline(readfile, L); while (i < 4) loop Read(L, C, good); if not good then Print("Error in read data"); exit; end if; if (C = character'val(32)) or (C = character'val(160)) or (C = HT) then next; else i := i + 1; end if; end loop; i := 0; while (i < 32) loop Read(L, C, good); if not good then Print("Error in read data"); exit; end if; if (C = character'val(32)) or (C = character'val(160)) or (C = HT) then next; else if (i mod 2) = 0 then data(count)(7 downto 4) := fromchar(C); else data(count)(3 downto 0) := fromchar(C); -- Print(tost(data(count))); count := count + 1; if count >= size then exit; end if; end if; i := i + 1; end if; end loop; i := 0; end loop; if count < size then Print("Not enough data in file"); else dataout := data; end if; end if; end if; else print("size is zero. no data read"); end if; end procedure; procedure readfile( constant filename: in string := ""; constant size: in integer := 0; variable dataout: out octet_vector) is begin readfile(filename, 0, size, dataout); end procedure; procedure readfile( constant filename: in string := ""; constant size: in integer := 0; variable dataout: out data_vector) is file readfile: text; variable l: line; variable test: boolean := true; variable count: integer := 0; variable data: data_vector(0 to size/4); begin if size /= 0 then if filename = "" then print("no file given"); else file_open(readfile, filename, read_mode); while not endfile(readfile) loop readline(readfile, l); hread(l, data(count/4), test); if (not test) then print("illegal data in file"); exit; end if; count := count + 4; if count >= size then exit; end if; end loop; if count < size then print("not enough data in file"); else if (size mod 4) = 0 then dataout(dataout'low to dataout'low+data'high-1) := data(0 to data'high-1); else dataout(dataout'low to dataout'low+data'high) := data(0 to data'high); end if; end if; end if; else print("size is zero. no data read"); end if; end procedure; procedure gen_rand_int( constant max : in real; variable seed1 : inout positive; variable seed2 : inout positive; variable rand : out integer) is variable rand_tmp : real; begin uniform(seed1, seed2, rand_tmp); rand := integer(floor(rand_tmp*max)); end procedure; function reverse(din : std_logic_vector) return std_logic_vector is variable dout: std_logic_vector(din'REVERSE_RANGE); begin for i in din'RANGE loop dout(i) := din(i); end loop; return dout; end function reverse; function ahb_doff ( constant dw : integer; constant size : integer; constant addr : std_logic_vector(4 downto 0)) return integer is variable off : integer; begin -- ahb_doff if size < 256 and dw = 256 and addr(4) = '0' then off := 128; else off := 0; end if; if size < 128 and dw >= 128 and addr(3) = '0' then off := off + 64; end if; if size < 64 and dw >= 64 and addr(2) = '0' then off := off + 32; end if; if size < 32 and addr(1) = '0' then off := off + 16; end if; if size < 16 and addr(0) = '0' then off := off + 8; end if; return off; end ahb_doff; end package body ; --=======================================-- -- pragma translate_on
gpl-2.0
cf0f2dec1f3639ef15a2b667abfd19cf
0.423587
5.166315
false
true
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_sg_v4_1/0535f152/hdl/src/vhdl/axi_sg_rddata_cntl.vhd
5
79,644
-- ************************************************************************* -- -- (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- ************************************************************************* -- ------------------------------------------------------------------------------- -- Filename: axi_sg_rddata_cntl.vhd -- -- Description: -- This file implements the DataMover Master Read Data Controller. -- -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library axi_sg_v4_1; use axi_sg_v4_1.axi_sg_rdmux; ------------------------------------------------------------------------------- entity axi_sg_rddata_cntl is generic ( C_INCLUDE_DRE : Integer range 0 to 1 := 0; -- Indicates if the DRE interface is used C_ALIGN_WIDTH : Integer range 1 to 3 := 3; -- Sets the width of the DRE Alignment controls C_SEL_ADDR_WIDTH : Integer range 1 to 8 := 5; -- Sets the width of the LS bits of the transfer address that -- are being used to Mux read data from a wider AXI4 Read -- Data Bus C_DATA_CNTL_FIFO_DEPTH : Integer range 1 to 32 := 4; -- Sets the depth of the internal command fifo used for the -- command queue C_MMAP_DWIDTH : Integer range 32 to 1024 := 32; -- Indicates the native data width of the Read Data port C_STREAM_DWIDTH : Integer range 8 to 1024 := 32; -- Sets the width of the Stream output data port C_TAG_WIDTH : Integer range 1 to 8 := 4; -- Indicates the width of the Tag field of the input command C_FAMILY : String := "virtex7" -- Indicates the device family of the target FPGA ); port ( -- Clock and Reset inputs ---------------------------------------- -- primary_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- Reset input -- mmap_reset : in std_logic; -- -- Reset used for the internal master logic -- ------------------------------------------------------------------ -- Soft Shutdown internal interface ----------------------------------- -- rst2data_stop_request : in std_logic; -- -- Active high soft stop request to modules -- -- data2addr_stop_req : Out std_logic; -- -- Active high signal requesting the Address Controller -- -- to stop posting commands to the AXI Read Address Channel -- -- data2rst_stop_cmplt : Out std_logic; -- -- Active high indication that the Data Controller has completed -- -- any pending transfers committed by the Address Controller -- -- after a stop has been requested by the Reset module. -- ----------------------------------------------------------------------- -- External Address Pipelining Contol support ------------------------- -- mm2s_rd_xfer_cmplt : out std_logic; -- -- Active high indication that the Data Controller has completed -- -- a single read data transfer on the AXI4 Read Data Channel. -- -- This signal escentially echos the assertion of rlast received -- -- from the AXI4. -- ----------------------------------------------------------------------- -- AXI Read Data Channel I/O --------------------------------------------- -- mm2s_rdata : In std_logic_vector(C_MMAP_DWIDTH-1 downto 0); -- -- AXI Read data input -- -- mm2s_rresp : In std_logic_vector(1 downto 0); -- -- AXI Read response input -- -- mm2s_rlast : In std_logic; -- -- AXI Read LAST input -- -- mm2s_rvalid : In std_logic; -- -- AXI Read VALID input -- -- mm2s_rready : Out std_logic; -- -- AXI Read data READY output -- -------------------------------------------------------------------------- -- MM2S DRE Control ------------------------------------------------------------- -- mm2s_dre_new_align : Out std_logic; -- -- Active high signal indicating new DRE aligment required -- -- mm2s_dre_use_autodest : Out std_logic; -- -- Active high signal indicating to the DRE to use an auto- -- -- calculated desination alignment based on the last transfer -- -- mm2s_dre_src_align : Out std_logic_vector(C_ALIGN_WIDTH-1 downto 0); -- -- Bit field indicating the byte lane of the first valid data byte -- -- being sent to the DRE -- -- mm2s_dre_dest_align : Out std_logic_vector(C_ALIGN_WIDTH-1 downto 0); -- -- Bit field indicating the desired byte lane of the first valid data byte -- -- to be output by the DRE -- -- mm2s_dre_flush : Out std_logic; -- -- Active high signal indicating to the DRE to flush the current -- -- contents to the output register in preparation of a new alignment -- -- that will be comming on the next transfer input -- --------------------------------------------------------------------------------- -- AXI Master Stream Channel------------------------------------------------------ -- mm2s_strm_wvalid : Out std_logic; -- -- AXI Stream VALID Output -- -- mm2s_strm_wready : In Std_logic; -- -- AXI Stream READY input -- -- mm2s_strm_wdata : Out std_logic_vector(C_STREAM_DWIDTH-1 downto 0); -- -- AXI Stream data output -- -- mm2s_strm_wstrb : Out std_logic_vector((C_STREAM_DWIDTH/8)-1 downto 0); -- -- AXI Stream STRB output -- -- mm2s_strm_wlast : Out std_logic; -- -- AXI Stream LAST output -- --------------------------------------------------------------------------------- -- MM2S Store and Forward Supplimental Control -------------------------------- -- This output is time aligned and qualified with the AXI Master Stream Channel-- -- mm2s_data2sf_cmd_cmplt : out std_logic; -- -- --------------------------------------------------------------------------------- -- Command Calculator Interface ------------------------------------------------- -- mstr2data_tag : In std_logic_vector(C_TAG_WIDTH-1 downto 0); -- -- The next command tag -- -- mstr2data_saddr_lsb : In std_logic_vector(C_SEL_ADDR_WIDTH-1 downto 0); -- -- The next command start address LSbs to use for the read data -- -- mux (only used if Stream data width is 8 or 16 bits). -- -- mstr2data_len : In std_logic_vector(7 downto 0); -- -- The LEN value output to the Address Channel -- -- mstr2data_strt_strb : In std_logic_vector((C_STREAM_DWIDTH/8)-1 downto 0); -- -- The starting strobe value to use for the first stream data beat -- -- mstr2data_last_strb : In std_logic_vector((C_STREAM_DWIDTH/8)-1 downto 0); -- -- The endiing (LAST) strobe value to use for the last stream -- -- data beat -- -- mstr2data_drr : In std_logic; -- -- The starting tranfer of a sequence of transfers -- -- mstr2data_eof : In std_logic; -- -- The endiing tranfer of a sequence of transfers -- -- mstr2data_sequential : In std_logic; -- -- The next sequential tranfer of a sequence of transfers -- -- spawned from a single parent command -- -- mstr2data_calc_error : In std_logic; -- -- Indication if the next command in the calculation pipe -- -- has a calculation error -- -- mstr2data_cmd_cmplt : In std_logic; -- -- The indication to the Data Channel that the current -- -- sub-command output is the last one compiled from the -- -- parent command pulled from the Command FIFO -- -- mstr2data_cmd_valid : In std_logic; -- -- The next command valid indication to the Data Channel -- -- Controller for the AXI MMap -- -- data2mstr_cmd_ready : Out std_logic ; -- -- Indication from the Data Channel Controller that the -- -- command is being accepted on the AXI Address Channel -- -- mstr2data_dre_src_align : In std_logic_vector(C_ALIGN_WIDTH-1 downto 0); -- -- The source (input) alignment for the DRE -- -- mstr2data_dre_dest_align : In std_logic_vector(C_ALIGN_WIDTH-1 downto 0); -- -- The destinstion (output) alignment for the DRE -- --------------------------------------------------------------------------------- -- Address Controller Interface ------------------------------------------------- -- addr2data_addr_posted : In std_logic ; -- -- Indication from the Address Channel Controller to the -- -- Data Controller that an address has been posted to the -- -- AXI Address Channel -- --------------------------------------------------------------------------------- -- Data Controller General Halted Status ---------------------------------------- -- data2all_dcntlr_halted : Out std_logic; -- -- When asserted, this indicates the data controller has satisfied -- -- all pending transfers queued by the Address Controller and is halted. -- --------------------------------------------------------------------------------- -- Output Stream Skid Buffer Halt control --------------------------------------- -- data2skid_halt : Out std_logic; -- -- The data controller asserts this output for 1 primary clock period -- -- The pulse commands the MM2S Stream skid buffer to tun off outputs -- -- at the next tlast transmission. -- --------------------------------------------------------------------------------- -- Read Status Controller Interface ------------------------------------------------ -- data2rsc_tag : Out std_logic_vector(C_TAG_WIDTH-1 downto 0); -- -- The propagated command tag from the Command Calculator -- -- data2rsc_calc_err : Out std_logic ; -- -- Indication that the current command out from the Cntl FIFO -- -- has a propagated calculation error from the Command Calculator -- -- data2rsc_okay : Out std_logic ; -- -- Indication that the AXI Read transfer completed with OK status -- -- data2rsc_decerr : Out std_logic ; -- -- Indication that the AXI Read transfer completed with decode error status -- -- data2rsc_slverr : Out std_logic ; -- -- Indication that the AXI Read transfer completed with slave error status -- -- data2rsc_cmd_cmplt : Out std_logic ; -- -- Indication by the Data Channel Controller that the -- -- corresponding status is the last status for a parent command -- -- pulled from the command FIFO -- -- rsc2data_ready : in std_logic; -- -- Handshake bit from the Read Status Controller Module indicating -- -- that the it is ready to accept a new Read status transfer -- -- data2rsc_valid : Out std_logic ; -- -- Handshake bit output to the Read Status Controller Module -- -- indicating that the Data Controller has valid tag and status -- -- indicators to transfer -- -- rsc2mstr_halt_pipe : In std_logic -- -- Status Flag indicating the Status Controller needs to stall the command -- -- execution pipe due to a Status flow issue or internal error. Generally -- -- this will occur if the Status FIFO is not being serviced fast enough to -- -- keep ahead of the command execution. -- ------------------------------------------------------------------------------------ ); end entity axi_sg_rddata_cntl; architecture implementation of axi_sg_rddata_cntl is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- Function declaration ---------------------------------------- ------------------------------------------------------------------- -- Function -- -- Function Name: funct_set_cnt_width -- -- Function Description: -- Sets a count width based on a fifo depth. A depth of 4 or less -- is a special case which requires a minimum count width of 3 bits. -- ------------------------------------------------------------------- function funct_set_cnt_width (fifo_depth : integer) return integer is Variable temp_cnt_width : Integer := 4; begin if (fifo_depth <= 4) then temp_cnt_width := 3; elsif (fifo_depth <= 8) then -- coverage off temp_cnt_width := 4; elsif (fifo_depth <= 16) then temp_cnt_width := 5; elsif (fifo_depth <= 32) then temp_cnt_width := 6; else -- fifo depth <= 64 temp_cnt_width := 7; end if; -- coverage on Return (temp_cnt_width); end function funct_set_cnt_width; -- Constant Declarations -------------------------------------------- Constant OKAY : std_logic_vector(1 downto 0) := "00"; Constant EXOKAY : std_logic_vector(1 downto 0) := "01"; Constant SLVERR : std_logic_vector(1 downto 0) := "10"; Constant DECERR : std_logic_vector(1 downto 0) := "11"; Constant STRM_STRB_WIDTH : integer := C_STREAM_DWIDTH/8; Constant LEN_OF_ZERO : std_logic_vector(7 downto 0) := (others => '0'); Constant USE_SYNC_FIFO : integer := 0; Constant REG_FIFO_PRIM : integer := 0; Constant BRAM_FIFO_PRIM : integer := 1; Constant SRL_FIFO_PRIM : integer := 2; Constant FIFO_PRIM_TYPE : integer := SRL_FIFO_PRIM; Constant TAG_WIDTH : integer := C_TAG_WIDTH; Constant SADDR_LSB_WIDTH : integer := C_SEL_ADDR_WIDTH; Constant LEN_WIDTH : integer := 8; Constant STRB_WIDTH : integer := C_STREAM_DWIDTH/8; Constant SOF_WIDTH : integer := 1; Constant EOF_WIDTH : integer := 1; Constant CMD_CMPLT_WIDTH : integer := 1; Constant SEQUENTIAL_WIDTH : integer := 1; Constant CALC_ERR_WIDTH : integer := 1; Constant DRE_ALIGN_WIDTH : integer := C_ALIGN_WIDTH; Constant DCTL_FIFO_WIDTH : Integer := TAG_WIDTH + -- Tag field SADDR_LSB_WIDTH + -- LS Address field width LEN_WIDTH + -- LEN field STRB_WIDTH + -- Starting Strobe field STRB_WIDTH + -- Ending Strobe field SOF_WIDTH + -- SOF Flag Field EOF_WIDTH + -- EOF flag field SEQUENTIAL_WIDTH + -- Calc error flag CMD_CMPLT_WIDTH + -- Sequential command flag CALC_ERR_WIDTH + -- Command Complete Flag DRE_ALIGN_WIDTH + -- DRE Source Align width DRE_ALIGN_WIDTH ; -- DRE Dest Align width -- Caution, the INDEX calculations are order dependent so don't rearrange Constant TAG_STRT_INDEX : integer := 0; Constant SADDR_LSB_STRT_INDEX : integer := TAG_STRT_INDEX + TAG_WIDTH; Constant LEN_STRT_INDEX : integer := SADDR_LSB_STRT_INDEX + SADDR_LSB_WIDTH; Constant STRT_STRB_STRT_INDEX : integer := LEN_STRT_INDEX + LEN_WIDTH; Constant LAST_STRB_STRT_INDEX : integer := STRT_STRB_STRT_INDEX + STRB_WIDTH; Constant SOF_STRT_INDEX : integer := LAST_STRB_STRT_INDEX + STRB_WIDTH; Constant EOF_STRT_INDEX : integer := SOF_STRT_INDEX + SOF_WIDTH; Constant SEQUENTIAL_STRT_INDEX : integer := EOF_STRT_INDEX + EOF_WIDTH; Constant CMD_CMPLT_STRT_INDEX : integer := SEQUENTIAL_STRT_INDEX + SEQUENTIAL_WIDTH; Constant CALC_ERR_STRT_INDEX : integer := CMD_CMPLT_STRT_INDEX + CMD_CMPLT_WIDTH; Constant DRE_SRC_STRT_INDEX : integer := CALC_ERR_STRT_INDEX + CALC_ERR_WIDTH; Constant DRE_DEST_STRT_INDEX : integer := DRE_SRC_STRT_INDEX + DRE_ALIGN_WIDTH; Constant ADDR_INCR_VALUE : integer := C_STREAM_DWIDTH/8; --Constant ADDR_POSTED_CNTR_WIDTH : integer := 5; -- allows up to 32 entry address queue Constant ADDR_POSTED_CNTR_WIDTH : integer := funct_set_cnt_width(C_DATA_CNTL_FIFO_DEPTH); Constant ADDR_POSTED_ZERO : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '0'); Constant ADDR_POSTED_ONE : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := TO_UNSIGNED(1, ADDR_POSTED_CNTR_WIDTH); Constant ADDR_POSTED_MAX : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '1'); -- Signal Declarations -------------------------------------------- signal sig_good_dbeat : std_logic := '0'; signal sig_get_next_dqual : std_logic := '0'; signal sig_last_mmap_dbeat : std_logic := '0'; signal sig_last_mmap_dbeat_reg : std_logic := '0'; signal sig_data2mmap_ready : std_logic := '0'; signal sig_mmap2data_valid : std_logic := '0'; signal sig_mmap2data_last : std_logic := '0'; signal sig_aposted_cntr_ready : std_logic := '0'; signal sig_ld_new_cmd : std_logic := '0'; signal sig_ld_new_cmd_reg : std_logic := '0'; signal sig_cmd_cmplt_reg : std_logic := '0'; signal sig_tag_reg : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_addr_lsb_reg : std_logic_vector(C_SEL_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_strt_strb_reg : std_logic_vector(STRM_STRB_WIDTH-1 downto 0) := (others => '0'); signal sig_last_strb_reg : std_logic_vector(STRM_STRB_WIDTH-1 downto 0) := (others => '0'); signal sig_addr_posted : std_logic := '0'; signal sig_addr_chan_rdy : std_logic := '0'; signal sig_dqual_rdy : std_logic := '0'; signal sig_good_mmap_dbeat : std_logic := '0'; signal sig_first_dbeat : std_logic := '0'; signal sig_last_dbeat : std_logic := '0'; signal sig_new_len_eq_0 : std_logic := '0'; signal sig_dbeat_cntr : unsigned(7 downto 0) := (others => '0'); Signal sig_dbeat_cntr_int : Integer range 0 to 255 := 0; signal sig_dbeat_cntr_eq_0 : std_logic := '0'; signal sig_dbeat_cntr_eq_1 : std_logic := '0'; signal sig_calc_error_reg : std_logic := '0'; signal sig_decerr : std_logic := '0'; signal sig_slverr : std_logic := '0'; signal sig_coelsc_okay_reg : std_logic := '0'; signal sig_coelsc_interr_reg : std_logic := '0'; signal sig_coelsc_decerr_reg : std_logic := '0'; signal sig_coelsc_slverr_reg : std_logic := '0'; signal sig_coelsc_cmd_cmplt_reg : std_logic := '0'; signal sig_coelsc_tag_reg : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_pop_coelsc_reg : std_logic := '0'; signal sig_push_coelsc_reg : std_logic := '0'; signal sig_coelsc_reg_empty : std_logic := '0'; signal sig_coelsc_reg_full : std_logic := '0'; signal sig_rsc2data_ready : std_logic := '0'; signal sig_cmd_cmplt_last_dbeat : std_logic := '0'; signal sig_next_tag_reg : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_next_strt_strb_reg : std_logic_vector(STRM_STRB_WIDTH-1 downto 0) := (others => '0'); signal sig_next_last_strb_reg : std_logic_vector(STRM_STRB_WIDTH-1 downto 0) := (others => '0'); signal sig_next_eof_reg : std_logic := '0'; signal sig_next_sequential_reg : std_logic := '0'; signal sig_next_cmd_cmplt_reg : std_logic := '0'; signal sig_next_calc_error_reg : std_logic := '0'; signal sig_next_dre_src_align_reg : std_logic_vector(C_ALIGN_WIDTH-1 downto 0) := (others => '0'); signal sig_next_dre_dest_align_reg : std_logic_vector(C_ALIGN_WIDTH-1 downto 0) := (others => '0'); signal sig_pop_dqual_reg : std_logic := '0'; signal sig_push_dqual_reg : std_logic := '0'; signal sig_dqual_reg_empty : std_logic := '0'; signal sig_dqual_reg_full : std_logic := '0'; signal sig_addr_posted_cntr : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '0'); signal sig_addr_posted_cntr_eq_0 : std_logic := '0'; signal sig_addr_posted_cntr_max : std_logic := '0'; signal sig_decr_addr_posted_cntr : std_logic := '0'; signal sig_incr_addr_posted_cntr : std_logic := '0'; signal sig_ls_addr_cntr : unsigned(C_SEL_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_incr_ls_addr_cntr : std_logic := '0'; signal sig_addr_incr_unsgnd : unsigned(C_SEL_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_no_posted_cmds : std_logic := '0'; Signal sig_cmd_fifo_data_in : std_logic_vector(DCTL_FIFO_WIDTH-1 downto 0); Signal sig_cmd_fifo_data_out : std_logic_vector(DCTL_FIFO_WIDTH-1 downto 0); signal sig_fifo_next_tag : std_logic_vector(TAG_WIDTH-1 downto 0); signal sig_fifo_next_sadddr_lsb : std_logic_vector(SADDR_LSB_WIDTH-1 downto 0); signal sig_fifo_next_len : std_logic_vector(LEN_WIDTH-1 downto 0); signal sig_fifo_next_strt_strb : std_logic_vector(STRB_WIDTH-1 downto 0); signal sig_fifo_next_last_strb : std_logic_vector(STRB_WIDTH-1 downto 0); signal sig_fifo_next_drr : std_logic := '0'; signal sig_fifo_next_eof : std_logic := '0'; signal sig_fifo_next_cmd_cmplt : std_logic := '0'; signal sig_fifo_next_calc_error : std_logic := '0'; signal sig_fifo_next_sequential : std_logic := '0'; signal sig_fifo_next_dre_src_align : std_logic_vector(C_ALIGN_WIDTH-1 downto 0) := (others => '0'); signal sig_fifo_next_dre_dest_align : std_logic_vector(C_ALIGN_WIDTH-1 downto 0) := (others => '0'); signal sig_cmd_fifo_empty : std_logic := '0'; signal sig_fifo_wr_cmd_valid : std_logic := '0'; signal sig_fifo_wr_cmd_ready : std_logic := '0'; signal sig_fifo_rd_cmd_valid : std_logic := '0'; signal sig_fifo_rd_cmd_ready : std_logic := '0'; signal sig_sequential_push : std_logic := '0'; signal sig_clr_dqual_reg : std_logic := '0'; signal sig_advance_pipe : std_logic := '0'; signal sig_halt_reg : std_logic := '0'; signal sig_halt_reg_dly1 : std_logic := '0'; signal sig_halt_reg_dly2 : std_logic := '0'; signal sig_halt_reg_dly3 : std_logic := '0'; signal sig_data2skid_halt : std_logic := '0'; signal sig_rd_xfer_cmplt : std_logic := '0'; signal mm2s_rlast_del : std_logic; begin --(architecture implementation) -- AXI MMap Data Channel Port assignments -- mm2s_rready <= '1'; --sig_data2mmap_ready; -- Read Status Block interface data2rsc_valid <= mm2s_rlast_del; --sig_coelsc_reg_full ; data2rsc_cmd_cmplt <= mm2s_rlast_del; -- data2rsc_valid <= sig_coelsc_reg_full ; mm2s_strm_wvalid <= mm2s_rvalid;-- and sig_data2mmap_ready; mm2s_strm_wlast <= mm2s_rlast; -- and sig_data2mmap_ready; mm2s_strm_wstrb <= (others => '1'); mm2s_strm_wdata <= mm2s_rdata; -- Adding a register for rready as OVC error out during reset RREADY_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1' ) then mm2s_rready <= '0'; Else mm2s_rready <= '1'; end if; end if; end process RREADY_REG; STATUS_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1' ) then mm2s_rlast_del <= '0'; Else mm2s_rlast_del <= mm2s_rlast and mm2s_rvalid; end if; end if; end process STATUS_REG; STATUS_COELESC_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1' or rsc2data_ready = '0') then -- and -- Added more qualification here for simultaneus -- sig_push_coelsc_reg = '0')) then -- push and pop condition per CR590244 sig_coelsc_tag_reg <= (others => '0'); sig_coelsc_interr_reg <= '0'; sig_coelsc_decerr_reg <= '0'; sig_coelsc_slverr_reg <= '0'; sig_coelsc_okay_reg <= '1'; -- set back to default of "OKAY" Elsif (mm2s_rvalid = '1') Then sig_coelsc_tag_reg <= sig_tag_reg; sig_coelsc_interr_reg <= '0'; sig_coelsc_decerr_reg <= sig_decerr or sig_coelsc_decerr_reg; sig_coelsc_slverr_reg <= sig_slverr or sig_coelsc_slverr_reg; sig_coelsc_okay_reg <= not(sig_decerr or sig_slverr ); else null; -- hold current state end if; end if; end process STATUS_COELESC_REG; sig_rsc2data_ready <= rsc2data_ready ; data2rsc_tag <= sig_coelsc_tag_reg ; data2rsc_calc_err <= sig_coelsc_interr_reg ; data2rsc_okay <= sig_coelsc_okay_reg ; data2rsc_decerr <= sig_coelsc_decerr_reg ; data2rsc_slverr <= sig_coelsc_slverr_reg ; -- -- -- AXI MM2S Stream Channel Port assignments ---- mm2s_strm_wvalid <= (mm2s_rvalid and ---- sig_advance_pipe) or ---- (sig_halt_reg and -- Force tvalid high on a Halt and -- -- sig_dqual_reg_full and -- a transfer is scheduled and -- -- not(sig_no_posted_cmds) and -- there are cmds posted to AXi and -- -- not(sig_calc_error_reg)); -- not a calc error -- -- -- ---- mm2s_strm_wlast <= (mm2s_rlast and -- -- sig_next_eof_reg) or -- -- (sig_halt_reg and -- Force tvalid high on a Halt and -- -- sig_dqual_reg_full and -- a transfer is scheduled and -- -- not(sig_no_posted_cmds) and -- there are cmds posted to AXi and -- -- not(sig_calc_error_reg)); -- not a calc error; -- -- -- -- Generate the Write Strobes for the Stream interface ---- mm2s_strm_wstrb <= (others => '1') ---- When (sig_halt_reg = '1') -- Force tstrb high on a Halt -- -- else sig_strt_strb_reg -- -- When (sig_first_dbeat = '1') -- -- Else sig_last_strb_reg -- -- When (sig_last_dbeat = '1') -- -- Else (others => '1'); -- -- -- -- -- -- -- MM2S Supplimental Controls -- mm2s_data2sf_cmd_cmplt <= (mm2s_rlast and -- sig_next_cmd_cmplt_reg) or -- (sig_halt_reg and -- sig_dqual_reg_full and -- not(sig_no_posted_cmds) and -- not(sig_calc_error_reg)); -- -- -- -- -- -- -- -- Address Channel Controller synchro pulse input -- sig_addr_posted <= addr2data_addr_posted; -- -- -- -- -- Request to halt the Address Channel Controller data2skid_halt <= '0'; data2all_dcntlr_halted <= '0'; data2mstr_cmd_ready <= '0'; mm2s_data2sf_cmd_cmplt <= '0'; data2addr_stop_req <= sig_halt_reg; data2rst_stop_cmplt <= '0'; mm2s_rd_xfer_cmplt <= '0'; -- -- -- -- Halted flag to the reset module -- data2rst_stop_cmplt <= (sig_halt_reg_dly3 and -- Normal Mode shutdown -- sig_no_posted_cmds and -- not(sig_calc_error_reg)) or -- (sig_halt_reg_dly3 and -- Shutdown after error trap -- sig_calc_error_reg); -- -- -- -- -- Read Transfer Completed Status output -- mm2s_rd_xfer_cmplt <= sig_rd_xfer_cmplt; -- -- -- -- -- Internal logic ------------------------------ -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_RD_CMPLT_FLAG -- -- -- -- Process Description: -- -- Implements the status flag indicating that a read data -- -- transfer has completed. This is an echo of a rlast assertion -- -- and a qualified data beat on the AXI4 Read Data Channel -- -- inputs. -- -- -- ------------------------------------------------------------- -- IMP_RD_CMPLT_FLAG : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- sig_rd_xfer_cmplt <= '0'; -- -- else -- -- sig_rd_xfer_cmplt <= sig_mmap2data_last and -- sig_good_mmap_dbeat; -- -- end if; -- end if; -- end process IMP_RD_CMPLT_FLAG; -- -- -- -- -- -- -- General flag for advancing the MMap Read and the Stream -- -- data pipelines -- sig_advance_pipe <= sig_addr_chan_rdy and -- sig_dqual_rdy and -- not(sig_coelsc_reg_full) and -- new status back-pressure term -- not(sig_calc_error_reg); -- -- -- -- test for Kevin's status throttle case -- sig_data2mmap_ready <= (mm2s_strm_wready or -- sig_halt_reg) and -- Ignore the Stream ready on a Halt request -- sig_advance_pipe; -- -- -- -- sig_good_mmap_dbeat <= sig_data2mmap_ready and -- sig_mmap2data_valid; -- -- -- sig_last_mmap_dbeat <= sig_good_mmap_dbeat and -- sig_mmap2data_last; -- -- -- sig_get_next_dqual <= sig_last_mmap_dbeat; -- -- -- -- -- -- -- -- ------------------------------------------------------------ -- -- Instance: I_READ_MUX -- -- -- -- Description: -- -- Instance of the MM2S Read Data Channel Read Mux -- -- -- ------------------------------------------------------------ -- I_READ_MUX : entity axi_sg_v4_1.axi_sg_rdmux -- generic map ( -- -- C_SEL_ADDR_WIDTH => C_SEL_ADDR_WIDTH , -- C_MMAP_DWIDTH => C_MMAP_DWIDTH , -- C_STREAM_DWIDTH => C_STREAM_DWIDTH -- -- ) -- port map ( -- -- mmap_read_data_in => mm2s_rdata , -- mux_data_out => open, --mm2s_strm_wdata , -- mstr2data_saddr_lsb => sig_addr_lsb_reg -- -- ); -- -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: REG_LAST_DBEAT -- -- -- -- Process Description: -- -- This implements a FLOP that creates a pulse -- -- indicating the LAST signal for an incoming read data channel -- -- has been received. Note that it is possible to have back to -- -- back LAST databeats. -- -- -- ------------------------------------------------------------- -- REG_LAST_DBEAT : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- sig_last_mmap_dbeat_reg <= '0'; -- -- else -- -- sig_last_mmap_dbeat_reg <= sig_last_mmap_dbeat; -- -- end if; -- end if; -- end process REG_LAST_DBEAT; -- -- -- -- -- -- -- -- ------------------------------------------------------------ -- -- If Generate -- -- -- -- Label: GEN_NO_DATA_CNTL_FIFO -- -- -- -- If Generate Description: -- -- Omits the input data control FIFO if the requested FIFO -- -- depth is 1. The Data Qualifier Register serves as a -- -- 1 deep FIFO by itself. -- -- -- ------------------------------------------------------------ -- GEN_NO_DATA_CNTL_FIFO : if (C_DATA_CNTL_FIFO_DEPTH = 1) generate -- -- begin -- -- -- Command Calculator Handshake output -- data2mstr_cmd_ready <= sig_fifo_wr_cmd_ready; -- -- sig_fifo_rd_cmd_valid <= mstr2data_cmd_valid ; -- -- -- -- -- pre 13.1 sig_fifo_wr_cmd_ready <= sig_dqual_reg_empty and -- -- pre 13.1 sig_aposted_cntr_ready and -- -- pre 13.1 not(rsc2mstr_halt_pipe) and -- The Rd Status Controller is not stalling -- -- pre 13.1 not(sig_calc_error_reg); -- the command execution pipe and there is -- -- pre 13.1 -- no calculation error being propagated -- -- sig_fifo_wr_cmd_ready <= sig_push_dqual_reg; -- -- -- -- -- sig_fifo_next_tag <= mstr2data_tag ; -- sig_fifo_next_sadddr_lsb <= mstr2data_saddr_lsb ; -- sig_fifo_next_len <= mstr2data_len ; -- sig_fifo_next_strt_strb <= mstr2data_strt_strb ; -- sig_fifo_next_last_strb <= mstr2data_last_strb ; -- sig_fifo_next_drr <= mstr2data_drr ; -- sig_fifo_next_eof <= mstr2data_eof ; -- sig_fifo_next_sequential <= mstr2data_sequential ; -- sig_fifo_next_cmd_cmplt <= mstr2data_cmd_cmplt ; -- sig_fifo_next_calc_error <= mstr2data_calc_error ; -- -- sig_fifo_next_dre_src_align <= mstr2data_dre_src_align ; -- sig_fifo_next_dre_dest_align <= mstr2data_dre_dest_align ; -- -- -- -- end generate GEN_NO_DATA_CNTL_FIFO; -- -- -- -- -- -- -- ------------------------------------------------------------ -- -- If Generate -- -- -- -- Label: GEN_DATA_CNTL_FIFO -- -- -- -- If Generate Description: -- -- Includes the input data control FIFO if the requested -- -- FIFO depth is more than 1. -- -- -- ------------------------------------------------------------ ---- GEN_DATA_CNTL_FIFO : if (C_DATA_CNTL_FIFO_DEPTH > 1) generate ---- ---- begin ---- ---- ---- -- Command Calculator Handshake output ---- data2mstr_cmd_ready <= sig_fifo_wr_cmd_ready; ---- ---- sig_fifo_wr_cmd_valid <= mstr2data_cmd_valid ; ---- ---- ---- sig_fifo_rd_cmd_ready <= sig_push_dqual_reg; -- pop the fifo when dqual reg is pushed ---- ---- ---- ---- ---- ---- -- Format the input fifo data word ---- sig_cmd_fifo_data_in <= mstr2data_dre_dest_align & ---- mstr2data_dre_src_align & ---- mstr2data_calc_error & ---- mstr2data_cmd_cmplt & ---- mstr2data_sequential & ---- mstr2data_eof & ---- mstr2data_drr & ---- mstr2data_last_strb & ---- mstr2data_strt_strb & ---- mstr2data_len & ---- mstr2data_saddr_lsb & ---- mstr2data_tag ; ---- ---- ---- -- Rip the output fifo data word ---- sig_fifo_next_tag <= sig_cmd_fifo_data_out((TAG_STRT_INDEX+TAG_WIDTH)-1 downto ---- TAG_STRT_INDEX); ---- sig_fifo_next_sadddr_lsb <= sig_cmd_fifo_data_out((SADDR_LSB_STRT_INDEX+SADDR_LSB_WIDTH)-1 downto ---- SADDR_LSB_STRT_INDEX); ---- sig_fifo_next_len <= sig_cmd_fifo_data_out((LEN_STRT_INDEX+LEN_WIDTH)-1 downto ---- LEN_STRT_INDEX); ---- sig_fifo_next_strt_strb <= sig_cmd_fifo_data_out((STRT_STRB_STRT_INDEX+STRB_WIDTH)-1 downto ---- STRT_STRB_STRT_INDEX); ---- sig_fifo_next_last_strb <= sig_cmd_fifo_data_out((LAST_STRB_STRT_INDEX+STRB_WIDTH)-1 downto ---- LAST_STRB_STRT_INDEX); ---- sig_fifo_next_drr <= sig_cmd_fifo_data_out(SOF_STRT_INDEX); ---- sig_fifo_next_eof <= sig_cmd_fifo_data_out(EOF_STRT_INDEX); ---- sig_fifo_next_sequential <= sig_cmd_fifo_data_out(SEQUENTIAL_STRT_INDEX); ---- sig_fifo_next_cmd_cmplt <= sig_cmd_fifo_data_out(CMD_CMPLT_STRT_INDEX); ---- sig_fifo_next_calc_error <= sig_cmd_fifo_data_out(CALC_ERR_STRT_INDEX); ---- ---- sig_fifo_next_dre_src_align <= sig_cmd_fifo_data_out((DRE_SRC_STRT_INDEX+DRE_ALIGN_WIDTH)-1 downto ---- DRE_SRC_STRT_INDEX); ---- sig_fifo_next_dre_dest_align <= sig_cmd_fifo_data_out((DRE_DEST_STRT_INDEX+DRE_ALIGN_WIDTH)-1 downto ---- DRE_DEST_STRT_INDEX); ---- ---- ---- ---- ---- ------------------------------------------------------------ ---- -- Instance: I_DATA_CNTL_FIFO ---- -- ---- -- Description: ---- -- Instance for the Command Qualifier FIFO ---- -- ---- ------------------------------------------------------------ ---- I_DATA_CNTL_FIFO : entity axi_sg_v4_1.axi_sg_fifo ---- generic map ( ---- ---- C_DWIDTH => DCTL_FIFO_WIDTH , ---- C_DEPTH => C_DATA_CNTL_FIFO_DEPTH , ---- C_IS_ASYNC => USE_SYNC_FIFO , ---- C_PRIM_TYPE => FIFO_PRIM_TYPE , ---- C_FAMILY => C_FAMILY ---- ---- ) ---- port map ( ---- ---- -- Write Clock and reset ---- fifo_wr_reset => mmap_reset , ---- fifo_wr_clk => primary_aclk , ---- ---- -- Write Side ---- fifo_wr_tvalid => sig_fifo_wr_cmd_valid , ---- fifo_wr_tready => sig_fifo_wr_cmd_ready , ---- fifo_wr_tdata => sig_cmd_fifo_data_in , ---- fifo_wr_full => open , ---- ---- -- Read Clock and reset ---- fifo_async_rd_reset => mmap_reset , ---- fifo_async_rd_clk => primary_aclk , ---- ---- -- Read Side ---- fifo_rd_tvalid => sig_fifo_rd_cmd_valid , ---- fifo_rd_tready => sig_fifo_rd_cmd_ready , ---- fifo_rd_tdata => sig_cmd_fifo_data_out , ---- fifo_rd_empty => sig_cmd_fifo_empty ---- ---- ); ---- ---- ---- end generate GEN_DATA_CNTL_FIFO; ---- -- -- -- -- -- -- -- -- -- -- Data Qualifier Register ------------------------------------ -- -- sig_ld_new_cmd <= sig_push_dqual_reg ; -- sig_addr_chan_rdy <= not(sig_addr_posted_cntr_eq_0); -- sig_dqual_rdy <= sig_dqual_reg_full ; -- sig_strt_strb_reg <= sig_next_strt_strb_reg ; -- sig_last_strb_reg <= sig_next_last_strb_reg ; -- sig_tag_reg <= sig_next_tag_reg ; -- sig_cmd_cmplt_reg <= sig_next_cmd_cmplt_reg ; -- sig_calc_error_reg <= sig_next_calc_error_reg ; -- -- -- -- Flag indicating that there are no posted commands to AXI -- sig_no_posted_cmds <= sig_addr_posted_cntr_eq_0; -- -- -- -- -- new for no bubbles between child requests -- sig_sequential_push <= sig_good_mmap_dbeat and -- MMap handshake qualified -- sig_last_dbeat and -- last data beat of transfer -- sig_next_sequential_reg;-- next queued command is sequential -- -- to the current command -- -- -- -- pre 13.1 sig_push_dqual_reg <= (sig_sequential_push or -- -- pre 13.1 sig_dqual_reg_empty) and -- -- pre 13.1 sig_fifo_rd_cmd_valid and -- -- pre 13.1 sig_aposted_cntr_ready and -- -- pre 13.1 not(rsc2mstr_halt_pipe); -- The Rd Status Controller is not -- -- stalling the command execution pipe -- -- sig_push_dqual_reg <= (sig_sequential_push or -- sig_dqual_reg_empty) and -- sig_fifo_rd_cmd_valid and -- sig_aposted_cntr_ready and -- not(sig_calc_error_reg) and -- 13.1 addition => An error has not been propagated -- not(rsc2mstr_halt_pipe); -- The Rd Status Controller is not -- -- stalling the command execution pipe -- -- -- sig_pop_dqual_reg <= not(sig_next_calc_error_reg) and -- sig_get_next_dqual and -- sig_dqual_reg_full ; -- -- -- -- new for no bubbles between child requests -- sig_clr_dqual_reg <= mmap_reset or -- (sig_pop_dqual_reg and -- not(sig_push_dqual_reg)); -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_DQUAL_REG -- -- -- -- Process Description: -- -- This process implements a register for the Data -- -- Control and qualifiers. It operates like a 1 deep Sync FIFO. -- -- -- ------------------------------------------------------------- -- IMP_DQUAL_REG : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (sig_clr_dqual_reg = '1') then -- -- sig_next_tag_reg <= (others => '0'); -- sig_next_strt_strb_reg <= (others => '0'); -- sig_next_last_strb_reg <= (others => '0'); -- sig_next_eof_reg <= '0'; -- sig_next_cmd_cmplt_reg <= '0'; -- sig_next_sequential_reg <= '0'; -- sig_next_calc_error_reg <= '0'; -- sig_next_dre_src_align_reg <= (others => '0'); -- sig_next_dre_dest_align_reg <= (others => '0'); -- -- sig_dqual_reg_empty <= '1'; -- sig_dqual_reg_full <= '0'; -- -- elsif (sig_push_dqual_reg = '1') then -- -- sig_next_tag_reg <= sig_fifo_next_tag ; -- sig_next_strt_strb_reg <= sig_fifo_next_strt_strb ; -- sig_next_last_strb_reg <= sig_fifo_next_last_strb ; -- sig_next_eof_reg <= sig_fifo_next_eof ; -- sig_next_cmd_cmplt_reg <= sig_fifo_next_cmd_cmplt ; -- sig_next_sequential_reg <= sig_fifo_next_sequential ; -- sig_next_calc_error_reg <= sig_fifo_next_calc_error ; -- sig_next_dre_src_align_reg <= sig_fifo_next_dre_src_align ; -- sig_next_dre_dest_align_reg <= sig_fifo_next_dre_dest_align ; -- -- sig_dqual_reg_empty <= '0'; -- sig_dqual_reg_full <= '1'; -- -- else -- null; -- don't change state -- end if; -- end if; -- end process IMP_DQUAL_REG; -- -- -- -- -- -- -- -- -- Address LS Cntr logic -------------------------- -- -- sig_addr_lsb_reg <= STD_LOGIC_VECTOR(sig_ls_addr_cntr); -- sig_addr_incr_unsgnd <= TO_UNSIGNED(ADDR_INCR_VALUE, C_SEL_ADDR_WIDTH); -- sig_incr_ls_addr_cntr <= sig_good_mmap_dbeat; -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: DO_ADDR_LSB_CNTR -- -- -- -- Process Description: -- -- Implements the LS Address Counter used for controlling -- -- the Read Data Mux during Burst transfers -- -- -- ------------------------------------------------------------- -- DO_ADDR_LSB_CNTR : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1' or -- (sig_pop_dqual_reg = '1' and -- sig_push_dqual_reg = '0')) then -- Clear the Counter -- -- sig_ls_addr_cntr <= (others => '0'); -- -- elsif (sig_push_dqual_reg = '1') then -- Load the Counter -- -- sig_ls_addr_cntr <= unsigned(sig_fifo_next_sadddr_lsb); -- -- elsif (sig_incr_ls_addr_cntr = '1') then -- Increment the Counter -- -- sig_ls_addr_cntr <= sig_ls_addr_cntr + sig_addr_incr_unsgnd; -- -- else -- null; -- Hold Current value -- end if; -- end if; -- end process DO_ADDR_LSB_CNTR; -- -- -- -- -- -- -- -- -- -- -- -- -- ----- Address posted Counter logic -------------------------------- -- -- sig_incr_addr_posted_cntr <= sig_addr_posted ; -- -- -- sig_decr_addr_posted_cntr <= sig_last_mmap_dbeat_reg ; -- -- -- sig_aposted_cntr_ready <= not(sig_addr_posted_cntr_max); -- -- sig_addr_posted_cntr_eq_0 <= '1' -- when (sig_addr_posted_cntr = ADDR_POSTED_ZERO) -- Else '0'; -- -- sig_addr_posted_cntr_max <= '1' -- when (sig_addr_posted_cntr = ADDR_POSTED_MAX) -- Else '0'; -- -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_ADDR_POSTED_FIFO_CNTR -- -- -- -- Process Description: -- -- This process implements a register for the Address -- -- Posted FIFO that operates like a 1 deep Sync FIFO. -- -- -- ------------------------------------------------------------- -- IMP_ADDR_POSTED_FIFO_CNTR : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- sig_addr_posted_cntr <= ADDR_POSTED_ZERO; -- -- elsif (sig_incr_addr_posted_cntr = '1' and -- sig_decr_addr_posted_cntr = '0' and -- sig_addr_posted_cntr_max = '0') then -- -- sig_addr_posted_cntr <= sig_addr_posted_cntr + ADDR_POSTED_ONE ; -- -- elsif (sig_incr_addr_posted_cntr = '0' and -- sig_decr_addr_posted_cntr = '1' and -- sig_addr_posted_cntr_eq_0 = '0') then -- -- sig_addr_posted_cntr <= sig_addr_posted_cntr - ADDR_POSTED_ONE ; -- -- else -- null; -- don't change state -- end if; -- end if; -- end process IMP_ADDR_POSTED_FIFO_CNTR; -- -- -- -- -- -- -- -- -- ------- First/Middle/Last Dbeat detirmination ------------------- -- -- sig_new_len_eq_0 <= '1' -- When (sig_fifo_next_len = LEN_OF_ZERO) -- else '0'; -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: DO_FIRST_MID_LAST -- -- -- -- Process Description: -- -- Implements the detection of the First/Mid/Last databeat of -- -- a transfer. -- -- -- ------------------------------------------------------------- -- DO_FIRST_MID_LAST : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- sig_first_dbeat <= '0'; -- sig_last_dbeat <= '0'; -- -- elsif (sig_ld_new_cmd = '1') then -- -- sig_first_dbeat <= not(sig_new_len_eq_0); -- sig_last_dbeat <= sig_new_len_eq_0; -- -- Elsif (sig_dbeat_cntr_eq_1 = '1' and -- sig_good_mmap_dbeat = '1') Then -- -- sig_first_dbeat <= '0'; -- sig_last_dbeat <= '1'; -- -- Elsif (sig_dbeat_cntr_eq_0 = '0' and -- sig_dbeat_cntr_eq_1 = '0' and -- sig_good_mmap_dbeat = '1') Then -- -- sig_first_dbeat <= '0'; -- sig_last_dbeat <= '0'; -- -- else -- null; -- hols current state -- end if; -- end if; -- end process DO_FIRST_MID_LAST; -- -- -- -- -- -- ------- Data Controller Halted Indication ------------------------------- -- -- -- data2all_dcntlr_halted <= sig_no_posted_cmds and -- (sig_calc_error_reg or -- rst2data_stop_request); -- -- -- -- -- ------- Data Beat counter logic ------------------------------- -- sig_dbeat_cntr_int <= TO_INTEGER(sig_dbeat_cntr); -- -- sig_dbeat_cntr_eq_0 <= '1' -- when (sig_dbeat_cntr_int = 0) -- Else '0'; -- -- sig_dbeat_cntr_eq_1 <= '1' -- when (sig_dbeat_cntr_int = 1) -- Else '0'; -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: DO_DBEAT_CNTR -- -- -- -- Process Description: -- -- -- -- -- ------------------------------------------------------------- -- DO_DBEAT_CNTR : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- sig_dbeat_cntr <= (others => '0'); -- elsif (sig_ld_new_cmd = '1') then -- sig_dbeat_cntr <= unsigned(sig_fifo_next_len); -- Elsif (sig_good_mmap_dbeat = '1' and -- sig_dbeat_cntr_eq_0 = '0') Then -- sig_dbeat_cntr <= sig_dbeat_cntr-1; -- else -- null; -- Hold current state -- end if; -- end if; -- end process DO_DBEAT_CNTR; -- -- -- -- -- -- -- ------ Read Response Status Logic ------------------------------ -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: LD_NEW_CMD_PULSE -- -- -- -- Process Description: -- -- Generate a 1 Clock wide pulse when a new command has been -- -- loaded into the Command Register -- -- -- ------------------------------------------------------------- -- LD_NEW_CMD_PULSE : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1' or -- sig_ld_new_cmd_reg = '1') then -- sig_ld_new_cmd_reg <= '0'; -- elsif (sig_ld_new_cmd = '1') then -- sig_ld_new_cmd_reg <= '1'; -- else -- null; -- hold State -- end if; -- end if; -- end process LD_NEW_CMD_PULSE; -- -- -- -- sig_pop_coelsc_reg <= sig_coelsc_reg_full and -- sig_rsc2data_ready ; -- -- sig_push_coelsc_reg <= (sig_good_mmap_dbeat and -- not(sig_coelsc_reg_full)) or -- (sig_ld_new_cmd_reg and -- sig_calc_error_reg) ; -- -- sig_cmd_cmplt_last_dbeat <= (sig_cmd_cmplt_reg and sig_mmap2data_last) or -- sig_calc_error_reg; -- -- -- ------- Read Response Decode -- Decode the AXI MMap Read Response sig_decerr <= '1' When mm2s_rresp = DECERR Else '0'; sig_slverr <= '1' When mm2s_rresp = SLVERR Else '0'; -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: RD_RESP_COELESC_REG -- -- -- -- Process Description: -- -- Implement the Read error/status coelescing register. -- -- Once a bit is set it will remain set until the overall -- -- status is written to the Status Controller. -- -- Tag bits are just registered at each valid dbeat. -- -- -- ------------------------------------------------------------- ---- STATUS_COELESC_REG : process (primary_aclk) ---- begin ---- if (primary_aclk'event and primary_aclk = '1') then ---- if (mmap_reset = '1' or ---- (sig_pop_coelsc_reg = '1' and -- Added more qualification here for simultaneus ---- sig_push_coelsc_reg = '0')) then -- push and pop condition per CR590244 ---- ---- sig_coelsc_tag_reg <= (others => '0'); ---- sig_coelsc_cmd_cmplt_reg <= '0'; ---- sig_coelsc_interr_reg <= '0'; ---- sig_coelsc_decerr_reg <= '0'; ---- sig_coelsc_slverr_reg <= '0'; ---- sig_coelsc_okay_reg <= '1'; -- set back to default of "OKAY" ---- ---- sig_coelsc_reg_full <= '0'; ---- sig_coelsc_reg_empty <= '1'; ---- ---- ---- ---- Elsif (sig_push_coelsc_reg = '1') Then ---- ---- sig_coelsc_tag_reg <= sig_tag_reg; ---- sig_coelsc_cmd_cmplt_reg <= sig_cmd_cmplt_last_dbeat; ---- sig_coelsc_interr_reg <= sig_calc_error_reg or ---- sig_coelsc_interr_reg; ---- sig_coelsc_decerr_reg <= sig_decerr or sig_coelsc_decerr_reg; ---- sig_coelsc_slverr_reg <= sig_slverr or sig_coelsc_slverr_reg; ---- sig_coelsc_okay_reg <= not(sig_decerr or ---- sig_slverr or ---- sig_calc_error_reg ); ---- ---- sig_coelsc_reg_full <= sig_cmd_cmplt_last_dbeat; ---- sig_coelsc_reg_empty <= not(sig_cmd_cmplt_last_dbeat); ---- ---- ---- else ---- ---- null; -- hold current state ---- ---- end if; ---- end if; ---- end process STATUS_COELESC_REG; -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------ -- -- If Generate -- -- -- -- Label: GEN_NO_DRE -- -- -- -- If Generate Description: -- -- Ties off DRE Control signals to logic low when DRE is -- -- omitted from the MM2S functionality. -- -- -- -- -- ------------------------------------------------------------ -- GEN_NO_DRE : if (C_INCLUDE_DRE = 0) generate -- -- begin -- mm2s_dre_new_align <= '0'; mm2s_dre_use_autodest <= '0'; mm2s_dre_src_align <= (others => '0'); mm2s_dre_dest_align <= (others => '0'); mm2s_dre_flush <= '0'; -- -- end generate GEN_NO_DRE; -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------ -- -- If Generate -- -- -- -- Label: GEN_INCLUDE_DRE_CNTLS -- -- -- -- If Generate Description: -- -- Implements the DRE Control logic when MM2S DRE is enabled. -- -- -- -- - The DRE needs to have forced alignment at a SOF assertion -- -- -- -- -- ------------------------------------------------------------ -- GEN_INCLUDE_DRE_CNTLS : if (C_INCLUDE_DRE = 1) generate -- -- -- local signals -- signal lsig_s_h_dre_autodest : std_logic := '0'; -- signal lsig_s_h_dre_new_align : std_logic := '0'; -- -- begin -- -- -- mm2s_dre_new_align <= lsig_s_h_dre_new_align; -- -- -- -- -- -- Autodest is asserted on a new parent command and the -- -- previous parent command was not delimited with a EOF -- mm2s_dre_use_autodest <= lsig_s_h_dre_autodest; -- -- -- -- -- -- Assign the DRE Source and Destination Alignments -- -- Only used when mm2s_dre_new_align is asserted -- mm2s_dre_src_align <= sig_next_dre_src_align_reg ; -- mm2s_dre_dest_align <= sig_next_dre_dest_align_reg; -- -- -- -- Assert the Flush flag when the MMap Tlast input of the current transfer is -- -- asserted and the next transfer is not sequential and not the last -- -- transfer of a packet. -- mm2s_dre_flush <= mm2s_rlast and -- not(sig_next_sequential_reg) and -- not(sig_next_eof_reg); -- -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_S_H_NEW_ALIGN -- -- -- -- Process Description: -- -- Generates the new alignment command flag to the DRE. -- -- -- ------------------------------------------------------------- -- IMP_S_H_NEW_ALIGN : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- lsig_s_h_dre_new_align <= '0'; -- -- -- Elsif (sig_push_dqual_reg = '1' and -- sig_fifo_next_drr = '1') Then -- -- lsig_s_h_dre_new_align <= '1'; -- -- elsif (sig_pop_dqual_reg = '1') then -- -- lsig_s_h_dre_new_align <= sig_next_cmd_cmplt_reg and -- not(sig_next_sequential_reg) and -- not(sig_next_eof_reg); -- -- Elsif (sig_good_mmap_dbeat = '1') Then -- -- lsig_s_h_dre_new_align <= '0'; -- -- -- else -- -- null; -- hold current state -- -- end if; -- end if; -- end process IMP_S_H_NEW_ALIGN; -- -- -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_S_H_AUTODEST -- -- -- -- Process Description: -- -- Generates the control for the DRE indicating whether the -- -- DRE destination alignment should be derived from the write -- -- strobe stat of the last completed data-beat to the AXI -- -- stream output. -- -- -- ------------------------------------------------------------- -- IMP_S_H_AUTODEST : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- lsig_s_h_dre_autodest <= '0'; -- -- -- Elsif (sig_push_dqual_reg = '1' and -- sig_fifo_next_drr = '1') Then -- -- lsig_s_h_dre_autodest <= '0'; -- -- elsif (sig_pop_dqual_reg = '1') then -- -- lsig_s_h_dre_autodest <= sig_next_cmd_cmplt_reg and -- not(sig_next_sequential_reg) and -- not(sig_next_eof_reg); -- -- Elsif (lsig_s_h_dre_new_align = '1' and -- sig_good_mmap_dbeat = '1') Then -- -- lsig_s_h_dre_autodest <= '0'; -- -- -- else -- -- null; -- hold current state -- -- end if; -- end if; -- end process IMP_S_H_AUTODEST; -- -- -- -- -- end generate GEN_INCLUDE_DRE_CNTLS; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------- Soft Shutdown Logic ------------------------------- -- -- -- -- Assign the output port skid buf control -- data2skid_halt <= sig_data2skid_halt; -- -- -- Create a 1 clock wide pulse to tell the output -- -- stream skid buffer to shut down its outputs -- sig_data2skid_halt <= sig_halt_reg_dly2 and -- not(sig_halt_reg_dly3); -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_HALT_REQ_REG -- -- -- -- Process Description: -- -- Implements the flop for capturing the Halt request from -- -- the Reset module. -- -- -- ------------------------------------------------------------- IMP_HALT_REQ_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_halt_reg <= '0'; elsif (rst2data_stop_request = '1') then sig_halt_reg <= '1'; else null; -- Hold current State end if; end if; end process IMP_HALT_REQ_REG; -- -- -- -- -- ------------------------------------------------------------- -- -- Synchronous Process with Sync Reset -- -- -- -- Label: IMP_HALT_REQ_REG_DLY -- -- -- -- Process Description: -- -- Implements the flops for delaying the halt request by 3 -- -- clocks to allow the Address Controller to halt before the -- -- Data Contoller can safely indicate it has exhausted all -- -- transfers committed to the AXI Address Channel by the Address -- -- Controller. -- -- -- ------------------------------------------------------------- -- IMP_HALT_REQ_REG_DLY : process (primary_aclk) -- begin -- if (primary_aclk'event and primary_aclk = '1') then -- if (mmap_reset = '1') then -- -- sig_halt_reg_dly1 <= '0'; -- sig_halt_reg_dly2 <= '0'; -- sig_halt_reg_dly3 <= '0'; -- -- else -- -- sig_halt_reg_dly1 <= sig_halt_reg; -- sig_halt_reg_dly2 <= sig_halt_reg_dly1; -- sig_halt_reg_dly3 <= sig_halt_reg_dly2; -- -- end if; -- end if; -- end process IMP_HALT_REQ_REG_DLY; -- -- -- -- -- -- -- -- -- end implementation;
gpl-3.0
1004cb71a8f30702dfb66bdeac906f79
0.390525
4.440455
false
false
false
false
borti4938/sd2snes
verilog/sd2snes_sdd1/Input_Manager.vhd
2
17,475
---------------------------------------------------------------------------------- -- Company: Traducciones Magno -- Engineer: Magno -- -- Create Date: 18.03.2018 18:59:09 -- Design Name: -- Module Name: Input_Manager - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx leaf cells in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Input_Manager is Port( clk : in STD_LOGIC; -- control data DMA_Conf_Valid : in STD_LOGIC; DMA_In_Progress : in STD_LOGIC; Header_Valid : out STD_LOGIC; Header_BPP : out STD_LOGIC_VECTOR(1 downto 0); Header_Context : out STD_LOGIC_VECTOR(1 downto 0); -- data input from ROM ROM_Data_tready : out STD_LOGIC; ROM_Data_tvalid : in STD_LOGIC; ROM_Data_tdata : in STD_LOGIC_VECTOR(15 downto 0); ROM_Data_tkeep : in STD_LOGIC_VECTOR(1 downto 0); -- Golomb decoded value Decoded_Bit_tready : in STD_LOGIC; Decoded_Bit_tuser : in STD_LOGIC_VECTOR(7 downto 0); Decoded_Bit_tvalid : out STD_LOGIC; Decoded_Bit_tdata : out STD_LOGIC; Decoded_Bit_tlast : out STD_LOGIC ); end Input_Manager; architecture Behavioral of Input_Manager is COMPONENT FIFO_AXIS Generic( FIFO_DEPTH : integer := 32 ); Port( clk : IN STD_LOGIC; srst : IN STD_LOGIC; din_tready : OUT STD_LOGIC; din_tvalid : IN STD_LOGIC; din_tdata : IN STD_LOGIC_VECTOR(15 DOWNTO 0); din_tkeep : IN STD_LOGIC_VECTOR(1 downto 0); dout_tready : IN STD_LOGIC; dout_tvalid : OUT STD_LOGIC; dout_tdata : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); full : OUT STD_LOGIC; empty : OUT STD_LOGIC ); END COMPONENT; COMPONENT Serializer Port( clk : IN STD_LOGIC; Rst : IN STD_LOGIC; FIFO_tready : OUT STD_LOGIC; FIFO_tvalid : IN STD_LOGIC; FIFO_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0); Shift : IN STD_LOGIC; Shift_cnt : IN STD_LOGIC_VECTOR(2 downto 0); Serial_tvalid : OUT STD_LOGIC; Serial_tdata : OUT STD_LOGIC_VECTOR(7 downto 0) ); END COMPONENT; COMPONENT Golomb_N_Decoder Generic( N : integer); Port( clk : IN STD_LOGIC; rst : IN STD_LOGIC; din_tready : OUT STD_LOGIC; din_tdata : IN STD_LOGIC_VECTOR(N DOWNTO 0); din_tuser : OUT STD_LOGIC_VECTOR(2 downto 0); dout_tready : IN STD_LOGIC; dout_tdata : OUT STD_LOGIC; dout_tlast : OUT STD_LOGIC); END COMPONENT; COMPONENT Golomb_0_Decoder Port( clk : IN STD_LOGIC; rst : IN STD_LOGIC; din_tready : OUT STD_LOGIC; din_tdata : IN STD_LOGIC_VECTOR(0 DOWNTO 0); din_tuser : OUT STD_LOGIC_VECTOR(2 downto 0); dout_tready : IN STD_LOGIC; dout_tdata : OUT STD_LOGIC; dout_tlast : OUT STD_LOGIC); END COMPONENT; type TipoEstado is( WAIT_START, FILL_SERIALIZER, GET_HEADER, INIT_GOLOMB, WAIT_END); signal estado : TipoEstado := WAIT_START; signal Decoded_Bit_tvalid_i : STD_LOGIC := '0'; signal Decoded_Bit_tlast_i : STD_LOGIC := '0'; signal Decoded_Bit_tdata_i : STD_LOGIC := '0'; signal Decoded_Bit_tuser_i : STD_LOGIC_VECTOR(2 downto 0) := "000"; signal FIFO_tready : STD_LOGIC := '0'; signal FIFO_Full : STD_LOGIC := '1'; signal FIFO_tvalid : STD_LOGIC := '0'; signal FIFO_tdata : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal Bit_Shift_Rdy : STD_LOGIC := '0'; signal Bit_Shift_Cnt : STD_LOGIC_VECTOR(2 downto 0) := "000"; signal Bit_Serializer_tvalid : STD_LOGIC := '0'; signal Bit_Serializer_tdata : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal G0_Run_End : STD_LOGIC := '0'; signal G1_Run_End : STD_LOGIC := '0'; signal G2_Run_End : STD_LOGIC := '0'; signal G3_Run_End : STD_LOGIC := '0'; signal G4_Run_End : STD_LOGIC := '0'; signal G5_Run_End : STD_LOGIC := '0'; signal G6_Run_End : STD_LOGIC := '0'; signal G7_Run_End : STD_LOGIC := '0'; signal G0_din : STD_LOGIC_VECTOR(0 downto 0) := (others => '0'); signal G1_din : STD_LOGIC_VECTOR(1 downto 0) := (others => '0'); signal G2_din : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G3_din : STD_LOGIC_VECTOR(3 downto 0) := (others => '0'); signal G4_din : STD_LOGIC_VECTOR(4 downto 0) := (others => '0'); signal G5_din : STD_LOGIC_VECTOR(5 downto 0) := (others => '0'); signal G6_din : STD_LOGIC_VECTOR(6 downto 0) := (others => '0'); signal G7_din : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal G0_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G1_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G2_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G3_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G4_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G5_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G6_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal G7_shift : STD_LOGIC_VECTOR(2 downto 0) := (others => '0'); signal Decoded_G0_tready : STD_LOGIC := '0'; signal Decoded_G0_tdata : STD_LOGIC := '0'; signal Decoded_G0_tlast : STD_LOGIC := '0'; signal Decoded_G1_tready : STD_LOGIC := '0'; signal Decoded_G1_tdata : STD_LOGIC := '0'; signal Decoded_G1_tlast : STD_LOGIC := '0'; signal Decoded_G2_tready : STD_LOGIC := '0'; signal Decoded_G2_tdata : STD_LOGIC := '0'; signal Decoded_G2_tlast : STD_LOGIC := '0'; signal Decoded_G3_tready : STD_LOGIC := '0'; signal Decoded_G3_tdata : STD_LOGIC := '0'; signal Decoded_G3_tlast : STD_LOGIC := '0'; signal Decoded_G4_tready : STD_LOGIC := '0'; signal Decoded_G4_tdata : STD_LOGIC := '0'; signal Decoded_G4_tlast : STD_LOGIC := '0'; signal Decoded_G5_tready : STD_LOGIC := '0'; signal Decoded_G5_tdata : STD_LOGIC := '0'; signal Decoded_G5_tlast : STD_LOGIC := '0'; signal Decoded_G6_tready : STD_LOGIC := '0'; signal Decoded_G6_tdata : STD_LOGIC := '0'; signal Decoded_G6_tlast : STD_LOGIC := '0'; signal Decoded_G7_tready : STD_LOGIC := '0'; signal Decoded_G7_tdata : STD_LOGIC := '0'; signal Decoded_G7_tlast : STD_LOGIC := '0'; signal FSM_Reset : STD_LOGIC := '1'; signal FSM_Get_Header : STD_LOGIC := '0'; signal FSM_Load_Golomb : STD_LOGIC := '0'; signal Control_ILA : STD_LOGIC_VECTOR(35 downto 0); signal DBG_Cnt : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal FIFO_Cnt : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); begin -- FIFO for input words from ROM, that converts to byte data; FIFO is kept mid-full with 4 words -- (64 bits); worst IO rate case is 8 output bits * 8 bits per G7 code = 64 bits = 8 byte Input_Data : FIFO_AXIS Generic map(32) Port map(clk => clk, srst => FSM_Reset, din_tready => ROM_Data_tready, din_tvalid => ROM_Data_tvalid, din_tdata => ROM_Data_tdata, din_tkeep => ROM_Data_tkeep, dout_tready => FIFO_tready, dout_tvalid => FIFO_tvalid, dout_tdata => FIFO_tdata, full => FIFO_Full); -- convert input bytes to bitstream Bitstream : Serializer Port map(clk => clk, Rst => FSM_Reset, FIFO_tready => FIFO_tready, FIFO_tvalid => FIFO_tvalid, FIFO_tdata => FIFO_tdata, Shift => Bit_Shift_Rdy, Shift_cnt => Bit_Shift_Cnt, Serial_tvalid => Bit_Serializer_tvalid, Serial_tdata => Bit_Serializer_tdata ); -- process to register header configuration for decompression; one-cycle strobe signals -- data is valid and decompression may start Process( clk ) Begin if rising_edge( clk ) then if( FSM_Reset = '1' OR FSM_Get_Header = '0' ) then Header_Valid <= '0'; else Header_Valid <= '1'; Header_BPP <= Bit_Serializer_tdata(0) & Bit_Serializer_tdata(1); Header_Context <= Bit_Serializer_tdata(2) & Bit_Serializer_tdata(3); end if; end if; End Process; -- serializer is updated when last bit in the run is out of any Golomb decoder or after reading header Process( clk ) Begin if rising_edge( clk ) then if( FSM_Reset = '1' ) then Bit_Shift_Rdy <= '0'; Bit_Shift_Cnt <= "000"; else Bit_Shift_Rdy <= FSM_Load_Golomb OR G0_Run_End OR G1_Run_End OR G2_Run_End OR G3_Run_End OR G4_Run_End OR G5_Run_End OR G6_Run_End OR G7_Run_End; -- when header is already read, shift first 4 bits if( FSM_Load_Golomb = '1' ) then Bit_Shift_Cnt <= "011"; end if; if( G0_Run_End = '1' ) then Bit_Shift_Cnt <= G0_shift; end if; if( G1_Run_End = '1' ) then Bit_Shift_Cnt <= G1_shift; end if; if( G2_Run_End = '1' ) then Bit_Shift_Cnt <= G2_shift; end if; if( G3_Run_End = '1' ) then Bit_Shift_Cnt <= G3_shift; end if; if( G4_Run_End = '1' ) then Bit_Shift_Cnt <= G4_shift; end if; if( G5_Run_End = '1' ) then Bit_Shift_Cnt <= G5_shift; end if; if( G6_Run_End = '1' ) then Bit_Shift_Cnt <= G6_shift; end if; if( G7_Run_End = '1' ) then Bit_Shift_Cnt <= G7_shift; end if; end if; end if; End Process; -- select which Golomb decoder to request the bit to Decoded_G0_tready <= Decoded_Bit_tuser(0) AND Decoded_Bit_tready; Decoded_G1_tready <= Decoded_Bit_tuser(1) AND Decoded_Bit_tready; Decoded_G2_tready <= Decoded_Bit_tuser(2) AND Decoded_Bit_tready; Decoded_G3_tready <= Decoded_Bit_tuser(3) AND Decoded_Bit_tready; Decoded_G4_tready <= Decoded_Bit_tuser(4) AND Decoded_Bit_tready; Decoded_G5_tready <= Decoded_Bit_tuser(5) AND Decoded_Bit_tready; Decoded_G6_tready <= Decoded_Bit_tuser(6) AND Decoded_Bit_tready; Decoded_G7_tready <= Decoded_Bit_tuser(7) AND Decoded_Bit_tready; -- data in for feeding Golomb decoders G0_din <= Bit_Serializer_tdata(0 downto 0); G1_din <= Bit_Serializer_tdata(1 downto 0); G2_din <= Bit_Serializer_tdata(2 downto 0); G3_din <= Bit_Serializer_tdata(3 downto 0); G4_din <= Bit_Serializer_tdata(4 downto 0); G5_din <= Bit_Serializer_tdata(5 downto 0); G6_din <= Bit_Serializer_tdata(6 downto 0); G7_din <= Bit_Serializer_tdata(7 downto 0); -- Order 0 Golomb decoder G0 : Golomb_0_Decoder Port map(clk => clk, rst => FSM_Reset, din_tready => G0_Run_End, din_tdata => G0_din, din_tuser => G0_shift, dout_tready => Decoded_G0_tready, dout_tdata => Decoded_G0_tdata, dout_tlast => Decoded_G0_tlast ); -- Order 1 Golomb decoder G1 : Golomb_N_Decoder Generic map( 1 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G1_Run_End, din_tdata => G1_din, din_tuser => G1_shift, dout_tready => Decoded_G1_tready, dout_tdata => Decoded_G1_tdata, dout_tlast => Decoded_G1_tlast ); -- Order 2 Golomb decoder G2 : Golomb_N_Decoder Generic map( 2 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G2_Run_End, din_tdata => G2_din, din_tuser => G2_shift, dout_tready => Decoded_G2_tready, dout_tdata => Decoded_G2_tdata, dout_tlast => Decoded_G2_tlast ); -- Order 3 Golomb decoder G3 : Golomb_N_Decoder Generic map( 3 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G3_Run_End, din_tdata => G3_din, din_tuser => G3_shift, dout_tready => Decoded_G3_tready, dout_tdata => Decoded_G3_tdata, dout_tlast => Decoded_G3_tlast ); -- Order 4 Golomb decoder G4 : Golomb_N_Decoder Generic map( 4 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G4_Run_End, din_tdata => G4_din, din_tuser => G4_shift, dout_tready => Decoded_G4_tready, dout_tdata => Decoded_G4_tdata, dout_tlast => Decoded_G4_tlast ); -- Order 5 Golomb decoder G5 : Golomb_N_Decoder Generic map( 5 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G5_Run_End, din_tdata => G5_din, din_tuser => G5_shift, dout_tready => Decoded_G5_tready, dout_tdata => Decoded_G5_tdata, dout_tlast => Decoded_G5_tlast ); -- Order 6 Golomb decoder G6 : Golomb_N_Decoder Generic map( 6 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G6_Run_End, din_tdata => G6_din, din_tuser => G6_shift, dout_tready => Decoded_G6_tready, dout_tdata => Decoded_G6_tdata, dout_tlast => Decoded_G6_tlast ); -- Order 7 Golomb decoder G7 : Golomb_N_Decoder Generic map( 7 ) Port map(clk => clk, rst => FSM_Reset, din_tready => G7_Run_End, din_tdata => G7_din, din_tuser => G7_shift, dout_tready => Decoded_G7_tready, dout_tdata => Decoded_G7_tdata, dout_tlast => Decoded_G7_tlast ); Decoded_Bit_tvalid <= Decoded_Bit_tvalid_i; Decoded_Bit_tdata <= Decoded_Bit_tdata_i; Decoded_Bit_tlast <= Decoded_Bit_tlast_i; Process(clk) Begin if rising_edge( clk ) then if( FSM_Reset = '1' ) then Decoded_Bit_tvalid_i <= '0'; Decoded_Bit_tdata_i <= '0'; Decoded_Bit_tlast_i <= '0'; else Decoded_Bit_tvalid_i <= Decoded_Bit_tready; -- multiplexor for routing Golomb decoded bit to module's output if( Decoded_Bit_tready = '1' ) then if( Decoded_Bit_tuser(0) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G0_tdata; Decoded_Bit_tlast_i <= Decoded_G0_tlast; end if; if( Decoded_Bit_tuser(1) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G1_tdata; Decoded_Bit_tlast_i <= Decoded_G1_tlast; end if; if( Decoded_Bit_tuser(2) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G2_tdata; Decoded_Bit_tlast_i <= Decoded_G2_tlast; end if; if( Decoded_Bit_tuser(3) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G3_tdata; Decoded_Bit_tlast_i <= Decoded_G3_tlast; end if; if( Decoded_Bit_tuser(4) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G4_tdata; Decoded_Bit_tlast_i <= Decoded_G4_tlast; end if; if( Decoded_Bit_tuser(5) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G5_tdata; Decoded_Bit_tlast_i <= Decoded_G5_tlast; end if; if( Decoded_Bit_tuser(6) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G6_tdata; Decoded_Bit_tlast_i <= Decoded_G6_tlast; end if; if( Decoded_Bit_tuser(7) = '1' ) then Decoded_Bit_tdata_i <= Decoded_G7_tdata; Decoded_Bit_tlast_i <= Decoded_G7_tlast; end if; end if; end if; end if; End Process; -- FSM for controlling input data into the FIFO and serialized data to -- Golomb decoders Process( clk ) Begin if rising_edge( clk ) then case estado is -- keep FIFO reset to avoid filling it with unneeded data; -- when DMA configuration is valid, go to next step when WAIT_START => if( DMA_Conf_Valid = '1' ) then estado <= FILL_SERIALIZER; end if; -- wait for bit serializer to be ready when FILL_SERIALIZER => if( Bit_Serializer_tvalid = '1' ) then estado <= GET_HEADER; end if; -- read header from bitstream when GET_HEADER => estado <= INIT_GOLOMB; -- load Golomb decoders and header when INIT_GOLOMB => estado <= WAIT_END; -- monitor serializer's bit pointer to ask for new data; if DMA transfer -- ends, go to reset state when WAIT_END => if( DMA_In_Progress = '0' ) then estado <= WAIT_START; end if; end case; end if; end Process; -- reset FIFO while decompression is stopped FSM_Reset <= '1' when estado = WAIT_START else '0'; -- enable register to capture header data FSM_Get_Header <= '1' when estado = GET_HEADER else '0'; -- Golomb decoders are loaded with data at initialization with estado select FSM_Load_Golomb <= '1' when INIT_GOLOMB, '0' when others; end Behavioral;
gpl-2.0
aa37f56f972c9b27d21935d40a7c6407
0.568069
2.833631
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_gpio_1_0/sim/design_1_axi_gpio_1_0.vhd
1
9,109
-- (c) Copyright 1995-2016 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- DO NOT MODIFY THIS FILE. -- IP VLNV: xilinx.com:ip:axi_gpio:2.0 -- IP Revision: 6 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_gpio_v2_0; USE axi_gpio_v2_0.axi_gpio; ENTITY design_1_axi_gpio_1_0 IS PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(8 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_araddr : IN STD_LOGIC_VECTOR(8 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; gpio_io_i : IN STD_LOGIC_VECTOR(0 DOWNTO 0); gpio_io_o : OUT STD_LOGIC_VECTOR(0 DOWNTO 0); gpio_io_t : OUT STD_LOGIC_VECTOR(0 DOWNTO 0) ); END design_1_axi_gpio_1_0; ARCHITECTURE design_1_axi_gpio_1_0_arch OF design_1_axi_gpio_1_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_gpio_1_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_gpio IS GENERIC ( C_FAMILY : STRING; C_S_AXI_ADDR_WIDTH : INTEGER; C_S_AXI_DATA_WIDTH : INTEGER; C_GPIO_WIDTH : INTEGER; C_GPIO2_WIDTH : INTEGER; C_ALL_INPUTS : INTEGER; C_ALL_INPUTS_2 : INTEGER; C_ALL_OUTPUTS : INTEGER; C_ALL_OUTPUTS_2 : INTEGER; C_INTERRUPT_PRESENT : INTEGER; C_DOUT_DEFAULT : STD_LOGIC_VECTOR(31 DOWNTO 0); C_TRI_DEFAULT : STD_LOGIC_VECTOR(31 DOWNTO 0); C_IS_DUAL : INTEGER; C_DOUT_DEFAULT_2 : STD_LOGIC_VECTOR(31 DOWNTO 0); C_TRI_DEFAULT_2 : STD_LOGIC_VECTOR(31 DOWNTO 0) ); PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(8 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_araddr : IN STD_LOGIC_VECTOR(8 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; ip2intc_irpt : OUT STD_LOGIC; gpio_io_i : IN STD_LOGIC_VECTOR(0 DOWNTO 0); gpio_io_o : OUT STD_LOGIC_VECTOR(0 DOWNTO 0); gpio_io_t : OUT STD_LOGIC_VECTOR(0 DOWNTO 0); gpio2_io_i : IN STD_LOGIC_VECTOR(31 DOWNTO 0); gpio2_io_o : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); gpio2_io_t : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) ); END COMPONENT axi_gpio; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 S_AXI_ACLK CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 S_AXI_ARESETN RST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awaddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wstrb: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WSTRB"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_araddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RREADY"; ATTRIBUTE X_INTERFACE_INFO OF gpio_io_i: SIGNAL IS "xilinx.com:interface:gpio:1.0 GPIO TRI_I"; ATTRIBUTE X_INTERFACE_INFO OF gpio_io_o: SIGNAL IS "xilinx.com:interface:gpio:1.0 GPIO TRI_O"; ATTRIBUTE X_INTERFACE_INFO OF gpio_io_t: SIGNAL IS "xilinx.com:interface:gpio:1.0 GPIO TRI_T"; BEGIN U0 : axi_gpio GENERIC MAP ( C_FAMILY => "zynq", C_S_AXI_ADDR_WIDTH => 9, C_S_AXI_DATA_WIDTH => 32, C_GPIO_WIDTH => 1, C_GPIO2_WIDTH => 32, C_ALL_INPUTS => 0, C_ALL_INPUTS_2 => 0, C_ALL_OUTPUTS => 0, C_ALL_OUTPUTS_2 => 0, C_INTERRUPT_PRESENT => 0, C_DOUT_DEFAULT => X"00000000", C_TRI_DEFAULT => X"FFFFFFFF", C_IS_DUAL => 0, C_DOUT_DEFAULT_2 => X"00000000", C_TRI_DEFAULT_2 => X"FFFFFFFF" ) PORT MAP ( s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, s_axi_awaddr => s_axi_awaddr, s_axi_awvalid => s_axi_awvalid, s_axi_awready => s_axi_awready, s_axi_wdata => s_axi_wdata, s_axi_wstrb => s_axi_wstrb, s_axi_wvalid => s_axi_wvalid, s_axi_wready => s_axi_wready, s_axi_bresp => s_axi_bresp, s_axi_bvalid => s_axi_bvalid, s_axi_bready => s_axi_bready, s_axi_araddr => s_axi_araddr, s_axi_arvalid => s_axi_arvalid, s_axi_arready => s_axi_arready, s_axi_rdata => s_axi_rdata, s_axi_rresp => s_axi_rresp, s_axi_rvalid => s_axi_rvalid, s_axi_rready => s_axi_rready, gpio_io_i => gpio_io_i, gpio_io_o => gpio_io_o, gpio_io_t => gpio_io_t, gpio2_io_i => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)) ); END design_1_axi_gpio_1_0_arch;
gpl-3.0
19d3450d69f5f8861a90c7f5b90c6132
0.678999
3.219866
false
false
false
false
Yuriu5/MiniBlaze
test/Simu/tb_generic_hdl_fifo.vhd
1
11,671
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library vunit_lib; context vunit_lib.vunit_context; entity tb_generic_hdl_fifo is generic ( runner_cfg : string ); end tb_generic_hdl_fifo; architecture simu of tb_generic_hdl_fifo is component generic_hdl_fifo is generic ( G_DEPTH_LOG2 : integer := 4; -- Depth is equal to 2^(G_DEPTH_LOG2) G_WIDTH : integer := 8 ); port ( clk : in std_logic; rst_n : in std_logic; -- Data data_wr : in std_logic_vector(G_WIDTH-1 downto 0); wr_en : in std_logic; rd_en : in std_logic; data_rd : out std_logic_vector(G_WIDTH-1 downto 0); rd_valid : out std_logic; -- Status nb_data : out std_logic_vector(G_DEPTH_LOG2 downto 0); empty : out std_logic; full : out std_logic ); end component; constant C_DEPTH : integer := 4; constant C_WIDTH : integer := 16; constant C_PERIOD : time := 8 ns; signal s_zero : std_logic_vector(C_WIDTH-1 downto 0) := (others => '0'); signal s_one : std_logic_vector(C_WIDTH-1 downto 0) := (others => '1'); signal s_test : std_logic_vector(C_WIDTH-1 downto 0); signal clk : std_logic := '0'; signal rst_n : std_logic := '0'; signal s_data_wr : std_logic_vector(C_WIDTH-1 downto 0) := (others => '0'); signal s_wr_en : std_logic := '0'; signal s_rd_en : std_logic := '0'; signal s_data_rd : std_logic_vector(C_WIDTH-1 downto 0) := (others => '0'); signal s_rd_valid : std_logic := '0'; signal s_nb_data : std_logic_vector(C_DEPTH downto 0) := (others => '0'); signal s_empty : std_logic := '0'; signal s_full : std_logic := '0'; signal r_cnt : unsigned(C_WIDTH-1 downto 0) := (others => '0'); begin clk <= not clk after C_PERIOD/2; s_test <= x"CAFE"; i_dut : generic_hdl_fifo generic map( G_DEPTH_LOG2 => C_DEPTH, G_WIDTH => C_WIDTH ) port map( clk => clk, rst_n => rst_n, -- data_wr => s_data_wr, wr_en => s_wr_en, rd_en => s_rd_en, data_rd => s_data_rd, rd_valid => s_rd_valid, -- nb_data => s_nb_data, empty => s_empty, full => s_full ); main : process variable filter : log_filter_t; begin checker_init( display_format => verbose, file_name => join(output_path(runner_cfg), "error.cvs"), file_format => verbose_csv); logger_init( display_format => verbose, file_name => join(output_path(runner_cfg), "log.csv"), file_format => verbose_csv); stop_level((debug,verbose), display_handler, filter); test_runner_setup(runner,runner_cfg); enable_pass_msg; enable_pass_msg(file_handler); enable_pass_msg(display_handler); while test_suite loop reset_checker_stat; wait until rising_edge(clk); rst_n <= '0'; wait for 10*C_PERIOD; rst_n <= '1'; wait until rising_edge(clk); if run("test_during_reset") then rst_n <= '0'; wait until rising_edge(clk); check_equal(s_data_wr, s_zero(s_data_wr'left downto 0)); check_equal(s_wr_en, '0'); check_equal(s_rd_en, '0'); check_equal(s_data_rd, s_zero(s_data_rd'left downto 0)); check_equal(s_rd_valid, '0'); check_equal(s_nb_data, s_zero(s_nb_data'left downto 0)); check_equal(s_empty, '1'); check_equal(s_full, '1'); elsif run("test_write_one_word") then wait until rising_edge(clk); s_wr_en <= '1'; s_data_wr <= s_test; check_equal(s_empty, '1'); check_equal(s_nb_data, s_zero(s_nb_data'left downto 0)); wait until rising_edge(clk); s_wr_en <= '0'; s_rd_en <= '1'; wait until rising_edge(clk); check_equal(s_nb_data, std_logic_vector(to_unsigned(1,C_DEPTH+1))); check_equal(s_empty, '0'); s_rd_en <= '0'; wait until rising_edge(clk); check_equal(s_empty, '1'); check_equal(s_nb_data, s_zero(s_nb_data'left downto 0)); check_equal(s_data_rd, s_test); check_equal(s_rd_valid, '1'); wait until rising_edge(clk); check_equal(s_rd_valid, '0'); elsif run("test_after_reset") then check_equal(s_data_wr, s_zero(s_data_wr'left downto 0)); check_equal(s_wr_en, '0'); check_equal(s_rd_en, '0'); check_equal(s_data_rd, s_zero(s_data_rd'left downto 0)); check_equal(s_rd_valid, '0'); check_equal(s_nb_data, s_zero(s_nb_data'left downto 0)); check_equal(s_empty, '1'); check_equal(s_full, '0'); elsif run("write_full_then_read") then wait until rising_edge(clk); s_wr_en <= '1'; s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); s_data_wr <= std_logic_vector(r_cnt); wait until rising_edge(clk); check_equal(s_full, '1'); s_rd_en <= '1'; s_wr_en <= '0'; wait until s_rd_valid = '1' and rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(1,C_WIDTH)), "Should be 1"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(2,C_WIDTH)), "Should be 2"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(3,C_WIDTH)), "Should be 3"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(4,C_WIDTH)), "Should be 4"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(5,C_WIDTH)), "Should be 5"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(6,C_WIDTH)), "Should be 6"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(7,C_WIDTH)), "Should be 7"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(8,C_WIDTH)), "Should be 8"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(9,C_WIDTH)), "Should be 9"); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(10,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(11,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(12,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(13,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(14,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(15,C_WIDTH))); wait until rising_edge(clk); check_equal(s_data_rd, std_logic_vector(to_unsigned(16,C_WIDTH))); wait until rising_edge(clk); log(to_string(s_nb_data)); s_rd_en <= '0'; check_equal(s_empty, '1'); check_equal(s_rd_valid, '0'); elsif run("read_when_emtpy") then s_rd_en <= '1'; wait until rising_edge(clk); s_rd_en <= '0'; wait until rising_edge(clk); check_equal(s_rd_valid, '0'); check_equal(s_empty, '1'); check_equal(s_nb_data, std_logic_vector(to_unsigned(0,C_DEPTH+1))); s_wr_en <= '1'; wait until rising_edge(clk); s_wr_en <= '0'; wait until rising_edge(clk); check_equal(s_nb_data, std_logic_vector(to_unsigned(1,C_DEPTH+1))); check_equal(s_empty, '0'); elsif run("write_when_full") then s_wr_en <= '1'; wait until s_full = '1' and rising_edge(clk); s_wr_en <= '0'; wait until rising_edge(clk); check_equal(unsigned(s_nb_data), (to_unsigned(2**C_DEPTH, C_DEPTH+1)), "Should be full"); wait until rising_edge(clk); s_wr_en <= '1'; wait until rising_edge(clk); check_equal(unsigned(s_nb_data), (to_unsigned(2**C_DEPTH, C_DEPTH+1))); s_rd_en <= '1'; wait until rising_edge(clk); s_rd_en <= '0'; wait until rising_edge(clk); check_equal(s_rd_valid, '1'); check_equal(unsigned(s_nb_data), (to_unsigned((2**C_DEPTH)-1, C_DEPTH+1))); check_equal(s_full, '0'); end if; end loop; test_runner_cleanup(runner); end process; process(clk) begin if rising_edge(clk) then if rst_n = '0' then r_cnt <= (others => '0'); else r_cnt <= r_cnt + 1; end if; end if; end process; end simu;
mit
d6b21bec36f796a03fe6c50d6d9b9df2
0.481107
3.471446
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/ipi_proj/srcs/ip/vsrc_sel_v1_0/vhdl/video_src_sel.vhd
6
8,306
-- *************************************************************************** -- ** DISCLAIMER OF LIABILITY ** -- ** ** -- ** This file contains proprietary and confidential information of ** -- ** Xilinx, Inc. ("Xilinx"), that is distributed under a license ** -- ** from Xilinx, and may be used, copied and/or disclosed only ** -- ** pursuant to the terms of a valid license agreement with Xilinx. ** -- ** ** -- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION ** -- ** ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER ** -- ** EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT ** -- ** LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT, ** -- ** MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx ** -- ** does not warrant that functions included in the Materials will ** -- ** meet the requirements of Licensee, or that the operation of the ** -- ** Materials will be uninterrupted or error-free, or that defects ** -- ** in the Materials will be corrected. Furthermore, Xilinx does ** -- ** not warrant or make any representations regarding use, or the ** -- ** results of the use, of the Materials in terms of correctness, ** -- ** accuracy, reliability or otherwise. ** -- ** ** -- ** Xilinx products are not designed or intended to be fail-safe, ** -- ** or for use in any application requiring fail-safe performance, ** -- ** such as life-support or safety devices or systems, Class III ** -- ** medical devices, nuclear facilities, applications related to ** -- ** the deployment of airbags, or any other applications that could ** -- ** lead to death, personal injury or severe property or ** -- ** environmental damage (individually and collectively, "critical ** -- ** applications"). Customer assumes the sole risk and liability ** -- ** of any use of Xilinx products in critical applications, ** -- ** subject only to applicable laws and regulations governing ** -- ** limitations on product liability. ** -- ** ** -- ** Copyright 2010 Xilinx, Inc. ** -- ** All rights reserved. ** -- ** ** -- ** This disclaimer and copyright notice must be retained as part ** -- ** of this file at all times. ** -- *************************************************************************** ------------------------------------------------------------------------------ -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_com" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port: "*_i" -- device pins: "*_pin" -- ports: "- Names begin with Uppercase" -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC>" ------------------------------------------------------------------------------ -- DO NOT EDIT BELOW THIS LINE -------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; Library UNISIM; use UNISIM.vcomponents.all; -- DO NOT EDIT ABOVE THIS LINE -------------------- --USER libraries added here ------------------------------------------------------------------------------ -- Entity section ------------------------------------------------------------------------------ -- Definition of Generics: -- C_NUM_REG -- Number of software accessible registers -- C_SLV_DWIDTH -- Slave interface data bus width -- -- Definition of Ports: -- Bus2IP_Clk -- Bus to IP clock -- Bus2IP_Resetn -- Bus to IP reset -- Bus2IP_Data -- Bus to IP data bus -- Bus2IP_BE -- Bus to IP byte enables -- Bus2IP_RdCE -- Bus to IP read chip enable -- Bus2IP_WrCE -- Bus to IP write chip enable -- IP2Bus_Data -- IP to Bus data bus -- IP2Bus_RdAck -- IP to Bus read transfer acknowledgement -- IP2Bus_WrAck -- IP to Bus write transfer acknowledgement -- IP2Bus_Error -- IP to Bus error response ------------------------------------------------------------------------------ entity vsrc_sel is generic ( -- ADD USER GENERICS BELOW THIS LINE --------------- --USER generics added here -- ADD USER GENERICS ABOVE THIS LINE --------------- -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol parameters, do not add to or delete C_NUM_CHANNELS : integer := 1 -- DO NOT EDIT ABOVE THIS LINE --------------------- ); port ( -- ADD USER PORTS BELOW THIS LINE ------------------ -- User logic ports video_clk_1 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); video_clk_2 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); hsync_1 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); hsync_2 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); vsync_1 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); vsync_2 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); de_1 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); de_2 : in std_logic_vector(C_NUM_CHANNELS-1 downto 0); video_clk : out std_logic_vector(C_NUM_CHANNELS-1 downto 0); hsync : out std_logic_vector(C_NUM_CHANNELS-1 downto 0); vsync : out std_logic_vector(C_NUM_CHANNELS-1 downto 0); de : out std_logic_vector(C_NUM_CHANNELS-1 downto 0); video_sel : in std_logic ); attribute MAX_FANOUT : string; attribute SIGIS : string; -- attribute SIGIS of Bus2IP_Clk : signal is "CLK"; -- attribute SIGIS of Bus2IP_Resetn : signal is "RST"; end entity vsrc_sel; ------------------------------------------------------------------------------ -- Architecture section ------------------------------------------------------------------------------ architecture IMP of vsrc_sel is begin de <= de_1 when video_sel = '0' else de_2; hsync <= hsync_1 when video_sel = '0' else hsync_2; vsync <= vsync_1 when video_sel = '0' else vsync_2; VIDEO_SEL_GEN:for i in 0 to C_NUM_CHANNELS-1 generate begin BUFGMUX_INST : BUFGMUX generic map ( CLK_SEL_TYPE => "SYNC" -- Not supported. Must be "SYNC". ) port map ( O => video_clk(i), -- 1-bit output: Clock buffer output I0 => video_clk_1(i), -- 1-bit input: Clock buffer input (S=0) I1 => video_clk_2(i), -- 1-bit input: Clock buffer input (S=1) S => video_sel-- 1-bit input: Clock buffer select ); end generate VIDEO_SEL_GEN; end IMP;
gpl-3.0
28c8df8c1f3fd000d54797b4d014e010
0.451481
4.719318
false
false
false
false
mistryalok/Zedboard
learning/training/Microsystem/axi_interface_part2/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_bram_ctrl_1_0/synth/design_1_axi_bram_ctrl_1_0.vhd
1
16,618
-- (c) Copyright 1995-2016 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- -- DO NOT MODIFY THIS FILE. -- IP VLNV: xilinx.com:ip:axi_bram_ctrl:4.0 -- IP Revision: 3 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_bram_ctrl_v4_0; USE axi_bram_ctrl_v4_0.axi_bram_ctrl; ENTITY design_1_axi_bram_ctrl_1_0 IS PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(12 DOWNTO 0); s_axi_awlen : IN STD_LOGIC_VECTOR(7 DOWNTO 0); s_axi_awsize : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_awburst : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_awlock : IN STD_LOGIC; s_axi_awcache : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_awprot : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_arid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(12 DOWNTO 0); s_axi_arlen : IN STD_LOGIC_VECTOR(7 DOWNTO 0); s_axi_arsize : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_arburst : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_arlock : IN STD_LOGIC; s_axi_arcache : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_arprot : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rlast : OUT STD_LOGIC; s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; bram_rst_a : OUT STD_LOGIC; bram_clk_a : OUT STD_LOGIC; bram_en_a : OUT STD_LOGIC; bram_we_a : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END design_1_axi_bram_ctrl_1_0; ARCHITECTURE design_1_axi_bram_ctrl_1_0_arch OF design_1_axi_bram_ctrl_1_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_bram_ctrl_1_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_bram_ctrl IS GENERIC ( C_BRAM_INST_MODE : STRING; C_MEMORY_DEPTH : INTEGER; C_BRAM_ADDR_WIDTH : INTEGER; C_S_AXI_ADDR_WIDTH : INTEGER; C_S_AXI_DATA_WIDTH : INTEGER; C_S_AXI_ID_WIDTH : INTEGER; C_S_AXI_PROTOCOL : STRING; C_S_AXI_SUPPORTS_NARROW_BURST : INTEGER; C_SINGLE_PORT_BRAM : INTEGER; C_FAMILY : STRING; C_S_AXI_CTRL_ADDR_WIDTH : INTEGER; C_S_AXI_CTRL_DATA_WIDTH : INTEGER; C_ECC : INTEGER; C_ECC_TYPE : INTEGER; C_FAULT_INJECT : INTEGER; C_ECC_ONOFF_RESET_VALUE : INTEGER ); PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; ecc_interrupt : OUT STD_LOGIC; ecc_ue : OUT STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(12 DOWNTO 0); s_axi_awlen : IN STD_LOGIC_VECTOR(7 DOWNTO 0); s_axi_awsize : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_awburst : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_awlock : IN STD_LOGIC; s_axi_awcache : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_awprot : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_awvalid : IN STD_LOGIC; s_axi_awready : OUT STD_LOGIC; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_arid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(12 DOWNTO 0); s_axi_arlen : IN STD_LOGIC_VECTOR(7 DOWNTO 0); s_axi_arsize : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_arburst : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_arlock : IN STD_LOGIC; s_axi_arcache : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_arprot : IN STD_LOGIC_VECTOR(2 DOWNTO 0); s_axi_arvalid : IN STD_LOGIC; s_axi_arready : OUT STD_LOGIC; s_axi_rid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rlast : OUT STD_LOGIC; s_axi_rvalid : OUT STD_LOGIC; s_axi_rready : IN STD_LOGIC; s_axi_ctrl_awvalid : IN STD_LOGIC; s_axi_ctrl_awready : OUT STD_LOGIC; s_axi_ctrl_awaddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wvalid : IN STD_LOGIC; s_axi_ctrl_wready : OUT STD_LOGIC; s_axi_ctrl_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_ctrl_bvalid : OUT STD_LOGIC; s_axi_ctrl_bready : IN STD_LOGIC; s_axi_ctrl_araddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_arvalid : IN STD_LOGIC; s_axi_ctrl_arready : OUT STD_LOGIC; s_axi_ctrl_rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_rresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_ctrl_rvalid : OUT STD_LOGIC; s_axi_ctrl_rready : IN STD_LOGIC; bram_rst_a : OUT STD_LOGIC; bram_clk_a : OUT STD_LOGIC; bram_en_a : OUT STD_LOGIC; bram_we_a : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rst_b : OUT STD_LOGIC; bram_clk_b : OUT STD_LOGIC; bram_en_b : OUT STD_LOGIC; bram_we_b : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); bram_addr_b : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_b : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_b : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END COMPONENT axi_bram_ctrl; ATTRIBUTE X_CORE_INFO : STRING; ATTRIBUTE X_CORE_INFO OF design_1_axi_bram_ctrl_1_0_arch: ARCHITECTURE IS "axi_bram_ctrl,Vivado 2014.4"; ATTRIBUTE CHECK_LICENSE_TYPE : STRING; ATTRIBUTE CHECK_LICENSE_TYPE OF design_1_axi_bram_ctrl_1_0_arch : ARCHITECTURE IS "design_1_axi_bram_ctrl_1_0,axi_bram_ctrl,{}"; ATTRIBUTE CORE_GENERATION_INFO : STRING; ATTRIBUTE CORE_GENERATION_INFO OF design_1_axi_bram_ctrl_1_0_arch: ARCHITECTURE IS "design_1_axi_bram_ctrl_1_0,axi_bram_ctrl,{x_ipProduct=Vivado 2014.4,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=axi_bram_ctrl,x_ipVersion=4.0,x_ipCoreRevision=3,x_ipLanguage=VERILOG,x_ipSimLanguage=MIXED,C_BRAM_INST_MODE=EXTERNAL,C_MEMORY_DEPTH=2048,C_BRAM_ADDR_WIDTH=11,C_S_AXI_ADDR_WIDTH=13,C_S_AXI_DATA_WIDTH=32,C_S_AXI_ID_WIDTH=12,C_S_AXI_PROTOCOL=AXI4,C_S_AXI_SUPPORTS_NARROW_BURST=0,C_SINGLE_PORT_BRAM=1,C_FAMILY=zynq,C_S_AXI_CTRL_ADDR_WIDTH=32,C_S_AXI_CTRL_DATA_WIDTH=32,C_ECC=0,C_ECC_TYPE=0,C_FAULT_INJECT=0,C_ECC_ONOFF_RESET_VALUE=0}"; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 CLKIF CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 RSTIF RST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awaddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWPROT"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wstrb: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WSTRB"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WLAST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_araddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARPROT"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RLAST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RREADY"; ATTRIBUTE X_INTERFACE_INFO OF bram_rst_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA RST"; ATTRIBUTE X_INTERFACE_INFO OF bram_clk_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA CLK"; ATTRIBUTE X_INTERFACE_INFO OF bram_en_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA EN"; ATTRIBUTE X_INTERFACE_INFO OF bram_we_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA WE"; ATTRIBUTE X_INTERFACE_INFO OF bram_addr_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA ADDR"; ATTRIBUTE X_INTERFACE_INFO OF bram_wrdata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DIN"; ATTRIBUTE X_INTERFACE_INFO OF bram_rddata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DOUT"; BEGIN U0 : axi_bram_ctrl GENERIC MAP ( C_BRAM_INST_MODE => "EXTERNAL", C_MEMORY_DEPTH => 2048, C_BRAM_ADDR_WIDTH => 11, C_S_AXI_ADDR_WIDTH => 13, C_S_AXI_DATA_WIDTH => 32, C_S_AXI_ID_WIDTH => 12, C_S_AXI_PROTOCOL => "AXI4", C_S_AXI_SUPPORTS_NARROW_BURST => 0, C_SINGLE_PORT_BRAM => 1, C_FAMILY => "zynq", C_S_AXI_CTRL_ADDR_WIDTH => 32, C_S_AXI_CTRL_DATA_WIDTH => 32, C_ECC => 0, C_ECC_TYPE => 0, C_FAULT_INJECT => 0, C_ECC_ONOFF_RESET_VALUE => 0 ) PORT MAP ( s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, s_axi_awid => s_axi_awid, s_axi_awaddr => s_axi_awaddr, s_axi_awlen => s_axi_awlen, s_axi_awsize => s_axi_awsize, s_axi_awburst => s_axi_awburst, s_axi_awlock => s_axi_awlock, s_axi_awcache => s_axi_awcache, s_axi_awprot => s_axi_awprot, s_axi_awvalid => s_axi_awvalid, s_axi_awready => s_axi_awready, s_axi_wdata => s_axi_wdata, s_axi_wstrb => s_axi_wstrb, s_axi_wlast => s_axi_wlast, s_axi_wvalid => s_axi_wvalid, s_axi_wready => s_axi_wready, s_axi_bid => s_axi_bid, s_axi_bresp => s_axi_bresp, s_axi_bvalid => s_axi_bvalid, s_axi_bready => s_axi_bready, s_axi_arid => s_axi_arid, s_axi_araddr => s_axi_araddr, s_axi_arlen => s_axi_arlen, s_axi_arsize => s_axi_arsize, s_axi_arburst => s_axi_arburst, s_axi_arlock => s_axi_arlock, s_axi_arcache => s_axi_arcache, s_axi_arprot => s_axi_arprot, s_axi_arvalid => s_axi_arvalid, s_axi_arready => s_axi_arready, s_axi_rid => s_axi_rid, s_axi_rdata => s_axi_rdata, s_axi_rresp => s_axi_rresp, s_axi_rlast => s_axi_rlast, s_axi_rvalid => s_axi_rvalid, s_axi_rready => s_axi_rready, s_axi_ctrl_awvalid => '0', s_axi_ctrl_awaddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wvalid => '0', s_axi_ctrl_bready => '0', s_axi_ctrl_araddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_arvalid => '0', s_axi_ctrl_rready => '0', bram_rst_a => bram_rst_a, bram_clk_a => bram_clk_a, bram_en_a => bram_en_a, bram_we_a => bram_we_a, bram_addr_a => bram_addr_a, bram_wrdata_a => bram_wrdata_a, bram_rddata_a => bram_rddata_a, bram_rddata_b => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)) ); END design_1_axi_bram_ctrl_1_0_arch;
gpl-3.0
fa2967db15334adca1b91e36f29080ab
0.676014
3.060969
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_p_dst_cols_V.vhd
2
4,564
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_p_dst_cols_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_p_dst_cols_V_shiftReg; architecture rtl of FIFO_image_filter_p_dst_cols_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_p_dst_cols_V is generic ( MEM_STYLE : string := "shiftreg"; DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_p_dst_cols_V is component FIFO_image_filter_p_dst_cols_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_p_dst_cols_V_shiftReg : FIFO_image_filter_p_dst_cols_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
7835f59cdd9fde490bd0a581870e471e
0.534619
3.483969
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/syncram_2p.vhd
1
14,895
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: syncram_2p -- File: syncram_2p.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: syncronous 2-port ram with tech selection ------------------------------------------------------------------------------ library ieee; library techmap; use ieee.std_logic_1164.all; use techmap.gencomp.all; use work.allmem.all; library grlib; use grlib.config.all; use grlib.config_types.all; use grlib.stdlib.all; entity syncram_2p is generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; sepclk : integer := 0; wrfst : integer := 0; testen : integer := 0; words : integer := 0; custombits : integer := 1); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((abits -1) downto 0); dataout : out std_logic_vector((dbits -1) downto 0); wclk : in std_ulogic; write : in std_ulogic; waddress : in std_logic_vector((abits -1) downto 0); datain : in std_logic_vector((dbits -1) downto 0); testin : in std_logic_vector(TESTIN_WIDTH-1 downto 0) := testin_none; customclk: in std_ulogic := '0'; customin : in std_logic_vector(custombits-1 downto 0) := (others => '0'); customout:out std_logic_vector(custombits-1 downto 0)); end; architecture rtl of syncram_2p is constant nctrl : integer := abits*2 + (TESTIN_WIDTH-2) + 2; signal gnd : std_ulogic; signal vgnd : std_logic_vector(dbits-1 downto 0); signal dataoutx : std_logic_vector((dbits -1) downto 0); signal databp, testdata : std_logic_vector((dbits -1) downto 0); signal renable2 : std_ulogic; constant SCANTESTBP : boolean := (testen = 1) and (tech /= 0) and (tech /= ut90); constant iwrfst : integer := (1-syncram_2p_write_through(tech)) * wrfst; signal xrenable,xwrite : std_ulogic; signal custominx,customoutx: std_logic_vector(syncram_customif_maxwidth downto 0); begin gnd <= '0'; vgnd <= (others => '0'); xrenable <= renable and not testin(TESTIN_WIDTH-2) when testen/=0 else renable; xwrite <= write and not testin(TESTIN_WIDTH-2) when testen/=0 else write; no_wrfst : if iwrfst = 0 generate scanbp : if SCANTESTBP generate comb : process (waddress, raddress, datain, renable, write, testin) variable tmp : std_logic_vector((dbits -1) downto 0); variable ctrlsigs : std_logic_vector((nctrl -1) downto 0); begin ctrlsigs := testin(TESTIN_WIDTH-3 downto 0) & write & renable & raddress & waddress; tmp := datain; for i in 0 to nctrl-1 loop tmp(i mod dbits) := tmp(i mod dbits) xor ctrlsigs(i); end loop; testdata <= tmp; end process; reg : process(wclk) begin if rising_edge(wclk) then databp <= testdata; end if; end process; dmuxout : for i in 0 to dbits-1 generate x0 : grmux2 generic map (tech) port map (dataoutx(i), databp(i), testin(TESTIN_WIDTH-1), dataout(i)); end generate; end generate; noscanbp : if not SCANTESTBP generate dataout <= dataoutx; end generate; -- Write contention check (if applicable) renable2 <= '0' when ((sepclk = 0 and syncram_2p_dest_rw_collision(tech) = 1) and (renable and write) = '1' and raddress = waddress) else xrenable; end generate; wrfst_gen : if iwrfst = 1 generate -- No risk for read/write contention. Register addresses and mux on comparator no_contention_check : if syncram_2p_dest_rw_collision(tech) = 0 generate wfrstblocknoc : block type wrfst_type is record raddr : std_logic_vector((abits-1) downto 0); waddr : std_logic_vector((abits-1) downto 0); datain : std_logic_vector((dbits-1) downto 0); write : std_logic; renable : std_logic; end record; signal r : wrfst_type; begin comb : process(r, dataoutx, testin) begin if (SCANTESTBP and (testin(TESTIN_WIDTH-1) = '1')) or (((r.write and r.renable) = '1') and (r.raddr = r.waddr)) then dataout <= r.datain; else dataout <= dataoutx; end if; end process; reg : process(wclk) begin if rising_edge(wclk) then r.raddr <= raddress; r.waddr <= waddress; r.datain <= datain; r.write <= write; r.renable <= renable; end if; end process; end block wfrstblocknoc; renable2 <= xrenable; end generate; -- Risk of read/write contention. Use same comparator to gate read enable -- and mux data. contention_safe : if syncram_2p_dest_rw_collision(tech) /= 0 generate wfrstblockc : block signal col, mux : std_ulogic; signal rdatain : std_logic_vector((dbits-1) downto 0); begin comb : process(mux, xrenable, renable, write, raddress, waddress, rdatain, dataoutx, testin) begin col <= '0'; renable2 <= xrenable; if (write and renable) = '1' and raddress = waddress then col <= '1'; renable2 <= '0'; end if; if (SCANTESTBP and (testin(TESTIN_WIDTH-1) = '1')) or mux = '1' then dataout <= rdatain; else dataout <= dataoutx; end if; end process; reg : process(wclk) begin if rising_edge(wclk) then rdatain <= datain; mux <= col; end if; end process; end block wfrstblockc; end generate; end generate wrfst_gen; custominx(custominx'high downto custombits) <= (others => '0'); custominx(custombits-1 downto 0) <= customin; customout <= customoutx(custombits-1 downto 0); nocust: if syncram_has_customif(tech)=0 generate customoutx <= (others => '0'); end generate; inf : if tech = inferred generate x0 : generic_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, wclk, raddress, waddress, datain, write, dataoutx); end generate; xcv : if tech = virtex generate x0 : virtex_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, xwrite, xwrite, rclk, raddress, vgnd, dataoutx, renable2, gnd); end generate; xc2v : if (is_unisim(tech) = 1) and (tech /= virtex)generate x0 : unisim_syncram_2p generic map (abits, dbits, sepclk, iwrfst) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; vir : if tech = memvirage generate d39 : if dbits = 39 generate x0 : virage_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; d32 : if dbits <= 32 generate x0 : virage_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, xwrite, xwrite, rclk, raddress, vgnd, dataoutx, renable2, gnd); end generate; end generate; atrh : if tech = atc18rha generate x0 : atc18rha_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain, testin(TESTIN_WIDTH-1 downto TESTIN_WIDTH-4)); end generate; axc : if (tech = axcel) or (tech = axdsp) generate x0 : axcel_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; proa : if tech = proasic generate x0 : proasic_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; proa3 : if tech = apa3 generate x0 : proasic3_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; proa3e : if tech = apa3e generate x0 : proasic3e_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; proa3l : if tech = apa3l generate x0 : proasic3l_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; saed : if tech = saed32 generate -- x0 : saed32_syncram_2p generic map (abits, dbits, sepclk) -- port map (rclk, renable2, raddress, dataoutx, -- wclk, waddress, datain, xwrite); x0 : generic_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, wclk, raddress, waddress, datain, write, dataoutx); end generate; dar : if tech = dare generate x0 : dare_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; rhu : if tech = rhumc generate x0 : rhumc_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; fus : if tech = actfus generate x0 : fusion_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; ihp : if tech = ihp25 generate x0 : generic_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, wclk, raddress, waddress, datain, xwrite, dataoutx); end generate; -- NOTE: port 1 on altsyncram must be a read port due to Cyclone II M4K write issue alt : if (tech = altera) or (tech = stratix1) or (tech = stratix2) or (tech = stratix3) or (tech = stratix4) or (tech = cyclone3) generate x0 : altera_syncram_dp generic map (abits, dbits) port map (rclk, raddress, vgnd, dataoutx, renable2, gnd, wclk, waddress, datain, open, xwrite, xwrite); end generate; rh_lib18t0 : if tech = rhlib18t generate x0 : rh_lib18t_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain, testin(TESTIN_WIDTH-1 downto TESTIN_WIDTH-4)); end generate; lat : if tech = lattice generate x0 : ec_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, xwrite, xwrite, rclk, raddress, vgnd, dataoutx, renable2, gnd); end generate; ut025 : if tech = ut25 generate x0 : ut025crh_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; ut09 : if tech = ut90 generate x0 : ut90nhbd_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain, testin(TESTIN_WIDTH-3)); end generate; ut13 : if tech = ut130 generate x0 : ut130hbd_syncram_2p generic map (abits, dbits, words) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; arti : if tech = memartisan generate x0 : artisan_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; cust1 : if tech = custom1 generate x0 : custom1_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; ecl : if tech = eclipse generate x0 : eclipse_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, waddress, datain, xwrite); end generate; vir90 : if tech = memvirage90 generate x0 : virage90_syncram_dp generic map (abits, dbits) port map (wclk, waddress, datain, open, xwrite, xwrite, rclk, raddress, vgnd, dataoutx, renable2, gnd); end generate; nex : if tech = easic90 generate x0 : nextreme_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; smic : if tech = smic013 generate x0 : smic13_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; tm65gplu : if tech = tm65gplus generate x0 : tm65gplus_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; cmos9sfx : if tech = cmos9sf generate x0 : cmos9sf_syncram_2p generic map (abits, dbits) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; n2x : if tech = easic45 generate x0 : n2x_syncram_2p generic map (abits, dbits, sepclk, iwrfst) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain); end generate; rh_lib13t0 : if tech = rhlib13t generate x0 : rh_lib13t_syncram_2p generic map (abits, dbits, sepclk) port map (rclk, renable2, raddress, dataoutx, wclk, xwrite, waddress, datain, testin(TESTIN_WIDTH-1 downto TESTIN_WIDTH-4)); end generate; -- pragma translate_off noram : if has_2pram(tech) = 0 generate x : process begin assert false report "synram_2p: technology " & tech_table(tech) & " not supported" severity failure; wait; end process; end generate; dmsg : if GRLIB_CONFIG_ARRAY(grlib_debug_level) >= 2 generate x : process begin assert false report "syncram_2p: " & tost(2**abits) & "x" & tost(dbits) & " (" & tech_table(tech) & ")" severity note; wait; end process; end generate; generic_check : process begin assert sepclk = 0 or wrfst = 0 report "syncram_2p: Write-first not supported for RAM with separate clocks" severity failure; wait; end process; -- pragma translate_on end;
gpl-2.0
faccad5dd65023ed6a4454de1ee5f7ad
0.633233
3.798776
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/jtag/jtag.vhd
1
7,225
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- package: jtag -- File: jtag.vhd -- Author: Edvin Catovic - Gaisler Research -- Description: JTAG components ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; library techmap; use techmap.gencomp.all; package jtag is -- JTAG manufacturer IDs constant JTAG_MANF_ID_GR : integer range 0 to 2047 := 804; -- JTAG part numbers -- Do NOT select an existing part number for your custom design! constant JTAG_NEXTREME : integer range 0 to 65535 := 16#102#; constant JTAG_IHP25RH1 : integer range 0 to 65535 := 16#251#; constant JTAG_NGMP_PROTO : integer range 0 to 65535 := 16#281#; constant JTAG_NGMP_PROTO2 : integer range 0 to 65535 := 16#282#; constant JTAG_EXAMPLE_PART : integer range 0 to 65535 := 16#300#; constant JTAG_ORBITA1 : integer range 0 to 65535 := 16#631#; constant JTAG_ORBITA_OBTMP : integer range 0 to 65535 := 16#632#; constant JTAG_UT699RH : integer range 0 to 65535 := 16#699#; constant JTAG_UT700RH : integer range 0 to 65535 := 16#700#; constant JTAG_GR702 : integer range 0 to 65535 := 16#702#; constant JTAG_GR712 : integer range 0 to 65535 := 16#712#; constant JTAG_SPWRTRASIC : integer range 0 to 65535 := 16#718#; constant JTAG_UT840 : integer range 0 to 65535 := 16#840#; component ahbjtag generic ( tech : integer range 0 to NTECH := 0; hindex : integer := 0; nsync : integer range 1 to 2 := 1; idcode : integer range 0 to 255 := 9; manf : integer range 0 to 2047 := 804; part : integer range 0 to 65535 := 0; ver : integer range 0 to 15 := 0; ainst : integer range 0 to 255 := 2; dinst : integer range 0 to 255 := 3; scantest : integer := 0; oepol : integer := 1; tcknen : integer := 0; versel : integer range 0 to 1 := 1); port ( rst : in std_ulogic; clk : in std_ulogic; tck : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0); tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapi_tdo : in std_ulogic; trst : in std_ulogic := '1'; tdoen : out std_ulogic; tckn : in std_ulogic := '0'; tapo_tckn : out std_ulogic; tapo_ninst : out std_logic_vector(7 downto 0); tapo_iupd : out std_ulogic ); end component; component ahbjtag_bsd generic ( tech : integer range 0 to NTECH := 0; hindex : integer := 0; nsync : integer range 1 to 2 := 1; ainst : integer range 0 to 255 := 2; dinst : integer range 0 to 255 := 3); port ( rst : in std_ulogic; clk : in std_ulogic; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type; asel : in std_ulogic; dsel : in std_ulogic; tck : in std_ulogic; regi : in std_ulogic; shift : in std_ulogic; rego : out std_ulogic ); end component; component bscanctrl generic ( spinst: integer := 5; -- sample/preload etinst: integer := 6; -- extest itinst: integer := 7; --intest hzinst: integer := 8; -- highz clinst: integer := 10; -- clamp mbist : integer := 11; -- clamp scantest : integer := 0 ); port ( trst : in std_ulogic; tapo_tck : in std_ulogic; tapo_tckn : in std_ulogic; tapo_tdi : in std_ulogic; tapo_ninst : in std_logic_vector(7 downto 0); tapo_iupd : in std_ulogic; tapo_rst : in std_ulogic; tapo_capt : in std_ulogic; tapo_shft : in std_ulogic; tapo_upd : in std_ulogic; tapi_tdo : out std_ulogic; chain_tdi : out std_ulogic; chain_tdo : in std_ulogic; bsshft : out std_ulogic; bscapt : out std_ulogic; bsupdi : out std_ulogic; bsupdo : out std_ulogic; bsdrive : out std_ulogic; bshighz : out std_ulogic; bsmbist : out std_ulogic; testen : in std_ulogic; testrst : in std_ulogic ); end component; component bscanregs generic ( tech: integer := 0; nsigs: integer range 1 to 30 := 8; dirmask: integer := 2#00000000#; enable: integer range 0 to 1 := 1 ); port ( sigi: in std_logic_vector(nsigs-1 downto 0); sigo: out std_logic_vector(nsigs-1 downto 0); tck: in std_ulogic; tckn:in std_ulogic; tdi: in std_ulogic; tdo: out std_ulogic; bsshft: in std_ulogic; bscapt: in std_ulogic; bsupdi: in std_ulogic; bsupdo: in std_ulogic; bsdrive: in std_ulogic; bshighz: in std_ulogic ); end component; component bscanregsbd generic ( tech: integer:= 0; nsigs: integer := 8; enable: integer range 0 to 1 := 1; hzsup: integer range 0 to 1 := 1 ); port ( pado : out std_logic_vector(nsigs-1 downto 0); padoen : out std_logic_vector(nsigs-1 downto 0); padi : in std_logic_vector(nsigs-1 downto 0); coreo : in std_logic_vector(nsigs-1 downto 0); coreoen : in std_logic_vector(nsigs-1 downto 0); corei : out std_logic_vector(nsigs-1 downto 0); tck : in std_ulogic; tckn : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; bsshft : in std_ulogic; bscapt : in std_ulogic; -- capture signals to scan regs on next tck edge bsupdi : in std_ulogic; -- update indata reg from scan reg on next tck edge bsupdo : in std_ulogic; -- update outdata reg from scan reg on next tck edge bsdrive : in std_ulogic; -- drive outdata regs to pad, -- drive datareg(coreoen=0) or coreo(coreoen=1) to corei bshighz : in std_ulogic -- tri-state output if hzsup, sample 1 on input ); end component; end;
gpl-2.0
a1667c5f8d38cf25974e206ac31e5583
0.58436
3.62337
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/spw/comp/spwcomp.vhd
1
28,196
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; package spwcomp is component grspwc2 is generic( rmap : integer range 0 to 2 := 0; rmapcrc : integer range 0 to 1 := 0; fifosize1 : integer range 4 to 32 := 32; fifosize2 : integer range 16 to 64 := 64; rxunaligned : integer range 0 to 1 := 0; rmapbufs : integer range 2 to 8 := 4; scantest : integer range 0 to 1 := 0; ports : integer range 1 to 2 := 1; dmachan : integer range 1 to 4 := 1; tech : integer; input_type : integer range 0 to 4 := 0; output_type : integer range 0 to 2 := 0; rxtx_sameclk : integer range 0 to 1 := 0; nodeaddr : integer range 0 to 255 := 254; destkey : integer range 0 to 255 := 0); port( rst : in std_ulogic; clk : in std_ulogic; rxclk0 : in std_ulogic; rxclk1 : in std_ulogic; txclk : in std_ulogic; txclkn : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(3 downto 0); dv : in std_logic_vector(3 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(3 downto 0); so : out std_logic_vector(3 downto 0); --time iface tickin : in std_ulogic; tickinraw : in std_ulogic; timein : in std_logic_vector(7 downto 0); tickindone : out std_ulogic; tickout : out std_ulogic; tickoutraw : out std_ulogic; timeout : out std_logic_vector(7 downto 0); --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(4 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(4 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(4 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(4 downto 0); txrdata : in std_logic_vector(31 downto 0); --nchar fifo ncrenable : out std_ulogic; ncraddress : out std_logic_vector(5 downto 0); ncwrite : out std_ulogic; ncwdata : out std_logic_vector(9 downto 0); ncwaddress : out std_logic_vector(5 downto 0); ncrdata : in std_logic_vector(9 downto 0); --rmap buf rmrenable : out std_ulogic; rmraddress : out std_logic_vector(7 downto 0); rmwrite : out std_ulogic; rmwdata : out std_logic_vector(7 downto 0); rmwaddress : out std_logic_vector(7 downto 0); rmrdata : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0'; --parallel rx data out rxdav : out std_ulogic; rxdataout : out std_logic_vector(8 downto 0); loopback : out std_ulogic ); end component; component grspwc is generic( sysfreq : integer := 40000; usegen : integer range 0 to 1 := 1; nsync : integer range 1 to 2 := 1; rmap : integer range 0 to 2 := 0; rmapcrc : integer range 0 to 1 := 0; fifosize1 : integer range 4 to 32 := 32; fifosize2 : integer range 16 to 64 := 64; rxunaligned : integer range 0 to 1 := 0; rmapbufs : integer range 2 to 8 := 4; scantest : integer range 0 to 1 := 0; ports : integer range 1 to 2 := 1; tech : integer; nodeaddr : integer range 0 to 255 := 254; destkey : integer range 0 to 255 := 0 ); port( rst : in std_ulogic; clk : in std_ulogic; txclk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(1 downto 0); nd : in std_logic_vector(9 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(1 downto 0); so : out std_logic_vector(1 downto 0); rxrsto : out std_ulogic; --time iface tickin : in std_ulogic; tickout : out std_ulogic; --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); dcrstval : in std_logic_vector(9 downto 0); timerrstval : in std_logic_vector(11 downto 0); --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); --clk bufs rxclki : in std_logic_vector(1 downto 0); --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(4 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(4 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(4 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(4 downto 0); txrdata : in std_logic_vector(31 downto 0); --nchar fifo ncrenable : out std_ulogic; ncraddress : out std_logic_vector(5 downto 0); ncwrite : out std_ulogic; ncwdata : out std_logic_vector(8 downto 0); ncwaddress : out std_logic_vector(5 downto 0); ncrdata : in std_logic_vector(8 downto 0); --rmap buf rmrenable : out std_ulogic; rmraddress : out std_logic_vector(7 downto 0); rmwrite : out std_ulogic; rmwdata : out std_logic_vector(7 downto 0); rmwaddress : out std_logic_vector(7 downto 0); rmrdata : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testclk : in std_ulogic := '0'; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0'; rmapact : out std_ulogic ); end component; component grspwc_axcelerator is port( rst : in std_ulogic; clk : in std_ulogic; txclk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(1 downto 0); nd : in std_logic_vector(1 downto 0); --spw out do : out std_logic_vector(1 downto 0); so : out std_logic_vector(1 downto 0); rxrsto : out std_ulogic; --time iface tickin : in std_ulogic; tickout : out std_ulogic; --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); dcrstval : in std_logic_vector(9 downto 0); timerrstval : in std_logic_vector(11 downto 0); --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); --clk bufs rxclki : in std_logic_vector(1 downto 0); --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(4 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(4 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(4 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(4 downto 0); txrdata : in std_logic_vector(31 downto 0); --nchar fifo ncrenable : out std_ulogic; ncraddress : out std_logic_vector(5 downto 0); ncwrite : out std_ulogic; ncwdata : out std_logic_vector(8 downto 0); ncwaddress : out std_logic_vector(5 downto 0); ncrdata : in std_logic_vector(8 downto 0); --rmap buf rmrenable : out std_ulogic; rmraddress : out std_logic_vector(7 downto 0); rmwrite : out std_ulogic; rmwdata : out std_logic_vector(7 downto 0); rmwaddress : out std_logic_vector(7 downto 0); rmrdata : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testclk : in std_ulogic := '0'; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0' ); end component; component grspwc_unisim is port( rst : in std_ulogic; clk : in std_ulogic; txclk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(1 downto 0); nd : in std_logic_vector(1 downto 0); --spw out do : out std_logic_vector(1 downto 0); so : out std_logic_vector(1 downto 0); rxrsto : out std_ulogic; --time iface tickin : in std_ulogic; tickout : out std_ulogic; --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); dcrstval : in std_logic_vector(9 downto 0); timerrstval : in std_logic_vector(11 downto 0); --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); --clk bufs rxclki : in std_logic_vector(1 downto 0); --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(4 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(4 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(4 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(4 downto 0); txrdata : in std_logic_vector(31 downto 0); --nchar fifo ncrenable : out std_ulogic; ncraddress : out std_logic_vector(5 downto 0); ncwrite : out std_ulogic; ncwdata : out std_logic_vector(8 downto 0); ncwaddress : out std_logic_vector(5 downto 0); ncrdata : in std_logic_vector(8 downto 0); --rmap buf rmrenable : out std_ulogic; rmraddress : out std_logic_vector(7 downto 0); rmwrite : out std_ulogic; rmwdata : out std_logic_vector(7 downto 0); rmwaddress : out std_logic_vector(7 downto 0); rmrdata : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testclk : in std_ulogic := '0'; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0' ); end component; component grspw_gen is generic( tech : integer := 0; sysfreq : integer := 10000; usegen : integer range 0 to 1 := 1; nsync : integer range 1 to 2 := 1; rmap : integer range 0 to 2 := 0; rmapcrc : integer range 0 to 1 := 0; fifosize1 : integer range 4 to 32 := 32; fifosize2 : integer range 16 to 64 := 64; rxclkbuftype : integer range 0 to 2 := 0; rxunaligned : integer range 0 to 1 := 0; rmapbufs : integer range 2 to 8 := 4; ft : integer range 0 to 2 := 0; scantest : integer range 0 to 1 := 0; techfifo : integer range 0 to 1 := 1; ports : integer range 1 to 2 := 1; memtech : integer := 0; nodeaddr : integer range 0 to 255 := 254; destkey : integer range 0 to 255 := 0 ); port( rst : in std_ulogic; clk : in std_ulogic; txclk : in std_ulogic; rxclk : in std_logic_vector(1 downto 0); --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(1 downto 0); nd : in std_logic_vector(9 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(1 downto 0); so : out std_logic_vector(1 downto 0); rxrsto : out std_ulogic; --time iface tickin : in std_ulogic; tickout : out std_ulogic; --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); dcrstval : in std_logic_vector(9 downto 0); timerrstval : in std_logic_vector(11 downto 0); --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testclk : in std_ulogic := '0'; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0' ); end component; component grspw_codec_core is generic( ports : integer range 1 to 2 := 1; input_type : integer range 0 to 4 := 0; output_type : integer range 0 to 2 := 0; rxtx_sameclk : integer range 0 to 1 := 0; fifosize : integer range 16 to 2048 := 64; tech : integer; scantest : integer range 0 to 1 := 0 ); port( rst : in std_ulogic; clk : in std_ulogic; rxclk0 : in std_ulogic; rxclk1 : in std_ulogic; txclk : in std_ulogic; txclkn : in std_ulogic; testen : in std_ulogic; testrst : in std_ulogic; --spw in d : in std_logic_vector(3 downto 0); dv : in std_logic_vector(3 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(3 downto 0); so : out std_logic_vector(3 downto 0); --link fsm linkdisabled : in std_ulogic; linkstart : in std_ulogic; autostart : in std_ulogic; portsel : in std_ulogic; noportforce : in std_ulogic; rdivisor : in std_logic_vector(7 downto 0); idivisor : in std_logic_vector(7 downto 0); state : out std_logic_vector(2 downto 0); actport : out std_ulogic; dconnecterr : out std_ulogic; crederr : out std_ulogic; escerr : out std_ulogic; parerr : out std_ulogic; --rx fifo signals rxrenable : out std_ulogic; rxraddress : out std_logic_vector(10 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(9 downto 0); rxwaddress : out std_logic_vector(10 downto 0); rxrdata : in std_logic_vector(9 downto 0); rxaccess : out std_ulogic; --rx iface rxicharav : out std_ulogic; rxicharcnt : out std_logic_vector(11 downto 0); rxichar : out std_logic_vector(8 downto 0); rxiread : in std_ulogic; rxififorst : in std_ulogic; --tx fifo signals txrenable : out std_ulogic; txraddress : out std_logic_vector(10 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(8 downto 0); txwaddress : out std_logic_vector(10 downto 0); txrdata : in std_logic_vector(8 downto 0); txaccess : out std_ulogic; --tx iface txicharcnt : out std_logic_vector(11 downto 0); txifull : out std_ulogic; txiempty : out std_ulogic; txiwrite : in std_ulogic; txichar : in std_logic_vector(8 downto 0); txififorst : in std_ulogic; txififorstact: out std_ulogic; --time iface tickin : in std_ulogic; timein : in std_logic_vector(7 downto 0); tickin_done : out std_ulogic; tickout : out std_ulogic; timeout : out std_logic_vector(7 downto 0) ); end component; component grspw2_gen is generic( rmap : integer range 0 to 2 := 0; rmapcrc : integer range 0 to 1 := 0; fifosize1 : integer range 4 to 32 := 32; fifosize2 : integer range 16 to 64 := 64; rxunaligned : integer range 0 to 1 := 0; rmapbufs : integer range 2 to 8 := 4; scantest : integer range 0 to 1 := 0; ports : integer range 1 to 2 := 1; dmachan : integer range 1 to 4 := 1; tech : integer; input_type : integer range 0 to 4 := 0; output_type : integer range 0 to 2 := 0; rxtx_sameclk : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0; techfifo : integer range 0 to 1 := 1; memtech : integer := 0; nodeaddr : integer range 0 to 255 := 254; destkey : integer range 0 to 255 := 0); port( rst : in std_ulogic; clk : in std_ulogic; rxclk0 : in std_ulogic; rxclk1 : in std_ulogic; txclk : in std_ulogic; txclkn : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --spw in d : in std_logic_vector(3 downto 0); dv : in std_logic_vector(3 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(3 downto 0); so : out std_logic_vector(3 downto 0); --time iface tickin : in std_ulogic; tickinraw : in std_ulogic; timein : in std_logic_vector(7 downto 0); tickindone : out std_ulogic; tickout : out std_ulogic; tickoutraw : out std_ulogic; timeout : out std_logic_vector(7 downto 0); --irq irq : out std_logic; --misc clkdiv10 : in std_logic_vector(7 downto 0); linkdis : out std_ulogic; testrst : in std_ulogic := '0'; testen : in std_ulogic := '0'; --rmapen rmapen : in std_ulogic; rmapnodeaddr : in std_logic_vector(7 downto 0); --parallel rx data out rxdav : out std_ulogic; rxdataout : out std_logic_vector(8 downto 0) ); end component; component grspw_codec_gen is generic( ports : integer range 1 to 2 := 1; input_type : integer range 0 to 4 := 0; output_type : integer range 0 to 2 := 0; rxtx_sameclk : integer range 0 to 1 := 0; fifosize : integer range 16 to 2048 := 64; tech : integer; scantest : integer range 0 to 1 := 0; techfifo : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0 ); port( rst : in std_ulogic; clk : in std_ulogic; rxclk0 : in std_ulogic; rxclk1 : in std_ulogic; txclk : in std_ulogic; txclkn : in std_ulogic; testen : in std_ulogic; testrst : in std_ulogic; --spw in d : in std_logic_vector(3 downto 0); dv : in std_logic_vector(3 downto 0); dconnect : in std_logic_vector(3 downto 0); --spw out do : out std_logic_vector(3 downto 0); so : out std_logic_vector(3 downto 0); --link fsm linkdisabled : in std_ulogic; linkstart : in std_ulogic; autostart : in std_ulogic; portsel : in std_ulogic; noportforce : in std_ulogic; rdivisor : in std_logic_vector(7 downto 0); idivisor : in std_logic_vector(7 downto 0); state : out std_logic_vector(2 downto 0); actport : out std_ulogic; dconnecterr : out std_ulogic; crederr : out std_ulogic; escerr : out std_ulogic; parerr : out std_ulogic; --rx iface rxicharav : out std_ulogic; rxicharcnt : out std_logic_vector(11 downto 0); rxichar : out std_logic_vector(8 downto 0); rxiread : in std_ulogic; rxififorst : in std_ulogic; --tx iface txicharcnt : out std_logic_vector(11 downto 0); txifull : out std_ulogic; txiempty : out std_ulogic; txiwrite : in std_ulogic; txichar : in std_logic_vector(8 downto 0); txififorst : in std_ulogic; txififorstact: out std_ulogic; --time iface tickin : in std_ulogic; timein : in std_logic_vector(7 downto 0); tickin_done : out std_ulogic; tickout : out std_ulogic; timeout : out std_logic_vector(7 downto 0); --misc merror : out std_ulogic ); end component; end package;
gpl-2.0
12d097d4fbf0e5a566bb435437ad23b8
0.528444
3.664674
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep3c25-eek/config.vhd
1
7,326
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := cyclone3; constant CFG_MEMTECH : integer := cyclone3; constant CFG_PADTECH : integer := cyclone3; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := cyclone3; constant CFG_CLKMUL : integer := (5); constant CFG_CLKDIV : integer := (5); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 2 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 0; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 0*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 1; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 1; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0039#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000011#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 1; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- SSRAM controller constant CFG_SSCTRL : integer := 0; constant CFG_SSCTRLP16 : integer := 0; -- DDR controller constant CFG_DDRSP : integer := 1; constant CFG_DDRSP_INIT : integer := 1; constant CFG_DDRSP_FREQ : integer := (100); constant CFG_DDRSP_COL : integer := (9); constant CFG_DDRSP_SIZE : integer := (8); constant CFG_DDRSP_RSKEW : integer := (2500); -- SPI memory controller constant CFG_SPIMCTRL : integer := 0; constant CFG_SPIMCTRL_SDCARD : integer := 0; constant CFG_SPIMCTRL_READCMD : integer := 16#0#; constant CFG_SPIMCTRL_DUMMYBYTE : integer := 0; constant CFG_SPIMCTRL_DUALOUTPUT : integer := 0; constant CFG_SPIMCTRL_SCALER : integer := 1; constant CFG_SPIMCTRL_ASCALER : integer := 1; constant CFG_SPIMCTRL_PWRUPCNT : integer := 0; constant CFG_SPIMCTRL_OFFSET : integer := 16#0#; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 64; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 8; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0#; constant CFG_GRGPIO_WIDTH : integer := (5); -- I2C master constant CFG_I2C_ENABLE : integer := 1; -- PS/2 interface constant CFG_PS2_ENABLE : integer := 1; -- SPI controller constant CFG_SPICTRL_ENABLE : integer := 1; constant CFG_SPICTRL_NUM : integer := (1); constant CFG_SPICTRL_SLVS : integer := (1); constant CFG_SPICTRL_FIFO : integer := (2); constant CFG_SPICTRL_SLVREG : integer := 1; constant CFG_SPICTRL_ODMODE : integer := 0; constant CFG_SPICTRL_AM : integer := 0; constant CFG_SPICTRL_ASEL : integer := 0; constant CFG_SPICTRL_TWEN : integer := 0; constant CFG_SPICTRL_MAXWLEN : integer := (0); constant CFG_SPICTRL_SYNCRAM : integer := 0; constant CFG_SPICTRL_FT : integer := 0; -- LCD SVGA controller constant CFG_LCD_ENABLE : integer := 1; -- LCD 3-wire serial interface constant CFG_LCD3T_ENABLE : integer := 1; -- SVGA controller constant CFG_SVGA_ENABLE : integer := 0; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
5e8a638d92130b56c79a388501937cfe
0.651106
3.639344
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3mp/leon3mp.vhd
1
31,994
----------------------------------------------------------------------------- -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.can.all; use gaisler.pci.all; use gaisler.net.all; use gaisler.jtag.all; use gaisler.spacewire.all; library esa; use esa.memoryctrl.all; use esa.pcicomp.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( resetn : in std_ulogic; clk : in std_ulogic; pllref : in std_ulogic; errorn : out std_ulogic; address : out std_logic_vector(27 downto 0); data : inout std_logic_vector(31 downto 0); sa : out std_logic_vector(14 downto 0); sd : inout std_logic_vector(63 downto 0); sdclk : out std_ulogic; sdcke : out std_logic_vector (1 downto 0); -- sdram clock enable sdcsn : out std_logic_vector (1 downto 0); -- sdram chip select sdwen : out std_ulogic; -- sdram write enable sdrasn : out std_ulogic; -- sdram ras sdcasn : out std_ulogic; -- sdram cas sddqm : out std_logic_vector (7 downto 0); -- sdram dqm dsutx : out std_ulogic; -- DSU tx data dsurx : in std_ulogic; -- DSU rx data dsuen : in std_ulogic; dsubre : in std_ulogic; dsuact : out std_ulogic; txd1 : out std_ulogic; -- UART1 tx data rxd1 : in std_ulogic; -- UART1 rx data txd2 : out std_ulogic; -- UART2 tx data rxd2 : in std_ulogic; -- UART2 rx data ramsn : out std_logic_vector (4 downto 0); ramoen : out std_logic_vector (4 downto 0); rwen : out std_logic_vector (3 downto 0); oen : out std_ulogic; writen : out std_ulogic; read : out std_ulogic; iosn : out std_ulogic; romsn : out std_logic_vector (1 downto 0); gpio : inout std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); -- I/O port emdio : inout std_logic; -- ethernet PHY interface etx_clk : in std_ulogic; erx_clk : in std_ulogic; erxd : in std_logic_vector(3 downto 0); erx_dv : in std_ulogic; erx_er : in std_ulogic; erx_col : in std_ulogic; erx_crs : in std_ulogic; etxd : out std_logic_vector(3 downto 0); etx_en : out std_ulogic; etx_er : out std_ulogic; emdc : out std_ulogic; emddis : out std_logic; epwrdwn : out std_ulogic; ereset : out std_ulogic; esleep : out std_ulogic; epause : out std_ulogic; pci_rst : inout std_logic; -- PCI bus pci_clk : in std_ulogic; pci_gnt : in std_ulogic; pci_idsel : in std_ulogic; pci_lock : inout std_ulogic; pci_ad : inout std_logic_vector(31 downto 0); pci_cbe : inout std_logic_vector(3 downto 0); pci_frame : inout std_ulogic; pci_irdy : inout std_ulogic; pci_trdy : inout std_ulogic; pci_devsel : inout std_ulogic; pci_stop : inout std_ulogic; pci_perr : inout std_ulogic; pci_par : inout std_ulogic; pci_req : inout std_ulogic; pci_serr : inout std_ulogic; pci_host : in std_ulogic; pci_66 : in std_ulogic; pci_arb_req : in std_logic_vector(0 to 3); pci_arb_gnt : out std_logic_vector(0 to 3); can_txd : out std_ulogic; can_rxd : in std_ulogic; can_stb : out std_ulogic; spw_clk : in std_ulogic; spw_rxd : in std_logic_vector(0 to 2); spw_rxdn : in std_logic_vector(0 to 2); spw_rxs : in std_logic_vector(0 to 2); spw_rxsn : in std_logic_vector(0 to 2); spw_txd : out std_logic_vector(0 to 2); spw_txdn : out std_logic_vector(0 to 2); spw_txs : out std_logic_vector(0 to 2); spw_txsn : out std_logic_vector(0 to 2); tck, tms, tdi : in std_ulogic; tdo : out std_ulogic ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant maxahbmsp : integer := NCPU+CFG_AHB_UART+ CFG_GRETH+CFG_AHB_JTAG+log2x(CFG_PCI); constant maxahbm : integer := (CFG_SPW_NUM*CFG_SPW_EN) + maxahbmsp; signal vcc, gnd : std_logic_vector(4 downto 0); signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdram_out_type; signal sdo2, sdo3 : sdctrl_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, rstraw, pciclk, sdclkl, spw_lclk : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to NCPU-1); signal irqo : irq_out_vector(0 to NCPU-1); signal dbgi : l3_debug_in_vector(0 to NCPU-1); signal dbgo : l3_debug_out_vector(0 to NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal pcii : pci_in_type; signal pcio : pci_out_type; signal ethi, ethi1, ethi2 : eth_in_type; signal etho, etho1, etho2 : eth_out_type; signal gpti : gptimer_in_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal can_lrx, can_ltx : std_ulogic; signal lclk, pci_lclk : std_ulogic; signal pci_arb_req_n, pci_arb_gnt_n : std_logic_vector(0 to 3); signal spwi : grspw_in_type_vector(0 to 2); signal spwo : grspw_out_type_vector(0 to 2); signal spw_rxclk : std_logic_vector(0 to CFG_SPW_NUM-1); signal dtmp : std_logic_vector(0 to CFG_SPW_NUM-1); signal stmp : std_logic_vector(0 to CFG_SPW_NUM-1); signal spw_rxtxclk : std_ulogic; signal spw_rxclkn : std_ulogic; attribute sync_set_reset : string; attribute sync_set_reset of rstn : signal is "true"; constant BOARD_FREQ : integer := 40000; -- Board frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; constant IOAEN : integer := CFG_SDCTRL + CFG_CAN; constant CFG_SDEN : integer := CFG_SDCTRL + CFG_MCTRL_SDEN ; constant sysfreq : integer := (CFG_CLKMUL/CFG_CLKDIV)*40000; begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; pllref_pad : clkpad generic map (tech => padtech) port map (pllref, cgi.pllref); clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk); pci_clk_pad : clkpad generic map (tech => padtech, level => pci33) port map (pci_clk, pci_lclk); clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_SDEN, CFG_CLK_NOFB, CFG_PCI, CFG_PCIDLL, CFG_PCISYSCLK) port map (lclk, pci_lclk, clkm, open, open, sdclkl, pciclk, cgi, cgo); sdclk_pad : outpad generic map (tech => padtech, slew => 1, strength => 24) port map (sdclk, sdclkl); rst0 : rstgen -- reset generator port map (resetn, clkm, cgo.clklock, rstn, rstraw); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => IOAEN, nahbm => maxahbm, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- l3 : if CFG_LEON3 = 1 generate cpu : for i in 0 to NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, NCPU-1, CFG_DFIXED, CFG_SCAN, CFG_MMU_PAGE, CFG_BP) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; errorn_pad : odpad generic map (tech => padtech) port map (errorn, dbgo(0).error); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsuen_pad : inpad generic map (tech => padtech) port map (dsuen, dsui.enable); dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, dsuo.active); end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0: ahbuart -- Debug UART generic map (hindex => NCPU, pindex => 7, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(7), ahbmi, ahbmo(NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (dsurx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (dsutx, duo.txd); end generate; nouah : if CFG_AHB_UART = 0 generate apbo(7) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- src : if CFG_SRCTRL = 1 generate -- 32-bit PROM/SRAM controller sr0 : srctrl generic map (hindex => 0, ramws => CFG_SRCTRL_RAMWS, romws => CFG_SRCTRL_PROMWS, ramaddr => 16#400#, prom8en => CFG_SRCTRL_8BIT, rmw => CFG_SRCTRL_RMW) port map (rstn, clkm, ahbsi, ahbso(0), memi, memo, sdo3); apbo(0) <= apb_none; end generate; sdc : if CFG_SDCTRL = 1 generate sdc : sdctrl generic map (hindex => 3, haddr => 16#600#, hmask => 16#F00#, ioaddr => 1, fast => 0, pwron => 0, invclk => CFG_SDCTRL_INVCLK, sdbits => 32 + 32*CFG_SDCTRL_SD64, pageburst => CFG_SDCTRL_PAGE) port map (rstn, clkm, ahbsi, ahbso(3), sdi, sdo2); sa_pad : outpadv generic map (width => 15, tech => padtech) port map (sa, sdo2.address); sd_pad : iopadv generic map (width => 32, tech => padtech) port map (sd(31 downto 0), sdo2.data(31 downto 0), sdo2.bdrive, sdi.data(31 downto 0)); sd2 : if CFG_SDCTRL_SD64 = 1 generate sd_pad2 : iopadv generic map (width => 32) port map (sd(63 downto 32), sdo2.data, sdo2.bdrive, sdi.data(63 downto 32)); end generate; sdcke_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcke, sdo2.sdcke); sdwen_pad : outpad generic map (tech => padtech) port map (sdwen, sdo2.sdwen); sdcsn_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcsn, sdo2.sdcsn); sdras_pad : outpad generic map (tech => padtech) port map (sdrasn, sdo2.rasn); sdcas_pad : outpad generic map (tech => padtech) port map (sdcasn, sdo2.casn); sddqm_pad : outpadv generic map (width =>8, tech => padtech) port map (sddqm, sdo2.dqm(7 downto 0)); end generate; mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 0, pindex => 0, paddr => 0, srbanks => 4+CFG_MCTRL_5CS, sden => CFG_MCTRL_SDEN, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, invclk => CFG_MCTRL_INVCLK, sepbus => CFG_MCTRL_SEPBUS, sdbits => 32 + 32*CFG_MCTRL_SD64, pageburst => CFG_MCTRL_PAGE) port map (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo); sdpads : if CFG_MCTRL_SDEN = 1 generate -- SDRAM controller sd2 : if CFG_MCTRL_SEPBUS = 1 generate sa_pad : outpadv generic map (width => 15) port map (sa, memo.sa); bdr : for i in 0 to 3 generate sd_pad : iopadv generic map (tech => padtech, width => 8) port map (sd(31-i*8 downto 24-i*8), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), memi.sd(31-i*8 downto 24-i*8)); sd2 : if CFG_MCTRL_SD64 = 1 generate sd_pad2 : iopadv generic map (tech => padtech, width => 8) port map (sd(31-i*8+32 downto 24-i*8+32), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), memi.sd(31-i*8+32 downto 24-i*8+32)); end generate; end generate; end generate; sdwen_pad : outpad generic map (tech => padtech) port map (sdwen, sdo.sdwen); sdras_pad : outpad generic map (tech => padtech) port map (sdrasn, sdo.rasn); sdcas_pad : outpad generic map (tech => padtech) port map (sdcasn, sdo.casn); sddqm_pad : outpadv generic map (width =>8, tech => padtech) port map (sddqm, sdo.dqm); sdcke_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcke, sdo.sdcke); sdcsn_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcsn, sdo.sdcsn); end generate; end generate; nosd0 : if (CFG_MCTRL_SDEN = 0) and (CFG_SDCTRL = 0) generate -- no SDRAM controller sdcke_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcke, vcc(1 downto 0)); sdcsn_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcsn, vcc(1 downto 0)); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "10"; mgpads : if (CFG_SRCTRL = 1) or (CFG_MCTRL_LEON2 = 1) generate -- prom/sram pads addr_pad : outpadv generic map (width => 28, tech => padtech) port map (address, memo.address(27 downto 0)); rams_pad : outpadv generic map (width => 5, tech => padtech) port map (ramsn, memo.ramsn(4 downto 0)); roms_pad : outpadv generic map (width => 2, tech => padtech) port map (romsn, memo.romsn(1 downto 0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.oen); rwen_pad : outpadv generic map (width => 4, tech => padtech) port map (rwen, memo.wrn); roen_pad : outpadv generic map (width => 5, tech => padtech) port map (ramoen, memo.ramoen(4 downto 0)); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.writen); read_pad : outpad generic map (tech => padtech) port map (read, memo.read); iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); bdr : for i in 0 to 3 generate data_pad : iopadv generic map (tech => padtech, width => 8) port map (data(31-i*8 downto 24-i*8), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), memi.data(31-i*8 downto 24-i*8)); end generate; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 5, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(5)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(5) <= ahbs_none; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; ua2 : if CFG_UART2_ENABLE /= 0 generate uart2 : apbuart -- UART 2 generic map (pindex => 9, paddr => 9, pirq => 3, fifosize => CFG_UART2_FIFO) port map (rstn, clkm, apbi, apbo(9), u2i, u2o); u2i.rxd <= rxd2; u2i.ctsn <= '0'; u2i.extclk <= '0'; txd2 <= u2o.txd; end generate; noua1 : if CFG_UART2_ENABLE = 0 generate apbo(9) <= apb_none; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW, wdog => CFG_GPT_WDOG) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GR GPIO unit grgpio0: grgpio generic map( pindex => 11, paddr => 11, imask => CFG_GRGPIO_IMASK, nbits => CFG_GRGPIO_WIDTH) port map( rstn, clkm, apbi, apbo(11), gpioi, gpioo); pio_pads : for i in 0 to CFG_GRGPIO_WIDTH-1 generate pio_pad : iopad generic map (tech => padtech) port map (gpio(i), gpioo.dout(i), gpioo.oen(i), gpioi.din(i)); end generate; end generate; ----------------------------------------------------------------------- --- PCI ------------------------------------------------------------ ----------------------------------------------------------------------- pp : if CFG_PCI /= 0 generate pci_gr0 : if CFG_PCI = 1 generate -- simple target-only pci0 : pci_target generic map (hindex => NCPU+CFG_AHB_UART+CFG_AHB_JTAG, device_id => CFG_PCIDID, vendor_id => CFG_PCIVID) port map (rstn, clkm, pciclk, pcii, pcio, ahbmi, ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG)); end generate; pci_mtf0 : if CFG_PCI = 2 generate -- master/target with fifo pci0 : pci_mtf generic map (memtech => memtech, hmstndx => NCPU+CFG_AHB_UART+CFG_AHB_JTAG, fifodepth => log2(CFG_PCIDEPTH), device_id => CFG_PCIDID, vendor_id => CFG_PCIVID, hslvndx => 4, pindex => 4, paddr => 4, haddr => 16#E00#, ioaddr => 16#400#, nsync => 2, hostrst => 1) port map (rstn, clkm, pciclk, pcii, pcio, apbi, apbo(4), ahbmi, ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG), ahbsi, ahbso(4)); end generate; pci_mtf1 : if CFG_PCI = 3 generate -- master/target with fifo and DMA dma : pcidma generic map (memtech => memtech, dmstndx => NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1, dapbndx => 5, dapbaddr => 5, blength => blength, mstndx => NCPU+CFG_AHB_UART+CFG_AHB_JTAG, fifodepth => log2(CFG_PCIDEPTH), device_id => CFG_PCIDID, vendor_id => CFG_PCIVID, slvndx => 4, apbndx => 4, apbaddr => 4, haddr => 16#E00#, ioaddr => 16#800#, nsync => 2, hostrst => 1) port map (rstn, clkm, pciclk, pcii, pcio, apbo(5), ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1), apbi, apbo(4), ahbmi, ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG), ahbsi, ahbso(4)); end generate; pci_trc0 : if CFG_PCITBUFEN /= 0 generate -- PCI trace buffer pt0 : pcitrace generic map (depth => (6 + log2(CFG_PCITBUF/256)), memtech => memtech, pindex => 8, paddr => 16#100#, pmask => 16#f00#) port map ( rstn, clkm, pciclk, pcii, apbi, apbo(8)); end generate; pcia0 : if CFG_PCI_ARB = 1 generate -- PCI arbiter pciarb0 : pciarb generic map (pindex => 10, paddr => 10, apb_en => CFG_PCI_ARBAPB) port map ( clk => pciclk, rst_n => pcii.rst, req_n => pci_arb_req_n, frame_n => pcii.frame, gnt_n => pci_arb_gnt_n, pclk => clkm, prst_n => rstn, apbi => apbi, apbo => apbo(10) ); pgnt_pad : outpadv generic map (tech => padtech, width => 4) port map (pci_arb_gnt, pci_arb_gnt_n); preq_pad : inpadv generic map (tech => padtech, width => 4) port map (pci_arb_req, pci_arb_req_n); end generate; pcipads0 : pcipads generic map (padtech => padtech) -- PCI pads port map ( pci_rst, pci_gnt, pci_idsel, pci_lock, pci_ad, pci_cbe, pci_frame, pci_irdy, pci_trdy, pci_devsel, pci_stop, pci_perr, pci_par, pci_req, pci_serr, pci_host, pci_66, pcii, pcio ); end generate; nop1 : if CFG_PCI <= 1 generate apbo(4) <= apb_none; end generate; nop2 : if CFG_PCI <= 2 generate apbo(5) <= apb_none; end generate; nop3 : if CFG_PCI <= 1 generate ahbso(4) <= ahbs_none; end generate; notrc : if CFG_PCITBUFEN = 0 generate apbo(8) <= apb_none; end generate; noarb : if CFG_PCI_ARB = 0 generate apbo(10) <= apb_none; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : greth generic map(hindex => NCPU+CFG_AHB_UART+CFG_PCI+CFG_AHB_JTAG, pindex => 15, paddr => 15, pirq => 7, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL) port map( rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(NCPU+CFG_AHB_UART+CFG_PCI+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); emdio_pad : iopad generic map (tech => padtech) port map (emdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 1) port map (etx_clk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 1) port map (erx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (erxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (erx_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (erx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (erx_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (erx_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (etxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map ( etx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (etx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (emdc, etho.mdc); emdis_pad : outpad generic map (tech => padtech) port map (emddis, vcc(0)); eepwrdwn_pad : outpad generic map (tech => padtech) port map (epwrdwn, gnd(0)); esleep_pad : outpad generic map (tech => padtech) port map (esleep, gnd(0)); epause_pad : outpad generic map (tech => padtech) port map (epause, gnd(0)); ereset_pad : outpad generic map (tech => padtech) port map (ereset, gnd(0)); end generate; ----------------------------------------------------------------------- --- CAN -------------------------------------------------------------- ----------------------------------------------------------------------- can0 : if CFG_CAN = 1 generate can0 : can_oc generic map (slvndx => 6, ioaddr => CFG_CANIO, iomask => 16#FFF#, irq => CFG_CANIRQ, memtech => memtech) port map (rstn, clkm, ahbsi, ahbso(6), can_lrx, can_ltx ); end generate; ncan : if CFG_CAN = 0 generate ahbso(6) <= ahbs_none; end generate; can_stb <= '0'; -- no standby can_loopback : if CFG_CANLOOP = 1 generate can_lrx <= can_ltx; end generate; can_pads : if CFG_CANLOOP = 0 generate can_tx_pad : outpad generic map (tech => padtech) port map (can_txd, can_ltx); can_rx_pad : inpad generic map (tech => padtech) port map (can_rxd, can_lrx); end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ocram : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map ( rstn, clkm, ahbsi, ahbso(7)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(7) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- SPACEWIRE ------------------------------------------------------- ----------------------------------------------------------------------- spw : if CFG_SPW_EN > 0 generate spw_clk_pad : clkpad generic map (tech => padtech) port map (spw_clk, spw_lclk); spw_rxtxclk <= spw_lclk; spw_rxclkn <= not spw_rxtxclk; swloop : for i in 0 to CFG_SPW_NUM-1 generate -- GRSPW2 PHY spw2_input : if CFG_SPW_GRSPW = 2 generate spw_phy0 : grspw2_phy generic map( scantest => 0, tech => fabtech, input_type => CFG_SPW_INPUT) port map( rstn => rstn, rxclki => spw_rxtxclk, rxclkin => spw_rxclkn, nrxclki => spw_rxtxclk, di => dtmp(i), si => stmp(i), do => spwi(i).d(1 downto 0), dov => spwi(i).dv(1 downto 0), dconnect => spwi(i).dconnect(1 downto 0), rxclko => spw_rxclk(i)); spwi(i).nd <= (others => '0'); -- Only used in GRSPW spwi(i).dv(3 downto 2) <= "00"; -- For second port end generate spw2_input; -- GRSPW PHY spw1_input: if CFG_SPW_GRSPW = 1 generate spw_phy0 : grspw_phy generic map( tech => fabtech, rxclkbuftype => 1, scantest => 0) port map( rxrst => spwo(i).rxrst, di => dtmp(i), si => stmp(i), rxclko => spw_rxclk(i), do => spwi(i).d(0), ndo => spwi(i).nd(4 downto 0), dconnect => spwi(i).dconnect(1 downto 0)); spwi(i).d(1) <= '0'; spwi(i).dv <= (others => '0'); -- Only used in GRSPW2 spwi(i).nd(9 downto 5) <= "00000"; -- For second port end generate spw1_input; spwi(i).d(3 downto 2) <= "00"; -- For second port spwi(i).dconnect(3 downto 2) <= "00"; -- For second port spwi(i).s(1 downto 0) <= "00"; -- Only used in PHY sw0 : grspwm generic map(tech => memtech, netlist => CFG_SPW_NETLIST, hindex => maxahbmsp+i, pindex => 12+i, paddr => 12+i, pirq => 10+i, sysfreq => sysfreq, nsync => 1, rmap => CFG_SPW_RMAP, rmapcrc => CFG_SPW_RMAPCRC, rmapbufs => CFG_SPW_RMAPBUF, ports => 1, dmachan => CFG_SPW_DMACHAN, fifosize1 => CFG_SPW_AHBFIFO, fifosize2 => CFG_SPW_RXFIFO, rxclkbuftype => 1, spwcore => CFG_SPW_GRSPW, input_type => CFG_SPW_INPUT, output_type => CFG_SPW_OUTPUT, rxtx_sameclk => CFG_SPW_RTSAME) port map(resetn, clkm, spw_rxclk(i), spw_rxclk(i), spw_rxtxclk, spw_rxtxclk, ahbmi, ahbmo(maxahbmsp+i), apbi, apbo(12+i), spwi(i), spwo(i)); spwi(i).tickin <= '0'; spwi(i).rmapen <= '1'; spwi(i).clkdiv10 <= conv_std_logic_vector(sysfreq/10000-1, 8); spwi(i).dcrstval <= (others => '0'); spwi(i).timerrstval <= (others => '0'); spw_rxd_pad : inpad_ds generic map (padtech, lvds, x25v) port map (spw_rxd(i), spw_rxdn(i), dtmp(i)); spw_rxs_pad : inpad_ds generic map (padtech, lvds, x25v) port map (spw_rxs(i), spw_rxsn(i), stmp(i)); spw_txd_pad : outpad_ds generic map (padtech, lvds, x25v) port map (spw_txd(i), spw_txdn(i), spwo(i).d(0), gnd(0)); spw_txs_pad : outpad_ds generic map (padtech, lvds, x25v) port map (spw_txs(i), spw_txsn(i), spwo(i).s(0), gnd(0)); end generate; end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- -- nam1 : for i in maxahbm to NAHBMST-1 generate -- ahbmo(i) <= ahbm_none; -- end generate; -- nam2 : if CFG_PCI > 1 generate -- ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_PCI-1) <= ahbm_none; -- end generate; -- nap0 : for i in 12+(CFG_SPW_NUM*CFG_SPW_EN) to NAPBSLV-1 generate apbo(i) <= apb_none; end generate; -- apbo(6) <= apb_none; -- nah0 : for i in 9 to NAHBSLV-1 generate ahbso(i) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 MP Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
b92cbf10c105479547f16d18eafe1938
0.561293
3.466681
false
false
false
false
capitanov/Stupid_watch
src/rtl/game_cores/cl_square.vhd
1
3,886
-------------------------------------------------------------------------------- -- -- Title : cl_square.vhd -- Design : Example -- Author : Kapitanov -- Company : InSys -- -- Version : 1.0 -------------------------------------------------------------------------------- -- -- Description : Game block for square 8x8 -- -- -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use work.ctrl_types_pkg.array8x8; entity cl_square is generic( constant yend : std_logic_vector(4 downto 0); --! Y end area constant ystart : std_logic_vector(4 downto 0); --! Y start area constant xend : std_logic_vector(6 downto 0); --! X end area constant xstart : std_logic_vector(6 downto 0) --! X start area ); port( -- system signals: clk : in std_logic; --! clock reset : in std_logic; --! system reset -- vga XoY coordinates: show_disp : in array8x8; --! show square display --data_hide : in std_logic; display : in std_logic; --! display enable x_char : in std_logic_vector(9 downto 0); --! X line: 0:79 y_char : in std_logic_vector(8 downto 0); --! Y line: 0:29 -- out color scheme: rgb : out std_logic_vector(2 downto 0) --! RGB Colour ); end cl_square; architecture cl_square of cl_square is signal data_rom : std_logic_vector(7 downto 0); signal x_in : std_logic_vector(6 downto 0); signal y_in : std_logic_vector(4 downto 0); signal data : std_logic; signal dataxy : std_logic; signal x_rev : std_logic_vector(2 downto 0); signal x_del : std_logic_vector(2 downto 0); signal x_z : std_logic_vector(2 downto 0); signal y_charz : std_logic_vector(3 downto 0); constant color : std_logic_vector(2 downto 0):="001"; begin y_charz <= y_char(3 downto 0) when rising_edge(clk); x_in <= x_char(9 downto 3); y_in <= y_char(8 downto 4); pr_select3: process(clk, reset) is begin if reset = '0' then dataxy <= '0'; elsif rising_edge(clk) then if display = '0' then dataxy <= '0'; else if ((xstart <= x_in) and (x_in < xend)) then if ((ystart <= y_in) and (y_in < yend)) then dataxy <= not show_disp(conv_integer(x_in(2 downto 0)))(conv_integer(y_in(2 downto 0))); else dataxy <= '0'; end if; else dataxy <= '0'; end if; end if; end if; end process; pr_new_box: process(clk, reset) begin if reset = '0' then data_rom <= x"00"; elsif rising_edge(clk) then if (dataxy = '1') then case y_charz(3 downto 0) is when x"0" => data_rom <= x"FE"; when x"1" => data_rom <= x"FE"; when x"2" => data_rom <= x"FE"; when x"3" => data_rom <= x"FE"; when x"4" => data_rom <= x"FE"; when x"5" => data_rom <= x"FE"; when x"6" => data_rom <= x"FE"; when x"7" => data_rom <= x"FE"; when x"8" => data_rom <= x"FE"; when x"9" => data_rom <= x"FE"; when x"A" => data_rom <= x"FE"; when x"B" => data_rom <= x"FE"; when x"C" => data_rom <= x"FE"; when x"D" => data_rom <= x"FE"; when x"E" => data_rom <= x"FE"; when others => data_rom <= x"00"; end case; else data_rom <= x"00"; end if; end if; end process; g_rev: for ii in 0 to 2 generate begin x_rev(ii) <= not x_char(ii) when rising_edge(clk); end generate; x_del <= x_rev when rising_edge(clk); x_z <= x_del when rising_edge(clk); pr_sw_sel: process(clk, reset) is begin if reset = '0' then data <= '0'; elsif rising_edge(clk) then data <= data_rom(to_integer(unsigned(x_z))); end if; end process; g_rgb: for ii in 0 to 2 generate begin rgb(ii) <= data and color(ii); end generate; end cl_square;
mit
b7b41fc88bf303ee943dc80a755a5865
0.533453
2.783668
false
false
false
false
IamVNIE/Hardware-Security
DES CryptoCore/src/pp.vhd
2
944
library ieee; use ieee.std_logic_1164.all; entity pp is port ( so1x,so2x,so3x,so4x,so5x,so6x,so7x,so8x : in std_logic_vector(1 to 4); ppo : out std_logic_vector(1 to 32) ); end pp; architecture behaviour of pp is signal XX : std_logic_vector(1 to 32); begin XX(1 to 4)<=so1x; XX(5 to 8)<=so2x; XX(9 to 12)<=so3x; XX(13 to 16)<=so4x; XX(17 to 20)<=so5x; XX(21 to 24)<=so6x; XX(25 to 28)<=so7x; XX(29 to 32)<=so8x; ppo(1)<=XX(16); ppo(2)<=XX(7); ppo(3)<=XX(20); ppo(4)<=XX(21); ppo(5)<=XX(29); ppo(6)<=XX(12); ppo(7)<=XX(28); ppo(8)<=XX(17); ppo(9)<=XX(1); ppo(10)<=XX(15); ppo(11)<=XX(23); ppo(12)<=XX(26); ppo(13)<=XX(5); ppo(14)<=XX(18); ppo(15)<=XX(31); ppo(16)<=XX(10); ppo(17)<=XX(2); ppo(18)<=XX(8); ppo(19)<=XX(24); ppo(20)<=XX(14); ppo(21)<=XX(32); ppo(22)<=XX(27); ppo(23)<=XX(3); ppo(24)<=XX(9); ppo(25)<=XX(19); ppo(26)<=XX(13); ppo(27)<=XX(30); ppo(28)<=XX(6); ppo(29)<=XX(22); ppo(30)<=XX(11); ppo(31)<=XX(4); ppo(32)<=XX(25); end;
mit
fffd460ab71b3f503a44750a9084517d
0.584746
1.954451
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/startBtn/example_design/startBtn_exdes.vhd
1
4,336
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7.1 Core - Top-level core wrapper -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006-2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: startBtn_exdes.vhd -- -- Description: -- This is the actual BMG core wrapper. -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: August 31, 2005 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY UNISIM; USE UNISIM.VCOMPONENTS.ALL; -------------------------------------------------------------------------------- -- Entity Declaration -------------------------------------------------------------------------------- ENTITY startBtn_exdes IS PORT ( --Inputs - Port A ADDRA : IN STD_LOGIC_VECTOR(13 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END startBtn_exdes; ARCHITECTURE xilinx OF startBtn_exdes IS COMPONENT BUFG IS PORT ( I : IN STD_ULOGIC; O : OUT STD_ULOGIC ); END COMPONENT; COMPONENT startBtn IS PORT ( --Port A ADDRA : IN STD_LOGIC_VECTOR(13 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; SIGNAL CLKA_buf : STD_LOGIC; SIGNAL CLKB_buf : STD_LOGIC; SIGNAL S_ACLK_buf : STD_LOGIC; BEGIN bufg_A : BUFG PORT MAP ( I => CLKA, O => CLKA_buf ); bmg0 : startBtn PORT MAP ( --Port A ADDRA => ADDRA, DOUTA => DOUTA, CLKA => CLKA_buf ); END xilinx;
mit
3d08651a01ea0a1bb757770b0cb6e622
0.575646
4.823137
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/ddr/ahb2avl_async_be.vhd
1
10,392
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahb2avl_async_be -- File: ahb2avl_async_be.vhd -- Author: Magnus Hjorth - Aeroflex Gaisler -- Description: Avalon clock domain part of ahb2avl_async -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.stdlib.all; library gaisler; use gaisler.ddrpkg.all; use gaisler.ddrintpkg.all; entity ahb2avl_async_be is generic ( avldbits : integer := 32; avlabits : integer := 20; burstlen : integer := 8; nosync : integer := 0 ); port ( rst : in std_ulogic; clk : in std_ulogic; avlsi : out ddravl_slv_in_type; avlso : in ddravl_slv_out_type; request: in ddr_request_type; start_tog: in std_ulogic; response: out ddr_response_type; wbraddr : out std_logic_vector(log2((32*burstlen)/avldbits) downto 0); wbrdata : in std_logic_vector(avldbits-1 downto 0); rbwaddr : out std_logic_vector(log2((32*burstlen)/avldbits)-1 downto 0); rbwdata : out std_logic_vector(avldbits-1 downto 0); rbwrite : out std_logic ); end; architecture rtl of ahb2avl_async_be is constant avlbl: integer := (burstlen*32) / avldbits; constant onev: std_logic_vector(15 downto 0) := (others => '1'); type be_state is (idle,acc1,acc2,rdwait); type be_regs is record req1,req2 : ddr_request_type; start1,start2: std_ulogic; resp: ddr_response_type; s: be_state; ramaddr: std_logic_vector(log2(avlbl)-1 downto 0); beginburst: std_ulogic; wr: std_ulogic; rd: std_ulogic; reading: std_ulogic; rdata_valid_prev: std_ulogic; wmaskmode: std_ulogic; rstarted: std_ulogic; end record; signal r,nr: be_regs; begin comb: process(r,rst,request,start_tog,avlso,wbrdata) variable v: be_regs; variable vstart: std_logic; variable vreq: ddr_request_type; variable startmask,endmask,mask,mask16,mask8: std_logic_vector(avldbits/8-1 downto 0); variable ad32: std_logic_vector(3 downto 2); variable nwmaskmode: std_ulogic; variable rbw: std_ulogic; variable slvi: ddravl_slv_in_type; variable rddone: std_ulogic; variable inc_ramaddr: std_ulogic; begin v := r; slvi := ddravl_slv_in_none; slvi.burstbegin := r.beginburst; slvi.addr(avlabits-1 downto log2(avlbl)) := vreq.startaddr(avlabits-1-log2(avlbl)+log2(burstlen*4) downto log2(burstlen*4)); slvi.addr(log2(avlbl)-1 downto 0) := r.ramaddr; slvi.wdata(avldbits-1 downto 0) := wbrdata; slvi.write_req := r.wr; slvi.size := std_logic_vector(to_unsigned(avlbl, slvi.size'length)); v.req1 := request; v.req2 := r.req1; v.start1 := start_tog; v.start2 := r.start1; vstart:=r.start2; vreq:=r.req2; if nosync /= 0 then vstart:=start_tog; vreq:=r.req1; end if; startmask := (others => '1'); endmask := (others => '1'); mask16 := (others => '1'); mask8 := (others => '1'); case avldbits is when 32 => if vreq.startaddr(1)='0' then mask16:="1100"; else mask16:="0011"; end if; if vreq.startaddr(0)='0' then mask8:="1010"; else mask8:="0101"; end if; when 64 => if vreq.startaddr(2)='0' then startmask:="11111111"; else startmask:="00001111"; end if; if vreq.endaddr(2)='0' then endmask:="11110000"; else endmask:="11111111"; end if; if vreq.startaddr(1)='0' then mask16:="11001100"; else mask16:="00110011"; end if; if vreq.startaddr(0)='0' then mask8:="10101010"; else mask8:="01010101"; end if; when 128 => ad32 := vreq.startaddr(3 downto 2); case ad32 is when "00" => startmask:="1111111111111111"; when "01" => startmask:="0000111111111111"; when "10" => startmask:="0000000011111111"; when others => startmask:="0000000000001111"; end case; ad32 := vreq.endaddr(3 downto 2); case ad32 is when "00" => endmask:="1111000000000000"; when "01" => endmask:="1111111100000000"; when "10" => endmask:="1111111111110000"; when others => endmask:="1111111111111111"; end case; if vreq.startaddr(1)='0' then mask16:="1100110011001100"; else mask16:="0011001100110011"; end if; if vreq.startaddr(0)='0' then mask8:="1010101010101010"; else mask8:="0101010101010101"; end if; when 256 => case vreq.startaddr(4 downto 2) is when "000" => startmask:="11111111111111111111111111111111"; when "001" => startmask:="00001111111111111111111111111111"; when "010" => startmask:="00000000111111111111111111111111"; when "011" => startmask:="00000000000011111111111111111111"; when "100" => startmask:="00000000000000001111111111111111"; when "101" => startmask:="00000000000000000000111111111111"; when "110" => startmask:="00000000000000000000000011111111"; when others => startmask:="00000000000000000000000000001111"; end case; case vreq.endaddr(4 downto 2) is when "000" => endmask:="11110000000000000000000000000000"; when "001" => endmask:="11111111000000000000000000000000"; when "010" => endmask:="11111111111100000000000000000000"; when "011" => endmask:="11111111111111110000000000000000"; when "100" => endmask:="11111111111111111111000000000000"; when "101" => endmask:="11111111111111111111111100000000"; when "110" => endmask:="11111111111111111111111111110000"; when others => endmask:="11111111111111111111111111111111"; end case; if vreq.startaddr(1)='0' then mask16:="11001100110011001100110011001100"; else mask16:="00110011001100110011001100110011"; end if; if vreq.startaddr(0)='0' then mask8:="10101010101010101010101010101010"; else mask8:="01010101010101010101010101010101"; end if; when others => --pragma translate_off assert false report "Unsupported data bus width" severity failure; --pragma translate_on end case; mask := (others => r.wmaskmode); nwmaskmode := r.wmaskmode; if r.wmaskmode='0' then if r.ramaddr=vreq.startaddr(log2(burstlen*4)-1 downto log2(avldbits/8)) then mask := startmask; nwmaskmode:='1'; if r.reading='1' then v.rstarted := '1'; end if; end if; end if; if r.ramaddr=vreq.endaddr(log2(burstlen*4)-1 downto log2(avldbits/8)) then mask := mask and endmask; nwmaskmode:='0'; end if; if vreq.hsize(2 downto 1)="00" then mask := mask and mask16; if vreq.hsize(0)='0' then mask := mask and mask8; end if; end if; rddone := '0'; inc_ramaddr := '0'; rbw := '0'; if r.reading /= '0' then if avlso.rdata_valid='1' then rbw := '1'; inc_ramaddr := '1'; if v.rstarted='1' then v.resp.rctr_gray(log2(avlbl)-1 downto 0) := nextgray(r.resp.rctr_gray(log2(avlbl)-1 downto 0)); end if; if r.ramaddr=(r.ramaddr'range => '1') then rddone:='1'; end if; end if; else v.resp.rctr_gray := (others => '0'); end if; v.beginburst := '0'; case r.s is when idle => if vstart /= r.resp.done_tog then v.s := acc1; v.beginburst := '1'; end if; v.reading := '0'; v.rstarted := '0'; v.wmaskmode := '0'; v.rd := '0'; v.wr := '0'; when acc1 => v.wr := vreq.hwrite; v.rd := not vreq.hwrite; v.reading := not vreq.hwrite; if vreq.hwrite='1' then slvi.write_req := '1'; end if; if vreq.hwrite/='0' then v.s := acc2; end if; if vreq.hwrite='0' and avlso.ready='1' then v.s := rdwait; end if; if vreq.hwrite = '0' then mask := (others => '1'); end if; if avlso.ready='1' and vreq.hwrite/='0' then inc_ramaddr := '1'; end if; when acc2 => if avlso.ready='1' then inc_ramaddr := '1'; if r.ramaddr=onev(r.ramaddr'length-1 downto 0) then v.wr := '0'; v.resp.done_tog := not r.resp.done_tog; v.s := idle; end if; end if; when rdwait => v.rd := '0'; if rddone='1' then v.resp.done_tog := not r.resp.done_tog; v.s := idle; end if; end case; if inc_ramaddr/='0' then v.ramaddr := std_logic_vector(unsigned(r.ramaddr)+1); v.wmaskmode := nwmaskmode; end if; if v.s=idle then v.ramaddr := (others => '0'); end if; slvi.read_req := v.rd; slvi.be(avldbits/8-1 downto 0) := mask; if rst='0' then v.s := idle; v.resp := ddr_response_none; end if; nr <= v; response <= r.resp; wbraddr <= r.resp.done_tog & v.ramaddr; rbwaddr <= r.ramaddr; rbwdata <= avlso.rdata(avldbits-1 downto 0); rbwrite <= rbw; avlsi <= slvi; end process; regs: process(clk) begin if rising_edge(clk) then r <= nr; end if; end process; end;
gpl-2.0
5867946da7975208123dc272225d3e0b
0.582275
3.767948
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/eth/core/eth_edcl_ahb_mst.vhd
1
4,674
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: eth_edcl_ahb_mst -- File: eth_edcl_ahb_mst.vhd -- Author: Marko Isomaki - Gaisler Research -- Description: Ethernet EDCL MAC AHB master interface ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; library eth; use eth.grethpkg.all; entity eth_edcl_ahb_mst is port( rst : in std_ulogic; clk : in std_ulogic; ahbmi : in ahbc_mst_in_type; ahbmo : out ahbc_mst_out_type; tmsti : in eth_tx_ahb_in_type; tmsto : out eth_tx_ahb_out_type ); attribute sync_set_reset of rst : signal is "true"; end entity; architecture rtl of eth_edcl_ahb_mst is type reg_type is record bg : std_ulogic; --bus granted ba : std_ulogic; --bus active bb : std_ulogic; --1kB burst boundary detected retry : std_ulogic; end record; signal r, rin : reg_type; begin comb : process(rst, r, tmsti, ahbmi) is variable v : reg_type; variable htrans : std_logic_vector(1 downto 0); variable hbusreq : std_ulogic; variable hwrite : std_ulogic; variable haddr : std_logic_vector(31 downto 0); variable hwdata : std_logic_vector(31 downto 0); variable tretry : std_ulogic; variable tready : std_ulogic; variable terror : std_ulogic; variable tgrant : std_ulogic; variable hsize : std_logic_vector(2 downto 0); begin v := r; htrans := HTRANS_IDLE; tready := '0'; tretry := '0'; terror := '0'; tgrant := '0'; hsize := HSIZE_WORD; hwdata := tmsti.data; hbusreq := tmsti.req; if hbusreq = '1' then htrans := HTRANS_NONSEQ; end if; haddr := tmsti.addr; hwrite := tmsti.write; if (tmsti.req and r.ba and not r.retry) = '1' then htrans := HTRANS_SEQ; end if; if (tmsti.req and r.bg and ahbmi.hready and not r.retry) = '1' then tgrant := '1'; end if; --1 kB burst boundary if ahbmi.hready = '1' then if haddr(9 downto 2) = "11111111" then v.bb := '1'; else v.bb := '0'; end if; end if; if (r.bb = '1') and (htrans /= HTRANS_IDLE) then htrans := HTRANS_NONSEQ; end if; if r.ba = '1' then if ahbmi.hready = '1' then case ahbmi.hresp is when HRESP_OKAY => tready := '1'; when HRESP_SPLIT | HRESP_RETRY => tretry := '1'; when HRESP_ERROR => terror := '1'; when others => null; end case; end if; end if; if (r.ba = '1') and ((ahbmi.hresp = HRESP_RETRY) or (ahbmi.hresp = HRESP_SPLIT)) then v.retry := not ahbmi.hready; else v.retry := '0'; end if; if r.retry = '1' then htrans := HTRANS_IDLE; end if; if ahbmi.hready = '1' then v.bg := ahbmi.hgrant; if (htrans = HTRANS_NONSEQ) or (htrans = HTRANS_SEQ) then v.ba := r.bg; else v.ba := '0'; end if; end if; if rst = '0' then v.bg := '0'; v.ba := '0'; v.bb := '0'; end if; rin <= v; tmsto.data <= ahbmi.hrdata; tmsto.error <= terror; tmsto.retry <= tretry; tmsto.ready <= tready; tmsto.grant <= tgrant; ahbmo.htrans <= htrans; ahbmo.hsize <= hsize; ahbmo.hbusreq <= hbusreq; ahbmo.haddr <= haddr; ahbmo.hwrite <= hwrite; ahbmo.hwdata <= hwdata; end process; regs : process(clk) begin if rising_edge(clk) then r <= rin; end if; end process; ahbmo.hlock <= '0'; ahbmo.hburst <= HBURST_INCR; ahbmo.hprot <= "0011"; end architecture;
gpl-2.0
7d2f41a226b8ef1c3d579ad76b60c75c
0.567394
3.634526
false
false
false
false
hhanff/software
vhdl/funcs.vhd
1
55,806
----------------------------------------------------------------------- -- Package that declares some special functions needed for RTL netlisting ----------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; package FUNCS is --- RTL netlister functions function mux_s (inputs : std_logic_vector; sel : unsigned) return std_logic; function mux_v (inputs : unsigned; sel : std_logic) return unsigned; function mux_v (inputs : unsigned; sel : unsigned) return unsigned; function mux_v (inputs : signed; sel : signed) return signed; function mux1hot_s (inputs : unsigned; sel : unsigned) return std_logic; function mux1hot_v (inputs : unsigned; sel : unsigned) return unsigned; function mux1hot_v (inputs : signed; sel : signed) return signed; type integers is array (positive range <>) of integer; function muxv_s (inputs : unsigned; choices_nb : integers; choices : unsigned; sel : unsigned) return std_logic; function muxv_v (inputs : unsigned; choices_nb : integers; choices : unsigned; sel : unsigned) return unsigned; function lat_s (input : std_logic; clk : std_logic; output : std_logic) return std_logic; function lat_v (input : unsigned; clk : std_logic; output: unsigned) return unsigned; function tri_s (input : std_logic; control : std_logic) return std_logic; function tri_v (input : unsigned; control : std_logic) return unsigned; FUNCTION to_stdlogic ( arg1 : BOOLEAN ) RETURN STD_LOGIC; FUNCTION maximum ( arg1, arg2 : INTEGER) RETURN INTEGER; FUNCTION minimum ( arg1, arg2 : INTEGER) RETURN INTEGER; FUNCTION "xor" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "xor" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION "not" ( arg1 : SIGNED ) RETURN SIGNED; FUNCTION "not" ( arg1 : UNSIGNED ) RETURN UNSIGNED; FUNCTION "and" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "and" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION "nand" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "nand" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION "or" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "or" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION "nor" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "nor" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION "xnor" (arg1, arg2:SIGNED) RETURN SIGNED; FUNCTION "xnor" (arg1, arg2:UNSIGNED) RETURN UNSIGNED; FUNCTION nand_reduce(arg : UNSIGNED) RETURN STD_LOGIC; FUNCTION nand_reduce(arg : SIGNED) RETURN STD_LOGIC; FUNCTION eq ( l, r : UNSIGNED ) RETURN BOOLEAN ; --attribute builtin_subprogram of "="[UNSIGNED, UNSIGNED return BOOLEAN]: function is "stdarith_eq_uu"; FUNCTION eq ( l, r : SIGNED ) RETURN BOOLEAN ; --attribute builtin_subprogram of "="[SIGNED, SIGNED return BOOLEAN]: function is "stdarith_eq_ss"; -- Vectorized Overloaded Arithmetic Operators FUNCTION "+" ( arg1, arg2 : STD_LOGIC ) RETURN STD_LOGIC; FUNCTION "-" ( arg1, arg2 : STD_LOGIC ) RETURN STD_LOGIC; FUNCTION "/" ( l, r : UNSIGNED ) RETURN UNSIGNED; FUNCTION "/" ( l, r : SIGNED ) RETURN SIGNED; FUNCTION "MOD" ( l, r : SIGNED ) RETURN SIGNED; FUNCTION "MOD" ( l, r : UNSIGNED ) RETURN UNSIGNED; FUNCTION "REM" ( l, r : SIGNED ) RETURN SIGNED; FUNCTION "REM" ( l, r : UNSIGNED ) RETURN UNSIGNED; FUNCTION "**" ( l, r : SIGNED ) RETURN SIGNED; FUNCTION "**" ( l, r : UNSIGNED ) RETURN UNSIGNED; FUNCTION "sla" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "sla" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; FUNCTION "sra" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "sra" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; FUNCTION "sll" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "sll" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; FUNCTION "srl" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "srl" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; FUNCTION "rol" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "rol" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; FUNCTION "ror" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED ; FUNCTION "ror" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED ; -- -- In general, objects in this package are required to be functions. -- For synthesizability reasons, we want the "flipflop" functions to be -- procedures. There is a special kludge in the rtl netlister to let -- this work. -- procedure flipflop (signal input : in std_logic; signal clk : in std_logic; signal output : out std_logic); procedure flipflop (signal input : in unsigned; signal clk : in std_logic; signal output : out unsigned); procedure flipflop (signal input : in std_logic; signal clk : in std_logic; signal output : out std_logic; signal rst : in std_logic; signal value : in std_logic); procedure flipflop (signal input : in unsigned; signal clk : in std_logic; signal output : out unsigned; signal rst : in std_logic; signal value : in unsigned); -- -- This is used in the special case when we need to pick a vector that -- has been changed into a constant. This is because the VHDL language -- doesn't allow one to say "bits"[index] -- function readindex (input : unsigned; index : natural) return std_logic; -- -- The following procedures insert n consecutive wait until edge -- statements into the process. 'phase' gives the active edge ie it -- should be either '1' or '0' -- procedure wait_clock_cycles (constant n : natural; signal clk : in std_logic; constant phase : in std_logic); procedure wait_clock_cycles (constant n : natural; signal clk : in bit; constant phase : in bit); -- Declare Exemplar Synthesis Directive attributes attribute SYNTHESIS_RETURN : STRING ; attribute IS_SIGNED : BOOLEAN ; end FUNCS; package body FUNCS is function mux_s (inputs : std_logic_vector; sel : unsigned) return std_logic is variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "mux"; begin result := inputs ( conv_integer ( '0'&sel )); return result; end; function mux_v (inputs : unsigned; sel : std_logic) return unsigned is constant nb_inputs : positive := 2; constant size : positive := inputs'length/nb_inputs; variable value : integer; variable ins : unsigned(0 to inputs'length-1) := inputs; variable result : unsigned(0 to size-1); variable left, right : integer; attribute SYNTHESIS_RETURN of result:variable is "mux"; begin if (sel = '1') then value := 1; else value := 0; end if; left := value*size; right := (value + 1)*size -1; for i in left to right loop result(i-left) := ins(i); end loop; --result := ins (value*size to (value+1)*size-1); return result; end; function mux_v (inputs : unsigned; sel : unsigned) return unsigned is variable value : natural := conv_integer (unsigned(sel)); constant nb_inputs : positive := 2 ** sel'length; constant size : positive := inputs'length/nb_inputs; variable ins : unsigned(0 to inputs'length-1) := inputs; variable result : unsigned(0 to size-1); variable left, right : natural; attribute SYNTHESIS_RETURN of result:variable is "mux"; begin left := value*size; right := (value + 1)*size -1; for i in left to right loop result(i-left) := ins(i); end loop; --result := ins (value*size to (value+1)*size-1); return result; end; function mux_v (inputs : signed; sel : signed) return signed is variable value : natural := conv_integer (unsigned(sel)); constant nb_inputs : positive := 2 ** sel'length; constant size : positive := inputs'length/nb_inputs; variable ins : signed(0 to inputs'length-1) := inputs; variable result : signed(0 to size-1); variable left, right : natural; attribute SYNTHESIS_RETURN of result:variable is "mux"; begin left := value*size; right := (value + 1)*size -1; for i in left to right loop result(i-left) := ins(i); end loop; --result := ins (value*size to (value+1)*size-1); return result; end; function mux1hot_s (inputs : unsigned; sel : unsigned) return std_logic is variable ins : unsigned(0 to inputs'length-1) := inputs; variable s : unsigned(0 to sel'length-1) := sel; variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "mux1hot"; begin for i in s'range loop if s(i) = '1' then result := ins (i); return result; end if; end loop; return '0'; end; function mux1hot_v (inputs : unsigned; sel : unsigned) return unsigned is constant size : positive := inputs'length/sel'length; variable ins : unsigned(0 to inputs'length-1) := inputs; variable s : unsigned(0 to sel'length-1) := sel; variable result : unsigned(0 to size-1); variable left, right : integer; attribute SYNTHESIS_RETURN of result:variable is "mux1hot"; begin for i in s'range loop if (s(i) = '1') then left := i*size; right := (i+1)*size-1; for j in left to right loop result(j-left) := ins(j); end loop; --result := ins (i*size to (i+1)*size-1); return result; end if; end loop; result := (others=>'0'); return result; end; function mux1hot_v (inputs : signed; sel : signed) return signed is constant size : positive := inputs'length/sel'length; variable ins : signed(0 to inputs'length-1) := inputs; variable s : signed(0 to sel'length-1) := sel; variable result : signed(0 to size-1); variable left, right : integer; attribute SYNTHESIS_RETURN of result:variable is "mux1hot"; begin for i in s'range loop if (s(i) = '1') then left := i*size; right := (i+1)*size-1; for j in left to right loop result(j-left) := ins(j); end loop; --result := ins (i*size to (i+1)*size-1); return result; end if; end loop; result := (others=>'0'); return result; end; function muxv_s (inputs : unsigned; choices_nb : integers; choices : unsigned; sel : unsigned) return std_logic is variable ins : unsigned(0 to inputs'length-1) := inputs; variable chs : unsigned(0 to choices'length-1) := choices; variable ch : unsigned(0 to sel'length-1); variable choice_index : integer := 0; variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "muxv"; begin for i in 0 to choices_nb'length-1 loop for j in 1 to choices_nb(i) loop ch := chs (choice_index*sel'length to (choice_index+1)*sel'length); if (sel = ch) then result := ins (i); return result; end if; choice_index := choice_index + 1; end loop; end loop; result := ins (choices_nb'length-1); return result; end; function muxv_v (inputs : unsigned; choices_nb : integers; choices : unsigned; sel : unsigned) return unsigned is constant size : positive := inputs'length/choices_nb'length; variable ins : unsigned(0 to inputs'length-1) := inputs; variable chs : unsigned(0 to choices'length-1) := choices; variable ch : unsigned(0 to sel'length-1); variable choice_index : integer := 0; variable result : unsigned(0 to size-1); variable left, right : integer; attribute SYNTHESIS_RETURN of result:variable is "muxv"; begin for i in 0 to choices_nb'length-1 loop for j in 1 to choices_nb(i) loop left := choice_index*sel'length; right := (choice_index+1)*sel'length; for k in left to right loop ch(k-left) := chs(k); end loop; --ch := chs (choice_index*sel'length to -- (choice_index+1)*sel'length); if (sel = ch) then left := i * size; right := (i+1)*size-1; for k in left to right loop result(k-left) := ins(k); end loop; --result := ins (i*size to (i+1)*size-1); return result; end if; choice_index := choice_index + 1; end loop; end loop; left := (choices_nb'length-1)*size; right := choices_nb'length*size-1; for j in left to right loop result(j-left) := ins(j); end loop; --result := ins ((choices_nb'length-1)*size to choices_nb'length*size-1); return result; end; function lat_s (input : std_logic; clk : std_logic; output : std_logic) return std_logic is variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "lat"; begin if (clk = '1') then result := input; return result; else result := output; return result; end if; end; function lat_v (input : unsigned; clk : std_logic; output: unsigned) return unsigned is variable result : unsigned(output'range); attribute SYNTHESIS_RETURN of result:variable is "lat"; begin if (clk = '1') then result := input; return result; else result := output; return result; end if; end; function tri_s (input : std_logic; control : std_logic) return std_logic is variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "tri"; begin if (control = '1') then result := input; return result; else result := 'Z'; return result; end if; end; function tri_v (input : unsigned; control : std_logic) return unsigned is variable result : unsigned(input'range); attribute SYNTHESIS_RETURN of result:variable is "tri"; begin if (control = '1') then result := input; return result; else result := (others => 'Z'); return result; end if; end; -- -- Arithmetic, other functions missing from ieee.std_logic_arith -- TYPE stdlogic_1d IS ARRAY (std_ulogic) OF std_ulogic; TYPE stdlogic_table IS ARRAY(std_ulogic, std_ulogic) OF std_ulogic; TYPE stdlogic_boolean_table IS ARRAY(std_ulogic, std_ulogic) OF BOOLEAN; CONSTANT eq_table : stdlogic_boolean_table := ( -- ---------------------------------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------------------------------- ( FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE ), -- | U | ( FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE ), -- | X | ( FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE ), -- | 0 | ( FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE ), -- | 1 | ( FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE ), -- | Z | ( FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE ), -- | W | ( FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE ), -- | L | ( FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE ), -- | H | ( FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE ) -- | D | ); -- truth table for "and" function CONSTANT and_table : stdlogic_table := ( -- ---------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------- ( 'U', 'U', '0', 'U', 'U', 'U', '0', 'U', 'U' ), -- | U | ( 'U', 'X', '0', 'X', 'X', 'X', '0', 'X', 'X' ), -- | X | ( '0', '0', '0', '0', '0', '0', '0', '0', '0' ), -- | 0 | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | 1 | ( 'U', 'X', '0', 'X', 'X', 'X', '0', 'X', 'X' ), -- | Z | ( 'U', 'X', '0', 'X', 'X', 'X', '0', 'X', 'X' ), -- | W | ( '0', '0', '0', '0', '0', '0', '0', '0', '0' ), -- | L | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | H | ( 'U', 'X', '0', 'X', 'X', 'X', '0', 'X', 'X' ) -- | D | ); -- truth table for "or" function CONSTANT or_table : stdlogic_table := ( -- ---------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------- ( 'U', 'U', 'U', '1', 'U', 'U', 'U', '1', 'U' ), -- | U | ( 'U', 'X', 'X', '1', 'X', 'X', 'X', '1', 'X' ), -- | X | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | 0 | ( '1', '1', '1', '1', '1', '1', '1', '1', '1' ), -- | 1 | ( 'U', 'X', 'X', '1', 'X', 'X', 'X', '1', 'X' ), -- | Z | ( 'U', 'X', 'X', '1', 'X', 'X', 'X', '1', 'X' ), -- | W | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | L | ( '1', '1', '1', '1', '1', '1', '1', '1', '1' ), -- | H | ( 'U', 'X', 'X', '1', 'X', 'X', 'X', '1', 'X' ) -- | D | ); -- truth table for "xor" function CONSTANT xor_table : stdlogic_table := ( -- ---------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | 0 | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | 1 | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | Z | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | W | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | L | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | H | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- | D | ); -- truth table for "not" function CONSTANT not_table: stdlogic_1D := -- ------------------------------------------------- -- | U X 0 1 Z W L H D | -- ------------------------------------------------- ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ); FUNCTION "+" ( arg1, arg2 : STD_LOGIC ) RETURN STD_LOGIC IS -- truth table for "xor" function CONSTANT xor_table : stdlogic_table := ( -- ---------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | 0 | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | 1 | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | Z | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | W | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | L | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | H | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- | D | ); VARIABLE result : STD_LOGIC ; -- Arithmetic addition of two logic types. Works as XOR. ATTRIBUTE synthesis_return OF result:VARIABLE IS "XOR" ; BEGIN result := xor_table( arg1, arg2 ); RETURN result ; END "+"; FUNCTION "-" ( arg1, arg2 : std_logic ) RETURN std_logic IS -- truth table for "xor" function CONSTANT xor_table : stdlogic_table := ( -- ---------------------------------------------------- -- | U X 0 1 Z W L H D | | -- ---------------------------------------------------- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | 0 | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | 1 | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | Z | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | W | ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', 'X' ), -- | L | ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' ), -- | H | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- | D | ); -- Arithmetic addition of logic types. Same as XOR. VARIABLE result : std_logic ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "XOR" ; BEGIN result := xor_table( arg1, arg2 ); RETURN result ; END "-"; FUNCTION zxt( q : UNSIGNED; i : INTEGER ) RETURN UNSIGNED IS VARIABLE qs : UNSIGNED (1 TO i); VARIABLE qt : UNSIGNED (1 TO q'length); -- Hidden function. Synthesis directives are present in its callers BEGIN qt := q; IF i < q'length THEN qs := qt( (q'length-i+1) TO qt'right); ELSIF i > q'length THEN qs := (OTHERS=>'0'); qs := qs(1 TO (i-q'length)) & qt; ELSE qs := qt; END IF; RETURN qs; END; FUNCTION eq ( l, r : STD_LOGIC ) RETURN BOOLEAN IS -- Equal for two logic types VARIABLE result : BOOLEAN ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "EQ" ; BEGIN result := eq_table( l, r ); RETURN result ; END; FUNCTION eq ( l,r : UNSIGNED ) RETURN BOOLEAN IS CONSTANT ml : INTEGER := maximum( l'length, r'length ); VARIABLE lt : UNSIGNED ( 1 TO ml ); VARIABLE rt : UNSIGNED ( 1 TO ml ); -- Arithmetic Equal for two Unsigned vectors VARIABLE result : BOOLEAN ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "EQ" ; BEGIN lt := zxt( l, ml ); rt := zxt( r, ml ); FOR i IN lt'range LOOP IF NOT eq( lt(i), rt(i) ) THEN result := FALSE ; RETURN result; END IF; END LOOP; RETURN TRUE; END; FUNCTION eq ( l,r : SIGNED ) RETURN BOOLEAN IS CONSTANT len : INTEGER := maximum( l'length, r'length ); VARIABLE lt, rt : UNSIGNED ( len-1 downto 0 ) := (OTHERS => '0'); -- Arithmetic Equal for two Signed vectors VARIABLE result : BOOLEAN ; ATTRIBUTE is_signed OF l:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF r:CONSTANT IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "EQ" ; BEGIN assert l'length > 1 AND r'length > 1 report "SIGNED vector must be atleast 2 bits wide" severity ERROR; lt := (OTHERS => l(l'left)) ; lt(l'length - 1 DOWNTO 0) := UNSIGNED(l); rt := (OTHERS => r(r'left)) ; rt(r'length - 1 DOWNTO 0) := UNSIGNED(r); result := (eq( lt, rt )); RETURN result ; END; FUNCTION "not" ( arg1 : SIGNED ) RETURN SIGNED IS VARIABLE result : SIGNED ( arg1'RANGE ) := (Others => 'X'); -- Vector-wide NOT -- Synthesizable as is. ATTRIBUTE synthesis_return OF result:VARIABLE IS "NOT" ; begin for i in result'range loop result(i) := not_table( arg1(i) ); end loop; return result; end "not"; FUNCTION "not" ( arg1 : UNSIGNED ) RETURN UNSIGNED IS VARIABLE result : UNSIGNED ( arg1'RANGE ) := (Others => 'X'); -- Vector-wide NOT -- Synthesizable as is. ATTRIBUTE synthesis_return OF result:VARIABLE IS "NOT" ; begin for i in result'range loop result(i) := not_table( arg1(i) ); end loop; return result; end "not"; FUNCTION "and" ( arg1,arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide AND with zero-extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "AND" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := and_table( lt(i), rt(i) ); END LOOP; RETURN res; end "and"; FUNCTION "nand" ( arg1,arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide NAND with zero-extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "NAND" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := not_table( and_table( lt(i), rt(i) ) ); END LOOP; RETURN res; end "nand"; FUNCTION "or" ( arg1,arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide OR with zero-extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "OR" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := or_table( lt(i), rt(i) ); END LOOP; RETURN res; end "or"; FUNCTION "nor" ( arg1,arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide NOR with zero-extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "NOR" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := not_table( or_table( lt(i), rt(i) ) ); END LOOP; RETURN res; end "nor"; FUNCTION "and" ( arg1,arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide AND with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "AND" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a and b); RETURN (answer); end "and"; FUNCTION "nand" ( arg1,arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide NAND with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "NAND" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a nand b); RETURN (answer); end "nand"; FUNCTION "or" ( arg1,arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide OR with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "OR" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a or b); RETURN (answer); end "or"; FUNCTION "nor" ( arg1,arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide NOR with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "NOR" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a nor b); RETURN (answer); end "nor"; FUNCTION "xnor" ( arg1, arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide XNOR with zero extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "XNOR" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := not_table( xor_table( lt(i), rt(i) ) ); END LOOP; RETURN res; end "xnor"; FUNCTION "xnor" ( arg1, arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide XNOR with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "XNOR" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a xnor b); RETURN (answer); end "xnor"; FUNCTION and_reduce(arg: SIGNED) RETURN STD_LOGIC IS VARIABLE result: STD_LOGIC; -- Exemplar synthesis directive attributes for this function ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_AND" ; BEGIN result := '1'; FOR i IN arg'RANGE LOOP result := result AND arg(i); END LOOP; RETURN result; END; FUNCTION nand_reduce(arg: SIGNED) RETURN STD_LOGIC IS VARIABLE result: STD_LOGIC; ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_NAND" ; BEGIN result := NOT and_reduce(arg); RETURN result; END; FUNCTION and_reduce(arg: UNSIGNED) RETURN STD_LOGIC IS VARIABLE result: STD_LOGIC; -- Exemplar synthesis directive attributes for this function ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_AND" ; BEGIN result := '1'; FOR i IN arg'RANGE LOOP result := result AND arg(i); END LOOP; RETURN result; END; FUNCTION nand_reduce(arg: UNSIGNED) RETURN STD_LOGIC IS VARIABLE result: STD_LOGIC; ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_NAND" ; BEGIN result := NOT and_reduce(arg); RETURN result; END; FUNCTION hasx( v : SIGNED ) RETURN BOOLEAN IS -- Synthesizable as is. Normal synthesis rules apply for -- comparison of metalogical values. BEGIN FOR i IN v'range LOOP IF v(i) = '0' OR v(i) = '1' OR v(i) = 'L' OR v(i) = 'H'THEN NULL; ELSE RETURN TRUE; END IF; END LOOP; RETURN FALSE; END hasx; FUNCTION hasx( v : UNSIGNED ) RETURN BOOLEAN IS -- Synthesizable as is. Normal synthesis rules apply for -- comparison of metalogical values. BEGIN FOR i IN v'range LOOP IF v(i) = '0' OR v(i) = '1' OR v(i) = 'L' OR v(i) = 'H'THEN NULL; ELSE RETURN TRUE; END IF; END LOOP; RETURN FALSE; END hasx; FUNCTION sxt( q : SIGNED; i : INTEGER ) RETURN SIGNED IS VARIABLE qs : SIGNED (1 TO i); VARIABLE qt : SIGNED (1 TO q'length); -- Hidden function for synthesis; Directives set for its callers BEGIN qt := q; IF i < q'length THEN qs := qt( (q'length-i+1) TO qt'right); ELSIF i > q'length THEN qs := (OTHERS=>q(q'left)); qs := qs(1 TO (i-q'length)) & qt; ELSE qs := qt; END IF; RETURN qs; END; FUNCTION "abs" (arg1:SIGNED) RETURN SIGNED IS constant len : integer := arg1'length; VARIABLE answer, tmp : SIGNED( len-1 downto 0 ) := (others=>'0'); VARIABLE index : integer := len; -- Absolute value of Signed vector ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; -- Return a UNsigned vector that is abs of the input vector ATTRIBUTE synthesis_return OF answer:VARIABLE IS "ABS" ; BEGIN assert arg1'length > 1 report "SIGNED vector must be atleast 2 bits wide" severity ERROR; IF hasx(arg1) THEN answer := (OTHERS => 'X'); ELSIF (arg1(arg1'left) = '0' OR arg1(arg1'left) = 'L') THEN answer := arg1; ELSE tmp := arg1; lp1 : FOR i IN answer'REVERSE_RANGE LOOP IF (tmp(i) = '1' OR tmp(i) = 'H') THEN index := i+1; answer(i downto 0) := tmp(i downto 0); exit; END IF; END LOOP lp1; answer(len-1 downto index) := NOT tmp(len-1 downto index); end if; RETURN (answer); END ; FUNCTION to_stdlogic (arg1:BOOLEAN) RETURN STD_LOGIC IS -- Synthesizable as is. BEGIN IF(arg1) THEN RETURN('1') ; ELSE RETURN('0') ; END IF ; END ; FUNCTION maximum (arg1,arg2:INTEGER) RETURN INTEGER IS BEGIN IF(arg1 > arg2) THEN RETURN(arg1) ; ELSE RETURN(arg2) ; END IF; END ; FUNCTION minimum (arg1,arg2:INTEGER) RETURN INTEGER IS BEGIN IF(arg1 < arg2) THEN RETURN(arg1) ; ELSE RETURN(arg2) ; END IF; END ; FUNCTION "xor" ( arg1, arg2 : UNSIGNED ) RETURN UNSIGNED IS CONSTANT ml : integer := maximum( arg1'LENGTH, arg2'LENGTH ); VARIABLE lt : UNSIGNED ( 1 to ml ); VARIABLE rt : UNSIGNED ( 1 to ml ); VARIABLE res : UNSIGNED ( 1 to ml ); -- Vector-wide XOR with zero-extend ATTRIBUTE synthesis_return OF res:VARIABLE IS "XOR" ; begin lt := zxt( arg1, ml ); rt := zxt( arg2, ml ); FOR i IN res'RANGE LOOP res(i) := xor_table( lt(i), rt(i) ); END LOOP; RETURN res; end "xor"; FUNCTION "xor" ( arg1, arg2 : SIGNED ) RETURN SIGNED IS CONSTANT len : INTEGER := maximum(arg1'length,arg2'length) ; VARIABLE a,b : UNSIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; VARIABLE answer : SIGNED(len-1 DOWNTO 0) := (OTHERS => '0') ; -- Vector-wide XOR with sign extend ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF arg2:CONSTANT IS TRUE ; ATTRIBUTE is_signed OF answer:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF answer:VARIABLE IS "XOR" ; BEGIN a := (OTHERS => arg1(arg1'left)) ; a(arg1'length - 1 DOWNTO 0) := UNSIGNED(arg1); b := (OTHERS => arg2(arg2'left)) ; b(arg2'length - 1 DOWNTO 0) := UNSIGNED(arg2); answer := SIGNED(a xor b); RETURN (answer); end "xor"; FUNCTION shift( v : SIGNED ) RETURN SIGNED IS VARIABLE v1 : SIGNED( v'range ); -- Hidden function. Synthesis directives set for its callers. BEGIN FOR i IN (v'left+1) TO v'right LOOP v1(i-1) := v(i); END LOOP; v1(v1'right) := '0'; RETURN v1; END shift; FUNCTION shift( v : UNSIGNED ) RETURN UNSIGNED IS VARIABLE v1 : UNSIGNED( v'range ); -- Hidden function. Synthesis directives set for its callers. BEGIN FOR i IN (v'left+1) TO v'right LOOP v1(i-1) := v(i); END LOOP; v1(v1'right) := '0'; RETURN v1; END shift; FUNCTION rshift( v : UNSIGNED ) RETURN UNSIGNED IS VARIABLE v1 : UNSIGNED( v'range ); -- Hidden function for synthesis; Directives set for its callers BEGIN FOR i IN v'left TO v'right-1 LOOP v1(i+1) := v(i); END LOOP; v1(v1'left) := '0'; RETURN v1; END rshift; FUNCTION rshift( v : SIGNED ) RETURN SIGNED IS VARIABLE v1 : SIGNED( v'range ); -- Hidden function for synthesis; Directives set for its callers BEGIN FOR i IN v'left TO v'right-1 LOOP v1(i+1) := v(i); END LOOP; v1(v1'left) := '0'; RETURN v1; END rshift; FUNCTION "/" (l, r :UNSIGNED) RETURN UNSIGNED IS CONSTANT ml : INTEGER := maximum(l'length,r'length); VARIABLE lt : UNSIGNED(0 TO ml+1); VARIABLE rt : UNSIGNED(0 TO ml+1); VARIABLE quote : UNSIGNED(1 TO ml) := (OTHERS=>'X'); VARIABLE tmp : UNSIGNED(0 TO ml+1) := (OTHERS=>'0'); VARIABLE n : UNSIGNED(0 TO ml+1) := (OTHERS=>'0'); -- Division of Unsigned vectors. ATTRIBUTE synthesis_return OF quote:VARIABLE IS "DIV" ; BEGIN if (eq(r,"0")) then ASSERT false REPORT "Attempted divide by ZERO" SEVERITY ERROR; ELSIF NOT (hasx(l) OR hasx(r)) THEN lt := zxt( l, ml+2 ); WHILE lt >= r LOOP rt := zxt( r, ml+2 ); n := (OTHERS=>'0'); n(n'right) := '1'; WHILE rt <= lt LOOP rt := shift(rt); n := shift(n); END LOOP; rt := rshift(rt); lt := lt - rt; n := rshift(n); tmp := tmp + n; END LOOP; quote := tmp(2 TO ml+1); END IF; RETURN quote; END "/"; FUNCTION "MOD" (l, r :UNSIGNED) RETURN UNSIGNED IS CONSTANT ml : INTEGER := maximum(l'length,r'length); VARIABLE lt : UNSIGNED(0 TO ml+1); VARIABLE rt : UNSIGNED(0 TO ml+1); -- Modulo with unsigned vectors VARIABLE result : UNSIGNED(2 to ml+1) := (OTHERS=>'X'); ATTRIBUTE synthesis_return OF result:VARIABLE IS "MOD" ; BEGIN if (eq(r,"00")) then ASSERT false REPORT "Attempted divide by ZERO" SEVERITY ERROR; ELSIF NOT (hasx(l) OR hasx(r)) THEN lt := zxt( l, ml+2 ); WHILE lt >= r LOOP rt := zxt( r, ml+2 ); WHILE rt <= lt LOOP rt := shift(rt); END LOOP; rt := rshift(rt); lt := lt - rt; END LOOP; result := lt(2 TO ml+1); END IF; RETURN result ; END "MOD"; FUNCTION "REM" (l, r :UNSIGNED) RETURN UNSIGNED IS CONSTANT ml : INTEGER := maximum(l'length,r'length); VARIABLE lt : UNSIGNED(0 TO ml+1); VARIABLE rt : UNSIGNED(0 TO ml+1); -- Remainder with unsigned vectors VARIABLE result : UNSIGNED(2 to ml+1) := (OTHERS=>'X'); ATTRIBUTE synthesis_return OF result:VARIABLE IS "REM" ; BEGIN if (eq(r,"0")) then ASSERT false REPORT "Attempted divide by ZERO" SEVERITY ERROR; ELSIF NOT (hasx(l) OR hasx(r)) THEN lt := zxt( l, ml+2 ); WHILE lt >= r LOOP rt := zxt( r, ml+2 ); WHILE rt <= lt LOOP rt := shift(rt); END LOOP; rt := rshift(rt); lt := lt - rt; END LOOP; result := lt(2 TO ml+1); END IF; RETURN result ; END "REM"; FUNCTION "**" (l, r :UNSIGNED) RETURN UNSIGNED IS VARIABLE return_vector : UNSIGNED(l'range) := (OTHERS=>'0'); VARIABLE tmp : UNSIGNED(1 TO (2 * l'length)) := (OTHERS=>'0'); CONSTANT lsh_l : INTEGER := l'length+1; CONSTANT lsh_r : INTEGER := 2 * l'length; VARIABLE pow : INTEGER; -- Power with unsigned vectors ATTRIBUTE synthesis_return OF return_vector:VARIABLE IS "POWER" ; BEGIN IF (hasx(l) OR hasx(r)) THEN FOR i IN return_vector'range LOOP return_vector(i) := 'X'; END LOOP; ELSE pow := conv_integer(r); tmp( tmp'right ) := '1'; FOR i IN 1 TO pow LOOP tmp := tmp(lsh_l TO lsh_r) * l; END LOOP; return_vector := tmp(lsh_l TO lsh_r); END IF; RETURN return_vector; END "**"; FUNCTION "**" (l, r :SIGNED) RETURN SIGNED IS VARIABLE return_vector : SIGNED(l'range) := (OTHERS=>'0'); VARIABLE tmp : SIGNED(1 TO (2 * l'length)) := (OTHERS=>'0'); CONSTANT lsh_l : INTEGER := l'length+1; CONSTANT lsh_r : INTEGER := 2 * l'length; VARIABLE pow : INTEGER; -- Power with signed vectors ATTRIBUTE is_signed OF l:CONSTANT IS TRUE; ATTRIBUTE is_signed OF r:CONSTANT IS TRUE; -- Return a signed vector that is power of the input vectors ATTRIBUTE is_signed OF return_vector:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF return_vector:VARIABLE IS "POWER" ; BEGIN IF (hasx(l) OR hasx(r)) THEN FOR i IN return_vector'range LOOP return_vector(i) := 'X'; END LOOP; ELSE pow := conv_integer(r); tmp( tmp'right ) := '1'; FOR i IN 1 TO pow LOOP tmp := tmp(lsh_l TO lsh_r) * l; END LOOP; return_vector := tmp(lsh_l TO lsh_r); END IF; RETURN return_vector; END "**"; -- -- Shift Left (arithmetic) Functions -- FUNCTION "sla" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : UNSIGNED(1 to len) := (others => arg1(arg1'right)); VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 SLA VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SLA" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := se; ELSIF (arg2 = 0) THEN result := arg1; ELSE result := ans(arg2+1 to len) & se(1 to arg2); END IF; RETURN result ; END ; FUNCTION "sla" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : SIGNED(1 to len) := (others => arg1(arg1'right)); VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 SLA VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SLA" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := se; ELSIF (arg2 = 0) THEN result := arg1; ELSE result := ans(arg2+1 to len) & se(1 to arg2); END IF; RETURN result ; END ; -- -- Shift Right (arithmetics) Functions -- FUNCTION "sra" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : UNSIGNED(1 to len) := (others => arg1(arg1'left)); VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 SRA VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SRA" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (se(1 to arg2) & ans(1 to len-arg2)); END IF; RETURN result ; END ; FUNCTION "sra" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : SIGNED(1 to len) := (others => arg1(arg1'left)); VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 SRA VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SRA" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (se(1 to arg2) & ans(1 to len-arg2)); END IF; RETURN result ; END ; -- -- Shift Left (logical) Functions -- FUNCTION "sll" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : UNSIGNED(1 to len) := (others =>'0'); VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 SLL VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SLL" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (ans(arg2+1 to len) & se(1 to arg2)); END IF; RETURN result ; END ; FUNCTION "sll" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : SIGNED(1 to len) := (others =>'0'); VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 SLL VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SLL" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (ans(arg2+1 to len) & se(1 to arg2)); END IF; RETURN result ; END ; -- -- Shift Right (logical) Functions -- FUNCTION "srl" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : UNSIGNED(1 to len) := (others => '0'); VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 SRL VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SRL" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (se(1 to arg2) & ans(1 to len-arg2)); END IF; RETURN result ; END ; FUNCTION "srl" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT se : SIGNED(1 to len) := (others => '0'); VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 SRL VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "SRL" ; BEGIN IF (arg2 >= len) THEN ASSERT FALSE REPORT "shift is further than array size." SEVERITY WARNING ; result := (se); ELSIF (arg2 = 0) THEN result := (arg1); ELSE result := (se(1 to arg2) & ans(1 to len-arg2)); END IF; RETURN result ; END ; -- -- Rotate Left (Logical) Functions -- FUNCTION "rol" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT marg2 : integer := arg2 mod len; VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 ROL VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "ROL" ; BEGIN ASSERT arg2 <= len REPORT "rotate is further than array size." SEVERITY WARNING ; IF (marg2 = 0) THEN result := (arg1); ELSE result := (ans(marg2+1 to len) & ans(1 to marg2)); END IF; RETURN result ; END ; FUNCTION "rol" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT marg2 : integer := arg2 mod len; VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 ROL VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "ROL" ; BEGIN ASSERT arg2 <= len REPORT "rotate is further than array size." SEVERITY WARNING ; IF (marg2 = 0) THEN result := (arg1); ELSE result := (ans(marg2+1 to len) & ans(1 to marg2)); END IF; RETURN result ; END ; -- -- Rotate Right (Logical) Functions -- FUNCTION "ror" (arg1:UNSIGNED ; arg2:NATURAL) RETURN UNSIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT marg2 : integer := arg2 mod len; VARIABLE ans : UNSIGNED(1 to len) := arg1; -- VHDL 93 ROR VARIABLE result : UNSIGNED (1 to len) ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "ROR" ; BEGIN ASSERT arg2 <= len REPORT "rotate is further than array size." SEVERITY WARNING ; IF (marg2 = 0) THEN result := (arg1); ELSE result := (ans(len-marg2+1 to len) & ans(1 to len-marg2)); END IF; RETURN result ; END ; FUNCTION "ror" (arg1:SIGNED ; arg2:NATURAL) RETURN SIGNED IS CONSTANT len : INTEGER := arg1'length ; CONSTANT marg2 : integer := arg2 mod len; VARIABLE ans : SIGNED(1 to len) := arg1; -- VHDL 93 ROR VARIABLE result : SIGNED (1 to len) ; ATTRIBUTE is_signed OF arg1:CONSTANT IS TRUE; ATTRIBUTE is_signed OF result:VARIABLE IS TRUE ; ATTRIBUTE synthesis_return OF result:VARIABLE IS "ROR" ; BEGIN ASSERT arg2 <= len REPORT "rotate is further than array size." SEVERITY WARNING ; IF (marg2 = 0) THEN result := (arg1); ELSE result := (ans(len-marg2+1 to len) & ans(1 to len-marg2)); END IF; RETURN result ; END ; -- -- In general, objects in this package are required to be functions. -- For synthesizability reasons, we want the "flipflop" functions to be -- procedures. There is a special kludge in the rtl netlister to let -- this work. -- procedure flipflop (signal input : in std_logic; signal clk : in std_logic; signal output : out std_logic) is attribute SYNTHESIS_RETURN of output:signal is "flipflop"; begin if (clk'last_value = '0' and clk = '1') then output <= input; end if; end; procedure flipflop (signal input : in unsigned; signal clk : in std_logic; signal output : out unsigned) is attribute SYNTHESIS_RETURN of output:signal is "flipflop"; begin if (clk'last_value = '0' and clk = '1') then output <= input; end if; end; procedure flipflop (signal input : in std_logic; signal clk : in std_logic; signal output : out std_logic; signal rst : in std_logic; signal value : in std_logic) is attribute SYNTHESIS_RETURN of output:signal is "flipflop"; begin if (rst = '1') then output <= value; elsif (clk'event and clk = '1') then output <= input; end if; end; procedure flipflop (signal input : in unsigned; signal clk : in std_logic; signal output : out unsigned; signal rst : in std_logic; signal value : in unsigned) is attribute SYNTHESIS_RETURN of output:signal is "flipflop"; begin if (rst = '1') then output <= value; elsif (clk'event and clk = '1') then output <= input; end if; end; -- -- This is used in the special case when we need to pick a vector that -- has been changed into a constant. This is because the VHDL language -- doesn't allow one to say "bits"[index] -- function readindex (input : unsigned; index : natural) return std_logic is variable result : std_logic; attribute SYNTHESIS_RETURN of result:variable is "readindex"; begin result := input(index); return result; end; -- -- The following procedures insert n consecutive wait until edge -- statements into the process. 'phase' gives the active edge ie it -- should be either '1' or '0' -- procedure wait_clock_cycles (constant n : natural; signal clk : in std_logic; constant phase : in std_logic) is -- pragma built_in synch begin for i in 1 to n loop wait until clk'event and clk=phase; end loop; end; procedure wait_clock_cycles (constant n : natural; signal clk : in bit; constant phase : in bit) is -- pragma built_in synch begin for i in 1 to n loop wait until clk'event and clk=phase; end loop; end; end FUNCS;
apache-2.0
60d9d579c1a90f649c184ce73dc16fcf
0.529441
3.67459
false
false
false
false
IamVNIE/Hardware-Security
RC5 CryptoCore/Rc5 Codes/RC5decryptAllSteps.vhd
2
6,793
Library IEEE; Use IEEE.std_logic_1164.all; Use IEEE.std_logic_unsigned.all; Use Work.RC5_Pkg.all; Entity rc5_dec IS Port ( --Ports clr : In std_logic; clk : In std_logic; din : In std_logic_vector(63 downto 0); din_vld : In std_logic; key_rdy : In std_logic; skey : In rom; dout : Out std_logic_vector(63 downto 0); dout_rdy : Out std_logic ); End rc5_dec; Architecture rtl Of rc5_dec IS --signals --Signals Signal i_cnt : Std_logic_vector(3 downto 0); Signal ab_key : Std_logic_vector(31 downto 0); Signal a_rot : Std_logic_vector(31 downto 0); Signal a : Std_logic_vector(31 downto 0); Signal a_reg : Std_logic_vector(31 downto 0); Signal a_skey0 : Std_logic_vector(31 downto 0); Signal ba_key : Std_logic_vector(31 downto 0); Signal b_rot : Std_logic_vector(31 downto 0); Signal b : Std_logic_vector(31 downto 0); Signal b_reg : Std_logic_vector(31 downto 0); Signal b_skey1 : Std_logic_vector(31 downto 0); --Type for state machine Type StateType IS ( ST_idle, ST_pre_round, ST_round_op, ST_ready ); --Signal for state machine Signal state_de : StateType; --Architecture Begin --Step Pre_B b_skey1 <= b_reg - skey(1); --Subtract skey(1) from din --Step B (B=((B-S[2*i+1])>>>A) XOR A) ba_key <= b_reg - skey(Conv_Integer(i_cnt & '1')); --Subtract key from B With a_reg(4 downto 0) Select --rotate B by A b_rot <= ba_key (0) & ba_key(31 downto 1) when "00001", ba_key(1 downto 0) & ba_key(31 downto 2) when "00010", ba_key(2 downto 0) & ba_key(31 downto 3) when "00011", ba_key(3 downto 0) & ba_key(31 downto 4) when "00100", ba_key(4 downto 0) & ba_key(31 downto 5) when "00101", ba_key(5 downto 0) & ba_key(31 downto 6) when "00110", ba_key(6 downto 0) & ba_key(31 downto 7) when "00111", ba_key(7 downto 0) & ba_key(31 downto 8) when "01000", ba_key(8 downto 0) & ba_key(31 downto 9) when "01001", ba_key(9 downto 0) & ba_key(31 downto 10) when "01010", ba_key(10 downto 0) & ba_key(31 downto 11) when "01011", ba_key(11 downto 0) & ba_key(31 downto 12) when "01100", ba_key(12 downto 0) & ba_key(31 downto 13) when "01101", ba_key(13 downto 0) & ba_key(31 downto 14) when "01110", ba_key(14 downto 0) & ba_key(31 downto 15) when "01111", ba_key(15 downto 0) & ba_key(31 downto 16) when "10000", ba_key(16 downto 0) & ba_key(31 downto 17) when "10001", ba_key(17 downto 0) & ba_key(31 downto 18) when "10010", ba_key(18 downto 0) & ba_key(31 downto 19) when "10011", ba_key(19 downto 0) & ba_key(31 downto 20) when "10100", ba_key(20 downto 0) & ba_key(31 downto 21) when "10101", ba_key(21 downto 0) & ba_key(31 downto 22) when "10110", ba_key(22 downto 0) & ba_key(31 downto 23) when "10111", ba_key(23 downto 0) & ba_key(31 downto 24) when "11000", ba_key(24 downto 0) & ba_key(31 downto 25) when "11001", ba_key(25 downto 0) & ba_key(31 downto 26) when "11010", ba_key(26 downto 0) & ba_key(31 downto 27) when "11011", ba_key(27 downto 0) & ba_key(31 downto 28) when "11100", ba_key(28 downto 0) & ba_key(31 downto 29) when "11101", ba_key(29 downto 0) & ba_key(31 downto 30) when "11110", ba_key(30 downto 0) & ba_key(31) when "11111", ba_key when others; b <= b_rot XOR a_reg; --XOR with A after rotation --Step A (A=((A-S[2*i])>>>B) XOR B) a_skey0 <= a_reg - skey(0); ab_key <= a_reg - skey(Conv_Integer(i_cnt & '0')); --subtract key from A With b(4 downto 0) Select --Rotate A by result of b a_rot <= ab_key (0) & ab_key(31 downto 1) when "00001", ab_key(1 downto 0) & ab_key(31 downto 2) when "00010", ab_key(2 downto 0) & ab_key(31 downto 3) when "00011", ab_key(3 downto 0) & ab_key(31 downto 4) when "00100", ab_key(4 downto 0) & ab_key(31 downto 5) when "00101", ab_key(5 downto 0) & ab_key(31 downto 6) when "00110", ab_key(6 downto 0) & ab_key(31 downto 7) when "00111", ab_key(7 downto 0) & ab_key(31 downto 8) when "01000", ab_key(8 downto 0) & ab_key(31 downto 9) when "01001", ab_key(9 downto 0) & ab_key(31 downto 10) when "01010", ab_key(10 downto 0) & ab_key(31 downto 11) when "01011", ab_key(11 downto 0) & ab_key(31 downto 12) when "01100", ab_key(12 downto 0) & ab_key(31 downto 13) when "01101", ab_key(13 downto 0) & ab_key(31 downto 14) when "01110", ab_key(14 downto 0) & ab_key(31 downto 15) when "01111", ab_key(15 downto 0) & ab_key(31 downto 16) when "10000", ab_key(16 downto 0) & ab_key(31 downto 17) when "10001", ab_key(17 downto 0) & ab_key(31 downto 18) when "10010", ab_key(18 downto 0) & ab_key(31 downto 19) when "10011", ab_key(19 downto 0) & ab_key(31 downto 20) when "10100", ab_key(20 downto 0) & ab_key(31 downto 21) when "10101", ab_key(21 downto 0) & ab_key(31 downto 22) when "10110", ab_key(22 downto 0) & ab_key(31 downto 23) when "10111", ab_key(23 downto 0) & ab_key(31 downto 24) when "11000", ab_key(24 downto 0) & ab_key(31 downto 25) when "11001", ab_key(25 downto 0) & ab_key(31 downto 26) when "11010", ab_key(26 downto 0) & ab_key(31 downto 27) when "11011", ab_key(27 downto 0) & ab_key(31 downto 28) when "11100", ab_key(28 downto 0) & ab_key(31 downto 29) when "11101", ab_key(29 downto 0) & ab_key(31 downto 30) when "11110", ab_key(30 downto 0) & ab_key(31) when "11111", ab_key when others; a <= a_rot XOR b; --XOR rotated A with result of b --Register A Process(clr, clk) Begin If(clr='0') Then a_reg <= din(63 downto 32); elsif(clk'Event and clk='1') Then If (state_de = ST_round_op) Then a_reg <= a; End If; End If; End Process; --Register B Process(clr, clk) Begin If(clr='0') Then b_reg <= din(31 downto 0); Elsif(clk'Event and clk='1') Then If (state_de = ST_round_op) Then b_reg <= b; End If; End If; End Process; --State Machine Counter Process(clr, clk) Begin If(clr='0') Then state_de <= ST_idle; Elsif(clk'Event And clk='1') Then Case state_de IS When ST_idle => If (din_vld = '1' and key_rdy='1') Then state_de <= ST_round_op; End If; When ST_round_op => If (i_cnt = "0001") Then state_de <= ST_pre_round; End If; When ST_pre_round => state_de <= ST_ready; When ST_ready => state_de <= ST_idle; End Case; End If; End Process; --Round Counter Process(clr, clk) Begin If(clr='0') Then i_cnt <= "1100"; Elsif(clk'Event And clk='1') Then If (state_de = ST_round_op) Then If(i_cnt="0001") Then i_cnt <= "1100"; Else i_cnt <= i_cnt - '1'; End If; End If; End If; End Process; --Output dout <= a_skey0 & b_skey1; With state_de Select dout_rdy <= '1' When ST_ready, '0' When Others; End rtl;
mit
bec0ccb95da4d2f32daa17248f770ef6
0.61372
2.559533
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/leon3v3/dsu3x.vhd
1
28,301
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: dsu -- File: dsu.vhd -- Author: Jiri Gaisler, Edvin Catovic - Gaisler Research -- Description: Combined LEON3 debug support and AHB trace unit ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.config_types.all; use grlib.config.all; use grlib.stdlib.all; use grlib.devices.all; library gaisler; use gaisler.leon3.all; library techmap; use techmap.gencomp.all; entity dsu3x is generic ( hindex : integer := 0; haddr : integer := 16#900#; hmask : integer := 16#f00#; ncpu : integer := 1; tbits : integer := 30; -- timer bits (instruction trace time tag) tech : integer := DEFMEMTECH; irq : integer := 0; kbytes : integer := 0; clk2x : integer range 0 to 1 := 0; testen : integer := 0 ); port ( rst : in std_ulogic; hclk : in std_ulogic; cpuclk : in std_ulogic; ahbmi : in ahb_mst_in_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; dbgi : in l3_debug_out_vector(0 to NCPU-1); dbgo : out l3_debug_in_vector(0 to NCPU-1); dsui : in dsu_in_type; dsuo : out dsu_out_type; hclken : in std_ulogic ); attribute sync_set_reset of rst : signal is "true"; end; architecture rtl of dsu3x is constant TBUFABITS : integer := log2(kbytes) + 6; constant NBITS : integer := log2x(ncpu); constant PROC_H : integer := 24+NBITS-1; constant PROC_L : integer := 24; constant AREA_H : integer := 23; constant AREA_L : integer := 20; constant HBITS : integer := 28; constant DSU3_VERSION : integer := 1; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_LEON3DSU, 0, DSU3_VERSION, 0), 4 => ahb_membar(haddr, '0', '0', hmask), others => zero32); type slv_reg_type is record hsel : std_ulogic; haddr : std_logic_vector(PROC_H downto 0); hwrite : std_ulogic; hwdata : std_logic_vector(31 downto 0); hrdata : std_logic_vector(31 downto 0); hready : std_ulogic; hready2 : std_ulogic; end record; constant slv_reg_none : slv_reg_type := ( hsel => '0', haddr => (others => '0'), hwrite => '0', hwdata => (others => '0'), hrdata => (others => '0'), hready => '1', hready2 => '1' ); type reg_type is record slv : slv_reg_type; en : std_logic_vector(0 to NCPU-1); te : std_logic_vector(0 to NCPU-1); be : std_logic_vector(0 to NCPU-1); bw : std_logic_vector(0 to NCPU-1); bs : std_logic_vector(0 to NCPU-1); bx : std_logic_vector(0 to NCPU-1); bz : std_logic_vector(0 to NCPU-1); halt : std_logic_vector(0 to NCPU-1); reset : std_logic_vector(0 to NCPU-1); bn : std_logic_vector(NCPU-1 downto 0); ss : std_logic_vector(NCPU-1 downto 0); bmsk : std_logic_vector(NCPU-1 downto 0); dmsk : std_logic_vector(NCPU-1 downto 0); cnt : std_logic_vector(2 downto 0); dsubre : std_logic_vector(2 downto 0); dsuen : std_logic_vector(2 downto 0); act : std_ulogic; timer : std_logic_vector(tbits-1 downto 0); pwd : std_logic_vector(NCPU-1 downto 0); tstop : std_ulogic; end record; constant RRES : reg_type := ( slv => slv_reg_none, en => (others => '0'), te => (others => '0'), be => (others => '0'), bw => (others => '0'), bs => (others => '0'), bx => (others => '0'), bz => (others => '0'), halt => (others => '0'), reset => (others => '0'), bn => (others => '0'), ss => (others => '0'), bmsk => (others => '0'), dmsk => (others => '0'), cnt => (others => '0'), dsubre => (others => '0'), dsuen => (others => '0'), act => '0', timer => (others => '0'), pwd => (others => '0'), tstop => '0' ); type trace_break_reg is record addr : std_logic_vector(31 downto 2); mask : std_logic_vector(31 downto 2); read : std_logic; write : std_logic; end record; constant trace_break_none : trace_break_reg := ( addr => (others => '0'), mask => (others => '0'), read => '0', write => '0' ); type t_reg_type is record haddr : std_logic_vector(31 downto 0); hwrite : std_logic; htrans : std_logic_vector(1 downto 0); hsize : std_logic_vector(2 downto 0); hburst : std_logic_vector(2 downto 0); hwdata : std_logic_vector(31 downto 0); hmaster : std_logic_vector(3 downto 0); hmastlock : std_logic; hsel : std_logic; ahbactive : std_logic; aindex : std_logic_vector(TBUFABITS - 1 downto 0); -- buffer index enable : std_logic; -- trace enable bphit : std_logic; -- AHB breakpoint hit bphit2 : std_logic; -- delayed bphit dcnten : std_logic; -- delay counter enable delaycnt : std_logic_vector(TBUFABITS - 1 downto 0); -- delay counter tbreg1 : trace_break_reg; tbreg2 : trace_break_reg; tbwr : std_logic; -- trace buffer write enable break : std_logic; -- break CPU when AHB tracing stops end record; constant TRES : t_reg_type := ( haddr => (others => '0'), hwrite => '0', htrans => (others => '0'), hsize => (others => '0'), hburst => (others => '0'), hwdata => (others => '0'), hmaster => (others => '0'), hmastlock => '0', hsel => '0', ahbactive => '0', aindex => (others => '0'), enable => '0', bphit => '0', bphit2 => '0', dcnten => '0', delaycnt => (others => '0'), tbreg1 => trace_break_none, tbreg2 => trace_break_none, tbwr => '0', break => '0' ); type hclk_reg_type is record irq : std_ulogic; oen : std_ulogic; end record; constant hclk_reg_none : hclk_reg_type := ( irq => '0', oen => '0' ); constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; constant TRACEN : boolean := (kbytes /= 0); signal tbi : tracebuf_in_type; signal tbo : tracebuf_out_type; signal tr, trin : t_reg_type; signal r, rin : reg_type; signal rh, rhin : hclk_reg_type; signal ahbsi2 : ahb_slv_in_type; signal hrdata2x : std_logic_vector(31 downto 0); begin comb: process(rst, r, ahbsi, ahbsi2, dbgi, dsui, ahbmi, tr, tbo, hclken, rh, hrdata2x) variable v : reg_type; variable iuacc : std_ulogic; variable dbgmode, tstop : std_ulogic; variable rawindex : integer range 0 to (2**NBITS)-1; variable index : natural range 0 to NCPU-1; variable hasel1 : std_logic_vector(AREA_H-1 downto AREA_L); variable hasel2 : std_logic_vector(6 downto 2); variable tv : t_reg_type; variable vabufi : tracebuf_in_type; variable aindex : std_logic_vector(TBUFABITS - 1 downto 0); -- buffer index variable hirq : std_logic_vector(NAHBIRQ-1 downto 0); variable cpwd : std_logic_vector(15 downto 0); variable hrdata : std_logic_vector(31 downto 0); variable bphit1, bphit2 : std_ulogic; variable vh : hclk_reg_type; begin v := r; iuacc := '0'; --v.slv.hready := '0'; dbgmode := '0'; tstop := '1'; v.dsubre := r.dsubre(1 downto 0) & dsui.break; v.dsuen := r.dsuen(1 downto 0) & dsui.enable; hrdata := r.slv.hrdata; tv := tr; vabufi.enable := '0'; tv.bphit := '0'; tv.tbwr := '0'; if (clk2x /= 0) then tv.bphit2 := tr.bphit; else tv.bphit2 := '0'; end if; vabufi.data := (others => '0'); vabufi.addr := (others => '0'); vabufi.write := (others => '0'); aindex := (others => '0'); hirq := (others => '0'); v.reset := (others => '0'); if TRACEN then aindex := tr.aindex + 1; if (clk2x /= 0) then vh.irq := tr.bphit or tr.bphit2; hirq(irq) := rh.irq; else hirq(irq) := tr.bphit; end if; end if; if hclken = '1' then v.slv.hready := '0'; v.act := '0'; end if; -- check for AHB watchpoints bphit1 := '0'; bphit2 := '0'; if TRACEN and ((ahbsi2.hready and tr.ahbactive) = '1') then if ((((tr.tbreg1.addr xor tr.haddr(31 downto 2)) and tr.tbreg1.mask) = zero32(29 downto 0)) and (((tr.tbreg1.read and not tr.hwrite) or (tr.tbreg1.write and tr.hwrite)) = '1')) then bphit1 := '1'; end if; if ((((tr.tbreg2.addr xor tr.haddr(31 downto 2)) and tr.tbreg2.mask) = zero32(29 downto 0)) and (((tr.tbreg2.read and not tr.hwrite) or (tr.tbreg2.write and tr.hwrite)) = '1')) then bphit2 := '1'; end if; if (bphit1 or bphit2) = '1' then if ((tr.enable and not r.act) = '1') and (tr.dcnten = '0') and (tr.delaycnt /= zero32(TBUFABITS-1 downto 0)) then tv.dcnten := '1'; else tv.enable := '0'; tv.bphit := tr.break; end if; end if; end if; -- generate AHB buffer inputs vabufi.write := "0000"; if TRACEN then if (tr.enable = '1') and (r.act = '0') then vabufi.addr(TBUFABITS-1 downto 0) := tr.aindex; vabufi.data(127) := bphit1 or bphit2; vabufi.data(96+tbits-1 downto 96) := r.timer; vabufi.data(94 downto 80) := ahbmi.hirq(15 downto 1); vabufi.data(79) := tr.hwrite; vabufi.data(78 downto 77) := tr.htrans; vabufi.data(76 downto 74) := tr.hsize; vabufi.data(73 downto 71) := tr.hburst; vabufi.data(70 downto 67) := tr.hmaster; vabufi.data(66) := tr.hmastlock; vabufi.data(65 downto 64) := ahbmi.hresp; if tr.hwrite = '1' then vabufi.data(63 downto 32) := ahbsi2.hwdata(31 downto 0); else vabufi.data(63 downto 32) := ahbmi.hrdata(31 downto 0); end if; vabufi.data(31 downto 0) := tr.haddr; else vabufi.addr(TBUFABITS-1 downto 0) := tr.haddr(TBUFABITS+3 downto 4); vabufi.data := ahbsi2.hwdata(31 downto 0) & ahbsi2.hwdata(31 downto 0) & ahbsi2.hwdata(31 downto 0) & ahbsi2.hwdata(31 downto 0); end if; -- write trace buffer if (tr.enable and not r.act) = '1' then if (tr.ahbactive and ahbsi2.hready) = '1' then tv.aindex := aindex; tv.tbwr := '1'; vabufi.enable := '1'; vabufi.write := "1111"; end if; end if; -- trace buffer delay counter handling if (tr.dcnten = '1') then if (tr.delaycnt = zero32(TBUFABITS-1 downto 0)) then tv.enable := '0'; tv.dcnten := '0'; tv.bphit := tr.break; end if; if tr.tbwr = '1' then tv.delaycnt := tr.delaycnt - 1; end if; end if; -- save AHB transfer parameters if (ahbsi2.hready = '1' ) then tv.haddr := ahbsi2.haddr; tv.hwrite := ahbsi2.hwrite; tv.htrans := ahbsi2.htrans; tv.hsize := ahbsi2.hsize; tv.hburst := ahbsi2.hburst; tv.hmaster := ahbsi2.hmaster; tv.hmastlock := ahbsi2.hmastlock; end if; if tr.hsel = '1' then tv.hwdata := ahbsi2.hwdata(31 downto 0); end if; if ahbsi2.hready = '1' then tv.hsel := ahbsi2.hsel(hindex); tv.ahbactive := ahbsi2.htrans(1); end if; end if; if r.slv.hsel = '1' then if (clk2x = 0) then v.cnt := r.cnt - 1; else if (r.cnt /= "111") or (hclken = '1') then v.cnt := r.cnt - 1; end if; end if; end if; if (r.slv.hready and hclken) = '1' then v.slv.hsel := '0'; --v.slv.act := '0'; end if; for i in 0 to NCPU-1 loop if dbgi(i).dsumode = '1' then if r.dmsk(i) = '0' then dbgmode := '1'; if hclken = '1' then v.act := '1'; end if; end if; v.bn(i) := '1'; else tstop := '0'; end if; end loop; if tstop = '0' then v.timer := r.timer + 1; end if; if (clk2x /= 0) then if hclken = '1' then v.tstop := tstop; end if; tstop := r.tstop; end if; cpwd := (others => '0'); for i in 0 to NCPU-1 loop v.bn(i) := v.bn(i) or (dbgmode and r.bmsk(i)) or (r.dsubre(1) and not r.dsubre(2)); if TRACEN then v.bn(i) := v.bn(i) or (tr.bphit and not r.ss(i) and not r.act); end if; v.pwd(i) := dbgi(i).idle and (not dbgi(i).ipend) and not v.bn(i); end loop; cpwd(NCPU-1 downto 0) := r.pwd; if (ahbsi2.hready and ahbsi2.hsel(hindex)) = '1' then if (ahbsi2.htrans(1) = '1') then v.slv.hsel := '1'; v.slv.haddr := ahbsi2.haddr(PROC_H downto 0); v.slv.hwrite := ahbsi2.hwrite; v.cnt := "111"; end if; end if; for i in 0 to NCPU-1 loop v.en(i) := r.dsuen(2) and dbgi(i).dsu; end loop; rawindex := conv_integer(r.slv.haddr(PROC_H downto PROC_L)); if ncpu = 1 then index := 0; else if rawindex > ncpu then index := ncpu-1; else index := rawindex; end if; end if; hasel1 := r.slv.haddr(AREA_H-1 downto AREA_L); hasel2 := r.slv.haddr(6 downto 2); if r.slv.hsel = '1' then case hasel1 is when "000" => -- DSU registers if r.cnt(2 downto 0) = "110" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; hrdata := (others => '0'); case hasel2 is when "00000" => if r.slv.hwrite = '1' then if hclken = '1' then v.te(index) := ahbsi2.hwdata(0); v.be(index) := ahbsi2.hwdata(1); v.bw(index) := ahbsi2.hwdata(2); v.bs(index) := ahbsi2.hwdata(3); v.bx(index) := ahbsi2.hwdata(4); v.bz(index) := ahbsi2.hwdata(5); v.reset(index) := ahbsi2.hwdata(9); v.halt(index) := ahbsi2.hwdata(10); else v.reset := r.reset; end if; end if; hrdata(0) := r.te(index); hrdata(1) := r.be(index); hrdata(2) := r.bw(index); hrdata(3) := r.bs(index); hrdata(4) := r.bx(index); hrdata(5) := r.bz(index); hrdata(6) := dbgi(index).dsumode; hrdata(7) := r.dsuen(2); hrdata(8) := r.dsubre(2); hrdata(9) := not dbgi(index).error; hrdata(10) := dbgi(index).halt; hrdata(11) := dbgi(index).pwd; when "00010" => -- timer if r.slv.hwrite = '1' then if hclken = '1' then v.timer := ahbsi2.hwdata(tbits-1 downto 0); else v.timer := r.timer; end if; end if; hrdata(tbits-1 downto 0) := r.timer; when "01000" => if r.slv.hwrite = '1' then if hclken = '1' then v.bn := ahbsi2.hwdata(NCPU-1 downto 0); v.ss := ahbsi2.hwdata(16+NCPU-1 downto 16); else v.bn := r.bn; v.ss := r.ss; end if; end if; hrdata(NCPU-1 downto 0) := r.bn; hrdata(16+NCPU-1 downto 16) := r.ss; when "01001" => if (r.slv.hwrite and hclken) = '1' then v.bmsk(NCPU-1 downto 0) := ahbsi2.hwdata(NCPU-1 downto 0); v.dmsk(NCPU-1 downto 0) := ahbsi2.hwdata(NCPU-1+16 downto 16); end if; hrdata(NCPU-1 downto 0) := r.bmsk; hrdata(NCPU-1+16 downto 16) := r.dmsk; when "10000" => if TRACEN then hrdata((TBUFABITS + 15) downto 16) := tr.delaycnt; hrdata(2 downto 0) := tr.break & tr.dcnten & tr.enable; if r.slv.hwrite = '1' then if hclken = '1' then tv.delaycnt := ahbsi2.hwdata((TBUFABITS+ 15) downto 16); tv.break := ahbsi2.hwdata(2); tv.dcnten := ahbsi2.hwdata(1); tv.enable := ahbsi2.hwdata(0); else tv.delaycnt := tr.delaycnt; tv.break := tr.break; tv.dcnten := tr.dcnten; tv.enable := tr.enable; end if; end if; end if; when "10001" => if TRACEN then hrdata((TBUFABITS - 1 + 4) downto 4) := tr.aindex; if r.slv.hwrite = '1' then if hclken = '1' then tv.aindex := ahbsi2.hwdata((TBUFABITS - 1 + 4) downto 4); else tv.aindex := tr.aindex; end if; end if; end if; when "10100" => if TRACEN then hrdata(31 downto 2) := tr.tbreg1.addr; if (r.slv.hwrite and hclken) = '1' then tv.tbreg1.addr := ahbsi2.hwdata(31 downto 2); end if; end if; when "10101" => if TRACEN then hrdata := tr.tbreg1.mask & tr.tbreg1.read & tr.tbreg1.write; if (r.slv.hwrite and hclken) = '1' then tv.tbreg1.mask := ahbsi2.hwdata(31 downto 2); tv.tbreg1.read := ahbsi2.hwdata(1); tv.tbreg1.write := ahbsi2.hwdata(0); end if; end if; when "10110" => if TRACEN then hrdata(31 downto 2) := tr.tbreg2.addr; if (r.slv.hwrite and hclken) = '1' then tv.tbreg2.addr := ahbsi2.hwdata(31 downto 2); end if; end if; when "10111" => if TRACEN then hrdata := tr.tbreg2.mask & tr.tbreg2.read & tr.tbreg2.write; if (r.slv.hwrite and hclken) = '1' then tv.tbreg2.mask := ahbsi2.hwdata(31 downto 2); tv.tbreg2.read := ahbsi2.hwdata(1); tv.tbreg2.write := ahbsi2.hwdata(0); end if; end if; when others => end case; when "010" => -- AHB tbuf if TRACEN then if r.cnt(2 downto 0) = "101" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; vabufi.enable := not (tr.enable and not r.act); case tr.haddr(3 downto 2) is when "00" => hrdata := tbo.data(127 downto 96); if (r.slv.hwrite and hclken) = '1' then vabufi.write(3) := vabufi.enable and v.slv.hready; end if; when "01" => hrdata := tbo.data(95 downto 64); if (r.slv.hwrite and hclken) = '1' then vabufi.write(2) := vabufi.enable and v.slv.hready; end if; when "10" => hrdata := tbo.data(63 downto 32); if (r.slv.hwrite and hclken) = '1' then vabufi.write(1) := vabufi.enable and v.slv.hready; end if; when others => hrdata := tbo.data(31 downto 0); if (r.slv.hwrite and hclken) = '1' then vabufi.write(0) := vabufi.enable and v.slv.hready; end if; end case; else if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "011" | "001" => -- IU reg file, IU tbuf iuacc := '1'; hrdata := dbgi(index).data; if r.cnt(2 downto 0) = "101" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "100" => -- IU reg access iuacc := '1'; hrdata := dbgi(index).data; if r.cnt(1 downto 0) = "11" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "111" => -- DSU ASI if r.cnt(2 downto 1) = "11" then iuacc := '1'; else iuacc := '0'; end if; if (dbgi(index).crdy = '1') or (r.cnt = "000") then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; hrdata := dbgi(index).data; when others => if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end case; if (r.slv.hready and hclken and not v.slv.hsel) = '1' then v.slv.hready := '0'; end if; if (clk2x /= 0) and (r.slv.hready2 and hclken) = '1' then v.slv.hready := '1'; end if; end if; if r.slv.hsel = '1' then if (r.slv.hwrite and hclken) = '1' then v.slv.hwdata := ahbsi2.hwdata(31 downto 0); end if; if (clk2x = 0) or ((r.slv.hready or r.slv.hready2) = '0') then v.slv.hrdata := hrdata; end if; end if; if ((ahbsi2.hready and ahbsi2.hsel(hindex)) = '1') and (ahbsi2.htrans(1) = '0') then if (clk2x = 0) or (r.slv.hsel = '0') then v.slv.hready := '1'; end if; end if; if (clk2x /= 0) and (r.slv.hready = '1') then v.slv.hready2 := '0'; end if; if v.slv.hsel = '0' then v.slv.hready := '1'; end if; vh.oen := '0'; if (clk2x /= 0) then if (hclken and r.slv.hsel and (r.slv.hready2 or v.slv.hready)) = '1' then vh.oen := '1'; end if; if (r.slv.hsel = '1') and (r.cnt = "111") and (hclken = '0') then iuacc := '0'; end if; end if; if (not RESET_ALL) and (rst = '0') then v.bn := (others => r.dsubre(2)); v.bmsk := (others => '0'); v.dmsk := (others => '0'); v.ss := (others => '0'); v.timer := (others => '0'); v.slv.hsel := '0'; for i in 0 to NCPU-1 loop v.bw(i) := r.dsubre(2); v.be(i) := r.dsubre(2); v.bx(i) := r.dsubre(2); v.bz(i) := r.dsubre(2); v.bs(i) := '0'; v.te(i) := '0'; end loop; tv.ahbactive := '0'; tv.enable := '0'; tv.hsel := '0'; tv.dcnten := '0'; tv.tbreg1.read := '0'; tv.tbreg1.write := '0'; tv.tbreg2.read := '0'; tv.tbreg2.write := '0'; v.slv.hready := '1'; v.halt := (others => '0'); v.act := '0'; v.tstop := '0'; end if; vabufi.enable := vabufi.enable and not ahbsi.scanen; vabufi.diag := ahbsi.testen & "000"; rin <= v; trin <= tv; tbi <= vabufi; for i in 0 to NCPU-1 loop dbgo(i).tenable <= r.te(i); dbgo(i).dsuen <= r.en(i); dbgo(i).dbreak <= r.bn(i); -- or (dbgmode and r.bmsk(i)); if conv_integer(r.slv.haddr(PROC_H downto PROC_L)) = i then dbgo(i).denable <= iuacc; else dbgo(i).denable <= '0'; end if; dbgo(i).step <= r.ss(i); dbgo(i).berror <= r.be(i); dbgo(i).bsoft <= r.bs(i); dbgo(i).bwatch <= r.bw(i); dbgo(i).btrapa <= r.bx(i); dbgo(i).btrape <= r.bz(i); dbgo(i).daddr <= r.slv.haddr(PROC_L-1 downto 2); dbgo(i).ddata <= r.slv.hwdata(31 downto 0); dbgo(i).dwrite <= r.slv.hwrite; dbgo(i).halt <= r.halt(i); dbgo(i).reset <= r.reset(i); dbgo(i).timer(tbits-1 downto 0) <= r.timer; dbgo(i).timer(30 downto tbits) <= (others => '0'); end loop; ahbso.hconfig <= hconfig; ahbso.hresp <= HRESP_OKAY; ahbso.hready <= r.slv.hready; if (clk2x = 0) then ahbso.hrdata <= ahbdrivedata(r.slv.hrdata); else ahbso.hrdata <= ahbdrivedata(hrdata2x); end if; ahbso.hsplit <= (others => '0'); ahbso.hirq <= hirq; ahbso.hindex <= hindex; dsuo.active <= r.act; dsuo.tstop <= tstop; dsuo.pwd <= cpwd; rhin <= vh; end process; comb2gen0 : if (clk2x /= 0) generate ag0 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hmastlock, hclken, ahbsi2.hmastlock); ag1 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hwrite, hclken, ahbsi2.hwrite); ag2 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hready, hclken, ahbsi2.hready); gen3 : for i in ahbsi.haddr'range generate ag3 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.haddr(i), hclken, ahbsi2.haddr(i)); end generate; gen4 : for i in ahbsi.htrans'range generate ag4 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.htrans(i), hclken, ahbsi2.htrans(i)); end generate; -- gen5 : for i in ahbsi.hwdata'range generate gen5 : for i in 0 to 31 generate ag5 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hwdata(i), hclken, ahbsi2.hwdata(i)); end generate; gen6 : for i in ahbsi.hsize'range generate ag6 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hsize(i), hclken, ahbsi2.hsize(i)); end generate; gen7 : for i in ahbsi.hburst'range generate ag7 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hburst(i), hclken, ahbsi2.hburst(i)); end generate; gen8 : for i in ahbsi.hmaster'range generate ag8 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hmaster(i), hclken, ahbsi2.hmaster(i)); end generate; gen9 : for i in ahbsi.hsel'range generate ag9 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hsel(i), hclken, ahbsi2.hsel(i)); end generate; gen10 : for i in hrdata2x'range generate ag10 : clkand generic map (tech => 0, ren => 0) port map (r.slv.hrdata(i), rh.oen, hrdata2x(i)); end generate; reg2 : process(hclk) begin if rising_edge(hclk) then rh <= rhin; end if; end process; end generate; comb2gen1 : if (clk2x = 0) generate ahbsi2 <= ahbsi; rh.irq <= '0'; rh.oen <= '0'; hrdata2x <= (others => '0'); end generate; reg : process(cpuclk) begin if rising_edge(cpuclk) then r <= rin; if RESET_ALL and (rst = '0') then r <= RRES; for i in 0 to NCPU-1 loop r.bn(i) <= r.dsubre(2); r.bw(i) <= r.dsubre(2); r.be(i) <= r.dsubre(2); r.bx(i) <= r.dsubre(2); r.bz(i) <= r.dsubre(2); end loop; r.dsubre <= rin.dsubre; -- Sync. regs. r.dsuen <= rin.dsuen; r.en <= rin.en; end if; end if; end process; tb0 : if TRACEN generate treg : process(cpuclk) begin if rising_edge(cpuclk) then tr <= trin; if RESET_ALL and (rst = '0') then tr <= TRES; end if; end if; end process; mem0 : tbufmem generic map (tech => tech, tbuf => kbytes, testen => testen) port map (cpuclk, tbi, tbo); -- pragma translate_off bootmsg : report_version generic map ("dsu3_" & tost(hindex) & ": LEON3 Debug support unit + AHB Trace Buffer, " & tost(kbytes) & " kbytes"); -- pragma translate_on end generate; notb : if not TRACEN generate -- pragma translate_off bootmsg : report_version generic map ("dsu3_" & tost(hindex) & ": LEON3 Debug support unit"); -- pragma translate_on end generate; end;
gpl-2.0
2cc6ba9b81f8134fa9a4cf6da78d7ff9
0.51507
3.34725
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/prj/solution1/syn/vhdl/FIFO_image_filter_img_0_data_stream_2_V.vhd
4
4,629
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_img_0_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_img_0_data_stream_2_V_shiftReg; architecture rtl of FIFO_image_filter_img_0_data_stream_2_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_img_0_data_stream_2_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_img_0_data_stream_2_V is component FIFO_image_filter_img_0_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_img_0_data_stream_2_V_shiftReg : FIFO_image_filter_img_0_data_stream_2_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
593b3bafaaa49b51db2d6e3684638cf5
0.537697
3.449329
false
false
false
false
freecores/usb_fpga_1_11
examples/usb-fpga-2.16/2.16b/ucecho/fpga/ucecho.vhd
4
2,477
library ieee; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; Library UNISIM; use UNISIM.vcomponents.all; entity ucecho is port( pd : in unsigned(7 downto 0); pb : out unsigned(7 downto 0); fxclk_in : in std_logic ); end ucecho; architecture RTL of ucecho is --signal declaration signal pb_buf : unsigned(7 downto 0); signal clk : std_logic; signal fxclk_fb : std_logic; begin -- PLL used as clock filter fxclk_pll : PLLE2_BASE generic map ( BANDWIDTH => "OPTIMIZED", -- OPTIMIZED, HIGH, LOW CLKFBOUT_MULT => 20, -- Multiply value for all CLKOUT, (2-64) CLKFBOUT_PHASE => 0.0, -- Phase offset in degrees of CLKFB, (-360.000-360.000). CLKIN1_PERIOD => 0.0, -- Input clock period in ns to ps resolution (i.e. 33.333 is 30 MHz). -- CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: Divide amount for each CLKOUT (1-128) CLKOUT0_DIVIDE => 10, CLKOUT1_DIVIDE => 1, CLKOUT2_DIVIDE => 1, CLKOUT3_DIVIDE => 1, CLKOUT4_DIVIDE => 1, CLKOUT5_DIVIDE => 1, -- CLKOUT0_DUTY_CYCLE - CLKOUT5_DUTY_CYCLE: Duty cycle for each CLKOUT (0.001-0.999). CLKOUT0_DUTY_CYCLE => 0.5, CLKOUT1_DUTY_CYCLE => 0.5, CLKOUT2_DUTY_CYCLE => 0.5, CLKOUT3_DUTY_CYCLE => 0.5, CLKOUT4_DUTY_CYCLE => 0.5, CLKOUT5_DUTY_CYCLE => 0.5, -- CLKOUT0_PHASE - CLKOUT5_PHASE: Phase offset for each CLKOUT (-360.000-360.000). CLKOUT0_PHASE => 0.0, CLKOUT1_PHASE => 0.0, CLKOUT2_PHASE => 0.0, CLKOUT3_PHASE => 0.0, CLKOUT4_PHASE => 0.0, CLKOUT5_PHASE => 0.0, DIVCLK_DIVIDE => 1, -- Master division value, (1-56) REF_JITTER1 => 0.0, -- Reference input jitter in UI, (0.000-0.999). STARTUP_WAIT => "FALSE" -- Delay DONE until PLL Locks, ("TRUE"/"FALSE") ) port map ( CLKOUT0 => clk, CLKFBOUT => fxclk_fb, -- 1-bit output: Feedback clock CLKIN1 => fxclk_in, -- 1-bit input: Input clock PWRDWN => '0', -- 1-bit input: Power-down RST => '0', -- 1-bit input: Reset CLKFBIN => fxclk_fb -- 1-bit input: Feedback clock ); dpUCECHO: process(CLK) begin if CLK' event and CLK = '1' then if ( pd >= 97 ) and ( pd <= 122) then pb_buf <= pd - 32; else pb_buf <= pd; end if; pb <= pb_buf; end if; end process dpUCECHO; end RTL;
gpl-3.0
c16dddeb5f55d88e5f49bafb24dd240e
0.562778
3.293883
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml501/testbench.vhd
1
11,470
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2004-2008 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library cypress; use cypress.components.all; library hynix; use hynix.components.all; use work.debug.all; use work.ml50x.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 10; -- system clock period romwidth : integer := 32; -- rom data width (8/32) romdepth : integer := 16; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 18; -- ram address depth srambanks : integer := 2 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal sys_clk : std_logic := '0'; signal sys_rst_in : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal bus_error : std_logic_vector (1 downto 0); signal sram_flash_addr : std_logic_vector(23 downto 0); signal address : std_logic_vector(24 downto 0); signal sram_flash_data, data : std_logic_vector(31 downto 0); signal sram_cen : std_logic; signal sram_bw : std_logic_vector (3 downto 0); signal sram_oen : std_ulogic; signal flash_oen : std_ulogic; signal sram_flash_we_n : std_ulogic; signal flash_cen : std_logic; signal flash_adv_n : std_logic; signal sram_clk : std_ulogic; signal sram_clk_fb : std_ulogic; signal sram_mode : std_ulogic; signal sram_adv_ld_n : std_ulogic; signal iosn : std_ulogic; signal ddr_clk : std_logic_vector(1 downto 0); signal ddr_clkb : std_logic_vector(1 downto 0); signal ddr_cke : std_logic_vector(1 downto 0); signal ddr_csb : std_logic_vector(1 downto 0); signal ddr_odt : std_logic_vector(1 downto 0); signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (7 downto 0); -- ddr dm signal ddr_dqsp : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_dqsn : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_rdqs : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (13 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1+CFG_DDR2SP downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (63 downto 0); -- ddr data signal ddr_dq2 : std_logic_vector (63 downto 0); -- ddr data signal txd1 : std_ulogic; -- UART1 tx data signal rxd1 : std_ulogic; -- UART1 rx data signal gpio : std_logic_vector(13 downto 0); -- I/O port signal led : std_logic_vector(12 downto 0); -- I/O port signal phy_mii_data: std_logic; -- ethernet PHY interface signal phy_tx_clk : std_ulogic; signal phy_rx_clk : std_ulogic; signal phy_rx_data : std_logic_vector(7 downto 0); signal phy_dv : std_ulogic; signal phy_rx_er : std_ulogic; signal phy_col : std_ulogic; signal phy_crs : std_ulogic; signal phy_tx_data : std_logic_vector(7 downto 0); signal phy_tx_en : std_ulogic; signal phy_tx_er : std_ulogic; signal phy_mii_clk : std_ulogic; signal phy_rst_n : std_ulogic; signal phy_gtx_clk : std_ulogic; signal phy_int : std_ulogic := '1'; signal ps2_keyb_clk: std_logic; signal ps2_keyb_data: std_logic; signal ps2_mouse_clk: std_logic; signal ps2_mouse_data: std_logic; signal usb_csn, usb_rstn : std_logic; signal iic_scl_main, iic_sda_main : std_logic; signal iic_scl_dvi, iic_sda_dvi : std_logic; signal tft_lcd_data : std_logic_vector(11 downto 0); signal tft_lcd_clk_p : std_logic; signal tft_lcd_clk_n : std_logic; signal tft_lcd_hsync : std_logic; signal tft_lcd_vsync : std_logic; signal tft_lcd_de : std_logic; signal tft_lcd_reset_b : std_logic; signal sace_usb_a : std_logic_vector(6 downto 0); signal sace_mpce : std_ulogic; signal sace_usb_d : std_logic_vector(15 downto 0); signal sace_usb_oen : std_ulogic; signal sace_usb_wen : std_ulogic; signal sysace_mpirq : std_ulogic; signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal clk_200_p : std_ulogic := '0'; signal clk_200_n : std_ulogic := '1'; signal sysace_clk_in : std_ulogic := '0'; constant lresp : boolean := false; begin -- clock and reset sys_clk <= not sys_clk after ct * 1 ns; sys_rst_in <= '0', '1' after 200 ns; clk_200_p <= not clk_200_p after 2.5 ns; clk_200_n <= not clk_200_n after 2.5 ns; sysace_clk_in <= not sysace_clk_in after 15 ns; rxd1 <= 'H'; gpio(11) <= 'L'; sram_clk_fb <= sram_clk; ps2_keyb_data <= 'H'; ps2_keyb_clk <= 'H'; ps2_mouse_clk <= 'H'; ps2_mouse_data <= 'H'; iic_scl_main <= 'H'; iic_sda_main <= 'H'; iic_scl_dvi <= 'H'; iic_sda_dvi <= 'H'; sace_usb_d <= (others => 'H'); sysace_mpirq <= 'L'; cpu : entity work.leon3mp generic map ( fabtech, memtech, padtech, ncpu, disas, dbguart, pclow ) port map (sys_rst_in, sys_clk, clk_200_p, clk_200_n, sysace_clk_in, sram_flash_addr, sram_flash_data, sram_cen, sram_bw, sram_oen, sram_flash_we_n, flash_cen, flash_oen, flash_adv_n,sram_clk, sram_clk_fb, sram_mode, sram_adv_ld_n, iosn, ddr_clk, ddr_clkb, ddr_cke, ddr_csb, ddr_odt, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqsp, ddr_dqsn, ddr_ad, ddr_ba, ddr_dq, txd1, rxd1, gpio, led, bus_error, phy_gtx_clk, phy_mii_data, phy_tx_clk, phy_rx_clk, phy_rx_data, phy_dv, phy_rx_er, phy_col, phy_crs, phy_tx_data, phy_tx_en, phy_tx_er, phy_mii_clk, phy_rst_n, phy_int, ps2_keyb_clk, ps2_keyb_data, ps2_mouse_clk, ps2_mouse_data, usb_csn, usb_rstn, iic_scl_main, iic_sda_main, iic_scl_dvi, iic_sda_dvi, tft_lcd_data, tft_lcd_clk_p, tft_lcd_clk_n, tft_lcd_hsync, tft_lcd_vsync, tft_lcd_de, tft_lcd_reset_b, sace_usb_a, sace_mpce, sace_usb_d, sace_usb_oen, sace_usb_wen, sysace_mpirq ); -- ddr2mem : for i in 0 to 3 generate -- u1 : ddr2 -- PORT MAP( -- ck => ddr_clk(0), ck_n => ddr_clkb(0), cke => ddr_cke(0), cs_n => ddr_csb(0), -- ras_n => ddr_rasb, cas_n => ddr_casb, we_n => ddr_web, -- dm_rdqs => ddr_dm(i*2+1 downto i*2), ba => ddr_ba, -- addr => ddr_ad(12 downto 0), dq => ddr_dq(i*16+15 downto i*16), -- dqs => ddr_dqsp(i*2+1 downto i*2), dqs_n => ddr_dqsn(i*2+1 downto i*2), -- rdqs_n => ddr_rdqs(i*2+1 downto i*2), odt => ddr_odt(0)); -- end generate; ddr2ranks: for j in 0 to CS_NUM-1 generate ddr2chips: for i in 0 to 3 generate u1 : HY5PS121621F generic map (TimingCheckFlag => true, PUSCheckFlag => false, index => 3-i, fname => sdramfile, fdelay => 100*CFG_MIG_DDR2) port map (DQ => ddr_dq2(i*16+15 downto i*16), LDQS => ddr_dqsp(i*2), LDQSB => ddr_dqsn(i*2), UDQS => ddr_dqsp(i*2+1), UDQSB => ddr_dqsn(i*2+1), LDM => ddr_dm(i*2), WEB => ddr_web, CASB => ddr_casb, RASB => ddr_rasb, CSB => ddr_csb(j), BA => ddr_ba(1 downto 0), ADDR => ddr_ad(12 downto 0), CKE => ddr_cke(j), CLK => ddr_clk(j), CLKB => ddr_clkb(j), UDM => ddr_dm(i*2+1)); end generate; end generate; nodqdel : if (CFG_MIG_DDR2 = 1) generate ddr2delay : delay_wire generic map(data_width => ddr_dq'length, delay_atob => 0.0, delay_btoa => 0.0) port map(a => ddr_dq, b => ddr_dq2); end generate; dqdel : if (CFG_MIG_DDR2 = 0) generate ddr2delay : delay_wire generic map(data_width => ddr_dq'length, delay_atob => 0.0, delay_btoa => 4.5) port map(a => ddr_dq, b => ddr_dq2); end generate; sram01 : for i in 0 to 1 generate sr0 : sram generic map (index => i, abits => sramdepth, fname => sramfile) port map (sram_flash_addr(sramdepth downto 1), sram_flash_data(15-i*8 downto 8-i*8), sram_cen, sram_bw(i+2), sram_oen); end generate; sram23 : for i in 2 to 3 generate sr0 : sram generic map (index => i, abits => sramdepth, fname => sramfile) port map (sram_flash_addr(sramdepth downto 1), sram_flash_data(47-i*8 downto 40-i*8), sram_cen, sram_bw(i-2), sram_oen); end generate; prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (sram_flash_addr(romdepth-1 downto 0), sram_flash_data(15 downto 0), gnd, gnd, flash_cen, sram_flash_we_n, flash_oen); phy0 : if (CFG_GRETH = 1) generate phy_mii_data <= 'H'; p0: phy generic map (address => 7) port map(sys_rst_in, phy_mii_data, phy_tx_clk, phy_rx_clk, phy_rx_data, phy_dv, phy_rx_er, phy_col, phy_crs, phy_tx_data, phy_tx_en, phy_tx_er, phy_mii_clk, phy_gtx_clk); end generate; -- p0: phy -- port map(rst, led_cfg, open, etx_clk, erx_clk, erxd, erx_dv, -- erx_er, erx_col, erx_crs, etxd, etx_en, etx_er, emdc); i0: i2c_slave_model port map (iic_scl_main, iic_sda_main); iuerr : process begin wait for 5000 ns; if to_x01(bus_error(0)) = '0' then wait on bus_error; end if; assert (to_x01(bus_error(0)) = '0') report "*** IU in error mode, simulation halted ***" severity failure ; end process; data <= sram_flash_data(15 downto 0) & sram_flash_data(31 downto 16); address <= sram_flash_addr & '0'; test0 : grtestmod port map ( sys_rst_in, sys_clk, bus_error(0), sram_flash_addr(20 downto 1), data, iosn, flash_oen, sram_bw(0), open); sram_flash_data <= buskeep(sram_flash_data), (others => 'H') after 250 ns; -- ddr_dq <= buskeep(ddr_dq), (others => 'H') after 250 ns; data <= buskeep(data), (others => 'H') after 250 ns; end ;
gpl-2.0
fd9e1e4c858302fdc84dd1a881737e65
0.615955
2.953141
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep2sgx90-av/testbench.vhd
1
14,212
------------------------------------------------------------------------------ -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Aeroflex Gaisler ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library cypress; use cypress.components.all; library hynix; use hynix.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 10; -- system clock period romwidth : integer := 8; -- rom data width (8/32) romdepth : integer := 21; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 20; -- ram address depth srambanks : integer := 4 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal clkout, pllref : std_ulogic; signal Rst : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal dsuen, dsutx, dsurx, dsuact : std_ulogic; signal dsurst : std_ulogic; signal test : std_ulogic; signal error : std_logic; signal gpio : std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal clk2 : std_ulogic := '1'; signal debugout : std_logic_vector(31 downto 0); -- External Adress/data bus, flash+ssram signal fs_addr : std_logic_vector(24 downto 0); signal fs_data : std_logic_vector(31 downto 0); signal io_cen : std_logic; signal flash_cen : std_ulogic; signal flash_oen : std_ulogic; signal flash_wen : std_ulogic; signal ssram_cen : std_logic; signal ssram_wen : std_logic; signal ssram_bw : std_logic_vector (0 to 3); signal ssram_oen : std_ulogic; signal ssram_clk : std_ulogic; signal ssram_adscn : std_ulogic; signal ssram_adspn : std_ulogic; signal ssram_advn : std_ulogic; signal datazz : std_logic_vector(3 downto 0); signal flash_addr : std_logic_vector(romdepth downto 0); -- muxed data bus signal prd : std_logic_vector(31 downto 0); signal ssd : std_logic_vector(31 downto 0); -- ddr memory signal ddr_clk : std_logic_vector(2 downto 0); signal ddr_clkb : std_logic_vector(2 downto 0); signal ddr_cke : std_logic_vector(1 downto 0); signal ddr_csb : std_logic_vector(1 downto 0); signal ddr_odt : std_logic_vector(1 downto 0); signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (7 downto 0); -- ddr dm signal ddr_dqs : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_dqsn : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_rdqs : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (13 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1 downto 0); -- ddr bank address signal ddr_dq, ddr_dq2 : std_logic_vector (63 downto 0); -- ddr data signal phy_gtx_clk : std_logic; signal phy_mii_data : std_logic; -- ethernet PHY interface signal phy_tx_clk : std_ulogic; signal phy_rx_clk : std_ulogic; signal phy_rx_data : std_logic_vector(7 downto 0); signal phy_dv : std_ulogic; signal phy_rx_er : std_ulogic; signal phy_col : std_ulogic; signal phy_crs : std_ulogic; signal phy_tx_data : std_logic_vector(7 downto 0); signal phy_tx_en : std_ulogic; signal phy_tx_er : std_ulogic; signal phy_mii_clk : std_ulogic; signal ft245_data : std_logic_vector (7 downto 0); signal ft245_rdn : std_logic; signal ft245_wr : std_logic; signal ft245_rxfn : std_logic; signal ft245_txen : std_logic; signal ft245_pwrenn : std_logic; signal plllock : std_ulogic; signal txd1, rxd1 : std_ulogic; --signal txd2, rxd2 : std_ulogic; constant lresp : boolean := false; signal sa : std_logic_vector(14 downto 0); signal sd : std_logic_vector(31 downto 0); component sram32 is generic ( index : integer := 0; -- Byte lane (0 - 3) abits: Positive := 10; -- Default 10 address bits (1Kx32) echk : integer := 0; -- Generate EDAC checksum tacc : integer := 10; -- access time (ns) fname : string := "ram.dat"); -- File to read from port ( a : in std_logic_vector(abits-1 downto 0); d : inout std_logic_vector(31 downto 0); lb : in std_logic; ub : in std_logic; ce : in std_logic; we : in std_ulogic; oe : in std_ulogic); end component; begin -- clock and reset -- 100 MHz clk <= not clk after 5 ns; -- ddr_clkin <= not clk after ct * 1 ns; rst <= dsurst; rxd1 <= '1'; -- ddr_dqs <= (others => 'L'); d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, ncpu, disas, dbguart, pclow ) port map ( resetn => rst, clk => clk, errorn => error, fs_addr => fs_addr, fs_data => fs_data, io_cen => io_cen, flash_cen => flash_cen, flash_oen => flash_oen, flash_wen => flash_wen, ssram_cen => ssram_cen, ssram_wen => ssram_wen, ssram_bw => ssram_bw, ssram_oen => ssram_oen, ssram_clk => ssram_clk, ssram_adscn => ssram_adscn, ssram_adspn => ssram_adspn, ssram_advn => ssram_advn, ddr_clk => ddr_clk, ddr_clkb => ddr_clkb, ddr_cke => ddr_cke, ddr_csb => ddr_csb, ddr_odt => ddr_odt, ddr_web => ddr_web, -- ddr write enable ddr_rasb => ddr_rasb, -- ddr ras ddr_casb => ddr_casb, -- ddr cas ddr_dm => ddr_dm, -- ddr dm ddr_dqs => ddr_dqs, -- ddr dqs ddr_ad => ddr_ad, -- ddr address ddr_ba => ddr_ba, -- ddr bank address ddr_dq => ddr_dq, -- ddr data phy_gtx_clk => phy_gtx_clk, phy_mii_data => phy_mii_data, phy_tx_clk => phy_tx_clk, phy_rx_clk => phy_rx_clk, phy_rx_data => phy_rx_data, phy_dv => phy_dv, phy_rx_er => phy_rx_er, phy_col => phy_col, phy_crs => phy_crs, phy_tx_data => phy_tx_data, phy_tx_en => phy_tx_en, phy_tx_er => phy_tx_er, phy_mii_clk => phy_mii_clk, dsuact => dsuact, rxd1 => rxd1, txd1 => txd1, gpio => gpio, ft245_data => ft245_data, ft245_rdn => ft245_rdn, ft245_wr => ft245_wr, ft245_rxfn => ft245_rxfn, ft245_txen => ft245_txen, ft245_pwrenn => ft245_pwrenn ); datazz <= "HHHH"; ssram0 : cy7c1380d generic map (fname => sramfile) port map( ioDq(35 downto 32) => datazz, ioDq(31 downto 0) => fs_data, iAddr => fs_addr(19 downto 1), iMode => gnd, inGW => vcc, inBWE => ssram_wen, inADV => ssram_advn, inADSP => ssram_adspn, inADSC => ssram_adscn, iClk => ssram_clk, inBwa => ssram_bw(3), inBwb => ssram_bw(2), inBwc => ssram_bw(1), inBwd => ssram_bw(0), inOE => ssram_oen, inCE1 => ssram_cen, iCE2 => vcc, inCE3 => gnd, iZz => gnd); -- 16 bit prom flash_addr <= '0'&fs_addr(romdepth-1 downto 0); prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (a => flash_addr(romdepth-1 downto 0), d => fs_data(31 downto 16), lb => '0', ub => '0', ce => flash_cen, we => flash_wen, oe => flash_oen); -- prd(23 downto 0) <= (others => '0'); -- data mux -- fs_data <= ssd when ssram_oen='0' and ssram_cen='0' else -- prd when flash_oen='0' and flash_cen='0' else -- (others => 'Z'); -- data <= buskeep(data), (others => 'H') after 250 ns; test0 : grtestmod port map ( rst, clk, error, fs_addr(20 downto 1), fs_data, io_cen, flash_oen, flash_wen, open); error <= 'H'; -- ERROR pull-up ddr2delay : delay_wire generic map(data_width => ddr_dq'length, delay_atob => 0.0, delay_btoa => 2.5) port map(a => ddr_dq, b => ddr_dq2); --DDR2 ddr2mem : for i in 0 to 3 generate u1 : HY5PS121621F generic map (TimingCheckFlag => false, PUSCheckFlag => false, index => 3-i, fname => sdramfile) port map (DQ => ddr_dq2(i*16+15 downto i*16), LDQS => ddr_dqs(i*2), LDQSB => ddr_dqsn(i*2), UDQS => ddr_dqs(i*2+1), UDQSB => ddr_dqsn(i*2+1), LDM => ddr_dm(i*2), WEB => ddr_web, CASB => ddr_casb, RASB => ddr_rasb, CSB => ddr_csb(0), BA => ddr_ba, ADDR => ddr_ad(12 downto 0), CKE => ddr_cke(0), CLK => ddr_clk(0), CLKB => ddr_clkb(0), UDM => ddr_dm(i*2+1)); -- PORT MAP( -- ck => ddr_clk(0), ck_n => ddr_clkb(0), cke => ddr_cke(0), cs_n => ddr_csb(0), -- ras_n => ddr_rasb, cas_n => ddr_casb, we_n => ddr_web, -- dm_rdqs => ddr_dm(i*2+1 downto i*2), ba => ddr_ba, -- addr => ddr_ad(12 downto 0), dq => ddr_dq(i*16+15 downto i*16), -- dqs => ddr_dqs(i*2+1 downto i*2), dqs_n => ddr_dqsn(i*2+1 downto i*2), -- rdqs_n => ddr_rdqs(i*2+1 downto i*2), odt => ddr_odt(0)); end generate; -- ddr_dq <= buskeep(ddr_dq), (others => 'H') after 250 ns; ddr_dqsn <= (others => 'U'); iuerr : process begin wait for 2500 ns; if to_x01(error) = '1' then wait on error; end if; assert (to_x01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; sd <= buskeep(sd), (others => 'H') after 250 ns; dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; wait for 500 ns; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#02#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#24#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#03#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#fc#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#2f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#6f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#11#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#00#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#04#, txp); txa(dsutx, 16#00#, 16#02#, 16#20#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#02#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#43#, 16#10#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#24#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#70#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#03#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
b253ee10ec0092ddf9271c53821f7b7c
0.565508
3.033511
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-ztex-ufm-111/ahb2mig_ztex.vhd
1
15,265
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: ahb2mig_ztex -- File: ahb2mig_ztex.vhd -- Author: Jiri Gaisler - Aeroflex Gaisler AB -- -- This is a AHB-2.0 interface for the Xilinx Spartan-6 MIG. -- One bidir 32-bit port is used for the main AHB bus. ------------------------------------------------------------------------------- -- Patched for ZTEX: Oleg Belousov <[email protected]> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; entity ahb2mig_ztex is generic( hindex : integer := 0; haddr : integer := 0; hmask : integer := 16#f00#; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff# ); port( mcb3_dram_dq : inout std_logic_vector(15 downto 0); mcb3_rzq : inout std_logic; mcb3_dram_udqs : inout std_logic; mcb3_dram_dqs : inout std_logic; mcb3_dram_a : out std_logic_vector(12 downto 0); mcb3_dram_ba : out std_logic_vector(1 downto 0); mcb3_dram_cke : out std_logic; mcb3_dram_ras_n : out std_logic; mcb3_dram_cas_n : out std_logic; mcb3_dram_we_n : out std_logic; mcb3_dram_dm : out std_logic; mcb3_dram_udm : out std_logic; mcb3_dram_ck : out std_logic; mcb3_dram_ck_n : out std_logic; ahbso : out ahb_slv_out_type; ahbsi : in ahb_slv_in_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; calib_done : out std_logic; test_error : out std_logic; rst_n_syn : in std_logic; rst_n_async : in std_logic; clk_amba : in std_logic; clk_mem : in std_logic ); end ; architecture rtl of ahb2mig_ztex is component mig_37 generic( C3_P0_MASK_SIZE : integer := 4; C3_P0_DATA_PORT_SIZE : integer := 32; C3_P1_MASK_SIZE : integer := 4; C3_P1_DATA_PORT_SIZE : integer := 32; C3_MEMCLK_PERIOD : integer := 5000; C3_RST_ACT_LOW : integer := 0; C3_INPUT_CLK_TYPE : string := "SINGLE_ENDED"; C3_CALIB_SOFT_IP : string := "TRUE"; C3_SIMULATION : string := "FALSE"; DEBUG_EN : integer := 0; C3_MEM_ADDR_ORDER : string := "ROW_BANK_COLUMN"; C3_NUM_DQ_PINS : integer := 16; C3_MEM_ADDR_WIDTH : integer := 13; C3_MEM_BANKADDR_WIDTH : integer := 2 ); port ( mcb3_dram_dq : inout std_logic_vector(C3_NUM_DQ_PINS-1 downto 0); mcb3_dram_a : out std_logic_vector(C3_MEM_ADDR_WIDTH-1 downto 0); mcb3_dram_ba : out std_logic_vector(C3_MEM_BANKADDR_WIDTH-1 downto 0); mcb3_dram_cke : out std_logic; mcb3_dram_ras_n : out std_logic; mcb3_dram_cas_n : out std_logic; mcb3_dram_we_n : out std_logic; mcb3_dram_dm : out std_logic; mcb3_dram_udqs : inout std_logic; mcb3_rzq : inout std_logic; mcb3_dram_udm : out std_logic; c3_sys_clk : in std_logic; c3_sys_rst_n : in std_logic; c3_calib_done : out std_logic; c3_clk0 : out std_logic; c3_rst0 : out std_logic; mcb3_dram_dqs : inout std_logic; mcb3_dram_ck : out std_logic; mcb3_dram_ck_n : out std_logic; c3_p0_cmd_clk : in std_logic; c3_p0_cmd_en : in std_logic; c3_p0_cmd_instr : in std_logic_vector(2 downto 0); c3_p0_cmd_bl : in std_logic_vector(5 downto 0); c3_p0_cmd_byte_addr : in std_logic_vector(29 downto 0); c3_p0_cmd_empty : out std_logic; c3_p0_cmd_full : out std_logic; c3_p0_wr_clk : in std_logic; c3_p0_wr_en : in std_logic; c3_p0_wr_mask : in std_logic_vector(C3_P0_MASK_SIZE - 1 downto 0); c3_p0_wr_data : in std_logic_vector(C3_P0_DATA_PORT_SIZE - 1 downto 0); c3_p0_wr_full : out std_logic; c3_p0_wr_empty : out std_logic; c3_p0_wr_count : out std_logic_vector(6 downto 0); c3_p0_wr_underrun : out std_logic; c3_p0_wr_error : out std_logic; c3_p0_rd_clk : in std_logic; c3_p0_rd_en : in std_logic; c3_p0_rd_data : out std_logic_vector(C3_P0_DATA_PORT_SIZE - 1 downto 0); c3_p0_rd_full : out std_logic; c3_p0_rd_empty : out std_logic; c3_p0_rd_count : out std_logic_vector(6 downto 0); c3_p0_rd_overflow : out std_logic; c3_p0_rd_error : out std_logic ); end component; type bstate_type is (idle, start, read1); constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIGDDR2, 0, 0, 0), 4 => ahb_membar(haddr, '1', '1', hmask), -- 5 => ahb_iobar(ioaddr, iomask), others => zero32); constant pconfig : apb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIGDDR2, 0, 0, 0), 1 => apb_iobar(paddr, pmask)); type reg_type is record bstate : bstate_type; cmd_bl : std_logic_vector(5 downto 0); wr_count : std_logic_vector(6 downto 0); rd_cnt : std_logic_vector(5 downto 0); hready : std_logic; hsel : std_logic; hwrite : std_logic; htrans : std_logic_vector(1 downto 0); hburst : std_logic_vector(2 downto 0); hsize : std_logic_vector(2 downto 0); hrdata : std_logic_vector(31 downto 0); haddr : std_logic_vector(31 downto 0); hmaster : std_logic_vector(3 downto 0); end record; type mcb_type is record cmd_en : std_logic; cmd_instr : std_logic_vector(2 downto 0); cmd_empty : std_logic; cmd_full : std_logic; cmd_bl : std_logic_vector(5 downto 0); cmd_byte_addr : std_logic_vector(29 downto 0); wr_full : std_logic; wr_empty : std_logic; wr_underrun : std_logic; wr_error : std_logic; wr_mask : std_logic_vector(3 downto 0); wr_en : std_logic; wr_data : std_logic_vector(31 downto 0); wr_count : std_logic_vector(6 downto 0); rd_data : std_logic_vector(31 downto 0); rd_full : std_logic; rd_empty : std_logic; rd_count : std_logic_vector(6 downto 0); rd_overflow : std_logic; rd_error : std_logic; rd_en : std_logic; end record; signal r, rin : reg_type; signal i : mcb_type; begin comb: process( rst_n_syn, r, ahbsi, i ) variable v : reg_type; variable wmask : std_logic_vector(3 downto 0); variable wr_en : std_logic; variable cmd_en : std_logic; variable cmd_instr : std_logic_vector(2 downto 0); variable rd_en : std_logic; variable cmd_bl : std_logic_vector(5 downto 0); variable hwdata : std_logic_vector(31 downto 0); variable readdata : std_logic_vector(31 downto 0); begin v := r; wr_en := '0'; cmd_en := '0'; cmd_instr := "000"; rd_en := '0'; if (ahbsi.hready = '1') then if (ahbsi.hsel(hindex) and ahbsi.htrans(1)) = '1' then v.hsel := '1'; v.hburst := ahbsi.hburst; v.hwrite := ahbsi.hwrite; v.hsize := ahbsi.hsize; v.hmaster := ahbsi.hmaster; v.hready := '0'; if ahbsi.htrans(0) = '0' then v.haddr := ahbsi.haddr; end if; else v.hsel := '0'; v.hready := '1'; end if; v.htrans := ahbsi.htrans; end if; hwdata := ahbsi.hwdata(15 downto 0) & ahbsi.hwdata(31 downto 16); case r.hsize(1 downto 0) is when "00" => wmask := not decode(r.haddr(1 downto 0)); case r.haddr(1 downto 0) is when "00" => wmask := "1101"; when "01" => wmask := "1110"; when "10" => wmask := "0111"; when others => wmask := "1011"; end case; when "01" => wmask := not decode(r.haddr(1 downto 0)); wmask(3) := wmask(2); wmask(1) := wmask(0); when others => wmask := "0000"; end case; i.wr_mask <= wmask; cmd_bl := r.cmd_bl; case r.bstate is when idle => if v.hsel = '1' then v.bstate := start; v.hready := ahbsi.hwrite and not i.cmd_full and not i.wr_full; v.haddr := ahbsi.haddr; end if; v.cmd_bl := (others => '0'); when start => if r.hwrite = '1' then v.haddr := r.haddr; if r.hready = '1' then v.cmd_bl := r.cmd_bl + 1; v.hready := '1'; wr_en := '1'; if (ahbsi.htrans /= "11") then if v.hsel = '1' then if (ahbsi.hwrite = '0') or (i.wr_count >= "0000100") then v.hready := '0'; else v.hready := '1'; end if; else v.bstate := idle; end if; v.cmd_bl := (others => '0'); v.haddr := ahbsi.haddr; cmd_en := '1'; elsif (i.cmd_full = '1') then v.hready := '0'; elsif (i.wr_count >= "0101111") then v.hready := '0'; cmd_en := '1'; v.cmd_bl := (others => '0'); v.haddr := ahbsi.haddr; end if; else if (i.cmd_full = '0') and (i.wr_count <= "0001111") then v.hready := '1'; end if; end if; else if i.cmd_full = '0' then cmd_en := '1'; cmd_instr(0) := '1'; v.cmd_bl := "000" & not r.haddr(4 downto 2); cmd_bl := v.cmd_bl; v.bstate := read1; end if; end if; when read1 => v.hready := '0'; if (r.rd_cnt = "000000") then -- flush data from previous line if (i.rd_empty = '0') or ((r.hready = '1') and (ahbsi.htrans /= "11")) then v.hrdata(31 downto 0) := i.rd_data(15 downto 0) & i.rd_data(31 downto 16); v.hready := '1'; if (i.rd_empty = '0') then v.cmd_bl := r.cmd_bl - 1; rd_en := '1'; end if; if (r.cmd_bl = "000000") or (ahbsi.htrans /= "11") then if (ahbsi.hsel(hindex) = '1') and (ahbsi.htrans = "10") and (r.hready = '1') then v.bstate := start; v.hready := ahbsi.hwrite and not i.cmd_full and not i.wr_full; v.cmd_bl := (others => '0'); else v.bstate := idle; end if; if (i.rd_empty = '1') then v.rd_cnt := r.cmd_bl + 1; else v.rd_cnt := r.cmd_bl; end if; end if; end if; end if; when others => end case; readdata := (others => '0'); -- case apbi.paddr(5 downto 2) is -- when "0000" => readdata(nbits-1 downto 0) := r.din2; -- when "0001" => readdata(nbits-1 downto 0) := r.dout; -- when others => -- end case; readdata(20 downto 0) := i.rd_error & i.rd_overflow & i.wr_error & i.wr_underrun & i.cmd_full & i.rd_full & i.rd_empty & i.wr_full & i.wr_empty & r.rd_cnt & r.cmd_bl; if (r.rd_cnt /= "000000") and (i.rd_empty = '0') then rd_en := '1'; v.rd_cnt := r.rd_cnt - 1; end if; if rst_n_syn = '0' then v.rd_cnt := "000000"; v.bstate := idle; v.hready := '1'; end if; rin <= v; apbo.prdata <= readdata; i.rd_en <= rd_en; i.wr_en <= wr_en; i.cmd_bl <= cmd_bl; i.cmd_en <= cmd_en; i.cmd_instr <= cmd_instr; i.wr_data <= hwdata; end process; i.cmd_byte_addr <= r.haddr(29 downto 2) & "00"; ahbso.hready <= r.hready; ahbso.hresp <= "00"; --r.hresp; ahbso.hrdata <= r.hrdata; ahbso.hconfig <= hconfig; ahbso.hirq <= (others => '0'); ahbso.hindex <= hindex; ahbso.hsplit <= (others => '0'); apbo.pirq <= (others => '0'); apbo.pindex <= pindex; apbo.pconfig <= pconfig; regs : process(clk_amba) begin if rising_edge(clk_amba) then r <= rin; end if; end process; MCB_inst : entity work.mig_37 generic map( C3_RST_ACT_LOW => 1, -- pragma translate_off C3_SIMULATION => "TRUE", -- pragma translate_on C3_MEM_ADDR_ORDER => "BANK_ROW_COLUMN" ) port map ( mcb3_dram_dq => mcb3_dram_dq, mcb3_rzq => mcb3_rzq, mcb3_dram_udqs => mcb3_dram_udqs, mcb3_dram_dqs => mcb3_dram_dqs, mcb3_dram_a => mcb3_dram_a, mcb3_dram_ba => mcb3_dram_ba, mcb3_dram_cke => mcb3_dram_cke, mcb3_dram_ras_n => mcb3_dram_ras_n, mcb3_dram_cas_n => mcb3_dram_cas_n, mcb3_dram_we_n => mcb3_dram_we_n, mcb3_dram_dm => mcb3_dram_dm, mcb3_dram_udm => mcb3_dram_udm, mcb3_dram_ck => mcb3_dram_ck, mcb3_dram_ck_n => mcb3_dram_ck_n, c3_sys_clk => clk_mem, c3_sys_rst_n => rst_n_async, c3_calib_done => calib_done, c3_clk0 => open, c3_rst0 => open, c3_p0_cmd_clk => clk_amba, c3_p0_cmd_en => i.cmd_en, c3_p0_cmd_instr => i.cmd_instr, c3_p0_cmd_bl => i.cmd_bl, c3_p0_cmd_byte_addr => i.cmd_byte_addr, c3_p0_cmd_empty => i.cmd_empty, c3_p0_cmd_full => i.cmd_full, c3_p0_wr_clk => clk_amba, c3_p0_wr_en => i.wr_en, c3_p0_wr_mask => i.wr_mask, c3_p0_wr_data => i.wr_data, c3_p0_wr_full => i.wr_full, c3_p0_wr_empty => i.wr_empty, c3_p0_wr_count => i.wr_count, c3_p0_wr_underrun => i.wr_underrun, c3_p0_wr_error => i.wr_error, c3_p0_rd_clk => clk_amba, c3_p0_rd_en => i.rd_en, c3_p0_rd_data => i.rd_data, c3_p0_rd_full => i.rd_full, c3_p0_rd_empty => i.rd_empty, c3_p0_rd_count => i.rd_count, c3_p0_rd_overflow => i.rd_overflow, c3_p0_rd_error => i.rd_error ); end;
gpl-2.0
0d8ee04b3145a5c453bfee4cd99b7b05
0.507304
3.04569
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys4/leon3mp.vhd
1
24,478
------------------------------------------------------------------------------ -- LEON3 Demonstration design -- Copyright (C) 2013 Aeroflex Gaisler ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- 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 2 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, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.spi.all; use gaisler.net.all; use gaisler.jtag.all; --pragma translate_off use gaisler.sim.all; library unisim; use unisim.BUFG; use unisim.PLLE2_ADV; --pragma translate_on library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( clk : in std_ulogic; -- onBoard Cellular RAM, Numonyx StrataFlash and Numonyx Quad Flash RamOE : out std_ulogic; RamWE : out std_ulogic; RamAdv : out std_ulogic; RamCE : out std_ulogic; RamClk : out std_ulogic; RamCRE : out std_ulogic; RamLB : out std_ulogic; RamUB : out std_ulogic; --RamWait : in std_ulogic; --QspiCSn : out std_ulogic; --QspiSCK : out std_ulogic; --QspiDB : inout std_logic_vector(3 downto 0); address : out std_logic_vector(22 downto 0); data : inout std_logic_vector(15 downto 0); -- 7 segment display --seg : out std_logic_vector(6 downto 0); --an : out std_logic_vector(7 downto 0); -- LEDs Led : out std_logic_vector(15 downto 0); -- Switches sw : in std_logic_vector(15 downto 0); -- Buttons btnCpuResetn : in std_ulogic; btn : in std_logic_vector(4 downto 0); -- VGA Connector --vgaRed : out std_logic_vector(2 downto 0); --vgaGreen : out std_logic_vector(2 downto 0); --vgaBlue : out std_logic_vector(2 downto 1); --Hsync : out std_ulogic; --Vsync : out std_ulogic; -- 12 pin connectors --ja : inout std_logic_vector(7 downto 0); --jb : inout std_logic_vector(7 downto 0); --jc : inout std_logic_vector(7 downto 0); --jd : inout std_logic_vector(7 downto 0); -- SMSC ethernet PHY PhyRstn : out std_ulogic; PhyCrs : in std_ulogic; PhyClk50Mhz : out std_ulogic; PhyTxd : out std_logic_vector(1 downto 0); PhyTxEn : out std_ulogic; PhyRxd : in std_logic_vector(1 downto 0); PhyRxEr : in std_ulogic; PhyMdc : out std_ulogic; PhyMdio : inout std_logic; -- Pic USB-HID interface --~ PS2KeyboardData : inout std_logic; --~ PS2KeyboardClk : inout std_logic; --~ PS2MouseData : inout std_logic; --~ PS2MouseClk : inout std_logic; --~ PicGpio : out std_logic_vector(1 downto 0); -- USB-RS232 interface RsRx : in std_logic; RsTx : out std_logic ); end; architecture rtl of leon3mp is component PLLE2_ADV generic ( BANDWIDTH : string := "OPTIMIZED"; CLKFBOUT_MULT : integer := 5; CLKFBOUT_PHASE : real := 0.0; CLKIN1_PERIOD : real := 0.0; CLKIN2_PERIOD : real := 0.0; CLKOUT0_DIVIDE : integer := 1; CLKOUT0_DUTY_CYCLE : real := 0.5; CLKOUT0_PHASE : real := 0.0; CLKOUT1_DIVIDE : integer := 1; CLKOUT1_DUTY_CYCLE : real := 0.5; CLKOUT1_PHASE : real := 0.0; CLKOUT2_DIVIDE : integer := 1; CLKOUT2_DUTY_CYCLE : real := 0.5; CLKOUT2_PHASE : real := 0.0; CLKOUT3_DIVIDE : integer := 1; CLKOUT3_DUTY_CYCLE : real := 0.5; CLKOUT3_PHASE : real := 0.0; CLKOUT4_DIVIDE : integer := 1; CLKOUT4_DUTY_CYCLE : real := 0.5; CLKOUT4_PHASE : real := 0.0; CLKOUT5_DIVIDE : integer := 1; CLKOUT5_DUTY_CYCLE : real := 0.5; CLKOUT5_PHASE : real := 0.0; COMPENSATION : string := "ZHOLD"; DIVCLK_DIVIDE : integer := 1; REF_JITTER1 : real := 0.0; REF_JITTER2 : real := 0.0; STARTUP_WAIT : string := "FALSE" ); port ( CLKFBOUT : out std_ulogic := '0'; CLKOUT0 : out std_ulogic := '0'; CLKOUT1 : out std_ulogic := '0'; CLKOUT2 : out std_ulogic := '0'; CLKOUT3 : out std_ulogic := '0'; CLKOUT4 : out std_ulogic := '0'; CLKOUT5 : out std_ulogic := '0'; DO : out std_logic_vector (15 downto 0); DRDY : out std_ulogic := '0'; LOCKED : out std_ulogic := '0'; CLKFBIN : in std_ulogic; CLKIN1 : in std_ulogic; CLKIN2 : in std_ulogic; CLKINSEL : in std_ulogic; DADDR : in std_logic_vector(6 downto 0); DCLK : in std_ulogic; DEN : in std_ulogic; DI : in std_logic_vector(15 downto 0); DWE : in std_ulogic; PWRDWN : in std_ulogic; RST : in std_ulogic ); end component; component BUFG port (O : out std_logic; I : in std_logic); end component; signal CLKFBOUT : std_logic; signal CLKFBIN : std_logic; signal eth_pll_rst : std_logic; signal eth_clk_nobuf : std_logic; signal eth_clk90_nobuf : std_logic; signal eth_clk : std_logic; signal eth_clk90 : std_logic; signal vcc : std_logic; signal gnd : std_logic; signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, dui : uart_in_type; signal u1o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ndsuact : std_ulogic; signal ethi : eth_in_type; signal etho : eth_out_type; signal gpti : gptimer_in_type; signal spii : spi_in_type; signal spio : spi_out_type; signal slvsel : std_logic_vector(CFG_SPICTRL_SLVS-1 downto 0); signal spmi : spimctrl_in_type; signal spmo : spimctrl_out_type; signal clkm, rstn, clkml : std_ulogic; signal tck, tms, tdi, tdo : std_ulogic; signal rstraw : std_logic; signal btnCpuReset : std_logic; signal lock : std_logic; -- RS232 APB Uart signal rxd1 : std_logic; signal txd1 : std_logic; attribute keep : boolean; attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of lock : signal is true; attribute syn_keep of clkml : signal is true; attribute syn_keep of clkm : signal is true; attribute syn_preserve of clkml : signal is true; attribute syn_preserve of clkm : signal is true; attribute keep of lock : signal is true; attribute keep of clkml : signal is true; attribute keep of clkm : signal is true; constant BOARD_FREQ : integer := 100000; -- CLK input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= '1'; gnd <= '0'; led(15 downto 4) <= (others =>'0'); -- unused leds off btnCpuReset<= not btnCpuResetn; cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; rst0 : rstgen generic map (acthigh => 1) port map (btnCpuReset, clkm, lock, rstn, rstraw); lock <= cgo.clklock; -- clock generator clkgen0 : clkgen generic map (fabtech, CFG_CLKMUL, CFG_CLKDIV, 0, 0, 0, 0, 0, BOARD_FREQ, 0) port map (clk, gnd, clkm, open, open, open, open, cgi, cgo, open, open, open); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => 1, nahbm => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- -- LEON3 processor leon3gen : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; led(3) <= not dbgo(0).error; led(2) <= not dsuo.active; -- LEON3 Debug Support Unit dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); --dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsui.enable <= '1'; end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; -- Debug UART dcomgen : if CFG_AHB_UART = 1 generate dcom0 : ahbuart generic map (hindex => CFG_NCPU, pindex => 4, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (RsRx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (RsTx, duo.txd); led(0) <= not dui.rxd; led(1) <= not duo.txd; end generate; nouah : if CFG_AHB_UART = 0 generate apbo(4) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 5, pindex => 0, paddr => 0, rommask => 0, iomask => 0, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT,srbanks=>1) port map (rstn, clkm, memi, memo, ahbsi, ahbso(5), apbi, apbo(0), wpo, open); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "01"; mg0 : if (CFG_MCTRL_LEON2 = 0) generate apbo(0) <= apb_none; ahbso(5) <= ahbs_none; memo.bdrive(0) <= '1'; end generate; mgpads : if (CFG_MCTRL_LEON2 /= 0) generate addr_pad : outpadv generic map (tech => padtech, width => 23) port map (address, memo.address(23 downto 1)); oen_pad : outpad generic map (tech => padtech) port map (RamOE, memo.oen); cs_pad : outpad generic map (tech => padtech) port map (RamCE, memo.ramsn(0)); lb_pad : outpad generic map (tech => padtech) port map (RamLB, memo.mben(0)); ub_pad : outpad generic map (tech => padtech) port map (RamUB, memo.mben(1)); wri_pad : outpad generic map (tech => padtech) port map (RamWE, memo.writen); end generate; bdr : iopadv generic map (tech => padtech, width => 8) port map (data(7 downto 0), memo.data(23 downto 16), memo.bdrive(1), memi.data(23 downto 16)); bdr2 : iopadv generic map (tech => padtech, width => 8) port map (data(15 downto 8), memo.data(31 downto 24), memo.bdrive(0), memi.data(31 downto 24)); RamCRE <= '0'; RamClk <= '0'; RamAdv <= '0'; ---------------------------------------------------------------------- --- DDR2 memory controller ------------------------------------------ ---------------------------------------------------------------------- noddr : if (CFG_DDR2SP+CFG_MIG_DDR2) = 0 generate lock <= '1'; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- -- APB Bridge apb0 : apbctrl generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo); -- Interrupt controller irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; -- Time Unit gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; -- serrx_pad : inpad generic map (tech => padtech) port map (dsurx, rxd1); -- sertx_pad : outpad generic map (tech => padtech) port map (dsutx, txd1); -- led(0) <= not rxd1; -- led(1) <= not txd1; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; nospi: if CFG_SPICTRL_ENABLE = 0 and CFG_SPIMCTRL = 0 generate apbo(7) <= apb_none; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : grethm generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, pindex => 15, paddr => 15, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, phyrstadr => 7, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL, giga => CFG_GRETH1G, rmii => 1) port map(rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); PhyRstn<=rstn; end generate; etxc_pad : outpad generic map (tech => padtech) port map (PhyClk50Mhz, eth_clk); ethpads : if (CFG_GRETH = 1) generate emdio_pad : iopad generic map (tech => padtech) port map (PhyMdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); ethi.rmii_clk<=eth_clk90; erxd_pad : inpadv generic map (tech => padtech, width => 2) --8 port map (PhyRxd, ethi.rxd(1 downto 0)); erxer_pad : inpad generic map (tech => padtech) port map (PhyRxEr, ethi.rx_er); erxcr_pad : inpad generic map (tech => padtech) port map (PhyCrs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 2) port map (PhyTxd, etho.txd(1 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map (PhyTxEn, etho.tx_en); emdc_pad : outpad generic map (tech => padtech) port map (PhyMdc, etho.mdc); end generate; ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ahbramgen : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 3, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map (rstn, clkm, ahbsi, ahbso(3)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(3) <= ahbs_none; end generate; ----------------------------------------------------------------------- -- Test report module, only used for simulation ---------------------- ----------------------------------------------------------------------- --pragma translate_off test0 : ahbrep generic map (hindex => 4, haddr => 16#200#) port map (rstn, clkm, ahbsi, ahbso(4)); --pragma translate_on ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+1) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Demonstration design for Digilent NEXYS 3 board", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on ----------------------------------------------------------------------- --- Ethernet Clock Generation --------------------------------------- ----------------------------------------------------------------------- -- 50 MHz clock for output bufgclk0 : BUFG port map (I => eth_clk_nobuf, O => eth_clk); -- 50 MHz with +90 deg phase for Rx GRETH bufgclk45 : BUFG port map (I => eth_clk90_nobuf, O => eth_clk90); CLKFBIN <= CLKFBOUT; eth_pll_rst <= not cgi.pllrst; PLLE2_ADV_inst : PLLE2_ADV generic map ( BANDWIDTH => "OPTIMIZED", -- OPTIMIZED, HIGH, LOW CLKFBOUT_MULT => 8, -- Multiply value for all CLKOUT, (2-64) CLKFBOUT_PHASE => 0.0, -- Phase offset in degrees of CLKFB, (-360.000-360.000). -- CLKIN_PERIOD: Input clock period in nS to ps resolution (i.e. 33.333 is 30 MHz). CLKIN1_PERIOD => 1000000.0/real(100000.0), CLKIN2_PERIOD => 0.0, -- CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: Divide amount for CLKOUT (1-128) CLKOUT0_DIVIDE => 16, CLKOUT1_DIVIDE => 16, CLKOUT2_DIVIDE => 1, CLKOUT3_DIVIDE => 1, CLKOUT4_DIVIDE => 1, CLKOUT5_DIVIDE => 1, -- CLKOUT0_DUTY_CYCLE - CLKOUT5_DUTY_CYCLE: Duty cycle for CLKOUT outputs (0.001-0.999). CLKOUT0_DUTY_CYCLE => 0.5, CLKOUT1_DUTY_CYCLE => 0.5, CLKOUT2_DUTY_CYCLE => 0.5, CLKOUT3_DUTY_CYCLE => 0.5, CLKOUT4_DUTY_CYCLE => 0.5, CLKOUT5_DUTY_CYCLE => 0.5, -- CLKOUT0_PHASE - CLKOUT5_PHASE: Phase offset for CLKOUT outputs (-360.000-360.000). CLKOUT0_PHASE => 0.0, CLKOUT1_PHASE => 90.0, CLKOUT2_PHASE => 0.0, CLKOUT3_PHASE => 0.0, CLKOUT4_PHASE => 0.0, CLKOUT5_PHASE => 0.0, COMPENSATION => "ZHOLD", -- ZHOLD, BUF_IN, EXTERNAL, INTERNAL DIVCLK_DIVIDE => 1, -- Master division value (1-56) -- REF_JITTER: Reference input jitter in UI (0.000-0.999). REF_JITTER1 => 0.0, REF_JITTER2 => 0.0, STARTUP_WAIT => "TRUE" -- Delay DONE until PLL Locks, ("TRUE"/"FALSE") ) port map ( -- Clock Outputs: 1-bit (each) output: User configurable clock outputs CLKOUT0 => eth_clk_nobuf, CLKOUT1 => eth_clk90_nobuf, CLKOUT2 => open, CLKOUT3 => open, CLKOUT4 => open, CLKOUT5 => open, -- DRP Ports: 16-bit (each) output: Dynamic reconfigration ports DO => open, DRDY => open, -- Feedback Clocks: 1-bit (each) output: Clock feedback ports CLKFBOUT => CLKFBOUT, -- Status Ports: 1-bit (each) output: PLL status ports LOCKED => open, -- Clock Inputs: 1-bit (each) input: Clock inputs CLKIN1 => clk, CLKIN2 => '0', -- Con trol Ports: 1-bit (each) input: PLL control ports CLKINSEL => '1', PWRDWN => '0', RST => eth_pll_rst, -- DRP Ports: 7-bit (each) input: Dynamic reconfigration ports DADDR => "0000000", DCLK => '0', DEN => '0', DI => "0000000000000000", DWE => '0', -- Feedback Clocks: 1-bit (each) input: Clock feedback ports CLKFBIN => CLKFBIN ); end rtl;
gpl-2.0
5cb8e258b8802b6fbcc426c0ac3357ea
0.521938
3.843907
false
false
false
false