content
stringlengths
1
1.04M
-- File: inc_comb.vhd -- Generated by MyHDL 0.8dev -- Date: Fri Dec 21 15:02:39 2012 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use std.textio.all; use work.pck_myhdl_08.all; entity inc_comb is port ( nextCount: out unsigned(7 downto 0); count: in unsigned(7 downto 0) ); end entity inc_comb; architecture MyHDL of inc_comb is begin nextCount <= (count + 1) mod 256; end architecture MyHDL;
-- File: inc_comb.vhd -- Generated by MyHDL 0.8dev -- Date: Fri Dec 21 15:02:39 2012 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use std.textio.all; use work.pck_myhdl_08.all; entity inc_comb is port ( nextCount: out unsigned(7 downto 0); count: in unsigned(7 downto 0) ); end entity inc_comb; architecture MyHDL of inc_comb is begin nextCount <= (count + 1) mod 256; end architecture MyHDL;
-- File: inc_comb.vhd -- Generated by MyHDL 0.8dev -- Date: Fri Dec 21 15:02:39 2012 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use std.textio.all; use work.pck_myhdl_08.all; entity inc_comb is port ( nextCount: out unsigned(7 downto 0); count: in unsigned(7 downto 0) ); end entity inc_comb; architecture MyHDL of inc_comb is begin nextCount <= (count + 1) mod 256; end architecture MyHDL;
-- File: inc_comb.vhd -- Generated by MyHDL 0.8dev -- Date: Fri Dec 21 15:02:39 2012 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use std.textio.all; use work.pck_myhdl_08.all; entity inc_comb is port ( nextCount: out unsigned(7 downto 0); count: in unsigned(7 downto 0) ); end entity inc_comb; architecture MyHDL of inc_comb is begin nextCount <= (count + 1) mod 256; end architecture MyHDL;
-- File: inc_comb.vhd -- Generated by MyHDL 0.8dev -- Date: Fri Dec 21 15:02:39 2012 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use std.textio.all; use work.pck_myhdl_08.all; entity inc_comb is port ( nextCount: out unsigned(7 downto 0); count: in unsigned(7 downto 0) ); end entity inc_comb; architecture MyHDL of inc_comb is begin nextCount <= (count + 1) mod 256; end architecture MyHDL;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.nano_cpu_pkg.all; use work.io_bus_pkg.all; library unisim; use unisim.vcomponents.all; entity nano is port ( clock : in std_logic; reset : in std_logic; -- i/o interface io_addr : out unsigned(7 downto 0); io_write : out std_logic; io_read : out std_logic; io_wdata : out std_logic_vector(15 downto 0); io_rdata : in std_logic_vector(15 downto 0); stall : in std_logic; -- system interface (to write code into the nano) sys_clock : in std_logic := '0'; sys_reset : in std_logic := '0'; sys_io_req : in t_io_req := c_io_req_init; sys_io_resp : out t_io_resp ); end entity; architecture structural of nano is signal sys_enable : std_logic; signal sys_bram_addr : std_logic_vector(10 downto 0); -- instruction/data ram signal ram_addr : std_logic_vector(9 downto 0); signal ram_en : std_logic; signal ram_we : std_logic; signal ram_wdata : std_logic_vector(15 downto 0); signal ram_rdata : std_logic_vector(15 downto 0); signal sys_io_req_bram : t_io_req; signal sys_io_resp_bram : t_io_resp; signal sys_io_req_regs : t_io_req; signal sys_io_resp_regs : t_io_resp; signal sys_core_reset : std_logic; signal usb_reset_tig : std_logic; signal usb_core_reset : std_logic; signal bram_reset : std_logic; signal bram_data : std_logic_vector(7 downto 0); begin i_split: entity work.io_bus_splitter generic map ( g_range_lo => 11, g_range_hi => 11, g_ports => 2 ) port map ( clock => sys_clock, req => sys_io_req, resp => sys_io_resp, reqs(0) => sys_io_req_bram, reqs(1) => sys_io_req_regs, resps(0) => sys_io_resp_bram, resps(1) => sys_io_resp_regs ); i_core: entity work.nano_cpu port map ( clock => clock, reset => usb_core_reset, -- instruction/data ram ram_addr => ram_addr, ram_en => ram_en, ram_we => ram_we, ram_wdata => ram_wdata, ram_rdata => ram_rdata, -- i/o interface io_addr => io_addr, io_write => io_write, io_read => io_read, io_wdata => io_wdata, io_rdata => io_rdata, stall => stall ); i_buf_ram: RAMB16_S9_S18 generic map ( INIT_00 => X"A028A02783E60AA7E8C1A0CA0AC3C0180BFFA03783E60AA4A0C40AB9A0CA0AB2", INIT_01 => X"E84D0AB0C0262AB27893E026A0CA0AAEE00B83E683FD0AA4C0100BFDE9EAE8F7", INIT_02 => X"0AA4C8352AA7783FE84D08F5A0C40AC1A0CA0AC3E028A0CA0AB2C0262AA67893", INIT_03 => X"C03CE854C8420BFDA02883E60AA5A03EA0263AA55AA5E028C0312AA7783F83E6", INIT_04 => X"08ECE8E780ECE05AA03EE84D0AA6A02783E60AA7E8AA83E683FD0AA4E028A028", INIT_05 => X"C8630BFCC8420BFDC840E854B800A03783E6A03ED859783EB800C84E80EC5AA5", INIT_06 => X"C87E52A60BFEA0C488CA80CA4AC92AA70BFEA03783E61AA80BE6E05AE9EAE8F7", INIT_07 => X"C828E854A03EE074E8E7C87D2AA7783F80CA5AA5C07D08CA80CA0AB0A0260AA5", INIT_08 => X"E099C87E52A52AA7783FE8E7C87E52A52AA7783FC8900BFEC09A0BFCC8420BFD", INIT_09 => X"E8C1A030E84D0AB8A020A031A025C87E52A62AA7783FE8E7C87E52A62AA7783F", INIT_0A => X"E0B283FE0AA4C0B02AA6783FE05A83E62ACB0BE6E8E7E8E7A027D8A15AA50ABB", INIT_0B => X"80EC5AA508ECE8E7D0CB7839C0E10BFEA039A02980EC0ACAA0C40ABC83FE0AA5", INIT_0C => X"08F6A020A03183FE0AA60000B800A03EA0C488CA80CA4AC62AA7A0260BFEC8BA", INIT_0D => X"0AA7A030E0D1C8DB5AA50AC7A021C0DE80EC5AA508ECC8D35AA50AC7A03180EC", INIT_0E => X"00400045004600000000B800D8E85AA50ABDE0C1C8E180EC5AA508ECE8E780EC", INIT_0F => X"81E10BF281E00BF181DF0BF0B800C8FA0BF0004B15E000500055005500560050", INIT_10 => X"B80083F00AA483F209E183F709E6E91081E50BF681E40BF581E30BF481E20BF3", INIT_11 => X"A06309E5A06109DEA07009E4A07109E3D18B09DF81DC0AA481DB0AA7A06209E0", INIT_12 => X"C96F52B6C13B52B5C14252B4C14852A42AAA81E6D9247864C93509E5A06009DF", INIT_13 => X"09DFA0631AAD09E5E8E7C93052B12AAA81E6D9357864E11C81DB5AA5C16F09DB", INIT_14 => X"2ABA39E609DF81DB0AA781DD2ACD09E6E16FC91C2AB309DFC91C09DCE124A060", INIT_15 => X"49DD09DCA0724AA7C16109DDA07409DED956783DC1612AB609DF81DD0AA4C153", INIT_16 => X"783DD91C51E209DDD16FC16F81E159DD09E181DE4AB609DE81DF3ABA09DF81DC", INIT_17 => X"4AA781DD09E2D17E51E209E1A07409DE81E72AA7A07009E4A07109E3B800D96F", INIT_18 => X"19DE1AB4C98F09DDE972B80081E36AA409E381E449DD09E4A0734AA749E72ACC", INIT_19 => X"09E5E972C19F81E159DD09E181DE4AB609DEA06009DFD993783DA06309E5A061", INIT_1A => X"81E6D9AD7864E1CA52B6C1D252B4C1D852B5C1C052B12AAA81E6D9A17864C9AD", INIT_1B => X"E1D581DB5AA5C1CA09DBE1A1A0602AB709DFE8E7A0631AAD09E5C9CA52B12AAA", INIT_1C => X"18EB2AAB09E680EB2ABA09DFC98C09E181DC49DD09DC81DB0AA781DF3ABA09DF", INIT_1D => X"00000000000000000000E1B6C1C009E5E1A1A06009DFC1CA2AB309DFB80081E6", INIT_1E => X"80EB89E881E90AA481E80AC00000000000000000000000000000000000000000", INIT_1F => X"00000000B800C9EE52BF81E84AAC09E881E94AA509E9CA012ABEC9EE50EB89E8", INIT_20 => X"DA1F51FE59FF783B81FF88EB80EB4AA909E881FE88EB80EB4AA809E881DF0000", INIT_21 => X"783BB80090EB09FE80EB4AA409E881FEB80090EB09FE80EB4AA909E881FEE1F5", INIT_22 => X"81E36AA409E381E449E40A00E1F5CA4B2AB189E8CA312AB409DFC1F5EA92EA11", INIT_23 => X"09DFE910EA70EA2AEA2AEA2A81E36AA40BE481E44BE58200EA88C1F5EA85B800", INIT_24 => X"6AA40BE081E44BE30BE1E1F5EA8DA028EA9709DCEA9719E90A00C26509DCEA18", INIT_25 => X"83E34AAF0BE3A028EA9709DCEA9719E90BE3C26509DCEA1809DFE910EA7081E3", INIT_26 => X"E1F5A028EA9709E6EA9719E90AC8C1F552B42AAA09E6E1F583E30AA4C9F553E2", INIT_27 => X"09E881E288EB80EB4AA709E881E188EB80EB4AA609E881E088EB80EB4AA509E8", INIT_28 => X"2AC44AA50BFAB8008AA382A34AC20BFAB8003BFA0BFBB80081E588EB80EB4AB2", INIT_29 => X"2AC54AA50BF992A30AA282A34ABF0BF982A2B8003BF82AC54AA50BF9B80083FA", INIT_2A => X"0010000E00800008F7FF700000050004000300020001000000000000B80083F9", INIT_2B => X"0320FDFF0751005000200800004500A0FFBF4000300020000400000610000FA0", INIT_2C => X"0000000003FFFFFCFFFB007800F1FFF002EE00ED007F003F006603A0006102E0", INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000" ) port map ( CLKB => clock, SSRB => reset, ENB => ram_en, WEB => ram_we, ADDRB => ram_addr, DIB => ram_wdata, DIPB => "00", DOB => ram_rdata, CLKA => sys_clock, SSRA => sys_reset, ENA => sys_enable, WEA => sys_io_req_bram.write, ADDRA => sys_bram_addr, DIA => sys_io_req_bram.data, DIPA => "0", DOA => bram_data ); sys_bram_addr(10 downto 1) <= std_logic_vector(sys_io_req_bram.address(10 downto 1)); sys_bram_addr(0) <= not sys_io_req_bram.address(0); sys_enable <= sys_io_req_bram.write or sys_io_req_bram.read; bram_reset <= not sys_enable; sys_io_resp_bram.data <= bram_data when sys_io_resp_bram.ack = '1' else X"00"; process(sys_clock) begin if rising_edge(sys_clock) then sys_io_resp_bram.ack <= sys_enable; sys_io_resp_regs <= c_io_resp_init; sys_io_resp_regs.ack <= sys_io_req_regs.write or sys_io_req_regs.read; if sys_io_req_regs.write = '1' then -- any address sys_core_reset <= not sys_io_req_regs.data(0); end if; if sys_reset = '1' then sys_core_reset <= '1'; end if; end if; end process; process(clock) begin if rising_edge(clock) then usb_reset_tig <= sys_core_reset; usb_core_reset <= usb_reset_tig; end if; end process; end architecture;
-- Copyright (C) 1991-2011 Altera Corporation -- Your use of Altera Corporation's design tools, logic functions -- and other software and tools, and its AMPP partner logic -- functions, and any output files from any of the foregoing -- (including device programming or simulation files), and any -- associated documentation or information are expressly subject -- to the terms and conditions of the Altera Program License -- Subscription Agreement, Altera MegaCore Function License -- Agreement, or other applicable license agreement, including, -- without limitation, that your use is for the sole purpose of -- programming logic devices manufactured by Altera and sold by -- Altera or its authorized distributors. Please refer to the -- applicable agreement for further details. -- Quartus II 11.0 Build 157 04/27/2011 library IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; package arriaii_atom_pack is function str_to_bin (lut_mask : string ) return std_logic_vector; function product(list : std_logic_vector) return std_logic ; function alt_conv_integer(arg : in std_logic_vector) return integer; -- default generic values CONSTANT DefWireDelay : VitalDelayType01 := (0 ns, 0 ns); CONSTANT DefPropDelay01 : VitalDelayType01 := (0 ns, 0 ns); CONSTANT DefPropDelay01Z : VitalDelayType01Z := (OTHERS => 0 ns); CONSTANT DefSetupHoldCnst : TIME := 0 ns; CONSTANT DefPulseWdthCnst : TIME := 0 ns; -- default control options -- CONSTANT DefGlitchMode : VitalGlitchKindType := OnEvent; -- change default delay type to Transport : for spr 68748 CONSTANT DefGlitchMode : VitalGlitchKindType := VitalTransport; CONSTANT DefGlitchMsgOn : BOOLEAN := FALSE; CONSTANT DefGlitchXOn : BOOLEAN := FALSE; CONSTANT DefMsgOnChecks : BOOLEAN := TRUE; CONSTANT DefXOnChecks : BOOLEAN := TRUE; -- output strength mapping -- UX01ZWHL- CONSTANT PullUp : VitalOutputMapType := "UX01HX01X"; CONSTANT NoPullUpZ : VitalOutputMapType := "UX01ZX01X"; CONSTANT PullDown : VitalOutputMapType := "UX01LX01X"; -- primitive result strength mapping CONSTANT wiredOR : VitalResultMapType := ( 'U', 'X', 'L', '1' ); CONSTANT wiredAND : VitalResultMapType := ( 'U', 'X', '0', 'H' ); CONSTANT L : VitalTableSymbolType := '0'; CONSTANT H : VitalTableSymbolType := '1'; CONSTANT x : VitalTableSymbolType := '-'; CONSTANT S : VitalTableSymbolType := 'S'; CONSTANT R : VitalTableSymbolType := '/'; CONSTANT U : VitalTableSymbolType := 'X'; CONSTANT V : VitalTableSymbolType := 'B'; -- valid clock signal (non-rising) -- Declare array types for CAM_SLICE TYPE arriaii_mem_data IS ARRAY (0 to 31) of STD_LOGIC_VECTOR (31 downto 0); function int2str( value : integer ) return string; function map_x_to_0 (value : std_logic) return std_logic; function SelectDelay (CONSTANT Paths: IN VitalPathArray01Type) return TIME; function int2bit (arg : boolean) return std_logic; function int2bit (arg : integer) return std_logic; function bin2int (s : std_logic_vector) return integer; function bin2int (s : std_logic) return integer; function int2bin (arg : integer; size : integer) return std_logic_vector; function int2bin (arg : boolean; size : integer) return std_logic_vector; function calc_sum_len( widtha : integer; widthb : integer) return integer; end arriaii_atom_pack; library IEEE; use IEEE.std_logic_1164.all; package body arriaii_atom_pack is type masklength is array (4 downto 1) of std_logic_vector(3 downto 0); function str_to_bin (lut_mask : string) return std_logic_vector is variable slice : masklength := (OTHERS => "0000"); variable mask : std_logic_vector(15 downto 0); begin for i in 1 to lut_mask'length loop case lut_mask(i) is when '0' => slice(i) := "0000"; when '1' => slice(i) := "0001"; when '2' => slice(i) := "0010"; when '3' => slice(i) := "0011"; when '4' => slice(i) := "0100"; when '5' => slice(i) := "0101"; when '6' => slice(i) := "0110"; when '7' => slice(i) := "0111"; when '8' => slice(i) := "1000"; when '9' => slice(i) := "1001"; when 'a' => slice(i) := "1010"; when 'A' => slice(i) := "1010"; when 'b' => slice(i) := "1011"; when 'B' => slice(i) := "1011"; when 'c' => slice(i) := "1100"; when 'C' => slice(i) := "1100"; when 'd' => slice(i) := "1101"; when 'D' => slice(i) := "1101"; when 'e' => slice(i) := "1110"; when 'E' => slice(i) := "1110"; when others => slice(i) := "1111"; end case; end loop; mask := (slice(1) & slice(2) & slice(3) & slice(4)); return (mask); end str_to_bin; function product (list: std_logic_vector) return std_logic is begin for i in 0 to 31 loop if list(i) = '0' then return ('0'); end if; end loop; return ('1'); end product; function alt_conv_integer(arg : in std_logic_vector) return integer is variable result : integer; begin result := 0; for i in arg'range loop if arg(i) = '1' then result := result + 2**i; end if; end loop; return result; end alt_conv_integer; function int2str( value : integer ) return string is variable ivalue,index : integer; variable digit : integer; variable line_no: string(8 downto 1) := " "; begin ivalue := value; index := 1; if (ivalue = 0) then line_no := " 0"; end if; while (ivalue > 0) loop digit := ivalue MOD 10; ivalue := ivalue/10; case digit is when 0 => line_no(index) := '0'; when 1 => line_no(index) := '1'; when 2 => line_no(index) := '2'; when 3 => line_no(index) := '3'; when 4 => line_no(index) := '4'; when 5 => line_no(index) := '5'; when 6 => line_no(index) := '6'; when 7 => line_no(index) := '7'; when 8 => line_no(index) := '8'; when 9 => line_no(index) := '9'; when others => ASSERT FALSE REPORT "Illegal number!" SEVERITY ERROR; end case; index := index + 1; end loop; return line_no; end; function map_x_to_0 (value : std_logic) return std_logic is begin if (Is_X (value) = TRUE) then return '0'; else return value; end if; end; function SelectDelay (CONSTANT Paths : IN VitalPathArray01Type) return TIME IS variable Temp : TIME; variable TransitionTime : TIME := TIME'HIGH; variable PathDelay : TIME := TIME'HIGH; begin for i IN Paths'RANGE loop next when not Paths(i).PathCondition; next when Paths(i).InputChangeTime > TransitionTime; Temp := Paths(i).PathDelay(tr01); if Paths(i).InputChangeTime < TransitionTime then PathDelay := Temp; else if Temp < PathDelay then PathDelay := Temp; end if; end if; TransitionTime := Paths(i).InputChangeTime; end loop; return PathDelay; end; function int2bit (arg : integer) return std_logic is variable int_val : integer := arg; variable result : std_logic; begin if (int_val = 0) then result := '0'; else result := '1'; end if; return result; end int2bit; function int2bit (arg : boolean) return std_logic is variable int_val : boolean := arg; variable result : std_logic; begin if (int_val ) then result := '1'; else result := '0'; end if; return result; end int2bit; function bin2int (s : std_logic_vector) return integer is constant temp : std_logic_vector(s'high-s'low DOWNTO 0) := s; variable result : integer := 0; begin for i in temp'range loop if (temp(i) = '1') then result := result + (2**i); end if; end loop; return(result); end bin2int; function bin2int (s : std_logic) return integer is constant temp : std_logic := s; variable result : integer := 0; begin if (temp = '1') then result := 1; else result := 0; end if; return(result); end bin2int; function int2bin (arg : integer; size : integer) return std_logic_vector is variable int_val : integer := arg; variable result : std_logic_vector(size-1 downto 0); begin for i in 0 to result'left loop if ((int_val mod 2) = 0) then result(i) := '0'; else result(i) := '1'; end if; int_val := int_val/2; end loop; return result; end int2bin; function int2bin (arg : boolean; size : integer) return std_logic_vector is variable result : std_logic_vector(size-1 downto 0); begin if(arg)then result := (OTHERS => '1'); else result := (OTHERS => '0'); end if; return result; end int2bin; function calc_sum_len( widtha : integer; widthb : integer) return integer is variable result: integer; begin if(widtha >= widthb) then result := widtha + 1; else result := widthb + 1; end if; return result; end calc_sum_len; end arriaii_atom_pack; Library ieee; use ieee.std_logic_1164.all; Package arriaii_pllpack is procedure find_simple_integer_fraction( numerator : in integer; denominator : in integer; max_denom : in integer; fraction_num : out integer; fraction_div : out integer); procedure find_m_and_n_4_manual_phase ( inclock_period : in integer; vco_phase_shift_step : in integer; clk0_mult: in integer; clk1_mult: in integer; clk2_mult: in integer; clk3_mult: in integer; clk4_mult: in integer; clk5_mult: in integer; clk6_mult: in integer; clk7_mult: in integer; clk8_mult: in integer; clk9_mult: in integer; clk0_div : in integer; clk1_div : in integer; clk2_div : in integer; clk3_div : in integer; clk4_div : in integer; clk5_div : in integer; clk6_div : in integer; clk7_div : in integer; clk8_div : in integer; clk9_div : in integer; clk0_used : in string; clk1_used : in string; clk2_used : in string; clk3_used : in string; clk4_used : in string; clk5_used : in string; clk6_used : in string; clk7_used : in string; clk8_used : in string; clk9_used : in string; m : out integer; n : out integer ); function gcd (X: integer; Y: integer) return integer; function count_digit (X: integer) return integer; function scale_num (X: integer; Y: integer) return integer; function lcm (A1: integer; A2: integer; A3: integer; A4: integer; A5: integer; A6: integer; A7: integer; A8: integer; A9: integer; A10: integer; P: integer) return integer; function output_counter_value (clk_divide: integer; clk_mult : integer ; M: integer; N: integer ) return integer; function counter_mode (duty_cycle: integer; output_counter_value: integer) return string; function counter_high (output_counter_value: integer := 1; duty_cycle: integer) return integer; function counter_low (output_counter_value: integer; duty_cycle: integer) return integer; function mintimedelay (t1: integer; t2: integer; t3: integer; t4: integer; t5: integer; t6: integer; t7: integer; t8: integer; t9: integer; t10: integer) return integer; function maxnegabs (t1: integer; t2: integer; t3: integer; t4: integer; t5: integer; t6: integer; t7: integer; t8: integer; t9: integer; t10: integer) return integer; function counter_time_delay ( clk_time_delay: integer; m_time_delay: integer; n_time_delay: integer) return integer; function get_phase_degree (phase_shift: integer; clk_period: integer) return integer; function counter_initial (tap_phase: integer; m: integer; n: integer) return integer; function counter_ph (tap_phase: integer; m : integer; n: integer) return integer; function ph_adjust (tap_phase: integer; ph_base : integer) return integer; function translate_string (mode : string) return string; function str2int (s : string) return integer; function dqs_str2int (s : string) return integer; end arriaii_pllpack; package body arriaii_pllpack is -- finds the closest integer fraction of a given pair of numerator and denominator. procedure find_simple_integer_fraction( numerator : in integer; denominator : in integer; max_denom : in integer; fraction_num : out integer; fraction_div : out integer) is constant MAX_ITER : integer := 20; type INT_ARRAY is array ((MAX_ITER-1) downto 0) of integer; variable quotient_array : INT_ARRAY; variable int_loop_iter : integer; variable int_quot : integer; variable m_value : integer; variable d_value : integer; variable old_m_value : integer; variable swap : integer; variable loop_iter : integer; variable num : integer; variable den : integer; variable i_max_iter : integer; begin loop_iter := 0; if (numerator = 0) then num := 1; else num := numerator; end if; if (denominator = 0) then den := 1; else den := denominator; end if; i_max_iter := max_iter; while (loop_iter < i_max_iter) loop int_quot := num / den; quotient_array(loop_iter) := int_quot; num := num - (den*int_quot); loop_iter := loop_iter+1; if ((num = 0) or (max_denom /= -1) or (loop_iter = i_max_iter)) then -- calculate the numerator and denominator if there is a restriction on the -- max denom value or if the loop is ending m_value := 0; d_value := 1; -- get the rounded value at this stage for the remaining fraction if (den /= 0) then m_value := (2*num/den); end if; -- calculate the fraction numerator and denominator at this stage for int_loop_iter in (loop_iter-1) downto 0 loop if (m_value = 0) then m_value := quotient_array(int_loop_iter); d_value := 1; else old_m_value := m_value; m_value := (quotient_array(int_loop_iter)*m_value) + d_value; d_value := old_m_value; end if; end loop; -- if the denominator is less than the maximum denom_value or if there is no restriction save it if ((d_value <= max_denom) or (max_denom = -1)) then if ((m_value = 0) or (d_value = 0)) then fraction_num := numerator; fraction_div := denominator; else fraction_num := m_value; fraction_div := d_value; end if; end if; -- end the loop if the denomitor has overflown or the numerator is zero (no remainder during this round) if (((d_value > max_denom) and (max_denom /= -1)) or (num = 0)) then i_max_iter := loop_iter; end if; end if; -- swap the numerator and denominator for the next round swap := den; den := num; num := swap; end loop; end find_simple_integer_fraction; -- find the M and N values for Manual phase based on the following 5 criterias: -- 1. The PFD frequency (i.e. Fin / N) must be in the range 5 MHz to 720 MHz -- 2. The VCO frequency (i.e. Fin * M / N) must be in the range 300 MHz to 1300 MHz -- 3. M is less than 512 -- 4. N is less than 512 -- 5. It's the smallest M/N which satisfies all the above constraints, and is within 2ps -- of the desired vco-phase-shift-step procedure find_m_and_n_4_manual_phase ( inclock_period : in integer; vco_phase_shift_step : in integer; clk0_mult: in integer; clk1_mult: in integer; clk2_mult: in integer; clk3_mult: in integer; clk4_mult: in integer; clk5_mult: in integer; clk6_mult: in integer; clk7_mult: in integer; clk8_mult: in integer; clk9_mult: in integer; clk0_div : in integer; clk1_div : in integer; clk2_div : in integer; clk3_div : in integer; clk4_div : in integer; clk5_div : in integer; clk6_div : in integer; clk7_div : in integer; clk8_div : in integer; clk9_div : in integer; clk0_used : in string; clk1_used : in string; clk2_used : in string; clk3_used : in string; clk4_used : in string; clk5_used : in string; clk6_used : in string; clk7_used : in string; clk8_used : in string; clk9_used : in string; m : out integer; n : out integer ) is constant MAX_M : integer := 511; constant MAX_N : integer := 511; constant MAX_PFD : integer := 720; constant MIN_PFD : integer := 5; constant MAX_VCO : integer := 1600; -- max vco frequency. (in mHz) constant MIN_VCO : integer := 300; -- min vco frequency. (in mHz) constant MAX_OFFSET : real := 0.004; variable vco_period : integer; variable pfd_freq : integer; variable vco_freq : integer; variable vco_ps_step_value : integer; variable i_m : integer; variable i_n : integer; variable i_pre_m : integer; variable i_pre_n : integer; variable closest_vco_step_value : integer; variable i_max_iter : integer; variable loop_iter : integer; variable clk0_div_factor_real : real; variable clk1_div_factor_real : real; variable clk2_div_factor_real : real; variable clk3_div_factor_real : real; variable clk4_div_factor_real : real; variable clk5_div_factor_real : real; variable clk6_div_factor_real : real; variable clk7_div_factor_real : real; variable clk8_div_factor_real : real; variable clk9_div_factor_real : real; variable clk0_div_factor_int : integer; variable clk1_div_factor_int : integer; variable clk2_div_factor_int : integer; variable clk3_div_factor_int : integer; variable clk4_div_factor_int : integer; variable clk5_div_factor_int : integer; variable clk6_div_factor_int : integer; variable clk7_div_factor_int : integer; variable clk8_div_factor_int : integer; variable clk9_div_factor_int : integer; begin vco_period := vco_phase_shift_step * 8; i_pre_m := 0; i_pre_n := 0; closest_vco_step_value := 0; LOOP_1 : for i_n_out in 1 to MAX_N loop for i_m_out in 1 to MAX_M loop clk0_div_factor_real := real(clk0_div * i_m_out) / real(clk0_mult * i_n_out); clk1_div_factor_real := real(clk1_div * i_m_out) / real(clk1_mult * i_n_out); clk2_div_factor_real := real(clk2_div * i_m_out) / real(clk2_mult * i_n_out); clk3_div_factor_real := real(clk3_div * i_m_out) / real(clk3_mult * i_n_out); clk4_div_factor_real := real(clk4_div * i_m_out) / real(clk4_mult * i_n_out); clk5_div_factor_real := real(clk5_div * i_m_out) / real(clk5_mult * i_n_out); clk6_div_factor_real := real(clk6_div * i_m_out) / real(clk6_mult * i_n_out); clk7_div_factor_real := real(clk7_div * i_m_out) / real(clk7_mult * i_n_out); clk8_div_factor_real := real(clk8_div * i_m_out) / real(clk8_mult * i_n_out); clk9_div_factor_real := real(clk9_div * i_m_out) / real(clk9_mult * i_n_out); clk0_div_factor_int := integer(clk0_div_factor_real); clk1_div_factor_int := integer(clk1_div_factor_real); clk2_div_factor_int := integer(clk2_div_factor_real); clk3_div_factor_int := integer(clk3_div_factor_real); clk4_div_factor_int := integer(clk4_div_factor_real); clk5_div_factor_int := integer(clk5_div_factor_real); clk6_div_factor_int := integer(clk6_div_factor_real); clk7_div_factor_int := integer(clk7_div_factor_real); clk8_div_factor_int := integer(clk8_div_factor_real); clk9_div_factor_int := integer(clk9_div_factor_real); if (((abs(clk0_div_factor_real - real(clk0_div_factor_int)) < MAX_OFFSET) or (clk0_used = "unused")) and ((abs(clk1_div_factor_real - real(clk1_div_factor_int)) < MAX_OFFSET) or (clk1_used = "unused")) and ((abs(clk2_div_factor_real - real(clk2_div_factor_int)) < MAX_OFFSET) or (clk2_used = "unused")) and ((abs(clk3_div_factor_real - real(clk3_div_factor_int)) < MAX_OFFSET) or (clk3_used = "unused")) and ((abs(clk4_div_factor_real - real(clk4_div_factor_int)) < MAX_OFFSET) or (clk4_used = "unused")) and ((abs(clk5_div_factor_real - real(clk5_div_factor_int)) < MAX_OFFSET) or (clk5_used = "unused")) and ((abs(clk6_div_factor_real - real(clk6_div_factor_int)) < MAX_OFFSET) or (clk6_used = "unused")) and ((abs(clk7_div_factor_real - real(clk7_div_factor_int)) < MAX_OFFSET) or (clk7_used = "unused")) and ((abs(clk8_div_factor_real - real(clk8_div_factor_int)) < MAX_OFFSET) or (clk8_used = "unused")) and ((abs(clk9_div_factor_real - real(clk9_div_factor_int)) < MAX_OFFSET) or (clk9_used = "unused")) ) then if ((i_m_out /= 0) and (i_n_out /= 0)) then pfd_freq := 1000000 / (inclock_period * i_n_out); vco_freq := (1000000 * i_m_out) / (inclock_period * i_n_out); vco_ps_step_value := (inclock_period * i_n_out) / (8 * i_m_out); if ( (i_m_out < max_m) and (i_n_out < max_n) and (pfd_freq >= min_pfd) and (pfd_freq <= max_pfd) and (vco_freq >= min_vco) and (vco_freq <= max_vco) ) then if (abs(vco_ps_step_value - vco_phase_shift_step) <= 2) then i_pre_m := i_m_out; i_pre_n := i_n_out; exit LOOP_1; else if ((closest_vco_step_value = 0) or (abs(vco_ps_step_value - vco_phase_shift_step) < abs(closest_vco_step_value - vco_phase_shift_step))) then i_pre_m := i_m_out; i_pre_n := i_n_out; closest_vco_step_value := vco_ps_step_value; end if; end if; end if; end if; end if; end loop; end loop; if ((i_pre_m /= 0) and (i_pre_n /= 0)) then find_simple_integer_fraction(i_pre_m, i_pre_n, MAX_N, m, n); else n := 1; m := lcm (clk0_mult, clk1_mult, clk2_mult, clk3_mult, clk4_mult, clk5_mult, clk6_mult, clk7_mult, clk8_mult, clk9_mult, inclock_period); end if; end find_m_and_n_4_manual_phase; -- find the greatest common denominator of X and Y function gcd (X: integer; Y: integer) return integer is variable L, S, R, G : integer := 1; begin if (X < Y) then -- find which is smaller. S := X; L := Y; else S := Y; L := X; end if; R := S; while ( R > 1) loop S := L; L := R; R := S rem L; -- divide bigger number by smaller. -- remainder becomes smaller number. end loop; if (R = 0) then -- if evenly divisible then L is gcd else it is 1. G := L; else G := R; end if; return G; end gcd; -- count the number of digits in the given integer function count_digit (X: integer) return integer is variable count, result: integer := 0; begin result := X; while (result /= 0) loop result := (result / 10); count := count + 1; end loop; return count; end count_digit; -- reduce the given huge number to Y significant digits function scale_num (X: integer; Y: integer) return integer is variable count : integer := 0; variable lc, fac_ten, result: integer := 1; begin count := count_digit(X); for lc in 1 to (count-Y) loop fac_ten := fac_ten * 10; end loop; result := (X / fac_ten); return result; end scale_num; -- find the least common multiple of A1 to A10 function lcm (A1: integer; A2: integer; A3: integer; A4: integer; A5: integer; A6: integer; A7: integer; A8: integer; A9: integer; A10: integer; P: integer) return integer is variable M1, M2, M3, M4, M5 , M6, M7, M8, M9, R: integer := 1; begin M1 := (A1 * A2)/gcd(A1, A2); M2 := (M1 * A3)/gcd(M1, A3); M3 := (M2 * A4)/gcd(M2, A4); M4 := (M3 * A5)/gcd(M3, A5); M5 := (M4 * A6)/gcd(M4, A6); M6 := (M5 * A7)/gcd(M5, A7); M7 := (M6 * A8)/gcd(M6, A8); M8 := (M7 * A9)/gcd(M7, A9); M9 := (M8 * A10)/gcd(M8, A10); if (M9 < 3) then R := 10; elsif (M9 = 3) then R := 9; elsif ((M9 <= 10) and (M9 > 3)) then R := 4 * M9; elsif (M9 > 1000) then R := scale_num(M9,3); else R := M9 ; end if; return R; end lcm; -- find the factor of division of the output clock frequency compared to the VCO function output_counter_value (clk_divide: integer; clk_mult: integer ; M: integer; N: integer ) return integer is variable r_real : real := 1.0; variable r: integer := 1; begin r_real := real(clk_divide * M)/ real(clk_mult * N); r := integer(r_real); return R; end output_counter_value; -- find the mode of each PLL counter - bypass, even or odd function counter_mode (duty_cycle: integer; output_counter_value: integer) return string is variable R: string (1 to 6) := " "; variable counter_value: integer := 1; begin counter_value := (2*duty_cycle*output_counter_value)/100; if output_counter_value = 1 then R := "bypass"; elsif (counter_value REM 2) = 0 then R := " even"; else R := " odd"; end if; return R; end counter_mode; -- find the number of VCO clock cycles to hold the output clock high function counter_high (output_counter_value: integer := 1; duty_cycle: integer) return integer is variable R: integer := 1; variable half_cycle_high : integer := 1; begin half_cycle_high := (duty_cycle * output_counter_value *2)/100 ; if (half_cycle_high REM 2 = 0) then R := half_cycle_high/2 ; else R := (half_cycle_high/2) + 1; end if; return R; end; -- find the number of VCO clock cycles to hold the output clock low function counter_low (output_counter_value: integer; duty_cycle: integer) return integer is variable R, R1: integer := 1; variable half_cycle_high : integer := 1; begin half_cycle_high := (duty_cycle * output_counter_value*2)/100 ; if (half_cycle_high REM 2 = 0) then R1 := half_cycle_high/2 ; else R1 := (half_cycle_high/2) + 1; end if; R := output_counter_value - R1; if (R = 0) then R := 1; end if; return R; end; -- find the smallest time delay amongst t1 to t10 function mintimedelay (t1: integer; t2: integer; t3: integer; t4: integer; t5: integer; t6: integer; t7: integer; t8: integer; t9: integer; t10: integer) return integer is variable m1,m2,m3,m4,m5,m6,m7,m8,m9 : integer := 0; begin if (t1 < t2) then m1 := t1; else m1 := t2; end if; if (m1 < t3) then m2 := m1; else m2 := t3; end if; if (m2 < t4) then m3 := m2; else m3 := t4; end if; if (m3 < t5) then m4 := m3; else m4 := t5; end if; if (m4 < t6) then m5 := m4; else m5 := t6; end if; if (m5 < t7) then m6 := m5; else m6 := t7; end if; if (m6 < t8) then m7 := m6; else m7 := t8; end if; if (m7 < t9) then m8 := m7; else m8 := t9; end if; if (m8 < t10) then m9 := m8; else m9 := t10; end if; if (m9 > 0) then return m9; else return 0; end if; end; -- find the numerically largest negative number, and return its absolute value function maxnegabs (t1: integer; t2: integer; t3: integer; t4: integer; t5: integer; t6: integer; t7: integer; t8: integer; t9: integer; t10: integer) return integer is variable m1,m2,m3,m4,m5,m6,m7,m8,m9 : integer := 0; begin if (t1 < t2) then m1 := t1; else m1 := t2; end if; if (m1 < t3) then m2 := m1; else m2 := t3; end if; if (m2 < t4) then m3 := m2; else m3 := t4; end if; if (m3 < t5) then m4 := m3; else m4 := t5; end if; if (m4 < t6) then m5 := m4; else m5 := t6; end if; if (m5 < t7) then m6 := m5; else m6 := t7; end if; if (m6 < t8) then m7 := m6; else m7 := t8; end if; if (m7 < t9) then m8 := m7; else m8 := t9; end if; if (m8 < t10) then m9 := m8; else m9 := t10; end if; if (m9 < 0) then return (0 - m9); else return 0; end if; end; -- adjust the phase (tap_phase) with the largest negative number (ph_base) function ph_adjust (tap_phase: integer; ph_base : integer) return integer is begin return (tap_phase + ph_base); end; -- find the time delay for each PLL counter function counter_time_delay (clk_time_delay: integer; m_time_delay: integer; n_time_delay: integer) return integer is variable R: integer := 0; begin R := clk_time_delay + m_time_delay - n_time_delay; return R; end; -- calculate the given phase shift (in ps) in terms of degrees function get_phase_degree (phase_shift: integer; clk_period: integer) return integer is variable result: integer := 0; begin result := ( phase_shift * 360 ) / clk_period; -- to round up the calculation result if (result > 0) then result := result + 1; elsif (result < 0) then result := result - 1; else result := 0; end if; return result; end; -- find the number of VCO clock cycles to wait initially before the first rising -- edge of the output clock function counter_initial (tap_phase: integer; m: integer; n: integer) return integer is variable R: integer; variable R1: real; begin R1 := (real(abs(tap_phase)) * real(m))/(360.0 * real(n)) + 0.6; -- Note NCSim VHDL had problem in rounding up for 0.5 - 0.99. -- This checking will ensure that the rounding up is done. if (R1 >= 0.5) and (R1 <= 1.0) then R1 := 1.0; end if; R := integer(R1); return R; end; -- find which VCO phase tap (0 to 7) to align the rising edge of the output clock to function counter_ph (tap_phase: integer; m: integer; n: integer) return integer is variable R: integer := 0; begin -- 0.5 is added for proper rounding of the tap_phase. R := integer(real(integer(real(tap_phase * m / n)+ 0.5) REM 360)/45.0) rem 8; return R; end; -- convert given string to length 6 by padding with spaces function translate_string (mode : string) return string is variable new_mode : string (1 to 6) := " "; begin if (mode = "bypass") then new_mode := "bypass"; elsif (mode = "even") then new_mode := " even"; elsif (mode = "odd") then new_mode := " odd"; end if; return new_mode; end; function str2int (s : string) return integer is variable len : integer := s'length; variable newdigit : integer := 0; variable sign : integer := 1; variable digit : integer := 0; begin for i in 1 to len loop case s(i) is when '-' => if i = 1 then sign := -1; else ASSERT FALSE REPORT "Illegal Character "& s(i) & "i n string parameter! " SEVERITY ERROR; end if; when '0' => digit := 0; when '1' => digit := 1; when '2' => digit := 2; when '3' => digit := 3; when '4' => digit := 4; when '5' => digit := 5; when '6' => digit := 6; when '7' => digit := 7; when '8' => digit := 8; when '9' => digit := 9; when others => ASSERT FALSE REPORT "Illegal Character "& s(i) & "in string parameter! " SEVERITY ERROR; end case; newdigit := newdigit * 10 + digit; end loop; return (sign*newdigit); end; function dqs_str2int (s : string) return integer is variable len : integer := s'length; variable newdigit : integer := 0; variable sign : integer := 1; variable digit : integer := 0; variable err : boolean := false; begin for i in 1 to len loop case s(i) is when '-' => if i = 1 then sign := -1; else ASSERT FALSE REPORT "Illegal Character "& s(i) & " in string parameter! " SEVERITY ERROR; err := true; end if; when '0' => digit := 0; when '1' => digit := 1; when '2' => digit := 2; when '3' => digit := 3; when '4' => digit := 4; when '5' => digit := 5; when '6' => digit := 6; when '7' => digit := 7; when '8' => digit := 8; when '9' => digit := 9; when others => -- set error flag err := true; end case; if (err) then err := false; else newdigit := newdigit * 10 + digit; end if; end loop; return (sign*newdigit); end; end arriaii_pllpack; -- -- -- DFFE Model -- -- LIBRARY IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; entity arriaii_dffe is generic( TimingChecksOn: Boolean := True; XOn: Boolean := DefGlitchXOn; MsgOn: Boolean := DefGlitchMsgOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*"; tpd_PRN_Q_negedge : VitalDelayType01 := DefPropDelay01; tpd_CLRN_Q_negedge : VitalDelayType01 := DefPropDelay01; tpd_CLK_Q_posedge : VitalDelayType01 := DefPropDelay01; tpd_ENA_Q_posedge : VitalDelayType01 := DefPropDelay01; tsetup_D_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_D_CLK_noedge_negedge : VitalDelayType := DefSetupHoldCnst; tsetup_ENA_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_D_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_D_CLK_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_ENA_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tipd_D : VitalDelayType01 := DefPropDelay01; tipd_CLRN : VitalDelayType01 := DefPropDelay01; tipd_PRN : VitalDelayType01 := DefPropDelay01; tipd_CLK : VitalDelayType01 := DefPropDelay01; tipd_ENA : VitalDelayType01 := DefPropDelay01); port( Q : out STD_LOGIC := '0'; D : in STD_LOGIC; CLRN : in STD_LOGIC; PRN : in STD_LOGIC; CLK : in STD_LOGIC; ENA : in STD_LOGIC); attribute VITAL_LEVEL0 of arriaii_dffe : entity is TRUE; end arriaii_dffe; -- architecture body -- architecture behave of arriaii_dffe is attribute VITAL_LEVEL0 of behave : architecture is TRUE; signal D_ipd : STD_ULOGIC := 'U'; signal CLRN_ipd : STD_ULOGIC := 'U'; signal PRN_ipd : STD_ULOGIC := 'U'; signal CLK_ipd : STD_ULOGIC := 'U'; signal ENA_ipd : STD_ULOGIC := 'U'; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (D_ipd, D, tipd_D); VitalWireDelay (CLRN_ipd, CLRN, tipd_CLRN); VitalWireDelay (PRN_ipd, PRN, tipd_PRN); VitalWireDelay (CLK_ipd, CLK, tipd_CLK); VitalWireDelay (ENA_ipd, ENA, tipd_ENA); end block; -------------------- -- BEHAVIOR SECTION -------------------- VITALBehavior : process (D_ipd, CLRN_ipd, PRN_ipd, CLK_ipd, ENA_ipd) -- timing check results VARIABLE Tviol_D_CLK : STD_ULOGIC := '0'; VARIABLE Tviol_ENA_CLK : STD_ULOGIC := '0'; VARIABLE TimingData_D_CLK : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_ENA_CLK : VitalTimingDataType := VitalTimingDataInit; -- functionality results VARIABLE Violation : STD_ULOGIC := '0'; VARIABLE PrevData_Q : STD_LOGIC_VECTOR(0 to 7); VARIABLE D_delayed : STD_ULOGIC := 'U'; VARIABLE CLK_delayed : STD_ULOGIC := 'U'; VARIABLE ENA_delayed : STD_ULOGIC := 'U'; VARIABLE Results : STD_LOGIC_VECTOR(1 to 1) := (others => '0'); -- output glitch detection variables VARIABLE Q_VitalGlitchData : VitalGlitchDataType; CONSTANT dffe_Q_tab : VitalStateTableType := ( ( L, L, x, x, x, x, x, x, x, L ), ( L, H, L, H, H, x, x, H, x, H ), ( L, H, L, H, x, L, x, H, x, H ), ( L, H, L, x, H, H, x, H, x, H ), ( L, H, H, x, x, x, H, x, x, S ), ( L, H, x, x, x, x, L, x, x, H ), ( L, H, x, x, x, x, H, L, x, S ), ( L, x, L, L, L, x, H, H, x, L ), ( L, x, L, L, x, L, H, H, x, L ), ( L, x, L, x, L, H, H, H, x, L ), ( L, x, x, x, x, x, x, x, x, S )); begin ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_D_CLK, TimingData => TimingData_D_CLK, TestSignal => D_ipd, TestSignalName => "D", RefSignal => CLK_ipd, RefSignalName => "CLK", SetupHigh => tsetup_D_CLK_noedge_posedge, SetupLow => tsetup_D_CLK_noedge_posedge, HoldHigh => thold_D_CLK_noedge_posedge, HoldLow => thold_D_CLK_noedge_posedge, CheckEnabled => TO_X01(( (NOT PRN_ipd) ) OR ( (NOT CLRN_ipd) ) OR ( (NOT ENA_ipd) )) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/DFFE", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_ENA_CLK, TimingData => TimingData_ENA_CLK, TestSignal => ENA_ipd, TestSignalName => "ENA", RefSignal => CLK_ipd, RefSignalName => "CLK", SetupHigh => tsetup_ENA_CLK_noedge_posedge, SetupLow => tsetup_ENA_CLK_noedge_posedge, HoldHigh => thold_ENA_CLK_noedge_posedge, HoldLow => thold_ENA_CLK_noedge_posedge, CheckEnabled => TO_X01(( (NOT PRN_ipd) ) OR ( (NOT CLRN_ipd) ) ) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/DFFE", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; ------------------------- -- Functionality Section ------------------------- Violation := Tviol_D_CLK or Tviol_ENA_CLK; VitalStateTable( StateTable => dffe_Q_tab, DataIn => ( Violation, CLRN_ipd, CLK_delayed, Results(1), D_delayed, ENA_delayed, PRN_ipd, CLK_ipd), Result => Results, NumStates => 1, PreviousDataIn => PrevData_Q); D_delayed := D_ipd; CLK_delayed := CLK_ipd; ENA_delayed := ENA_ipd; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => Q, OutSignalName => "Q", OutTemp => Results(1), Paths => ( 0 => (PRN_ipd'last_event, tpd_PRN_Q_negedge, TRUE), 1 => (CLRN_ipd'last_event, tpd_CLRN_Q_negedge, TRUE), 2 => (CLK_ipd'last_event, tpd_CLK_Q_posedge, TRUE)), GlitchData => Q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end behave; -- -- -- arriaii_mux21 Model -- -- LIBRARY IEEE; use ieee.std_logic_1164.all; use IEEE.VITAL_Timing.all; use work.arriaii_atom_pack.all; entity arriaii_mux21 is generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_A_MO : VitalDelayType01 := DefPropDelay01; tpd_B_MO : VitalDelayType01 := DefPropDelay01; tpd_S_MO : VitalDelayType01 := DefPropDelay01; tipd_A : VitalDelayType01 := DefPropDelay01; tipd_B : VitalDelayType01 := DefPropDelay01; tipd_S : VitalDelayType01 := DefPropDelay01); port ( A : in std_logic := '0'; B : in std_logic := '0'; S : in std_logic := '0'; MO : out std_logic); attribute VITAL_LEVEL0 of arriaii_mux21 : entity is TRUE; end arriaii_mux21; architecture AltVITAL of arriaii_mux21 is attribute VITAL_LEVEL0 of AltVITAL : architecture is TRUE; signal A_ipd, B_ipd, S_ipd : std_logic; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (A_ipd, A, tipd_A); VitalWireDelay (B_ipd, B, tipd_B); VitalWireDelay (S_ipd, S, tipd_S); end block; -------------------- -- BEHAVIOR SECTION -------------------- VITALBehavior : process (A_ipd, B_ipd, S_ipd) -- output glitch detection variables VARIABLE MO_GlitchData : VitalGlitchDataType; variable tmp_MO : std_logic; begin ------------------------- -- Functionality Section ------------------------- if (S_ipd = '1') then tmp_MO := B_ipd; else tmp_MO := A_ipd; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => MO, OutSignalName => "MO", OutTemp => tmp_MO, Paths => ( 0 => (A_ipd'last_event, tpd_A_MO, TRUE), 1 => (B_ipd'last_event, tpd_B_MO, TRUE), 2 => (S_ipd'last_event, tpd_S_MO, TRUE)), GlitchData => MO_GlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end AltVITAL; -- -- -- arriaii_mux41 Model -- -- LIBRARY IEEE; use ieee.std_logic_1164.all; use IEEE.VITAL_Timing.all; use work.arriaii_atom_pack.all; entity arriaii_mux41 is generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_IN0_MO : VitalDelayType01 := DefPropDelay01; tpd_IN1_MO : VitalDelayType01 := DefPropDelay01; tpd_IN2_MO : VitalDelayType01 := DefPropDelay01; tpd_IN3_MO : VitalDelayType01 := DefPropDelay01; tpd_S_MO : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01); tipd_IN0 : VitalDelayType01 := DefPropDelay01; tipd_IN1 : VitalDelayType01 := DefPropDelay01; tipd_IN2 : VitalDelayType01 := DefPropDelay01; tipd_IN3 : VitalDelayType01 := DefPropDelay01; tipd_S : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01) ); port ( IN0 : in std_logic := '0'; IN1 : in std_logic := '0'; IN2 : in std_logic := '0'; IN3 : in std_logic := '0'; S : in std_logic_vector(1 downto 0) := (OTHERS => '0'); MO : out std_logic ); attribute VITAL_LEVEL0 of arriaii_mux41 : entity is TRUE; end arriaii_mux41; architecture AltVITAL of arriaii_mux41 is attribute VITAL_LEVEL0 of AltVITAL : architecture is TRUE; signal IN0_ipd, IN1_ipd, IN2_ipd, IN3_ipd : std_logic; signal S_ipd : std_logic_vector(1 downto 0); begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (IN0_ipd, IN0, tipd_IN0); VitalWireDelay (IN1_ipd, IN1, tipd_IN1); VitalWireDelay (IN2_ipd, IN2, tipd_IN2); VitalWireDelay (IN3_ipd, IN3, tipd_IN3); VitalWireDelay (S_ipd(0), S(0), tipd_S(0)); VitalWireDelay (S_ipd(1), S(1), tipd_S(1)); end block; -------------------- -- BEHAVIOR SECTION -------------------- VITALBehavior : process (IN0_ipd, IN1_ipd, IN2_ipd, IN3_ipd, S_ipd(0), S_ipd(1)) -- output glitch detection variables VARIABLE MO_GlitchData : VitalGlitchDataType; variable tmp_MO : std_logic; begin ------------------------- -- Functionality Section ------------------------- if ((S_ipd(1) = '1') AND (S_ipd(0) = '1')) then tmp_MO := IN3_ipd; elsif ((S_ipd(1) = '1') AND (S_ipd(0) = '0')) then tmp_MO := IN2_ipd; elsif ((S_ipd(1) = '0') AND (S_ipd(0) = '1')) then tmp_MO := IN1_ipd; else tmp_MO := IN0_ipd; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => MO, OutSignalName => "MO", OutTemp => tmp_MO, Paths => ( 0 => (IN0_ipd'last_event, tpd_IN0_MO, TRUE), 1 => (IN1_ipd'last_event, tpd_IN1_MO, TRUE), 2 => (IN2_ipd'last_event, tpd_IN2_MO, TRUE), 3 => (IN3_ipd'last_event, tpd_IN3_MO, TRUE), 4 => (S_ipd(0)'last_event, tpd_S_MO(0), TRUE), 5 => (S_ipd(1)'last_event, tpd_S_MO(1), TRUE)), GlitchData => MO_GlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end AltVITAL; -- -- -- arriaii_and1 Model -- -- LIBRARY IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.VITAL_Timing.all; use work.arriaii_atom_pack.all; -- entity declaration -- entity arriaii_and1 is generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_IN1_Y : VitalDelayType01 := DefPropDelay01; tipd_IN1 : VitalDelayType01 := DefPropDelay01); port( Y : out STD_LOGIC; IN1 : in STD_LOGIC); attribute VITAL_LEVEL0 of arriaii_and1 : entity is TRUE; end arriaii_and1; -- architecture body -- architecture AltVITAL of arriaii_and1 is attribute VITAL_LEVEL0 of AltVITAL : architecture is TRUE; SIGNAL IN1_ipd : STD_ULOGIC := 'U'; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (IN1_ipd, IN1, tipd_IN1); end block; -------------------- -- BEHAVIOR SECTION -------------------- VITALBehavior : process (IN1_ipd) -- functionality results VARIABLE Results : STD_LOGIC_VECTOR(1 to 1) := (others => 'X'); ALIAS Y_zd : STD_ULOGIC is Results(1); -- output glitch detection variables VARIABLE Y_GlitchData : VitalGlitchDataType; begin ------------------------- -- Functionality Section ------------------------- Y_zd := TO_X01(IN1_ipd); ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => Y, OutSignalName => "Y", OutTemp => Y_zd, Paths => (0 => (IN1_ipd'last_event, tpd_IN1_Y, TRUE)), GlitchData => Y_GlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end AltVITAL; --------------------------------------------------------------------- -- -- Entity Name : arriaii_lcell_comb -- -- Description : Piranha LCELL_COMB VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; entity arriaii_lcell_comb is generic ( lut_mask : std_logic_vector(63 downto 0) := (OTHERS => '1'); shared_arith : string := "off"; extended_lut : string := "off"; dont_touch : string := "off"; lpm_type : string := "arriaii_lcell_comb"; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*"; tpd_dataa_combout : VitalDelayType01 := DefPropDelay01; tpd_datab_combout : VitalDelayType01 := DefPropDelay01; tpd_datac_combout : VitalDelayType01 := DefPropDelay01; tpd_datad_combout : VitalDelayType01 := DefPropDelay01; tpd_datae_combout : VitalDelayType01 := DefPropDelay01; tpd_dataf_combout : VitalDelayType01 := DefPropDelay01; tpd_datag_combout : VitalDelayType01 := DefPropDelay01; tpd_dataa_sumout : VitalDelayType01 := DefPropDelay01; tpd_datab_sumout : VitalDelayType01 := DefPropDelay01; tpd_datac_sumout : VitalDelayType01 := DefPropDelay01; tpd_datad_sumout : VitalDelayType01 := DefPropDelay01; tpd_dataf_sumout : VitalDelayType01 := DefPropDelay01; tpd_cin_sumout : VitalDelayType01 := DefPropDelay01; tpd_sharein_sumout : VitalDelayType01 := DefPropDelay01; tpd_dataa_cout : VitalDelayType01 := DefPropDelay01; tpd_datab_cout : VitalDelayType01 := DefPropDelay01; tpd_datac_cout : VitalDelayType01 := DefPropDelay01; tpd_datad_cout : VitalDelayType01 := DefPropDelay01; tpd_dataf_cout : VitalDelayType01 := DefPropDelay01; tpd_cin_cout : VitalDelayType01 := DefPropDelay01; tpd_sharein_cout : VitalDelayType01 := DefPropDelay01; tpd_dataa_shareout : VitalDelayType01 := DefPropDelay01; tpd_datab_shareout : VitalDelayType01 := DefPropDelay01; tpd_datac_shareout : VitalDelayType01 := DefPropDelay01; tpd_datad_shareout : VitalDelayType01 := DefPropDelay01; tipd_dataa : VitalDelayType01 := DefPropDelay01; tipd_datab : VitalDelayType01 := DefPropDelay01; tipd_datac : VitalDelayType01 := DefPropDelay01; tipd_datad : VitalDelayType01 := DefPropDelay01; tipd_datae : VitalDelayType01 := DefPropDelay01; tipd_dataf : VitalDelayType01 := DefPropDelay01; tipd_datag : VitalDelayType01 := DefPropDelay01; tipd_cin : VitalDelayType01 := DefPropDelay01; tipd_sharein : VitalDelayType01 := DefPropDelay01 ); port ( dataa : in std_logic := '0'; datab : in std_logic := '0'; datac : in std_logic := '0'; datad : in std_logic := '0'; datae : in std_logic := '0'; dataf : in std_logic := '0'; datag : in std_logic := '0'; cin : in std_logic := '0'; sharein : in std_logic := '0'; combout : out std_logic; sumout : out std_logic; cout : out std_logic; shareout : out std_logic ); attribute VITAL_LEVEL0 of arriaii_lcell_comb : entity is TRUE; end arriaii_lcell_comb; architecture vital_lcell_comb of arriaii_lcell_comb is attribute VITAL_LEVEL0 of vital_lcell_comb : architecture is TRUE; signal dataa_ipd : std_logic; signal datab_ipd : std_logic; signal datac_ipd : std_logic; signal datad_ipd : std_logic; signal datae_ipd : std_logic; signal dataf_ipd : std_logic; signal datag_ipd : std_logic; signal cin_ipd : std_logic; signal sharein_ipd : std_logic; signal f2_input3 : std_logic; -- sub masks signal f0_mask : std_logic_vector(15 downto 0); signal f1_mask : std_logic_vector(15 downto 0); signal f2_mask : std_logic_vector(15 downto 0); signal f3_mask : std_logic_vector(15 downto 0); begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (dataa_ipd, dataa, tipd_dataa); VitalWireDelay (datab_ipd, datab, tipd_datab); VitalWireDelay (datac_ipd, datac, tipd_datac); VitalWireDelay (datad_ipd, datad, tipd_datad); VitalWireDelay (datae_ipd, datae, tipd_datae); VitalWireDelay (dataf_ipd, dataf, tipd_dataf); VitalWireDelay (datag_ipd, datag, tipd_datag); VitalWireDelay (cin_ipd, cin, tipd_cin); VitalWireDelay (sharein_ipd, sharein, tipd_sharein); end block; f0_mask <= lut_mask(15 downto 0); f1_mask <= lut_mask(31 downto 16); f2_mask <= lut_mask(47 downto 32); f3_mask <= lut_mask(63 downto 48); f2_input3 <= datag_ipd WHEN (extended_lut = "on") ELSE datac_ipd; VITALtiming : process(dataa_ipd, datab_ipd, datac_ipd, datad_ipd, datae_ipd, dataf_ipd, f2_input3, cin_ipd, sharein_ipd) variable combout_VitalGlitchData : VitalGlitchDataType; variable sumout_VitalGlitchData : VitalGlitchDataType; variable cout_VitalGlitchData : VitalGlitchDataType; variable shareout_VitalGlitchData : VitalGlitchDataType; -- sub lut outputs variable f0_out : std_logic; variable f1_out : std_logic; variable f2_out : std_logic; variable f3_out : std_logic; -- muxed output variable g0_out : std_logic; variable g1_out : std_logic; -- internal variables variable f2_f : std_logic; variable adder_input2 : std_logic; -- output variables variable combout_tmp : std_logic; variable sumout_tmp : std_logic; variable cout_tmp : std_logic; -- temp variable for NCVHDL variable lut_mask_var : std_logic_vector(63 downto 0) := (OTHERS => '1'); begin lut_mask_var := lut_mask; ------------------------ -- Timing Check Section ------------------------ f0_out := VitalMUX(data => f0_mask, dselect => (datad_ipd, datac_ipd, datab_ipd, dataa_ipd)); f1_out := VitalMUX(data => f1_mask, dselect => (datad_ipd, f2_input3, datab_ipd, dataa_ipd)); f2_out := VitalMUX(data => f2_mask, dselect => (datad_ipd, datac_ipd, datab_ipd, dataa_ipd)); f3_out := VitalMUX(data => f3_mask, dselect => (datad_ipd, f2_input3, datab_ipd, dataa_ipd)); -- combout if (extended_lut = "on") then if (datae_ipd = '0') then g0_out := f0_out; g1_out := f2_out; elsif (datae_ipd = '1') then g0_out := f1_out; g1_out := f3_out; else g0_out := 'X'; g1_out := 'X'; end if; if (dataf_ipd = '0') then combout_tmp := g0_out; elsif ((dataf_ipd = '1') or (g0_out = g1_out))then combout_tmp := g1_out; else combout_tmp := 'X'; end if; else combout_tmp := VitalMUX(data => lut_mask_var, dselect => (dataf_ipd, datae_ipd, datad_ipd, datac_ipd, datab_ipd, dataa_ipd)); end if; -- sumout and cout f2_f := VitalMUX(data => f2_mask, dselect => (dataf_ipd, datac_ipd, datab_ipd, dataa_ipd)); if (shared_arith = "on") then adder_input2 := sharein_ipd; else adder_input2 := NOT f2_f; end if; sumout_tmp := cin_ipd XOR f0_out XOR adder_input2; cout_tmp := (cin_ipd AND f0_out) OR (cin_ipd AND adder_input2) OR (f0_out AND adder_input2); ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => combout, OutSignalName => "COMBOUT", OutTemp => combout_tmp, Paths => (0 => (dataa_ipd'last_event, tpd_dataa_combout, TRUE), 1 => (datab_ipd'last_event, tpd_datab_combout, TRUE), 2 => (datac_ipd'last_event, tpd_datac_combout, TRUE), 3 => (datad_ipd'last_event, tpd_datad_combout, TRUE), 4 => (datae_ipd'last_event, tpd_datae_combout, TRUE), 5 => (dataf_ipd'last_event, tpd_dataf_combout, TRUE), 6 => (datag_ipd'last_event, tpd_datag_combout, TRUE)), GlitchData => combout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => sumout, OutSignalName => "SUMOUT", OutTemp => sumout_tmp, Paths => (0 => (dataa_ipd'last_event, tpd_dataa_sumout, TRUE), 1 => (datab_ipd'last_event, tpd_datab_sumout, TRUE), 2 => (datac_ipd'last_event, tpd_datac_sumout, TRUE), 3 => (datad_ipd'last_event, tpd_datad_sumout, TRUE), 4 => (dataf_ipd'last_event, tpd_dataf_sumout, TRUE), 5 => (cin_ipd'last_event, tpd_cin_sumout, TRUE), 6 => (sharein_ipd'last_event, tpd_sharein_sumout, TRUE)), GlitchData => sumout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => cout, OutSignalName => "COUT", OutTemp => cout_tmp, Paths => (0 => (dataa_ipd'last_event, tpd_dataa_cout, TRUE), 1 => (datab_ipd'last_event, tpd_datab_cout, TRUE), 2 => (datac_ipd'last_event, tpd_datac_cout, TRUE), 3 => (datad_ipd'last_event, tpd_datad_cout, TRUE), 4 => (dataf_ipd'last_event, tpd_dataf_cout, TRUE), 5 => (cin_ipd'last_event, tpd_cin_cout, TRUE), 6 => (sharein_ipd'last_event, tpd_sharein_cout, TRUE)), GlitchData => cout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => shareout, OutSignalName => "SHAREOUT", OutTemp => f2_out, Paths => (0 => (dataa_ipd'last_event, tpd_dataa_shareout, TRUE), 1 => (datab_ipd'last_event, tpd_datab_shareout, TRUE), 2 => (datac_ipd'last_event, tpd_datac_shareout, TRUE), 3 => (datad_ipd'last_event, tpd_datad_shareout, TRUE)), GlitchData => shareout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_lcell_comb; --------------------------------------------------------------------- -- -- Entity Name : arriaii_routing_wire -- -- Description : PiranhaII Routing Wire VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_routing_wire is generic ( MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; tpd_datain_dataout : VitalDelayType01 := DefPropDelay01; tpd_datainglitch_dataout : VitalDelayType01 := DefPropDelay01; tipd_datain : VitalDelayType01 := DefPropDelay01 ); PORT ( datain : in std_logic; dataout : out std_logic ); attribute VITAL_LEVEL0 of arriaii_routing_wire : entity is TRUE; end arriaii_routing_wire; ARCHITECTURE behave of arriaii_routing_wire is attribute VITAL_LEVEL0 of behave : architecture is TRUE; signal datain_ipd : std_logic; signal datainglitch_inert : std_logic; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (datain_ipd, datain, tipd_datain); end block; VITAL: process(datain_ipd, datainglitch_inert) variable datain_inert_VitalGlitchData : VitalGlitchDataType; variable dataout_VitalGlitchData : VitalGlitchDataType; begin ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => datainglitch_inert, OutSignalName => "datainglitch_inert", OutTemp => datain_ipd, Paths => (1 => (datain_ipd'last_event, tpd_datainglitch_dataout, TRUE)), GlitchData => datain_inert_VitalGlitchData, Mode => VitalInertial, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "dataout", OutTemp => datainglitch_inert, Paths => (1 => (datain_ipd'last_event, tpd_datain_dataout, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end behave; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_tx_reg -- -- Description : Simulation model for a simple DFF. -- This is used for registering the enable inputs. -- No timing, powers upto 0. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE ieee.std_logic_1164.all; --USE ieee.std_logic_unsigned.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_lvds_tx_reg is GENERIC ( MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; TimingChecksOn : Boolean := True; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_ena : VitalDelayType01 := DefpropDelay01; tipd_d : VitalDelayType01 := DefpropDelay01; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( q : OUT std_logic; clk : IN std_logic; ena : IN std_logic; d : IN std_logic; clrn : IN std_logic; prn : IN std_logic ); attribute VITAL_LEVEL0 of arriaii_lvds_tx_reg : ENTITY is TRUE; END arriaii_lvds_tx_reg; ARCHITECTURE vital_arriaii_lvds_tx_reg of arriaii_lvds_tx_reg is attribute VITAL_LEVEL0 of vital_arriaii_lvds_tx_reg : architecture is TRUE; -- INTERNAL SIGNALS signal clk_ipd : std_logic; signal d_ipd : std_logic; signal ena_ipd : std_logic; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (d_ipd, d, tipd_d); end block; process (clk_ipd, clrn, prn) variable q_tmp : std_logic := '0'; variable q_VitalGlitchData : VitalGlitchDataType; variable Tviol_d_clk : std_ulogic := '0'; variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit; begin ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_d_clk, TimingData => TimingData_d_clk, TestSignal => d_ipd, TestSignalName => "d", RefSignal => clk_ipd, RefSignalName => "clk", SetupHigh => tsetup_d_clk_noedge_posedge, SetupLow => tsetup_d_clk_noedge_posedge, HoldHigh => thold_d_clk_noedge_posedge, HoldLow => thold_d_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT ena_ipd) ) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_lvds_tx_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; if (prn = '0') then q_tmp := '1'; elsif (clrn = '0') then q_tmp := '0'; elsif (clk_ipd'event and clk_ipd = '1') then if (ena_ipd = '1') then q_tmp := d_ipd; end if; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => q, OutSignalName => "Q", OutTemp => q_tmp, Paths => (1 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)), GlitchData => q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_arriaii_lvds_tx_reg; --//////////////////////////////////////////////////////////////////////////// -- -- Entity name : arriaii_lvds_tx_parallel_register -- -- Description : Register for the 10 data input channels of the Piranha -- LVDS Tx -- --//////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE IEEE.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE std.textio.all; ENTITY arriaii_lvds_tx_parallel_register is GENERIC ( channel_width : integer := 10; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tsetup_datain_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_datain_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_dataout_posedge : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_enable : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayArrayType01(9 downto 0) := (OTHERS => DefpropDelay01) ); PORT ( clk : in std_logic; enable : in std_logic; datain : in std_logic_vector(channel_width - 1 downto 0); devclrn : in std_logic := '1'; devpor : in std_logic := '1'; dataout : out std_logic_vector(channel_width - 1 downto 0) ); END arriaii_lvds_tx_parallel_register; ARCHITECTURE vital_tx_reg of arriaii_lvds_tx_parallel_register is signal clk_ipd : std_logic; signal enable_ipd : std_logic; signal datain_ipd : std_logic_vector(channel_width - 1 downto 0); begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (enable_ipd, enable, tipd_enable); loopbits : FOR i in datain'RANGE GENERATE VitalWireDelay (datain_ipd(i), datain(i), tipd_datain(i)); END GENERATE; end block; VITAL: process (clk_ipd, enable_ipd, datain_ipd, devpor, devclrn) variable Tviol_datain_clk : std_ulogic := '0'; variable TimingData_datain_clk : VitalTimingDataType := VitalTimingDataInit; variable dataout_VitalGlitchDataArray : VitalGlitchDataArrayType(9 downto 0); variable i : integer := 0; variable dataout_tmp : std_logic_vector(channel_width - 1 downto 0); variable CQDelay : TIME := 0 ns; begin if (now = 0 ns) then dataout_tmp := (OTHERS => '0'); end if; ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_datain_clk, TimingData => TimingData_datain_clk, TestSignal => datain_ipd, TestSignalName => "DATAIN", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_datain_clk_noedge_posedge, SetupLow => tsetup_datain_clk_noedge_posedge, HoldHigh => thold_datain_clk_noedge_posedge, HoldLow => thold_datain_clk_noedge_posedge, RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_lvds_tx_parallel_register", XOn => XOn, MsgOn => MsgOnChecks ); end if; if ((devpor = '0') or (devclrn = '0')) then dataout_tmp := (OTHERS => '0'); else if (clk_ipd'event and clk_ipd = '1') then if (enable_ipd = '1') then dataout_tmp := datain_ipd; end if; end if; end if; ---------------------- -- Path Delay Section ---------------------- CQDelay := SelectDelay( (1 => (clk_ipd'last_event, tpd_clk_dataout_posedge, TRUE)) ); dataout <= TRANSPORT dataout_tmp AFTER CQDelay; end process; end vital_tx_reg; --//////////////////////////////////////////////////////////////////////////// -- -- Entity name : arriaii_lvds_tx_out_block -- -- Description : Negative-edge triggered register on the Tx output. -- Also, optionally generates an identical/inverted output clock -- --//////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE IEEE.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE std.textio.all; ENTITY arriaii_lvds_tx_out_block is GENERIC ( bypass_serializer : String := "false"; invert_clock : String := "false"; use_falling_clock_edge : String := "false"; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tpd_datain_dataout : VitalDelayType01 := DefPropDelay01; tpd_clk_dataout : VitalDelayType01 := DefPropDelay01; tpd_clk_dataout_negedge : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01 ); PORT ( clk : in std_logic; datain : in std_logic; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; dataout : out std_logic ); END arriaii_lvds_tx_out_block; ARCHITECTURE vital_tx_out_block of arriaii_lvds_tx_out_block is signal clk_ipd : std_logic; signal datain_ipd : std_logic; signal inv_clk : integer; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (datain_ipd, datain, tipd_datain); end block; VITAL: process (clk_ipd, datain_ipd, devpor, devclrn) variable dataout_VitalGlitchData : VitalGlitchDataType; variable dataout_tmp : std_logic; begin if (now = 0 ns) then dataout_tmp := '0'; else if (bypass_serializer = "false") then if (use_falling_clock_edge = "false") then dataout_tmp := datain_ipd; end if; if (clk_ipd'event and clk_ipd = '0') then if (use_falling_clock_edge = "true") then dataout_tmp := datain_ipd; end if; end if; else if (invert_clock = "false") then dataout_tmp := clk_ipd; else dataout_tmp := NOT (clk_ipd); end if; if (invert_clock = "false") then inv_clk <= 0; else inv_clk <= 1; end if; end if; end if; ---------------------- -- Path Delay Section ---------------------- if (bypass_serializer = "false") then VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (0 => (datain_ipd'last_event, tpd_datain_dataout, TRUE), 1 => (clk_ipd'last_event, tpd_clk_dataout_negedge, use_falling_clock_edge = "true")), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end if; if (bypass_serializer = "true") then VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (1 => (clk_ipd'last_event, tpd_clk_dataout, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end if; end process; end vital_tx_out_block; --//////////////////////////////////////////////////////////////////////////// -- -- Entity name : arriaii_lvds_transmitter -- -- Description : Timing simulation model for the Piranha LVDS Tx WYSIWYG. -- It instantiates the following sub-modules : -- 1) primitive DFFE -- 2) Piranha_lvds_tx_parallel_register and -- 3) Piranha_lvds_tx_out_block -- --//////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE IEEE.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE std.textio.all; USE work.arriaii_lvds_tx_parallel_register; USE work.arriaii_lvds_tx_out_block; USE work.arriaii_lvds_tx_reg; ENTITY arriaii_lvds_transmitter is GENERIC ( channel_width : integer := 10; bypass_serializer : String := "false"; invert_clock : String := "false"; use_falling_clock_edge : String := "false"; use_serial_data_input : String := "false"; use_post_dpa_serial_data_input : String := "false"; is_used_as_outclk : String := "false"; tx_output_path_delay_engineering_bits : Integer := -1; enable_dpaclk_to_lvdsout : string := "off"; preemphasis_setting : integer := 0; vod_setting : integer := 0; differential_drive : integer := 0; lpm_type : string := "arriaii_lvds_transmitter"; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tpd_clk0_dataout_posedge : VitalDelayType01 := DefPropDelay01; tpd_clk0_dataout_negedge : VitalDelayType01 := DefPropDelay01; tpd_serialdatain_dataout : VitalDelayType01 := DefPropDelay01; tpd_dpaclkin_dataout : VitalDelayType01 := DefPropDelay01; tpd_postdpaserialdatain_dataout : VitalDelayType01 := DefPropDelay01; tipd_clk0 : VitalDelayType01 := DefpropDelay01; tipd_enable0 : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayArrayType01(9 downto 0) := (OTHERS => DefpropDelay01); tipd_serialdatain : VitalDelayType01 := DefpropDelay01; tipd_dpaclkin : VitalDelayType01 := DefpropDelay01; tipd_postdpaserialdatain : VitalDelayType01 := DefpropDelay01 ); PORT ( clk0 : in std_logic; enable0 : in std_logic := '0'; datain : in std_logic_vector(channel_width - 1 downto 0) := (OTHERS => '0'); serialdatain : in std_logic := '0'; postdpaserialdatain : in std_logic := '0'; dpaclkin : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; dataout : out std_logic; serialfdbkout : out std_logic ); end arriaii_lvds_transmitter; ARCHITECTURE vital_transmitter_atom of arriaii_lvds_transmitter is signal clk0_ipd : std_logic; signal serialdatain_ipd : std_logic; signal postdpaserialdatain_ipd : std_logic; signal dpaclkin_ipd : std_logic; signal input_data : std_logic_vector(channel_width - 1 downto 0); signal txload0 : std_logic; signal shift_out : std_logic; signal clk0_dly0 : std_logic; signal clk0_dly1 : std_logic; signal clk0_dly2 : std_logic; signal datain_dly : std_logic_vector(channel_width - 1 downto 0); signal datain_dly1 : std_logic_vector(channel_width - 1 downto 0); signal datain_dly2 : std_logic_vector(channel_width - 1 downto 0); signal datain_dly3 : std_logic_vector(channel_width - 1 downto 0); signal datain_dly4 : std_logic_vector(channel_width - 1 downto 0); signal vcc : std_logic := '1'; signal tmp_dataout : std_logic; COMPONENT arriaii_lvds_tx_parallel_register GENERIC ( channel_width : integer := 10; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tpd_clk_dataout_posedge : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_enable : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayArrayType01(9 downto 0) := (OTHERS => DefpropDelay01) ); PORT ( clk : in std_logic; enable : in std_logic; datain : in std_logic_vector(channel_width - 1 downto 0); devclrn : in std_logic := '1'; devpor : in std_logic := '1'; dataout : out std_logic_vector(channel_width - 1 downto 0) ); END COMPONENT; COMPONENT arriaii_lvds_tx_out_block GENERIC ( bypass_serializer : String := "false"; invert_clock : String := "false"; use_falling_clock_edge : String := "false"; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tpd_datain_dataout : VitalDelayType01 := DefPropDelay01; tpd_clk_dataout : VitalDelayType01 := DefPropDelay01; tpd_clk_dataout_negedge : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01 ); PORT ( clk : in std_logic; datain : in std_logic; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; dataout : out std_logic ); END COMPONENT; COMPONENT arriaii_lvds_tx_reg GENERIC (TimingChecksOn : Boolean := true; InstancePath : STRING := "*"; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01 ); PORT ( q : out STD_LOGIC := '0'; d : in STD_LOGIC := '1'; clrn : in STD_LOGIC := '1'; prn : in STD_LOGIC := '1'; clk : in STD_LOGIC := '0'; ena : in STD_LOGIC := '1' ); END COMPONENT; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk0_ipd, clk0, tipd_clk0); VitalWireDelay (serialdatain_ipd, serialdatain, tipd_serialdatain); VitalWireDelay (dpaclkin_ipd, dpaclkin, tipd_dpaclkin); VitalWireDelay (postdpaserialdatain_ipd, postdpaserialdatain, tipd_postdpaserialdatain); end block; txload0_reg: arriaii_lvds_tx_reg PORT MAP (d => enable0, clrn => vcc, prn => vcc, ena => vcc, clk => clk0_dly2, q => txload0 ); input_reg: arriaii_lvds_tx_parallel_register GENERIC MAP ( channel_width => channel_width) PORT MAP ( clk => txload0, enable => vcc, datain => datain_dly, dataout => input_data, devclrn => devclrn, devpor => devpor ); output_module: arriaii_lvds_tx_out_block GENERIC MAP ( bypass_serializer => bypass_serializer, use_falling_clock_edge => use_falling_clock_edge, invert_clock => invert_clock) PORT MAP ( clk => clk0_dly2, datain => shift_out, dataout => tmp_dataout, devclrn => devclrn, devpor => devpor ); clk_delay: process (clk0_ipd, datain) begin clk0_dly0 <= clk0_ipd; datain_dly1 <= datain; end process; clk_delay1: process (clk0_dly0, datain_dly1) begin clk0_dly1 <= clk0_dly0; datain_dly2 <= datain_dly1; end process; clk_delay2: process (clk0_dly1, datain_dly2) begin clk0_dly2 <= clk0_dly1; datain_dly3 <= datain_dly2; end process; data_delay: process (datain_dly3) begin datain_dly4 <= datain_dly3; end process; data_delay1: process (datain_dly4) begin datain_dly <= datain_dly4; end process; VITAL: process (clk0_ipd, devclrn, devpor) variable dataout_VitalGlitchData : VitalGlitchDataType; variable i : integer := 0; variable shift_data : std_logic_vector(channel_width-1 downto 0); begin if (now = 0 ns) then shift_data := (OTHERS => '0'); end if; if ((devpor = '0') or (devclrn = '0')) then shift_data := (OTHERS => '0'); else if (bypass_serializer = "false") then if (clk0_ipd'event and clk0_ipd = '1') then if (txload0 = '1') then shift_data := input_data; end if; shift_out <= shift_data(channel_width - 1); for i in channel_width-1 downto 1 loop shift_data(i) := shift_data(i - 1); end loop; end if; end if; end if; end process; process (serialdatain_ipd, postdpaserialdatain_ipd, dpaclkin_ipd, tmp_dataout ) variable dataout_tmp : std_logic := '0'; variable dataout_VitalGlitchData : VitalGlitchDataType; begin if (serialdatain_ipd'event and use_serial_data_input = "true") then dataout_tmp := serialdatain_ipd; elsif (postdpaserialdatain_ipd'event and use_post_dpa_serial_data_input = "true") then dataout_tmp := postdpaserialdatain_ipd; elsif (dpaclkin_ipd'event and enable_dpaclk_to_lvdsout = "on") then dataout_tmp := dpaclkin_ipd; else dataout_tmp := tmp_dataout; end if; ---------------------- -- Path Delay Section ---------------------- if (use_serial_data_input = "true") then VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (0 => (serialdatain_ipd'last_event, tpd_serialdatain_dataout, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); elsif (use_post_dpa_serial_data_input = "true") then VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (0 => (postdpaserialdatain_ipd'last_event, tpd_postdpaserialdatain_dataout, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); elsif (enable_dpaclk_to_lvdsout = "on") then VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (0 => (dpaclkin_ipd'last_event, tpd_dpaclkin_dataout, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); else VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (0 => (tmp_dataout'last_event, DefPropDelay01, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end if; end process; end vital_transmitter_atom; -- -- -- ARRIAII_RUBLOCK Model -- -- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use work.arriaii_atom_pack.all; entity arriaii_rublock is generic ( sim_init_config : string := "factory"; sim_init_watchdog_value : integer := 0; sim_init_status : integer := 0; lpm_type : string := "arriaii_rublock" ); port ( clk : in std_logic; shiftnld : in std_logic; captnupdt : in std_logic; regin : in std_logic; rsttimer : in std_logic; rconfig : in std_logic; regout : out std_logic ); end arriaii_rublock; architecture architecture_rublock of arriaii_rublock is begin end architecture_rublock; -- -- -- ARRIAII_OSCILLATOR Model -- -- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; entity arriaii_oscillator is generic ( lpm_type: string := "arriaii_oscillator"; TimingChecksOn: Boolean := True; XOn: Boolean := DefGlitchXOn; MsgOn: Boolean := DefGlitchMsgOn; tpd_oscena_clkout_posedge : VitalDelayType01 := DefPropDelay01; tipd_oscena : VitalDelayType01 := DefPropDelay01 ); port ( oscena : in std_logic; clkout : out std_logic ); end arriaii_oscillator; architecture architecture_oscillator of arriaii_oscillator is signal oscena_ipd : std_logic; signal int_osc : std_logic := '0'; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (oscena_ipd, oscena, tipd_oscena); end block; VITAL_osc : process(oscena_ipd, int_osc) variable OSC_PW : time := 6250 ps; -- pulse width for 80MHz clock variable osc_VitalGlitchData : VitalGlitchDataType; begin if (oscena_ipd = '1') then if ((int_osc = '0') or (int_osc = '1')) then int_osc <= not int_osc after OSC_PW; else int_osc <= '0' after OSC_PW; end if; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => clkout, OutSignalName => "osc", OutTemp => int_osc, Paths => (0 => (InputChangeTime => oscena_ipd'last_event, PathDelay => tpd_oscena_clkout_posedge, PathCondition => (oscena_ipd = '1'))), GlitchData => osc_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end architecture_oscillator; ---------------------------------------------------------------------------- -- Module Name : arriaii_ram_register -- Description : Register module for RAM inputs/outputs ---------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_ram_register IS GENERIC ( width : INTEGER := 1; preset : STD_LOGIC := '0'; tipd_d : VitalDelayArrayType01(143 DOWNTO 0) := (OTHERS => DefPropDelay01); tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; tipd_stall : VitalDelayType01 := DefPropDelay01; tipd_aclr : VitalDelayType01 := DefPropDelay01; tpw_ena_posedge : VitalDelayType := DefPulseWdthCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_aclr_q_posedge : VitalDelayType01 := DefPropDelay01; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_stall_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_stall_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_aclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_aclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst ); PORT ( d : IN STD_LOGIC_VECTOR(width - 1 DOWNTO 0); clk : IN STD_LOGIC; ena : IN STD_LOGIC; stall : IN STD_LOGIC; aclr : IN STD_LOGIC; devclrn : IN STD_LOGIC; devpor : IN STD_LOGIC; q : OUT STD_LOGIC_VECTOR(width - 1 DOWNTO 0); aclrout : OUT STD_LOGIC ); END arriaii_ram_register; ARCHITECTURE reg_arch OF arriaii_ram_register IS SIGNAL d_ipd : STD_LOGIC_VECTOR(width - 1 DOWNTO 0); SIGNAL clk_ipd : STD_LOGIC; SIGNAL ena_ipd : STD_LOGIC; SIGNAL aclr_ipd : STD_LOGIC; SIGNAL stall_ipd : STD_LOGIC; BEGIN WireDelay : BLOCK BEGIN loopbits : FOR i in d'RANGE GENERATE VitalWireDelay (d_ipd(i), d(i), tipd_d(i)); END GENERATE; VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (aclr_ipd, aclr, tipd_aclr); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (stall_ipd, stall, tipd_stall); END BLOCK; PROCESS (d_ipd,ena_ipd,stall_ipd,clk_ipd,aclr_ipd,devclrn,devpor) VARIABLE Tviol_clk_ena : STD_ULOGIC := '0'; VARIABLE Tviol_clk_aclr : STD_ULOGIC := '0'; VARIABLE Tviol_data_clk : STD_ULOGIC := '0'; VARIABLE TimingData_clk_ena : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_clk_stall : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_clk_aclr : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_data_clk : VitalTimingDataType := VitalTimingDataInit; VARIABLE Tviol_ena : STD_ULOGIC := '0'; VARIABLE PeriodData_ena : VitalPeriodDataType := VitalPeriodDataInit; VARIABLE q_VitalGlitchDataArray : VitalGlitchDataArrayType(143 downto 0); VARIABLE CQDelay : TIME := 0 ns; VARIABLE q_reg : STD_LOGIC_VECTOR(width - 1 DOWNTO 0) := (OTHERS => preset); BEGIN IF (aclr_ipd = '1' OR devclrn = '0' OR devpor = '0') THEN q_reg := (OTHERS => preset); ELSIF (clk_ipd = '1' AND clk_ipd'EVENT AND ena_ipd = '1' AND stall_ipd = '0') THEN q_reg := d_ipd; END IF; -- Timing checks VitalSetupHoldCheck ( Violation => Tviol_clk_ena, TimingData => TimingData_clk_ena, TestSignal => ena_ipd, TestSignalName => "ena", RefSignal => clk_ipd, RefSignalName => "clk", SetupHigh => tsetup_ena_clk_noedge_posedge, SetupLow => tsetup_ena_clk_noedge_posedge, HoldHigh => thold_ena_clk_noedge_posedge, HoldLow => thold_ena_clk_noedge_posedge, CheckEnabled => ((aclr_ipd) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/RAM Register VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_clk_ena, TimingData => TimingData_clk_stall, TestSignal => stall_ipd, TestSignalName => "stall", RefSignal => clk_ipd, RefSignalName => "clk", SetupHigh => tsetup_stall_clk_noedge_posedge, SetupLow => tsetup_stall_clk_noedge_posedge, HoldHigh => thold_stall_clk_noedge_posedge, HoldLow => thold_stall_clk_noedge_posedge, CheckEnabled => ((aclr_ipd) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/RAM Register VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_clk_aclr, TimingData => TimingData_clk_aclr, TestSignal => aclr_ipd, TestSignalName => "aclr", RefSignal => clk_ipd, RefSignalName => "clk", SetupHigh => tsetup_aclr_clk_noedge_posedge, SetupLow => tsetup_aclr_clk_noedge_posedge, HoldHigh => thold_aclr_clk_noedge_posedge, HoldLow => thold_aclr_clk_noedge_posedge, CheckEnabled => ((aclr_ipd) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/RAM Register VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_data_clk, TimingData => TimingData_data_clk, TestSignal => d_ipd, TestSignalName => "data", RefSignal => clk_ipd, RefSignalName => "clk", SetupHigh => tsetup_d_clk_noedge_posedge, SetupLow => tsetup_d_clk_noedge_posedge, HoldHigh => thold_d_clk_noedge_posedge, HoldLow => thold_d_clk_noedge_posedge, CheckEnabled => ((aclr_ipd) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/RAM Register VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalPeriodPulseCheck ( Violation => Tviol_ena, PeriodData => PeriodData_ena, TestSignal => ena_ipd, TestSignalName => "ena", PulseWidthHigh => tpw_ena_posedge, HeaderMsg => "/RAM Register VitalPeriodPulseCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); -- Path Delay Selection CQDelay := SelectDelay ( Paths => ( (0 => (clk_ipd'LAST_EVENT,tpd_clk_q_posedge,TRUE), 1 => (aclr_ipd'LAST_EVENT,tpd_aclr_q_posedge,TRUE)) ) ); q <= TRANSPORT q_reg AFTER CQDelay; END PROCESS; aclrout <= aclr_ipd; END reg_arch; ---------------------------------------------------------------------------- -- Module Name : arriaii_ram_pulse_generator -- Description : Generate pulse to initiate memory read/write operations ---------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_ram_pulse_generator IS GENERIC ( tipd_clk : VitalDelayType01 := (0.5 ns,0.5 ns); tipd_ena : VitalDelayType01 := DefPropDelay01; tpd_clk_pulse_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( clk,ena : IN STD_LOGIC; delaywrite : IN STD_LOGIC := '0'; pulse,cycle : OUT STD_LOGIC ); ATTRIBUTE VITAL_Level0 OF arriaii_ram_pulse_generator:ENTITY IS TRUE; END arriaii_ram_pulse_generator; ARCHITECTURE pgen_arch OF arriaii_ram_pulse_generator IS SIGNAL clk_ipd,ena_ipd : STD_LOGIC; SIGNAL state : STD_LOGIC; ATTRIBUTE VITAL_Level0 OF pgen_arch:ARCHITECTURE IS TRUE; BEGIN WireDelay : BLOCK BEGIN VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (ena_ipd, ena, tipd_ena); END BLOCK; PROCESS (clk_ipd,state) BEGIN IF (state = '1' AND state'EVENT) THEN state <= '0'; ELSIF (clk_ipd = '1' AND clk_ipd'EVENT AND ena_ipd = '1') THEN IF (delaywrite = '1') THEN state <= '1' AFTER 1 NS; -- delayed write ELSE state <= '1'; END IF; END IF; END PROCESS; PathDelay : PROCESS VARIABLE pulse_VitalGlitchData : VitalGlitchDataType; BEGIN WAIT UNTIL state'EVENT; VitalPathDelay01 ( OutSignal => pulse, OutSignalName => "pulse", OutTemp => state, Paths => (0 => (clk_ipd'LAST_EVENT,tpd_clk_pulse_posedge,TRUE)), GlitchData => pulse_VitalGlitchData, Mode => DefGlitchMode, XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); END PROCESS; cycle <= clk_ipd; END pgen_arch; LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE work.arriaii_ram_register; USE work.arriaii_ram_pulse_generator; ENTITY arriaii_ram_block IS GENERIC ( -- -------- GLOBAL PARAMETERS --------- operation_mode : STRING := "single_port"; mixed_port_feed_through_mode : STRING := "dont_care"; ram_block_type : STRING := "auto"; logical_ram_name : STRING := "ram_name"; init_file : STRING := "init_file.hex"; init_file_layout : STRING := "none"; enable_ecc : STRING := "false"; width_eccstatus : INTEGER := 3; data_interleave_width_in_bits : INTEGER := 1; data_interleave_offset_in_bits : INTEGER := 1; port_a_logical_ram_depth : INTEGER := 0; port_a_logical_ram_width : INTEGER := 0; port_a_first_address : INTEGER := 0; port_a_last_address : INTEGER := 0; port_a_first_bit_number : INTEGER := 0; port_a_address_clear : STRING := "none"; port_a_data_out_clear : STRING := "none"; port_a_data_in_clock : STRING := "clock0"; port_a_address_clock : STRING := "clock0"; port_a_write_enable_clock : STRING := "clock0"; port_a_read_enable_clock : STRING := "clock0"; port_a_byte_enable_clock : STRING := "clock0"; port_a_data_out_clock : STRING := "none"; port_a_data_width : INTEGER := 1; port_a_address_width : INTEGER := 1; port_a_byte_enable_mask_width : INTEGER := 1; port_b_logical_ram_depth : INTEGER := 0; port_b_logical_ram_width : INTEGER := 0; port_b_first_address : INTEGER := 0; port_b_last_address : INTEGER := 0; port_b_first_bit_number : INTEGER := 0; port_b_address_clear : STRING := "none"; port_b_data_out_clear : STRING := "none"; port_b_data_in_clock : STRING := "clock1"; port_b_address_clock : STRING := "clock1"; port_b_write_enable_clock: STRING := "clock1"; port_b_read_enable_clock: STRING := "clock1"; port_b_byte_enable_clock : STRING := "clock1"; port_b_data_out_clock : STRING := "none"; port_b_data_width : INTEGER := 1; port_b_address_width : INTEGER := 1; port_b_byte_enable_mask_width : INTEGER := 1; port_a_read_during_write_mode : STRING := "new_data_no_nbe_read"; port_b_read_during_write_mode : STRING := "new_data_no_nbe_read"; power_up_uninitialized : STRING := "false"; port_b_byte_size : INTEGER := 0; port_a_byte_size : INTEGER := 0; lpm_type : string := "arriaii_ram_block"; lpm_hint : string := "true"; clk0_input_clock_enable : STRING := "none"; -- ena0,ena2,none clk0_core_clock_enable : STRING := "none"; -- ena0,ena2,none clk0_output_clock_enable : STRING := "none"; -- ena0,none clk1_input_clock_enable : STRING := "none"; -- ena1,ena3,none clk1_core_clock_enable : STRING := "none"; -- ena1,ena3,none clk1_output_clock_enable : STRING := "none"; -- ena1,none clock_duty_cycle_dependence : STRING := "On"; mem_init0 : BIT_VECTOR := X"0"; mem_init1 : BIT_VECTOR := X"0"; mem_init2 : BIT_VECTOR := X"0"; mem_init3 : BIT_VECTOR := X"0"; mem_init4 : BIT_VECTOR := X"0"; mem_init5 : BIT_VECTOR := X"0"; mem_init6 : BIT_VECTOR := X"0"; mem_init7 : BIT_VECTOR := X"0"; mem_init8 : BIT_VECTOR := X"0"; mem_init9 : BIT_VECTOR := X"0"; mem_init10 : BIT_VECTOR := X"0"; mem_init11 : BIT_VECTOR := X"0"; mem_init12 : BIT_VECTOR := X"0"; mem_init13 : BIT_VECTOR := X"0"; mem_init14 : BIT_VECTOR := X"0"; mem_init15 : BIT_VECTOR := X"0"; mem_init16 : BIT_VECTOR := X"0"; mem_init17 : BIT_VECTOR := X"0"; mem_init18 : BIT_VECTOR := X"0"; mem_init19 : BIT_VECTOR := X"0"; mem_init20 : BIT_VECTOR := X"0"; mem_init21 : BIT_VECTOR := X"0"; mem_init22 : BIT_VECTOR := X"0"; mem_init23 : BIT_VECTOR := X"0"; mem_init24 : BIT_VECTOR := X"0"; mem_init25 : BIT_VECTOR := X"0"; mem_init26 : BIT_VECTOR := X"0"; mem_init27 : BIT_VECTOR := X"0"; mem_init28 : BIT_VECTOR := X"0"; mem_init29 : BIT_VECTOR := X"0"; mem_init30 : BIT_VECTOR := X"0"; mem_init31 : BIT_VECTOR := X"0"; mem_init32 : BIT_VECTOR := X"0"; mem_init33 : BIT_VECTOR := X"0"; mem_init34 : BIT_VECTOR := X"0"; mem_init35 : BIT_VECTOR := X"0"; mem_init36 : BIT_VECTOR := X"0"; mem_init37 : BIT_VECTOR := X"0"; mem_init38 : BIT_VECTOR := X"0"; mem_init39 : BIT_VECTOR := X"0"; mem_init40 : BIT_VECTOR := X"0"; mem_init41 : BIT_VECTOR := X"0"; mem_init42 : BIT_VECTOR := X"0"; mem_init43 : BIT_VECTOR := X"0"; mem_init44 : BIT_VECTOR := X"0"; mem_init45 : BIT_VECTOR := X"0"; mem_init46 : BIT_VECTOR := X"0"; mem_init47 : BIT_VECTOR := X"0"; mem_init48 : BIT_VECTOR := X"0"; mem_init49 : BIT_VECTOR := X"0"; mem_init50 : BIT_VECTOR := X"0"; mem_init51 : BIT_VECTOR := X"0"; mem_init52 : BIT_VECTOR := X"0"; mem_init53 : BIT_VECTOR := X"0"; mem_init54 : BIT_VECTOR := X"0"; mem_init55 : BIT_VECTOR := X"0"; mem_init56 : BIT_VECTOR := X"0"; mem_init57 : BIT_VECTOR := X"0"; mem_init58 : BIT_VECTOR := X"0"; mem_init59 : BIT_VECTOR := X"0"; mem_init60 : BIT_VECTOR := X"0"; mem_init61 : BIT_VECTOR := X"0"; mem_init62 : BIT_VECTOR := X"0"; mem_init63 : BIT_VECTOR := X"0"; mem_init64 : BIT_VECTOR := X"0"; mem_init65 : BIT_VECTOR := X"0"; mem_init66 : BIT_VECTOR := X"0"; mem_init67 : BIT_VECTOR := X"0"; mem_init68 : BIT_VECTOR := X"0"; mem_init69 : BIT_VECTOR := X"0"; mem_init70 : BIT_VECTOR := X"0"; mem_init71 : BIT_VECTOR := X"0"; connectivity_checking : string := "off" ); -- -------- PORT DECLARATIONS --------- PORT ( portadatain : IN STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0) := (OTHERS => '0'); portaaddr : IN STD_LOGIC_VECTOR(port_a_address_width - 1 DOWNTO 0) := (OTHERS => '0'); portawe : IN STD_LOGIC := '0'; portare : IN STD_LOGIC := '1'; portbdatain : IN STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0) := (OTHERS => '0'); portbaddr : IN STD_LOGIC_VECTOR(port_b_address_width - 1 DOWNTO 0) := (OTHERS => '0'); portbwe : IN STD_LOGIC := '0'; portbre : IN STD_LOGIC := '1'; clk0 : IN STD_LOGIC := '0'; clk1 : IN STD_LOGIC := '0'; ena0 : IN STD_LOGIC := '1'; ena1 : IN STD_LOGIC := '1'; ena2 : IN STD_LOGIC := '1'; ena3 : IN STD_LOGIC := '1'; clr0 : IN STD_LOGIC := '0'; clr1 : IN STD_LOGIC := '0'; portabyteenamasks : IN STD_LOGIC_VECTOR(port_a_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '1'); portbbyteenamasks : IN STD_LOGIC_VECTOR(port_b_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '1'); devclrn : IN STD_LOGIC := '1'; devpor : IN STD_LOGIC := '1'; portaaddrstall : IN STD_LOGIC := '0'; portbaddrstall : IN STD_LOGIC := '0'; eccstatus : OUT STD_LOGIC_VECTOR(width_eccstatus - 1 DOWNTO 0) := (OTHERS => '0'); dftout : OUT STD_LOGIC_VECTOR(8 DOWNTO 0) := "000000000"; portadataout : OUT STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0); portbdataout : OUT STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0) ); END arriaii_ram_block; ARCHITECTURE block_arch OF arriaii_ram_block IS COMPONENT arriaii_ram_pulse_generator PORT ( clk : IN STD_LOGIC; ena : IN STD_LOGIC; delaywrite : IN STD_LOGIC := '0'; pulse : OUT STD_LOGIC; cycle : OUT STD_LOGIC ); END COMPONENT; COMPONENT arriaii_ram_register GENERIC ( preset : STD_LOGIC := '0'; width : integer := 1 ); PORT ( d : IN STD_LOGIC_VECTOR(width - 1 DOWNTO 0); clk : IN STD_LOGIC; aclr : IN STD_LOGIC; devclrn : IN STD_LOGIC; devpor : IN STD_LOGIC; ena : IN STD_LOGIC; stall : IN STD_LOGIC; q : OUT STD_LOGIC_VECTOR(width - 1 DOWNTO 0); aclrout : OUT STD_LOGIC ); END COMPONENT; FUNCTION cond (condition : BOOLEAN;CONSTANT a,b : INTEGER) RETURN INTEGER IS VARIABLE c: INTEGER; BEGIN IF (condition) THEN c := a; ELSE c := b; END IF; RETURN c; END; SUBTYPE port_type IS BOOLEAN; CONSTANT primary : port_type := TRUE; CONSTANT secondary : port_type := FALSE; CONSTANT primary_port_is_a : BOOLEAN := (port_b_data_width <= port_a_data_width); CONSTANT primary_port_is_b : BOOLEAN := NOT primary_port_is_a; CONSTANT mode_is_rom : BOOLEAN := (operation_mode = "rom"); CONSTANT mode_is_sp : BOOLEAN := (operation_mode = "single_port"); CONSTANT mode_is_dp : BOOLEAN := (operation_mode = "dual_port"); CONSTANT mode_is_bdp : BOOLEAN := (operation_mode = "bidir_dual_port"); CONSTANT wired_mode : BOOLEAN := (port_a_address_width = port_b_address_width) AND (port_a_address_width = 1) AND (port_a_data_width /= port_b_data_width); CONSTANT num_cols : INTEGER := cond(mode_is_rom OR mode_is_sp,1, cond(wired_mode,2,2 ** (ABS(port_b_address_width - port_a_address_width)))); CONSTANT data_width : INTEGER := cond(primary_port_is_a,port_a_data_width,port_b_data_width); CONSTANT data_unit_width : INTEGER := cond(mode_is_rom OR mode_is_sp OR primary_port_is_b,port_a_data_width,port_b_data_width); CONSTANT address_unit_width : INTEGER := cond(mode_is_rom OR mode_is_sp OR primary_port_is_a,port_a_address_width,port_b_address_width); CONSTANT address_width : INTEGER := cond(mode_is_rom OR mode_is_sp OR primary_port_is_b,port_a_address_width,port_b_address_width); CONSTANT byte_size_a : INTEGER := port_a_data_width / port_a_byte_enable_mask_width; CONSTANT byte_size_b : INTEGER := port_b_data_width / port_b_byte_enable_mask_width; CONSTANT out_a_is_reg : BOOLEAN := (port_a_data_out_clock /= "none" AND port_a_data_out_clock /= "UNUSED"); CONSTANT out_b_is_reg : BOOLEAN := (port_b_data_out_clock /= "none" AND port_b_data_out_clock /= "UNUSED"); CONSTANT bytes_a_disabled : STD_LOGIC_VECTOR(port_a_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '0'); CONSTANT bytes_b_disabled : STD_LOGIC_VECTOR(port_b_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '0'); CONSTANT ram_type : BOOLEAN := FALSE; TYPE bool_to_std_logic_map IS ARRAY(TRUE DOWNTO FALSE) OF STD_LOGIC; CONSTANT bool_to_std_logic : bool_to_std_logic_map := ('1','0'); -- Hardware write modes CONSTANT dual_clock : BOOLEAN := (operation_mode = "dual_port" OR operation_mode = "bidir_dual_port") AND (port_b_address_clock = "clock1"); CONSTANT both_new_data_same_port : BOOLEAN := ( ((port_a_read_during_write_mode = "new_data_no_nbe_read") OR (port_a_read_during_write_mode = "dont_care")) AND ((port_b_read_during_write_mode = "new_data_no_nbe_read") OR (port_b_read_during_write_mode = "dont_care")) ); SIGNAL hw_write_mode_a : STRING(3 DOWNTO 1); SIGNAL hw_write_mode_b : STRING(3 DOWNTO 1); SIGNAL delay_write_pulse_a : STD_LOGIC ; SIGNAL delay_write_pulse_b : STD_LOGIC ; CONSTANT be_mask_write_a : BOOLEAN := (port_a_read_during_write_mode = "new_data_with_nbe_read"); CONSTANT be_mask_write_b : BOOLEAN := (port_b_read_during_write_mode = "new_data_with_nbe_read"); CONSTANT old_data_write_a : BOOLEAN := (port_a_read_during_write_mode = "old_data"); CONSTANT old_data_write_b : BOOLEAN := (port_b_read_during_write_mode = "old_data"); SIGNAL read_before_write_a : BOOLEAN; SIGNAL read_before_write_b : BOOLEAN; -- -------- internal signals --------- -- clock / clock enable SIGNAL clk_a_in,clk_b_in : STD_LOGIC; SIGNAL clk_a_byteena,clk_b_byteena : STD_LOGIC; SIGNAL clk_a_out,clk_b_out : STD_LOGIC; SIGNAL clkena_a_out,clkena_b_out : STD_LOGIC; SIGNAL clkena_out_c0, clkena_out_c1 : STD_LOGIC; SIGNAL write_cycle_a,write_cycle_b : STD_LOGIC; SIGNAL clk_a_rena, clk_a_wena : STD_LOGIC; SIGNAL clk_a_core : STD_LOGIC; SIGNAL clk_b_rena, clk_b_wena : STD_LOGIC; SIGNAL clk_b_core : STD_LOGIC; SUBTYPE one_bit_bus_type IS STD_LOGIC_VECTOR(0 DOWNTO 0); -- asynch clear TYPE clear_mode_type IS ARRAY (port_type'HIGH DOWNTO port_type'LOW) OF BOOLEAN; TYPE clear_vec_type IS ARRAY (port_type'HIGH DOWNTO port_type'LOW) OF STD_LOGIC; SIGNAL datain_a_clr,datain_b_clr : STD_LOGIC; SIGNAL dataout_a_clr,dataout_b_clr : STD_LOGIC; SIGNAL dataout_a_clr_reg, dataout_b_clr_reg : STD_LOGIC; SIGNAL dataout_a_clr_reg_in, dataout_b_clr_reg_in : one_bit_bus_type; SIGNAL dataout_a_clr_reg_out, dataout_b_clr_reg_out : one_bit_bus_type; SIGNAL addr_a_clr,addr_b_clr : STD_LOGIC; SIGNAL byteena_a_clr,byteena_b_clr : STD_LOGIC; SIGNAL we_a_clr,re_a_clr,we_b_clr,re_b_clr : STD_LOGIC; SIGNAL datain_a_clr_in,datain_b_clr_in : STD_LOGIC; SIGNAL addr_a_clr_in,addr_b_clr_in : STD_LOGIC; SIGNAL byteena_a_clr_in,byteena_b_clr_in : STD_LOGIC; SIGNAL we_a_clr_in,re_a_clr_in,we_b_clr_in,re_b_clr_in : STD_LOGIC; SIGNAL mem_invalidate,mem_invalidate_loc,read_latch_invalidate : clear_mode_type; SIGNAL clear_asserted_during_write : clear_vec_type; -- port A registers SIGNAL we_a_reg : STD_LOGIC; SIGNAL re_a_reg : STD_LOGIC; SIGNAL we_a_reg_in,we_a_reg_out : one_bit_bus_type; SIGNAL re_a_reg_in,re_a_reg_out : one_bit_bus_type; SIGNAL addr_a_reg : STD_LOGIC_VECTOR(port_a_address_width - 1 DOWNTO 0); SIGNAL datain_a_reg : STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0); SIGNAL dataout_a_reg : STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0); SIGNAL dataout_a : STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0); SIGNAL byteena_a_reg : STD_LOGIC_VECTOR(port_a_byte_enable_mask_width- 1 DOWNTO 0); -- port B registers SIGNAL we_b_reg, re_b_reg : STD_LOGIC; SIGNAL re_b_reg_in,re_b_reg_out,we_b_reg_in,we_b_reg_out : one_bit_bus_type; SIGNAL addr_b_reg : STD_LOGIC_VECTOR(port_b_address_width - 1 DOWNTO 0); SIGNAL datain_b_reg : STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0); SIGNAL dataout_b_reg : STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0); SIGNAL dataout_b : STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0); SIGNAL byteena_b_reg : STD_LOGIC_VECTOR(port_b_byte_enable_mask_width- 1 DOWNTO 0); -- pulses TYPE pulse_vec IS ARRAY (port_type'HIGH DOWNTO port_type'LOW) OF STD_LOGIC; SIGNAL write_pulse,read_pulse,read_pulse_feedthru : pulse_vec; SIGNAL rw_pulse : pulse_vec; SIGNAL wpgen_a_clk,wpgen_a_clkena,wpgen_b_clk,wpgen_b_clkena : STD_LOGIC; SIGNAL rpgen_a_clkena,rpgen_b_clkena : STD_LOGIC; SIGNAL ftpgen_a_clkena,ftpgen_b_clkena : STD_LOGIC; SIGNAL rwpgen_a_clkena,rwpgen_b_clkena : STD_LOGIC; -- registered address SIGNAL addr_prime_reg,addr_sec_reg : INTEGER; -- input/output SIGNAL datain_prime_reg,dataout_prime : STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0); SIGNAL datain_sec_reg,dataout_sec : STD_LOGIC_VECTOR(data_unit_width - 1 DOWNTO 0); -- overlapping location write SIGNAL dual_write : BOOLEAN; -- byte enable mask write TYPE be_mask_write_vec IS ARRAY (port_type'HIGH DOWNTO port_type'LOW) OF BOOLEAN; SIGNAL be_mask_write : be_mask_write_vec; -- memory core SUBTYPE mem_word_type IS STD_LOGIC_VECTOR (data_width - 1 DOWNTO 0); SUBTYPE mem_col_type IS STD_LOGIC_VECTOR (data_unit_width - 1 DOWNTO 0); TYPE mem_row_type IS ARRAY (num_cols - 1 DOWNTO 0) OF mem_col_type; TYPE mem_type IS ARRAY ((2 ** address_unit_width) - 1 DOWNTO 0) OF mem_row_type; SIGNAL mem : mem_type; SIGNAL init_mem : BOOLEAN := FALSE; CONSTANT mem_x : mem_type := (OTHERS => (OTHERS => (OTHERS => 'X'))); CONSTANT row_x : mem_row_type := (OTHERS => (OTHERS => 'X')); CONSTANT col_x : mem_col_type := (OTHERS => 'X'); SIGNAL mem_data : mem_row_type; SIGNAL old_mem_data : mem_row_type; SIGNAL mem_unit_data : mem_col_type; -- latches TYPE read_latch_rec IS RECORD prime : mem_row_type; sec : mem_col_type; END RECORD; SIGNAL read_latch : read_latch_rec; -- (row,column) coordinates SIGNAL row_sec,col_sec : INTEGER; -- byte enable TYPE mask_type IS (normal,inverse); TYPE mask_prime_type IS ARRAY(mask_type'HIGH DOWNTO mask_type'LOW) OF mem_word_type; TYPE mask_sec_type IS ARRAY(mask_type'HIGH DOWNTO mask_type'LOW) OF mem_col_type; TYPE mask_rec IS RECORD prime : mask_prime_type; sec : mask_sec_type; END RECORD; SIGNAL mask_vector : mask_rec; SIGNAL mask_vector_common : mem_col_type; FUNCTION get_mask( b_ena : IN STD_LOGIC_VECTOR; mode : port_type; CONSTANT b_ena_width ,byte_size: INTEGER ) RETURN mask_rec IS VARIABLE l : INTEGER; VARIABLE mask : mask_rec := ( (normal => (OTHERS => '0'),inverse => (OTHERS => 'X')), (normal => (OTHERS => '0'),inverse => (OTHERS => 'X')) ); BEGIN FOR l in 0 TO b_ena_width - 1 LOOP IF (b_ena(l) = '0') THEN IF (mode = primary) THEN mask.prime(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); mask.prime(inverse)((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => '0'); ELSE mask.sec(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); mask.sec(inverse)((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => '0'); END IF; ELSIF (b_ena(l) = 'X' OR b_ena(l) = 'U') THEN IF (mode = primary) THEN mask.prime(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); ELSE mask.sec(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); END IF; END IF; END LOOP; RETURN mask; END get_mask; -- port active for read/write SIGNAL active_a_core_in_vec,active_b_core_in_vec,active_a_core_out,active_b_core_out : one_bit_bus_type; SIGNAL active_a_in,active_b_in : STD_LOGIC; SIGNAL active_write_a : BOOLEAN; SIGNAL active_write_b : BOOLEAN; SIGNAL active_b_in_c0,active_b_core_in_c0,active_b_in_c1,active_b_core_in_c1 : STD_LOGIC; SIGNAL active_a_core_in,active_b_core_in : STD_LOGIC; SIGNAL active_a_core, active_b_core : BOOLEAN; SIGNAL wire_vcc : STD_LOGIC := '1'; SIGNAL wire_gnd : STD_LOGIC := '0'; BEGIN -- memory initialization init_mem <= TRUE; -- hardware write modes hw_write_mode_a <= "R+W" WHEN ((port_a_read_during_write_mode = "old_data") OR (port_a_read_during_write_mode = "new_data_with_nbe_read")) ELSE " FW" WHEN (dual_clock OR ( mixed_port_feed_through_mode = "dont_care" AND both_new_data_same_port )) ELSE " DW"; hw_write_mode_b <= "R+W" WHEN ((port_b_read_during_write_mode = "old_data") OR (port_b_read_during_write_mode = "new_data_with_nbe_read")) ELSE " FW" WHEN (dual_clock OR ( mixed_port_feed_through_mode = "dont_care" AND both_new_data_same_port )) ELSE " DW"; delay_write_pulse_a <= '0' WHEN (mode_is_dp AND mixed_port_feed_through_mode = "dont_care") ELSE '1' WHEN (hw_write_mode_a /= " FW") ELSE '0'; delay_write_pulse_b <= '1' WHEN (hw_write_mode_b /= " FW") ELSE '0' ; read_before_write_a <= (hw_write_mode_a = "R+W"); read_before_write_b <= (hw_write_mode_b = "R+W"); -- -------- core logic --------------- clk_a_in <= clk0; clk_a_wena <= '0' WHEN (port_a_write_enable_clock = "none") ELSE clk_a_in; clk_a_rena <= '0' WHEN (port_a_read_enable_clock = "none") ELSE clk_a_in; clk_a_byteena <= '0' WHEN (port_a_byte_enable_clock = "none" OR port_a_byte_enable_clock = "UNUSED") ELSE clk_a_in; clk_a_out <= '0' WHEN (port_a_data_out_clock = "none" OR port_a_data_out_clock = "UNUSED") ELSE clk0 WHEN (port_a_data_out_clock = "clock0") ELSE clk1; clk_b_in <= clk0 WHEN (port_b_address_clock = "clock0") ELSE clk1; clk_b_byteena <= '0' WHEN (port_b_byte_enable_clock = "none" OR port_b_byte_enable_clock = "UNUSED") ELSE clk0 WHEN (port_b_byte_enable_clock = "clock0") ELSE clk1; clk_b_wena <= '0' WHEN (port_b_write_enable_clock = "none") ELSE clk0 WHEN (port_b_write_enable_clock = "clock0") ELSE clk1; clk_b_rena <= '0' WHEN (port_b_read_enable_clock = "none") ELSE clk0 WHEN (port_b_read_enable_clock = "clock0") ELSE clk1; clk_b_out <= '0' WHEN (port_b_data_out_clock = "none" OR port_b_data_out_clock = "UNUSED") ELSE clk0 WHEN (port_b_data_out_clock = "clock0") ELSE clk1; addr_a_clr_in <= '0' WHEN (port_a_address_clear = "none" OR port_a_address_clear = "UNUSED") ELSE clr0; addr_b_clr_in <= '0' WHEN (port_b_address_clear = "none" OR port_b_address_clear = "UNUSED") ELSE clr0 WHEN (port_b_address_clear = "clear0") ELSE clr1; datain_a_clr_in <= '0'; datain_b_clr_in <= '0'; dataout_a_clr <= '0' WHEN (port_a_data_out_clear = "none" OR port_a_data_out_clear = "UNUSED") ELSE clr0 WHEN (port_a_data_out_clear = "clear0") ELSE clr1; dataout_b_clr <= '0' WHEN (port_b_data_out_clear = "none" OR port_b_data_out_clear = "UNUSED") ELSE clr0 WHEN (port_b_data_out_clear = "clear0") ELSE clr1; byteena_a_clr_in <= '0'; byteena_b_clr_in <= '0'; we_a_clr_in <= '0'; re_a_clr_in <= '0'; we_b_clr_in <= '0'; re_b_clr_in <= '0'; active_a_in <= '1' WHEN (clk0_input_clock_enable = "none") ELSE ena0 WHEN (clk0_input_clock_enable = "ena0") ELSE ena2; active_a_core_in <= '1' WHEN (clk0_core_clock_enable = "none") ELSE ena0 WHEN (clk0_core_clock_enable = "ena0") ELSE ena2; be_mask_write(primary_port_is_a) <= be_mask_write_a; be_mask_write(primary_port_is_b) <= be_mask_write_b; active_b_in_c0 <= '1' WHEN (clk0_input_clock_enable = "none") ELSE ena0 WHEN (clk0_input_clock_enable = "ena0") ELSE ena2; active_b_in_c1 <= '1' WHEN (clk1_input_clock_enable = "none") ELSE ena1 WHEN (clk1_input_clock_enable = "ena1") ELSE ena3; active_b_in <= active_b_in_c0 WHEN (port_b_address_clock = "clock0") ELSE active_b_in_c1; active_b_core_in_c0 <= '1' WHEN (clk0_core_clock_enable = "none") ELSE ena0 WHEN (clk0_core_clock_enable = "ena0") ELSE ena2; active_b_core_in_c1 <= '1' WHEN (clk1_core_clock_enable = "none") ELSE ena1 WHEN (clk1_core_clock_enable = "ena1") ELSE ena3; active_b_core_in <= active_b_core_in_c0 WHEN (port_b_address_clock = "clock0") ELSE active_b_core_in_c1; active_write_a <= (byteena_a_reg /= bytes_a_disabled); active_write_b <= (byteena_b_reg /= bytes_b_disabled); -- Store core clock enable value for delayed write -- port A core active active_a_core_in_vec(0) <= active_a_core_in; active_core_port_a : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => active_a_core_in_vec, clk => clk_a_in, aclr => wire_gnd, devclrn => wire_vcc,devpor => wire_vcc, ena => wire_vcc, stall => wire_gnd, q => active_a_core_out ); active_a_core <= (active_a_core_out(0) = '1'); -- port B core active active_b_core_in_vec(0) <= active_b_core_in; active_core_port_b : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => active_b_core_in_vec, clk => clk_b_in, aclr => wire_gnd, devclrn => wire_vcc,devpor => wire_vcc, ena => wire_vcc, stall => wire_gnd, q => active_b_core_out ); active_b_core <= (active_b_core_out(0) = '1'); -- ------ A input registers -- write enable we_a_reg_in(0) <= '0' WHEN mode_is_rom ELSE portawe; we_a_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => we_a_reg_in, clk => clk_a_wena, aclr => we_a_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_a_core_in, q => we_a_reg_out, aclrout => we_a_clr ); we_a_reg <= we_a_reg_out(0); -- read enable re_a_reg_in(0) <= portare; re_a_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => re_a_reg_in, clk => clk_a_rena, aclr => re_a_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_a_core_in, q => re_a_reg_out, aclrout => re_a_clr ); re_a_reg <= re_a_reg_out(0); -- address addr_a_register : arriaii_ram_register GENERIC MAP ( width => port_a_address_width ) PORT MAP ( d => portaaddr, clk => clk_a_in, aclr => addr_a_clr_in, devclrn => devclrn, devpor => devpor, stall => portaaddrstall, ena => active_a_in, q => addr_a_reg, aclrout => addr_a_clr ); -- data datain_a_register : arriaii_ram_register GENERIC MAP ( width => port_a_data_width ) PORT MAP ( d => portadatain, clk => clk_a_in, aclr => datain_a_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_a_in, q => datain_a_reg, aclrout => datain_a_clr ); -- byte enable byteena_a_register : arriaii_ram_register GENERIC MAP ( width => port_a_byte_enable_mask_width, preset => '1' ) PORT MAP ( d => portabyteenamasks, clk => clk_a_byteena, aclr => byteena_a_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_a_in, q => byteena_a_reg, aclrout => byteena_a_clr ); -- ------ B input registers -- read enable re_b_reg_in(0) <= portbre; re_b_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => re_b_reg_in, clk => clk_b_in, aclr => re_b_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_b_core_in, q => re_b_reg_out, aclrout => re_b_clr ); re_b_reg <= re_b_reg_out(0); -- write enable we_b_reg_in(0) <= portbwe; we_b_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => we_b_reg_in, clk => clk_b_in, aclr => we_b_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_b_core_in, q => we_b_reg_out, aclrout => we_b_clr ); we_b_reg <= we_b_reg_out(0); -- address addr_b_register : arriaii_ram_register GENERIC MAP ( width => port_b_address_width ) PORT MAP ( d => portbaddr, clk => clk_b_in, aclr => addr_b_clr_in, devclrn => devclrn, devpor => devpor, stall => portbaddrstall, ena => active_b_in, q => addr_b_reg, aclrout => addr_b_clr ); -- data datain_b_register : arriaii_ram_register GENERIC MAP ( width => port_b_data_width ) PORT MAP ( d => portbdatain, clk => clk_b_in, aclr => datain_b_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_b_in, q => datain_b_reg, aclrout => datain_b_clr ); -- byte enable byteena_b_register : arriaii_ram_register GENERIC MAP ( width => port_b_byte_enable_mask_width, preset => '1' ) PORT MAP ( d => portbbyteenamasks, clk => clk_b_byteena, aclr => byteena_b_clr_in, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => active_b_in, q => byteena_b_reg, aclrout => byteena_b_clr ); datain_prime_reg <= datain_a_reg WHEN primary_port_is_a ELSE datain_b_reg; addr_prime_reg <= alt_conv_integer(addr_a_reg) WHEN primary_port_is_a ELSE alt_conv_integer(addr_b_reg); datain_sec_reg <= (OTHERS => 'U') WHEN (mode_is_rom OR mode_is_sp) ELSE datain_b_reg WHEN primary_port_is_a ELSE datain_a_reg; addr_sec_reg <= alt_conv_integer(addr_b_reg) WHEN primary_port_is_a ELSE alt_conv_integer(addr_a_reg); -- Write pulse generation wpgen_a_clk <= clk_a_in; wpgen_a_clkena <= '1' WHEN (active_a_core AND active_write_a AND (we_a_reg = '1')) ELSE '0'; wpgen_a : arriaii_ram_pulse_generator PORT MAP ( clk => wpgen_a_clk, ena => wpgen_a_clkena, delaywrite => delay_write_pulse_a, pulse => write_pulse(primary_port_is_a), cycle => write_cycle_a ); wpgen_b_clk <= clk_b_in; wpgen_b_clkena <= '1' WHEN (active_b_core AND active_write_b AND mode_is_bdp AND (we_b_reg = '1')) ELSE '0'; wpgen_b : arriaii_ram_pulse_generator PORT MAP ( clk => wpgen_b_clk, ena => wpgen_b_clkena, delaywrite => delay_write_pulse_b, pulse => write_pulse(primary_port_is_b), cycle => write_cycle_b ); -- Read pulse generation rpgen_a_clkena <= '1' WHEN (active_a_core AND (re_a_reg = '1') AND (we_a_reg = '0')) ELSE '0'; rpgen_a : arriaii_ram_pulse_generator PORT MAP ( clk => clk_a_in, ena => rpgen_a_clkena, cycle => clk_a_core, pulse => read_pulse(primary_port_is_a) ); rpgen_b_clkena <= '1' WHEN ((mode_is_dp OR mode_is_bdp) AND active_b_core AND (re_b_reg = '1') AND (we_b_reg = '0')) ELSE '0'; rpgen_b : arriaii_ram_pulse_generator PORT MAP ( clk => clk_b_in, ena => rpgen_b_clkena, cycle => clk_b_core, pulse => read_pulse(primary_port_is_b) ); -- Read-during-Write pulse generation rwpgen_a_clkena <= '1' WHEN (active_a_core AND (re_a_reg = '1') AND (we_a_reg = '1') AND read_before_write_a) ELSE '0'; rwpgen_a : arriaii_ram_pulse_generator PORT MAP ( clk => clk_a_in, ena => rwpgen_a_clkena, pulse => rw_pulse(primary_port_is_a) ); rwpgen_b_clkena <= '1' WHEN (active_b_core AND mode_is_bdp AND (re_b_reg = '1') AND (we_b_reg = '1') AND read_before_write_b) ELSE '0'; rwpgen_b : arriaii_ram_pulse_generator PORT MAP ( clk => clk_b_in, ena => rwpgen_b_clkena, pulse => rw_pulse(primary_port_is_b) ); -- Create internal masks for byte enable processing mask_create : PROCESS (byteena_a_reg,byteena_b_reg) VARIABLE mask : mask_rec; BEGIN IF (byteena_a_reg'EVENT) THEN mask := get_mask(byteena_a_reg,primary_port_is_a,port_a_byte_enable_mask_width,byte_size_a); IF (primary_port_is_a) THEN mask_vector.prime <= mask.prime; ELSE mask_vector.sec <= mask.sec; END IF; END IF; IF (byteena_b_reg'EVENT) THEN mask := get_mask(byteena_b_reg,primary_port_is_b,port_b_byte_enable_mask_width,byte_size_b); IF (primary_port_is_b) THEN mask_vector.prime <= mask.prime; ELSE mask_vector.sec <= mask.sec; END IF; END IF; END PROCESS mask_create; -- (row,col) coordinates row_sec <= addr_sec_reg / num_cols; col_sec <= addr_sec_reg mod num_cols; mem_rw : PROCESS (init_mem, write_pulse,read_pulse,read_pulse_feedthru, rw_pulse, mem_invalidate,mem_invalidate_loc,read_latch_invalidate) -- mem init TYPE rw_type IS ARRAY (port_type'HIGH DOWNTO port_type'LOW) OF BOOLEAN; VARIABLE addr_range_init,row,col,index : INTEGER; VARIABLE mem_init_std : STD_LOGIC_VECTOR((port_a_last_address - port_a_first_address + 1)*port_a_data_width - 1 DOWNTO 0); VARIABLE mem_init : bit_vector(mem_init71'length + mem_init70'length + mem_init69'length + mem_init68'length + mem_init67'length + mem_init66'length + mem_init65'length + mem_init64'length + mem_init63'length + mem_init62'length + mem_init61'length + mem_init60'length + mem_init59'length + mem_init58'length + mem_init57'length + mem_init56'length + mem_init55'length + mem_init54'length + mem_init53'length + mem_init52'length + mem_init51'length + mem_init50'length + mem_init49'length + mem_init48'length + mem_init47'length + mem_init46'length + mem_init45'length + mem_init44'length + mem_init43'length + mem_init42'length + mem_init41'length + mem_init40'length + mem_init39'length + mem_init38'length + mem_init37'length + mem_init36'length + mem_init35'length + mem_init34'length + mem_init33'length + mem_init32'length + mem_init31'length + mem_init30'length + mem_init29'length + mem_init28'length + mem_init27'length + mem_init26'length + mem_init25'length + mem_init24'length + mem_init23'length + mem_init22'length + mem_init21'length + mem_init20'length + mem_init19'length + mem_init18'length + mem_init17'length + mem_init16'length + mem_init15'length + mem_init14'length + mem_init13'length + mem_init12'length + mem_init11'length + mem_init10'length + mem_init9'length + mem_init8'length + mem_init7'length + mem_init6'length + mem_init5'length + mem_init4'length + mem_init3'length + mem_init2'length + mem_init1'length + mem_init0'length - 1 DOWNTO 0); VARIABLE mem_val : mem_type; -- read/write VARIABLE mem_data_p : mem_row_type; VARIABLE old_mem_data_p : mem_row_type; VARIABLE row_prime,col_prime : INTEGER; VARIABLE access_same_location : BOOLEAN; VARIABLE read_during_write : rw_type; BEGIN read_during_write := (FALSE,FALSE); -- Memory initialization IF (init_mem'EVENT) THEN -- Initialize output latches to 0 IF (primary_port_is_a) THEN dataout_prime <= (OTHERS => '0'); IF (mode_is_dp OR mode_is_bdp) THEN dataout_sec <= (OTHERS => '0'); END IF; ELSE dataout_sec <= (OTHERS => '0'); IF (mode_is_dp OR mode_is_bdp) THEN dataout_prime <= (OTHERS => '0'); END IF; END IF; IF (power_up_uninitialized = "false" AND (NOT ram_type)) THEN mem_val := (OTHERS => (OTHERS => (OTHERS => '0'))); END IF; IF (primary_port_is_a) THEN addr_range_init := port_a_last_address - port_a_first_address + 1; ELSE addr_range_init := port_b_last_address - port_b_first_address + 1; END IF; IF (init_file_layout = "port_a" OR init_file_layout = "port_b") THEN mem_init := mem_init71 & mem_init70 & mem_init69 & mem_init68 & mem_init67 & mem_init66 & mem_init65 & mem_init64 & mem_init63 & mem_init62 & mem_init61 & mem_init60 & mem_init59 & mem_init58 & mem_init57 & mem_init56 & mem_init55 & mem_init54 & mem_init53 & mem_init52 & mem_init51 & mem_init50 & mem_init49 & mem_init48 & mem_init47 & mem_init46 & mem_init45 & mem_init44 & mem_init43 & mem_init42 & mem_init41 & mem_init40 & mem_init39 & mem_init38 & mem_init37 & mem_init36 & mem_init35 & mem_init34 & mem_init33 & mem_init32 & mem_init31 & mem_init30 & mem_init29 & mem_init28 & mem_init27 & mem_init26 & mem_init25 & mem_init24 & mem_init23 & mem_init22 & mem_init21 & mem_init20 & mem_init19 & mem_init18 & mem_init17 & mem_init16 & mem_init15 & mem_init14 & mem_init13 & mem_init12 & mem_init11 & mem_init10 & mem_init9 & mem_init8 & mem_init7 & mem_init6 & mem_init5 & mem_init4 & mem_init3 & mem_init2 & mem_init1 & mem_init0; mem_init_std := to_stdlogicvector(mem_init) ((port_a_last_address - port_a_first_address + 1)*port_a_data_width - 1 DOWNTO 0); FOR row IN 0 TO addr_range_init - 1 LOOP FOR col IN 0 to num_cols - 1 LOOP index := row * data_width; mem_val(row)(col) := mem_init_std(index + (col+1)*data_unit_width -1 DOWNTO index + col*data_unit_width); END LOOP; END LOOP; END IF; mem <= mem_val; END IF; access_same_location := (mode_is_dp OR mode_is_bdp) AND (addr_prime_reg = row_sec); -- Read before Write stage 1 : read data from memory -- Read before Write stage 2 : send data to output IF (rw_pulse(primary)'EVENT) THEN IF (rw_pulse(primary) = '1') THEN read_latch.prime <= mem(addr_prime_reg); ELSE IF (be_mask_write(primary)) THEN FOR i IN 0 TO data_width - 1 LOOP IF (mask_vector.prime(normal)(i) = 'X') THEN row_prime := i / data_unit_width; col_prime := i mod data_unit_width; dataout_prime(i) <= read_latch.prime(row_prime)(col_prime); END IF; END LOOP; ELSE FOR i IN 0 TO data_width - 1 LOOP row_prime := i / data_unit_width; col_prime := i mod data_unit_width; dataout_prime(i) <= read_latch.prime(row_prime)(col_prime); END LOOP; END IF; END IF; END IF; IF (rw_pulse(secondary)'EVENT) THEN IF (rw_pulse(secondary) = '1') THEN read_latch.sec <= mem(row_sec)(col_sec); ELSE IF (be_mask_write(secondary)) THEN FOR i IN 0 TO data_unit_width - 1 LOOP IF (mask_vector.sec(normal)(i) = 'X') THEN dataout_sec(i) <= read_latch.sec(i); END IF; END LOOP; ELSE dataout_sec <= read_latch.sec; END IF; END IF; END IF; -- Write stage 1 : X to buffer -- Write stage 2 : actual data to memory IF (write_pulse(primary)'EVENT) THEN IF (write_pulse(primary) = '1') THEN old_mem_data_p := mem(addr_prime_reg); mem_data_p := mem(addr_prime_reg); FOR i IN 0 TO num_cols - 1 LOOP mem_data_p(i) := mem_data_p(i) XOR mask_vector.prime(inverse)((i + 1)*data_unit_width - 1 DOWNTO i*data_unit_width); END LOOP; read_during_write(secondary) := (access_same_location AND read_pulse(secondary)'EVENT AND read_pulse(secondary) = '1'); IF (read_during_write(secondary)) THEN read_latch.sec <= old_mem_data_p(col_sec); ELSE mem_data <= mem_data_p; END IF; ELSIF (clear_asserted_during_write(primary) /= '1') THEN FOR i IN 0 TO data_width - 1 LOOP IF (mask_vector.prime(normal)(i) = '0') THEN mem(addr_prime_reg)(i / data_unit_width)(i mod data_unit_width) <= datain_prime_reg(i); ELSIF (mask_vector.prime(inverse)(i) = 'X') THEN mem(addr_prime_reg)(i / data_unit_width)(i mod data_unit_width) <= 'X'; END IF; END LOOP; END IF; END IF; IF (write_pulse(secondary)'EVENT) THEN IF (write_pulse(secondary) = '1') THEN read_during_write(primary) := (access_same_location AND read_pulse(primary)'EVENT AND read_pulse(primary) = '1'); IF (read_during_write(primary)) THEN read_latch.prime <= mem(addr_prime_reg); read_latch.prime(col_sec) <= mem(row_sec)(col_sec) XOR mask_vector.sec(inverse); ELSE mem_unit_data <= mem(row_sec)(col_sec) XOR mask_vector.sec(inverse); END IF; IF (access_same_location AND write_pulse(primary)'EVENT AND write_pulse(primary) = '1') THEN mask_vector_common <= mask_vector.prime(inverse)(((col_sec + 1)* data_unit_width - 1) DOWNTO col_sec*data_unit_width) AND mask_vector.sec(inverse); dual_write <= TRUE; END IF; ELSIF (clear_asserted_during_write(secondary) /= '1') THEN FOR i IN 0 TO data_unit_width - 1 LOOP IF (mask_vector.sec(normal)(i) = '0') THEN mem(row_sec)(col_sec)(i) <= datain_sec_reg(i); ELSIF (mask_vector.sec(inverse)(i) = 'X') THEN mem(row_sec)(col_sec)(i) <= 'X'; END IF; END LOOP; END IF; END IF; -- Simultaneous write IF (dual_write AND write_pulse = "00") THEN mem(row_sec)(col_sec) <= mem(row_sec)(col_sec) XOR mask_vector_common; dual_write <= FALSE; END IF; -- Read stage 1 : read data -- Read stage 2 : send data to output IF ((NOT read_during_write(primary)) AND read_pulse(primary)'EVENT) THEN IF (read_pulse(primary) = '1') THEN read_latch.prime <= mem(addr_prime_reg); IF (access_same_location AND write_pulse(secondary) = '1') THEN read_latch.prime(col_sec) <= mem_unit_data; END IF; ELSE FOR i IN 0 TO data_width - 1 LOOP row_prime := i / data_unit_width; col_prime := i mod data_unit_width; dataout_prime(i) <= read_latch.prime(row_prime)(col_prime); END LOOP; END IF; END IF; IF ((NOT read_during_write(secondary)) AND read_pulse(secondary)'EVENT) THEN IF (read_pulse(secondary) = '1') THEN IF (access_same_location AND write_pulse(primary) = '1') THEN read_latch.sec <= mem_data(col_sec); ELSE read_latch.sec <= mem(row_sec)(col_sec); END IF; ELSE dataout_sec <= read_latch.sec; END IF; END IF; -- Same port feed thru IF (read_pulse_feedthru(primary)'EVENT AND read_pulse_feedthru(primary) = '0') THEN IF (be_mask_write(primary)) THEN FOR i IN 0 TO data_width - 1 LOOP IF (mask_vector.prime(normal)(i) = '0') THEN dataout_prime(i) <= datain_prime_reg(i); END IF; END LOOP; ELSE dataout_prime <= datain_prime_reg XOR mask_vector.prime(normal); END IF; END IF; IF (read_pulse_feedthru(secondary)'EVENT AND read_pulse_feedthru(secondary) = '0') THEN IF (be_mask_write(secondary)) THEN FOR i IN 0 TO data_unit_width - 1 LOOP IF (mask_vector.sec(normal)(i) = '0') THEN dataout_sec(i) <= datain_sec_reg(i); END IF; END LOOP; ELSE dataout_sec <= datain_sec_reg XOR mask_vector.sec(normal); END IF; END IF; -- Async clear IF (mem_invalidate'EVENT) THEN IF (mem_invalidate(primary) = TRUE OR mem_invalidate(secondary) = TRUE) THEN mem <= mem_x; END IF; END IF; IF (mem_invalidate_loc'EVENT) THEN IF (mem_invalidate_loc(primary)) THEN mem(addr_prime_reg) <= row_x; END IF; IF (mem_invalidate_loc(secondary)) THEN mem(row_sec)(col_sec) <= col_x; END IF; END IF; IF (read_latch_invalidate'EVENT) THEN IF (read_latch_invalidate(primary)) THEN read_latch.prime <= row_x; END IF; IF (read_latch_invalidate(secondary)) THEN read_latch.sec <= col_x; END IF; END IF; END PROCESS mem_rw; -- Same port feed through ftpgen_a_clkena <= '1' WHEN (active_a_core AND (NOT mode_is_dp) AND (NOT old_data_write_a) AND (we_a_reg = '1') AND (re_a_reg = '1')) ELSE '0'; ftpgen_a : arriaii_ram_pulse_generator PORT MAP ( clk => clk_a_in, ena => ftpgen_a_clkena, pulse => read_pulse_feedthru(primary_port_is_a) ); ftpgen_b_clkena <= '1' WHEN (active_b_core AND mode_is_bdp AND (NOT old_data_write_b) AND (we_b_reg = '1') AND (re_b_reg = '1')) ELSE '0'; ftpgen_b : arriaii_ram_pulse_generator PORT MAP ( clk => clk_b_in, ena => ftpgen_b_clkena, pulse => read_pulse_feedthru(primary_port_is_b) ); -- Asynch clear events clear_a : PROCESS(addr_a_clr,we_a_clr,datain_a_clr) BEGIN IF (addr_a_clr'EVENT AND addr_a_clr = '1') THEN clear_asserted_during_write(primary_port_is_a) <= write_pulse(primary_port_is_a); IF (active_write_a AND (write_cycle_a = '1') AND (we_a_reg = '1')) THEN mem_invalidate(primary_port_is_a) <= TRUE,FALSE AFTER 0.5 ns; ELSIF (active_a_core AND re_a_reg = '1') THEN read_latch_invalidate(primary_port_is_a) <= TRUE,FALSE AFTER 0.5 ns; END IF; END IF; IF ((we_a_clr'EVENT AND we_a_clr = '1') OR (datain_a_clr'EVENT AND datain_a_clr = '1')) THEN clear_asserted_during_write(primary_port_is_a) <= write_pulse(primary_port_is_a); IF (active_write_a AND (write_cycle_a = '1') AND (we_a_reg = '1')) THEN mem_invalidate_loc(primary_port_is_a) <= TRUE,FALSE AFTER 0.5 ns; read_latch_invalidate(primary_port_is_a) <= TRUE,FALSE AFTER 0.5 ns; END IF; END IF; END PROCESS clear_a; clear_b : PROCESS(addr_b_clr,we_b_clr,datain_b_clr) BEGIN IF (addr_b_clr'EVENT AND addr_b_clr = '1') THEN clear_asserted_during_write(primary_port_is_b) <= write_pulse(primary_port_is_b); IF (mode_is_bdp AND active_write_b AND (write_cycle_b = '1') AND (we_b_reg = '1')) THEN mem_invalidate(primary_port_is_b) <= TRUE,FALSE AFTER 0.5 ns; ELSIF ((mode_is_dp OR mode_is_bdp) AND active_b_core AND re_b_reg = '1') THEN read_latch_invalidate(primary_port_is_b) <= TRUE,FALSE AFTER 0.5 ns; END IF; END IF; IF ((we_b_clr'EVENT AND we_b_clr = '1') OR (datain_b_clr'EVENT AND datain_b_clr = '1')) THEN clear_asserted_during_write(primary_port_is_b) <= write_pulse(primary_port_is_b); IF (mode_is_bdp AND active_write_b AND (write_cycle_b = '1') AND (we_b_reg = '1')) THEN mem_invalidate_loc(primary_port_is_b) <= TRUE,FALSE AFTER 0.5 ns; read_latch_invalidate(primary_port_is_b) <= TRUE,FALSE AFTER 0.5 ns; END IF; END IF; END PROCESS clear_b; -- Clear mux registers (Latch Clear) -- Port A output register clear dataout_a_clr_reg_in(0) <= dataout_a_clr; aclr_a_mux_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => dataout_a_clr_reg_in, clk => clk_a_core, aclr => wire_gnd, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => wire_vcc, q => dataout_a_clr_reg_out ); dataout_a_clr_reg <= dataout_a_clr_reg_out(0); -- Port B output register clear dataout_b_clr_reg_in(0) <= dataout_b_clr; aclr_b_mux_register : arriaii_ram_register GENERIC MAP ( width => 1 ) PORT MAP ( d => dataout_b_clr_reg_in, clk => clk_b_core, aclr => wire_gnd, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => wire_vcc, q => dataout_b_clr_reg_out ); dataout_b_clr_reg <= dataout_b_clr_reg_out(0); -- ------ Output registers clkena_out_c0 <= '1' WHEN (clk0_output_clock_enable = "none") ELSE ena0; clkena_out_c1 <= '1' WHEN (clk1_output_clock_enable = "none") ELSE ena1; clkena_a_out <= clkena_out_c0 WHEN (port_a_data_out_clock = "clock0") ELSE clkena_out_c1; clkena_b_out <= clkena_out_c0 WHEN (port_b_data_out_clock = "clock0") ELSE clkena_out_c1; dataout_a <= dataout_prime WHEN primary_port_is_a ELSE dataout_sec; dataout_b <= (OTHERS => 'U') WHEN (mode_is_rom OR mode_is_sp) ELSE dataout_prime WHEN primary_port_is_b ELSE dataout_sec; dataout_a_register : arriaii_ram_register GENERIC MAP ( width => port_a_data_width ) PORT MAP ( d => dataout_a, clk => clk_a_out, aclr => dataout_a_clr, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => clkena_a_out, q => dataout_a_reg ); dataout_b_register : arriaii_ram_register GENERIC MAP ( width => port_b_data_width ) PORT MAP ( d => dataout_b, clk => clk_b_out, aclr => dataout_b_clr, devclrn => devclrn, devpor => devpor, stall => wire_gnd, ena => clkena_b_out, q => dataout_b_reg ); portadataout <= dataout_a_reg WHEN (out_a_is_reg) ELSE (OTHERS => '0') WHEN ((dataout_a_clr = '1') OR (dataout_a_clr_reg = '1')) ELSE dataout_a; portbdataout <= dataout_b_reg WHEN (out_b_is_reg) ELSE (OTHERS => '0') WHEN ((dataout_b_clr = '1') OR (dataout_b_clr_reg = '1')) ELSE dataout_b; eccstatus <= (OTHERS => '0'); dftout <= (OTHERS => '0'); END block_arch; --------------------------------------------------------------------- -- -- Entity Name : arriaii_ff -- -- Description : Piranha FF VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; use work.arriaii_and1; entity arriaii_ff is generic ( power_up : string := "low"; x_on_violation : string := "on"; lpm_type : string := "arriaii_ff"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port ( d : in std_logic := '0'; clk : in std_logic := '0'; clrn : in std_logic := '1'; aload : in std_logic := '0'; sclr : in std_logic := '0'; sload : in std_logic := '0'; ena : in std_logic := '1'; asdata : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); attribute VITAL_LEVEL0 of arriaii_ff : entity is TRUE; end arriaii_ff; architecture vital_lcell_ff of arriaii_ff is attribute VITAL_LEVEL0 of vital_lcell_ff : architecture is TRUE; signal clk_ipd : std_logic; signal d_ipd : std_logic; signal d_dly : std_logic; signal asdata_ipd : std_logic; signal asdata_dly : std_logic; signal asdata_dly1 : std_logic; signal sclr_ipd : std_logic; signal sload_ipd : std_logic; signal clrn_ipd : std_logic; signal aload_ipd : std_logic; signal ena_ipd : std_logic; component arriaii_and1 generic (XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; tpd_IN1_Y : VitalDelayType01 := DefPropDelay01; tipd_IN1 : VitalDelayType01 := DefPropDelay01 ); port (Y : out STD_LOGIC; IN1 : in STD_LOGIC ); end component; begin ddelaybuffer: arriaii_and1 port map(IN1 => d_ipd, Y => d_dly); asdatadelaybuffer: arriaii_and1 port map(IN1 => asdata_ipd, Y => asdata_dly); asdatadelaybuffer1: arriaii_and1 port map(IN1 => asdata_dly, Y => asdata_dly1); --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (d_ipd, d, tipd_d); VitalWireDelay (asdata_ipd, asdata, tipd_asdata); VitalWireDelay (sclr_ipd, sclr, tipd_sclr); VitalWireDelay (sload_ipd, sload, tipd_sload); VitalWireDelay (clrn_ipd, clrn, tipd_clrn); VitalWireDelay (aload_ipd, aload, tipd_aload); VitalWireDelay (ena_ipd, ena, tipd_ena); end block; VITALtiming : process (clk_ipd, d_dly, asdata_dly1, sclr_ipd, sload_ipd, clrn_ipd, aload_ipd, ena_ipd, devclrn, devpor) variable Tviol_d_clk : std_ulogic := '0'; variable Tviol_asdata_clk : std_ulogic := '0'; variable Tviol_sclr_clk : std_ulogic := '0'; variable Tviol_sload_clk : std_ulogic := '0'; variable Tviol_ena_clk : std_ulogic := '0'; variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_asdata_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sclr_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sload_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_ena_clk : VitalTimingDataType := VitalTimingDataInit; variable q_VitalGlitchData : VitalGlitchDataType; variable iq : std_logic := '0'; variable idata: std_logic := '0'; -- variables for 'X' generation variable violation : std_logic := '0'; begin if (now = 0 ns) then if (power_up = "low") then iq := '0'; elsif (power_up = "high") then iq := '1'; end if; end if; ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_d_clk, TimingData => TimingData_d_clk, TestSignal => d, TestSignalName => "DATAIN", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_d_clk_noedge_posedge, SetupLow => tsetup_d_clk_noedge_posedge, HoldHigh => thold_d_clk_noedge_posedge, HoldLow => thold_d_clk_noedge_posedge, CheckEnabled => TO_X01((NOT clrn_ipd) OR (sload_ipd) OR (sclr_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/LCELL_FF", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_asdata_clk, TimingData => TimingData_asdata_clk, TestSignal => asdata_ipd, TestSignalName => "ASDATA", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_asdata_clk_noedge_posedge, SetupLow => tsetup_asdata_clk_noedge_posedge, HoldHigh => thold_asdata_clk_noedge_posedge, HoldLow => thold_asdata_clk_noedge_posedge, CheckEnabled => TO_X01((NOT clrn_ipd) OR (NOT sload_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/LCELL_FF", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sclr_clk, TimingData => TimingData_sclr_clk, TestSignal => sclr_ipd, TestSignalName => "SCLR", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sclr_clk_noedge_posedge, SetupLow => tsetup_sclr_clk_noedge_posedge, HoldHigh => thold_sclr_clk_noedge_posedge, HoldLow => thold_sclr_clk_noedge_posedge, CheckEnabled => TO_X01((NOT clrn_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/LCELL_FF", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sload_clk, TimingData => TimingData_sload_clk, TestSignal => sload_ipd, TestSignalName => "SLOAD", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sload_clk_noedge_posedge, SetupLow => tsetup_sload_clk_noedge_posedge, HoldHigh => thold_sload_clk_noedge_posedge, HoldLow => thold_sload_clk_noedge_posedge, CheckEnabled => TO_X01((NOT clrn_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/LCELL_FF", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_ena_clk, TimingData => TimingData_ena_clk, TestSignal => ena_ipd, TestSignalName => "ENA", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_ena_clk_noedge_posedge, SetupLow => tsetup_ena_clk_noedge_posedge, HoldHigh => thold_ena_clk_noedge_posedge, HoldLow => thold_ena_clk_noedge_posedge, CheckEnabled => TO_X01((NOT clrn_ipd) OR (NOT devpor) OR (NOT devclrn) ) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/LCELL_FF", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; violation := Tviol_d_clk or Tviol_asdata_clk or Tviol_sclr_clk or Tviol_sload_clk or Tviol_ena_clk; if ((devpor = '0') or (devclrn = '0') or (clrn_ipd = '0')) then iq := '0'; elsif (aload_ipd = '1') then iq := asdata_dly1; elsif (violation = 'X' and x_on_violation = "on") then iq := 'X'; elsif clk_ipd'event and clk_ipd = '1' and clk_ipd'last_value = '0' then if (ena_ipd = '1') then if (sclr_ipd = '1') then iq := '0'; elsif (sload_ipd = '1') then iq := asdata_dly1; else iq := d_dly; end if; end if; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => q, OutSignalName => "Q", OutTemp => iq, Paths => (0 => (clrn_ipd'last_event, tpd_clrn_q_posedge, TRUE), 1 => (aload_ipd'last_event, tpd_aload_q_posedge, TRUE), 2 => (asdata_ipd'last_event, tpd_asdata_q, TRUE), 3 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)), GlitchData => q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_lcell_ff; --///////////////////////////////////////////////////////////////////////////// -- -- VHDL Simulation Model for Piranha CLKSELECT Atom -- --///////////////////////////////////////////////////////////////////////////// -- -- -- ARRIAII_CLKSELECT Model -- -- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; entity arriaii_clkselect is generic ( lpm_type : STRING := "arriaii_clkselect"; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : STRING := "*"; tipd_inclk : VitalDelayArrayType01(3 downto 0) := (OTHERS => DefPropDelay01); tipd_clkselect : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01); tpd_inclk_outclk : VitalDelayArrayType01(3 downto 0) := (OTHERS => DefPropDelay01); tpd_clkselect_outclk : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01) ); port ( inclk : in std_logic_vector(3 downto 0) := "0000"; clkselect : in std_logic_vector(1 downto 0) := "00"; outclk : out std_logic ); attribute VITAL_LEVEL0 of arriaii_clkselect : entity is TRUE; end arriaii_clkselect; architecture vital_clkselect of arriaii_clkselect is attribute VITAL_LEVEL0 of vital_clkselect : architecture is TRUE; signal inclk_ipd : std_logic_vector(3 downto 0); signal clkselect_ipd : std_logic_vector(1 downto 0); signal clkmux_out : std_logic; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (inclk_ipd(0), inclk(0), tipd_inclk(0)); VitalWireDelay (inclk_ipd(1), inclk(1), tipd_inclk(1)); VitalWireDelay (inclk_ipd(2), inclk(2), tipd_inclk(2)); VitalWireDelay (inclk_ipd(3), inclk(3), tipd_inclk(3)); VitalWireDelay (clkselect_ipd(0), clkselect(0), tipd_clkselect(0)); VitalWireDelay (clkselect_ipd(1), clkselect(1), tipd_clkselect(1)); end block; process(inclk_ipd, clkselect_ipd) variable outclk_VitalGlitchData : VitalGlitchDataType; variable tmp : std_logic; begin if (clkselect_ipd = "11") then tmp := inclk_ipd(3); elsif (clkselect_ipd = "10") then tmp := inclk_ipd(2); elsif (clkselect_ipd = "01") then tmp := inclk_ipd(1); else tmp := inclk_ipd(0); end if; clkmux_out <= tmp; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => outclk, OutSignalName => "OUTCLOCK", OutTemp => tmp, Paths => (0 => (inclk_ipd(0)'last_event, tpd_inclk_outclk(0), TRUE), 1 => (inclk_ipd(1)'last_event, tpd_inclk_outclk(1), TRUE), 2 => (inclk_ipd(2)'last_event, tpd_inclk_outclk(2), TRUE), 3 => (inclk_ipd(3)'last_event, tpd_inclk_outclk(3), TRUE), 4 => (clkselect_ipd(0)'last_event, tpd_clkselect_outclk(0), TRUE), 5 => (clkselect_ipd(1)'last_event, tpd_clkselect_outclk(1), TRUE)), GlitchData => outclk_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_clkselect; --///////////////////////////////////////////////////////////////////////////// -- -- arriaii_and2 Model -- Description : Simulation model for a simple two input AND gate. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.VITAL_Timing.all; use work.arriaii_atom_pack.all; -- entity declaration -- entity arriaii_and2 is generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_IN1_Y : VitalDelayType01 := DefPropDelay01; tpd_IN2_Y : VitalDelayType01 := DefPropDelay01; tipd_IN1 : VitalDelayType01 := DefPropDelay01; tipd_IN2 : VitalDelayType01 := DefPropDelay01); port( Y : out STD_LOGIC; IN1 : in STD_LOGIC; IN2 : in STD_LOGIC); attribute VITAL_LEVEL0 of arriaii_and2 : entity is TRUE; end arriaii_and2; -- architecture body -- architecture AltVITAL of arriaii_and2 is attribute VITAL_LEVEL0 of AltVITAL : architecture is TRUE; SIGNAL IN1_ipd : STD_ULOGIC := 'U'; SIGNAL IN2_ipd : STD_ULOGIC := 'U'; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (IN1_ipd, IN1, tipd_IN1); VitalWireDelay (IN2_ipd, IN2, tipd_IN2); end block; -------------------- -- BEHAVIOR SECTION -------------------- VITALBehavior : process (IN1_ipd, IN2_ipd) -- functionality results VARIABLE Results : STD_LOGIC_VECTOR(1 to 1) := (others => 'X'); ALIAS Y_zd : STD_ULOGIC is Results(1); -- output glitch detection variables VARIABLE Y_GlitchData : VitalGlitchDataType; begin ------------------------- -- Functionality Section ------------------------- Y_zd := TO_X01(IN1_ipd) AND TO_X01(IN2_ipd); ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => Y, OutSignalName => "Y", OutTemp => Y_zd, Paths => ( 0 => (IN1_ipd'last_event, tpd_IN1_Y, TRUE), 1 => (IN2_ipd'last_event, tpd_IN2_Y, TRUE)), GlitchData => Y_GlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end AltVITAL; --///////////////////////////////////////////////////////////////////////////// -- -- Entity Name : arriaii_ena_reg -- -- Description : Simulation model for a simple DFF. -- This is used for the gated clock generation -- Powers upto 1. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_ena_reg is generic ( TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : STRING := "*"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01 ); PORT ( clk : in std_logic; ena : in std_logic := '1'; d : in std_logic; clrn : in std_logic := '1'; prn : in std_logic := '1'; q : out std_logic ); attribute VITAL_LEVEL0 of arriaii_ena_reg : entity is TRUE; end arriaii_ena_reg; ARCHITECTURE behave of arriaii_ena_reg is attribute VITAL_LEVEL0 of behave : architecture is TRUE; signal d_ipd : std_logic; signal clk_ipd : std_logic; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (d_ipd, d, tipd_d); VitalWireDelay (clk_ipd, clk, tipd_clk); end block; VITALtiming : process (clk_ipd, prn, clrn) variable Tviol_d_clk : std_ulogic := '0'; variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit; variable q_VitalGlitchData : VitalGlitchDataType; variable q_reg : std_logic := '1'; begin ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_d_clk, TimingData => TimingData_d_clk, TestSignal => d, TestSignalName => "D", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_d_clk_noedge_posedge, SetupLow => tsetup_d_clk_noedge_posedge, HoldHigh => thold_d_clk_noedge_posedge, HoldLow => thold_d_clk_noedge_posedge, CheckEnabled => TO_X01((clrn) OR (NOT ena)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ena_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; if (prn = '0') then q_reg := '1'; elsif (clrn = '0') then q_reg := '0'; elsif (clk_ipd'event and clk_ipd = '1' and clk_ipd'last_value = '0' and (ena = '1')) then q_reg := d_ipd; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => q, OutSignalName => "Q", OutTemp => q_reg, Paths => (0 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)), GlitchData => q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end behave; --///////////////////////////////////////////////////////////////////////////// -- -- VHDL Simulation Model for Piranha CLKCTRL Atom -- --///////////////////////////////////////////////////////////////////////////// -- -- -- Piranha_CLKCTRL Model -- -- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; use work.arriaii_ena_reg; use work.arriaii_and2; entity arriaii_clkena is generic ( clock_type : STRING := "Auto"; lpm_type : STRING := "arriaii_clkena"; ena_register_mode : STRING := "Falling Edge"; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : STRING := "*"; tipd_inclk : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01 ); port ( inclk : in std_logic := '0'; ena : in std_logic := '1'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; enaout : out std_logic; outclk : out std_logic ); attribute VITAL_LEVEL0 of arriaii_clkena : entity is TRUE; end arriaii_clkena; architecture vital_clkena of arriaii_clkena is attribute VITAL_LEVEL0 of vital_clkena : architecture is TRUE; component arriaii_and2 generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_IN1_Y : VitalDelayType01 := DefPropDelay01; tpd_IN2_Y : VitalDelayType01 := DefPropDelay01; tipd_IN1 : VitalDelayType01 := DefPropDelay01; tipd_IN2 : VitalDelayType01 := DefPropDelay01); port( Y : out STD_LOGIC; IN1 : in STD_LOGIC; IN2 : in STD_LOGIC); end component; component arriaii_ena_reg generic ( TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : STRING := "*"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01 ); PORT ( clk : in std_logic; ena : in std_logic := '1'; d : in std_logic; clrn : in std_logic := '1'; prn : in std_logic := '1'; q : out std_logic ); end component; signal inclk_ipd : std_logic; signal inclk_inv : std_logic; signal ena_ipd : std_logic; signal cereg_clr : std_logic; signal cereg1_out : std_logic; signal cereg2_out : std_logic; signal ena_out : std_logic; signal vcc : std_logic := '1'; begin --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (inclk_ipd, inclk, tipd_inclk); end block; inclk_inv <= NOT inclk_ipd; extena_reg1 : arriaii_ena_reg port map ( clk => inclk_inv, ena => vcc, d => ena_ipd, clrn => vcc, prn => devpor, q => cereg1_out ); extena_reg2 : arriaii_ena_reg port map ( clk => inclk_inv, ena => vcc, d => cereg1_out, clrn => vcc, prn => devpor, q => cereg2_out ); ena_out <= cereg1_out WHEN (ena_register_mode = "falling edge") ELSE ena_ipd WHEN (ena_register_mode = "none") ELSE cereg2_out; outclk_and : arriaii_and2 port map ( IN1 => inclk_ipd, IN2 => ena_out, Y => outclk ); enaout_and : arriaii_and2 port map ( IN1 => vcc, IN2 => ena_out, Y => enaout ); end vital_clkena; ---------------------------------------------------------------------------- -- Module Name : arriaii_mlab_cell_pulse_generator -- Description : Generate pulse to initiate memory read/write operations ---------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_mlab_cell_pulse_generator IS GENERIC ( tipd_clk : VitalDelayType01 := (1 ps,1 ps); tipd_ena : VitalDelayType01 := DefPropDelay01; tpd_clk_pulse_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( clk,ena : IN STD_LOGIC; pulse,cycle : OUT STD_LOGIC ); ATTRIBUTE VITAL_Level0 OF arriaii_mlab_cell_pulse_generator:ENTITY IS TRUE; END arriaii_mlab_cell_pulse_generator; ARCHITECTURE pgen_arch OF arriaii_mlab_cell_pulse_generator IS SIGNAL clk_ipd,ena_ipd : STD_LOGIC; SIGNAL state : STD_LOGIC; ATTRIBUTE VITAL_Level0 OF pgen_arch:ARCHITECTURE IS TRUE; BEGIN WireDelay : BLOCK BEGIN VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (ena_ipd, ena, tipd_ena); END BLOCK; PROCESS (clk_ipd,state) BEGIN IF (state = '1' AND state'EVENT) THEN state <= '0'; ELSIF (clk_ipd = '1' AND clk_ipd'EVENT AND ena_ipd = '1') THEN state <= '1'; END IF; END PROCESS; PathDelay : PROCESS VARIABLE pulse_VitalGlitchData : VitalGlitchDataType; BEGIN WAIT UNTIL state'EVENT; VitalPathDelay01 ( OutSignal => pulse, OutSignalName => "pulse", OutTemp => state, Paths => (0 => (clk_ipd'LAST_EVENT,tpd_clk_pulse_posedge,TRUE)), GlitchData => pulse_VitalGlitchData, Mode => DefGlitchMode, XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); END PROCESS; cycle <= clk_ipd; END pgen_arch; LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE work.arriaii_mlab_cell_pulse_generator; ENTITY arriaii_mlab_cell IS GENERIC ( -- -------- GLOBAL PARAMETERS --------- logical_ram_name : STRING := "lutram"; init_file : STRING := "UNUSED"; data_interleave_offset_in_bits : INTEGER := 1; logical_ram_depth : INTEGER := 0; logical_ram_width : INTEGER := 0; first_address : INTEGER := 0; last_address : INTEGER := 0; first_bit_number : INTEGER := 0; data_width : INTEGER := 1; address_width : INTEGER := 1; byte_enable_mask_width : INTEGER := 1; byte_size : INTEGER := 1; lpm_type : string := "arriaii_mlab_cell"; lpm_hint : string := "true"; mixed_port_feed_through_mode : string := "dont_care"; mem_init0 : BIT_VECTOR := X"0"; -- --------- VITAL PARAMETERS -------- tipd_clk0 : VitalDelayType01 := DefPropDelay01; tipd_ena0 : VitalDelayType01 := DefPropDelay01; tipd_portaaddr : VitalDelayArrayType01(7 DOWNTO 0) := (OTHERS => DefPropDelay01); tipd_portbaddr : VitalDelayArrayType01(7 DOWNTO 0) := (OTHERS => DefPropDelay01); tipd_portabyteenamasks : VitalDelayArrayType01(20 DOWNTO 0) := (OTHERS => DefPropDelay01); tsetup_portaaddr_clk0_noedge_negedge : VitalDelayType := DefSetupHoldCnst; tsetup_portabyteenamasks_clk0_noedge_negedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena0_clk0_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_portaaddr_clk0_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_portabyteenamasks_clk0_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_ena0_clk0_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_portbaddr_portbdataout : VitalDelayType01 := DefPropDelay01 ); -- -------- PORT DECLARATIONS --------- PORT ( portadatain : IN STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0) := (OTHERS => '0'); portaaddr : IN STD_LOGIC_VECTOR(address_width - 1 DOWNTO 0) := (OTHERS => '0'); portabyteenamasks : IN STD_LOGIC_VECTOR(byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '1'); portbaddr : IN STD_LOGIC_VECTOR(address_width - 1 DOWNTO 0) := (OTHERS => '0'); clk0 : IN STD_LOGIC := '0'; ena0 : IN STD_LOGIC := '1'; portbdataout : OUT STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0) ); END arriaii_mlab_cell; ARCHITECTURE block_arch OF arriaii_mlab_cell IS COMPONENT arriaii_mlab_cell_pulse_generator PORT ( clk : IN STD_LOGIC; ena : IN STD_LOGIC; pulse : OUT STD_LOGIC; cycle : OUT STD_LOGIC ); END COMPONENT; CONSTANT port_byte_size : INTEGER := data_width / byte_enable_mask_width; -- -------- internal signals --------- -- Write address SIGNAL write_address : INTEGER := 0; SIGNAL read_address : INTEGER := 0; -- pulses SIGNAL write_pulse, write_cycle, write_clock : STD_LOGIC; -- memory core SUBTYPE mem_word_type IS STD_LOGIC_VECTOR (data_width - 1 DOWNTO 0); TYPE mem_type IS ARRAY ((2 ** address_width) - 1 DOWNTO 0) OF mem_word_type; SIGNAL mem : mem_type; SIGNAL init_mem : BOOLEAN := FALSE; -- byte enable TYPE mask_type IS (normal,inverse); TYPE mask_write IS ARRAY(mask_type'HIGH DOWNTO mask_type'LOW) OF mem_word_type; SIGNAL mask_vector : mask_write := ( normal => (OTHERS => '0'), inverse => (OTHERS => 'X') ); -- output FUNCTION get_mask( b_ena : IN STD_LOGIC_VECTOR; CONSTANT b_ena_width ,byte_size: INTEGER ) RETURN mask_write IS VARIABLE l : INTEGER; VARIABLE mask : mask_write := (normal => (OTHERS => '0'),inverse => (OTHERS => 'X')); BEGIN FOR l in 0 TO b_ena_width - 1 LOOP IF (b_ena(l) = '0') THEN mask(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); mask(inverse)((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => '0'); ELSIF (b_ena(l) = 'X' OR b_ena(l) = 'U') THEN mask(normal) ((l+1)*byte_size - 1 DOWNTO l*byte_size) := (OTHERS => 'X'); END IF; END LOOP; RETURN mask; END get_mask; SIGNAL clk0_ipd : STD_LOGIC; SIGNAL ena0_ipd : STD_LOGIC; SIGNAL portaaddr_ipd : STD_LOGIC_VECTOR(address_width - 1 DOWNTO 0); SIGNAL portbaddr_ipd : STD_LOGIC_VECTOR(address_width - 1 DOWNTO 0); SIGNAL portabyteenamasks_ipd : STD_LOGIC_VECTOR(byte_enable_mask_width - 1 DOWNTO 0); SIGNAL ena0_reg : STD_LOGIC := '0'; BEGIN -- interconnect delays WireDelay : BLOCK BEGIN loopbits_ad : FOR i in portaaddr'RANGE GENERATE VitalWireDelay (portaaddr_ipd(i), portaaddr(i), tipd_portaaddr(i)); VitalWireDelay (portbaddr_ipd(i), portbaddr(i), tipd_portbaddr(i)); END GENERATE; loopbits_be : FOR j in portabyteenamasks'RANGE GENERATE VitalWireDelay (portabyteenamasks_ipd(j), portabyteenamasks(j), tipd_portabyteenamasks(j)); END GENERATE; VitalWireDelay (clk0_ipd, clk0, tipd_clk0); VitalWireDelay (ena0_ipd, ena0, tipd_ena0); END BLOCK; -- setup/hold checks setup_hold_checks: PROCESS (ena0_reg,portaaddr_ipd,portabyteenamasks_ipd,clk0_ipd,ena0_ipd) VARIABLE Tviol_clk_enable : STD_ULOGIC := '0'; VARIABLE Tviol_clk_address : STD_ULOGIC := '0'; VARIABLE Tviol_clk_bemasks : STD_ULOGIC := '0'; VARIABLE TimingData_clk_enable : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_clk_address : VitalTimingDataType := VitalTimingDataInit; VARIABLE TimingData_clk_bemasks : VitalTimingDataType := VitalTimingDataInit; BEGIN -- Timing checks VitalSetupHoldCheck ( Violation => Tviol_clk_enable, TimingData => TimingData_clk_enable, TestSignal => ena0_ipd, TestSignalName => "ena0", RefSignal => clk0_ipd, RefSignalName => "clk0", SetupHigh => tsetup_ena0_clk0_noedge_posedge, SetupLow => tsetup_ena0_clk0_noedge_posedge, HoldHigh => thold_ena0_clk0_noedge_posedge, HoldLow => thold_ena0_clk0_noedge_posedge, CheckEnabled => TRUE, RefTransition => '/', HeaderMsg => "/LUTRAM VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_clk_address, TimingData => TimingData_clk_address, TestSignal => portaaddr_ipd, TestSignalName => "portaaddr", RefSignal => clk0_ipd, RefSignalName => "clk0", SetupHigh => tsetup_portaaddr_clk0_noedge_negedge, SetupLow => tsetup_portaaddr_clk0_noedge_negedge, HoldHigh => thold_portaaddr_clk0_noedge_negedge, HoldLow => thold_portaaddr_clk0_noedge_negedge, CheckEnabled => (ena0_reg = '1'), RefTransition => '\', HeaderMsg => "/LUTRAM VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_clk_bemasks, TimingData => TimingData_clk_bemasks, TestSignal => portabyteenamasks_ipd, TestSignalName => "portabyteenamasks", RefSignal => clk0_ipd, RefSignalName => "clk0", SetupHigh => tsetup_portabyteenamasks_clk0_noedge_negedge, SetupLow => tsetup_portabyteenamasks_clk0_noedge_negedge, HoldHigh => thold_portabyteenamasks_clk0_noedge_negedge, HoldLow => thold_portabyteenamasks_clk0_noedge_negedge, CheckEnabled => (ena0_reg = '1'), RefTransition => '\', HeaderMsg => "/LUTRAM VitalSetupHoldCheck", XOn => DefXOnChecks, MsgOn => DefMsgOnChecks ); END PROCESS setup_hold_checks; -- latch CE signal PROCESS (clk0_ipd) BEGIN IF (clk0_ipd'EVENT AND clk0_ipd = '1') THEN ena0_reg <= ena0_ipd; END IF; END PROCESS; -- output path delay PROCESS (portbaddr_ipd) VARIABLE CQDelay : TIME := 0 ns; BEGIN CQDelay := SelectDelay( ( 1 => ( portbaddr_ipd'LAST_EVENT, tpd_portbaddr_portbdataout, TRUE ) ) ); read_address <= TRANSPORT alt_conv_integer(portbaddr_ipd) AFTER CQDelay; END PROCESS; -- memory initialization init_mem <= TRUE; write_clock <= NOT clk0_ipd; write_address <= alt_conv_integer(portaaddr_ipd); -- Write pulse generation (neg edge) wpgen_a : arriaii_mlab_cell_pulse_generator PORT MAP ( clk => write_clock, ena => ena0_reg, pulse => write_pulse, cycle => write_cycle ); -- Create internal masks for byte enable processing mask_create : PROCESS (portabyteenamasks_ipd) VARIABLE mask : mask_write; BEGIN IF (portabyteenamasks_ipd'EVENT) THEN mask := get_mask(portabyteenamasks_ipd,byte_enable_mask_width,port_byte_size); mask_vector <= mask; END IF; END PROCESS mask_create; mem_rw : PROCESS (init_mem, write_pulse) -- mem init VARIABLE addr_range_init,index : INTEGER; VARIABLE mem_init_std : STD_LOGIC_VECTOR((last_address - first_address + 1)*data_width - 1 DOWNTO 0); VARIABLE mem_init : bit_vector(mem_init0'length - 1 DOWNTO 0); VARIABLE mem_val : mem_type; -- read/write VARIABLE mem_data_p : mem_word_type; BEGIN -- Memory initialization IF (init_mem'EVENT) THEN -- Initialize output to 0 mem_val := (OTHERS => (OTHERS => '0')); IF (init_file /= "UNUSED" AND init_file /= "unused") THEN addr_range_init := last_address - first_address + 1; mem_init := mem_init0; mem_init_std := to_stdlogicvector(mem_init)((last_address - first_address + 1)*data_width - 1 DOWNTO 0); FOR row IN 0 TO addr_range_init - 1 LOOP index := row * data_width; mem_val(row) := mem_init_std(index + data_width -1 DOWNTO index ); END LOOP; END IF; mem <= mem_val; END IF; -- Write stage 1 : X to memory -- Write stage 2 : actual data to memory IF (write_pulse'EVENT) THEN IF (write_pulse = '1') THEN mem_data_p := mem(write_address); FOR i IN 0 TO data_width - 1 LOOP mem_data_p(i) := mem_data_p(i) XOR mask_vector(inverse)(i); END LOOP; mem(write_address) <= mem_data_p; ELSIF (write_pulse = '0') THEN mem_data_p := mem(write_address); FOR i IN 0 TO data_width - 1 LOOP IF (mask_vector(normal)(i) = '0') THEN mem(write_address)(i) <= portadatain(i); mem_data_p(i) := portadatain(i); ELSIF (mask_vector(inverse)(i) = 'X') THEN mem(write_address)(i) <= 'X'; mem_data_p(i) := 'X'; END IF; END LOOP; END IF; END IF; END PROCESS mem_rw; -- Continuous read portbdataout <= mem(read_address); END block_arch; --------------------------------------------------------------------- -- -- Entity Name : arriaii_io_ibuf -- -- Description : Piranha IO Ibuf VHDL simulation model -- -- --------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_io_ibuf IS GENERIC ( tipd_i : VitalDelayType01 := DefPropDelay01; tipd_ibar : VitalDelayType01 := DefPropDelay01; tpd_i_o : VitalDelayType01 := DefPropDelay01; tpd_ibar_o : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; differential_mode : string := "false"; bus_hold : string := "false"; simulate_z_as : string := "Z"; lpm_type : string := "arriaii_io_ibuf" ); PORT ( i : IN std_logic := '0'; ibar : IN std_logic := '0'; o : OUT std_logic ); END arriaii_io_ibuf; ARCHITECTURE arch OF arriaii_io_ibuf IS SIGNAL i_ipd : std_logic := '0'; SIGNAL ibar_ipd : std_logic := '0'; SIGNAL o_tmp : std_logic; SIGNAL out_tmp : std_logic; SIGNAL prev_value : std_logic := '0'; BEGIN WireDelay : block begin VitalWireDelay (i_ipd, i, tipd_i); VitalWireDelay (ibar_ipd, ibar, tipd_ibar); end block; PROCESS(i_ipd, ibar_ipd) BEGIN IF (differential_mode = "false") THEN IF (i_ipd = '1') THEN o_tmp <= '1'; prev_value <= '1'; ELSIF (i_ipd = '0') THEN o_tmp <= '0'; prev_value <= '0'; ELSE o_tmp <= i_ipd; END IF; ELSE IF (( i_ipd = '0' ) and (ibar_ipd = '1')) then o_tmp <= '0'; ELSIF (( i_ipd = '1' ) and (ibar_ipd = '0')) then o_tmp <= '1'; ELSIF((( i_ipd = '1' ) and (ibar_ipd = '1')) or (( i_ipd = '0' ) and (ibar_ipd = '0')))then o_tmp <= 'X'; ELSE o_tmp <= 'X'; END IF; END IF; END PROCESS; out_tmp <= prev_value when (bus_hold = "true") else 'Z' when((o_tmp = 'Z') AND (simulate_z_as = "Z")) else 'X' when((o_tmp = 'Z') AND (simulate_z_as = "X")) else '1' when((o_tmp = 'Z') AND (simulate_z_as = "vcc")) else '0' when((o_tmp = 'Z') AND (simulate_z_as = "gnd")) else o_tmp; ---------------------- -- Path Delay Section ---------------------- PROCESS( out_tmp) variable output_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => o, OutSignalName => "o", OutTemp => out_tmp, Paths => (0 => (i_ipd'last_event, tpd_i_o, TRUE), 1 => (ibar_ipd'last_event, tpd_ibar_o, TRUE)), GlitchData => output_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); END PROCESS; END arch; --------------------------------------------------------------------- -- -- Entity Name : arriaii_io_obuf -- -- Description : Piranha IO Obuf VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_io_obuf IS GENERIC ( tipd_i : VitalDelayType01 := DefPropDelay01; tipd_oe : VitalDelayType01 := DefPropDelay01; tipd_seriesterminationcontrol : VitalDelayArrayType01(15 DOWNTO 0) := (others => DefPropDelay01 ); tpd_i_o : VitalDelayType01 := DefPropDelay01; tpd_oe_o : VitalDelayType01 := DefPropDelay01; tpd_i_obar : VitalDelayType01 := DefPropDelay01; tpd_oe_obar : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; open_drain_output : string := "false"; bus_hold : string := "false"; lpm_type : string := "arriaii_io_obuf" ); PORT ( i : IN std_logic := '0'; oe : IN std_logic := '1'; seriesterminationcontrol : IN std_logic_vector(15 DOWNTO 0) := (others => '0'); devoe : IN std_logic := '1'; o : OUT std_logic; obar : OUT std_logic ); END arriaii_io_obuf; ARCHITECTURE arch OF arriaii_io_obuf IS --INTERNAL Signals SIGNAL i_ipd : std_logic := '0'; SIGNAL oe_ipd : std_logic := '0'; SIGNAL out_tmp : std_logic := 'Z'; SIGNAL out_tmp_bar : std_logic; SIGNAL prev_value : std_logic := '0'; SIGNAL o_tmp : std_logic; SIGNAL obar_tmp : std_logic; SIGNAL o_tmp1 : std_logic; SIGNAL obar_tmp1 : std_logic; SIGNAL seriesterminationcontrol_ipd : std_logic_vector(15 DOWNTO 0) := (others => '0'); BEGIN WireDelay : block begin VitalWireDelay (i_ipd, i, tipd_i); VitalWireDelay (oe_ipd, oe, tipd_oe); g1 :for i in seriesterminationcontrol'range generate VitalWireDelay (seriesterminationcontrol_ipd(i), seriesterminationcontrol(i), tipd_seriesterminationcontrol(i)); end generate; end block; PROCESS( i_ipd, oe_ipd) BEGIN IF (oe_ipd = '1') THEN IF (open_drain_output = "true") THEN IF (i_ipd = '0') THEN out_tmp <= '0'; out_tmp_bar <= '1'; prev_value <= '0'; ELSE out_tmp <= 'Z'; out_tmp_bar <= 'Z'; END IF; ELSE IF (i_ipd = '0') THEN out_tmp <= '0'; out_tmp_bar <= '1'; prev_value <= '0'; ELSE IF (i_ipd = '1') THEN out_tmp <= '1'; out_tmp_bar <= '0'; prev_value <= '1'; ELSE out_tmp <= i_ipd; out_tmp_bar <= i_ipd; END IF; END IF; END IF; ELSE IF (oe_ipd = '0') THEN out_tmp <= 'Z'; out_tmp_bar <= 'Z'; ELSE out_tmp <= 'X'; out_tmp_bar <= 'X'; END IF; END IF; END PROCESS; o_tmp1 <= prev_value WHEN (bus_hold = "true") ELSE out_tmp; obar_tmp1 <= NOT prev_value WHEN (bus_hold = "true") ELSE out_tmp_bar; o_tmp <= o_tmp1 WHEN (devoe = '1') ELSE 'Z'; obar_tmp <= obar_tmp1 WHEN (devoe = '1') ELSE 'Z'; --------------------- -- Path Delay Section ---------------------- PROCESS( o_tmp,obar_tmp) variable o_VitalGlitchData : VitalGlitchDataType; variable obar_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => o, OutSignalName => "o", OutTemp => o_tmp, Paths => (0 => (i_ipd'last_event, tpd_i_o, TRUE), 1 => (oe_ipd'last_event, tpd_oe_o, TRUE)), GlitchData => o_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => obar, OutSignalName => "obar", OutTemp => obar_tmp, Paths => (0 => (i_ipd'last_event, tpd_i_obar, TRUE), 1 => (oe_ipd'last_event, tpd_oe_obar, TRUE)), GlitchData => obar_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); END PROCESS; END arch; ----------------------------------------------------------------------- -- -- Entity Name : arriaii_ddio_in -- -- Description : Piranha DDIO_IN VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; LIBRARY altera; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use altera.all; use work.arriaii_atom_pack.all; ENTITY arriaii_ddio_in IS generic( tipd_datain : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_clkn : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; tipd_areset : VitalDelayType01 := DefPropDelay01; tipd_sreset : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; power_up : string := "low"; async_mode : string := "none"; sync_mode : string := "none"; use_clkn : string := "false"; lpm_type : string := "arriaii_ddio_in" ); PORT ( datain : IN std_logic := '0'; clk : IN std_logic := '0'; clkn : IN std_logic := '0'; ena : IN std_logic := '1'; areset : IN std_logic := '0'; sreset : IN std_logic := '0'; regoutlo : OUT std_logic; regouthi : OUT std_logic; dfflo : OUT std_logic; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_ddio_in; ARCHITECTURE arch OF arriaii_ddio_in IS component dffeas generic ( power_up : string := "DONT_CARE"; is_wysiwyg : string := "false"; x_on_violation : string := "on"; lpm_type : string := "DFFEAS"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_prn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port ( d : in std_logic := '0'; clk : in std_logic := '0'; ena : in std_logic := '1'; clrn : in std_logic := '1'; prn : in std_logic := '1'; aload : in std_logic := '0'; asdata : in std_logic := '1'; sclr : in std_logic := '0'; sload : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); end component; --Internal Signals SIGNAL datain_ipd : std_logic := '0'; SIGNAL clk_ipd : std_logic := '0'; SIGNAL clkn_ipd : std_logic := '0'; SIGNAL ena_ipd : std_logic := '0'; SIGNAL areset_ipd : std_logic := '0'; SIGNAL sreset_ipd : std_logic := '0'; SIGNAL ddioreg_aclr : std_logic; SIGNAL ddioreg_prn : std_logic; SIGNAL ddioreg_adatasdata : std_logic; SIGNAL ddioreg_sclr : std_logic; SIGNAL ddioreg_sload : std_logic; SIGNAL ddioreg_clk : std_logic; SIGNAL dfflo_tmp : std_logic; SIGNAL regout_tmp_hi : std_logic; SIGNAL regout_tmp_lo : std_logic; SIGNAL regouthi_tmp : std_logic; SIGNAL regoutlo_tmp : std_logic; BEGIN WireDelay : block begin VitalWireDelay (datain_ipd, datain, tipd_datain); VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (clkn_ipd, clkn, tipd_clkn); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (areset_ipd, areset, tipd_areset); VitalWireDelay (sreset_ipd, sreset, tipd_sreset); end block; ddioreg_clk <= NOT clk_ipd WHEN (use_clkn = "false") ELSE clkn_ipd; --Decode the control values for the DDIO registers PROCESS BEGIN WAIT UNTIL areset_ipd'EVENT OR sreset_ipd'EVENT; IF (async_mode = "clear") THEN ddioreg_aclr <= NOT areset_ipd; ddioreg_prn <= '1'; ELSIF (async_mode = "preset") THEN ddioreg_aclr <= '1'; ddioreg_prn <= NOT areset_ipd; ELSE ddioreg_aclr <= '1'; ddioreg_prn <= '1'; END IF; IF (sync_mode = "clear") THEN ddioreg_adatasdata <= '0'; ddioreg_sclr <= sreset_ipd; ddioreg_sload <= '0'; ELSIF (sync_mode = "preset") THEN ddioreg_adatasdata <= '1'; ddioreg_sclr <= '0'; ddioreg_sload <= sreset_ipd; ELSE ddioreg_adatasdata <= '0'; ddioreg_sclr <= '0'; ddioreg_sload <= '0'; END IF; END PROCESS; --DDIO High Register ddioreg_hi : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => datain_ipd, clk => clk_ipd, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => regout_tmp_hi, devpor => devpor, devclrn => devclrn ); --DDIO Low Register ddioreg_lo : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => datain_ipd, clk => ddioreg_clk, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dfflo_tmp, devpor => devpor, devclrn => devclrn ); ddioreg_lo1 : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => dfflo_tmp, clk => clk_ipd, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => regout_tmp_lo, devpor => devpor, devclrn => devclrn ); regouthi <= regout_tmp_hi ; regoutlo <= regout_tmp_lo ; dfflo <= dfflo_tmp ; END arch; --------------------------------------------------------------------- -- -- Entity Name : arriaii_ddio_oe -- -- Description : Piranha DDIO_OE VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; LIBRARY altera; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use altera.all; use work.arriaii_atom_pack.all; ENTITY arriaii_ddio_oe IS generic( tipd_oe : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; tipd_areset : VitalDelayType01 := DefPropDelay01; tipd_sreset : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; power_up : string := "low"; async_mode : string := "none"; sync_mode : string := "none"; lpm_type : string := "arriaii_ddio_oe" ); PORT ( oe : IN std_logic := '1'; clk : IN std_logic := '0'; ena : IN std_logic := '1'; areset : IN std_logic := '0'; sreset : IN std_logic := '0'; dataout : OUT std_logic; dfflo : OUT std_logic; dffhi : OUT std_logic; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_ddio_oe; ARCHITECTURE arch OF arriaii_ddio_oe IS component arriaii_mux21 generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_A_MO : VitalDelayType01 := DefPropDelay01; tpd_B_MO : VitalDelayType01 := DefPropDelay01; tpd_S_MO : VitalDelayType01 := DefPropDelay01; tipd_A : VitalDelayType01 := DefPropDelay01; tipd_B : VitalDelayType01 := DefPropDelay01; tipd_S : VitalDelayType01 := DefPropDelay01 ); port ( A : in std_logic := '0'; B : in std_logic := '0'; S : in std_logic := '0'; MO : out std_logic ); end component; component dffeas generic ( power_up : string := "DONT_CARE"; is_wysiwyg : string := "false"; x_on_violation : string := "on"; lpm_type : string := "DFFEAS"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_prn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port ( d : in std_logic := '0'; clk : in std_logic := '0'; ena : in std_logic := '1'; clrn : in std_logic := '1'; prn : in std_logic := '1'; aload : in std_logic := '0'; asdata : in std_logic := '1'; sclr : in std_logic := '0'; sload : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); end component; --Internal Signals SIGNAL oe_ipd : std_logic := '0'; SIGNAL clk_ipd : std_logic := '0'; SIGNAL ena_ipd : std_logic := '0'; SIGNAL areset_ipd : std_logic := '0'; SIGNAL sreset_ipd : std_logic := '0'; SIGNAL ddioreg_aclr : std_logic; SIGNAL ddioreg_prn : std_logic; SIGNAL ddioreg_adatasdata : std_logic; SIGNAL ddioreg_sclr : std_logic; SIGNAL ddioreg_sload : std_logic; SIGNAL dfflo_tmp : std_logic; SIGNAL dffhi_tmp : std_logic; signal nclk : std_logic; signal dataout_tmp : std_logic; BEGIN WireDelay : block begin VitalWireDelay (oe_ipd, oe, tipd_oe); VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (areset_ipd, areset, tipd_areset); VitalWireDelay (sreset_ipd, sreset, tipd_sreset); end block; nclk <= NOT clk_ipd; PROCESS BEGIN WAIT UNTIL areset_ipd'EVENT OR sreset_ipd'EVENT; IF (async_mode = "clear") THEN ddioreg_aclr <= NOT areset_ipd; ddioreg_prn <= '1'; ELSIF (async_mode = "preset") THEN ddioreg_aclr <= '1'; ddioreg_prn <= NOT areset_ipd; ELSE ddioreg_aclr <= '1'; ddioreg_prn <= '1'; END IF; IF (sync_mode = "clear") THEN ddioreg_adatasdata <= '0'; ddioreg_sclr <= sreset_ipd; ddioreg_sload <= '0'; ELSIF (sync_mode = "preset") THEN ddioreg_adatasdata <= '1'; ddioreg_sclr <= '0'; ddioreg_sload <= sreset_ipd; ELSE ddioreg_adatasdata <= '0'; ddioreg_sclr <= '0'; ddioreg_sload <= '0'; END IF; END PROCESS; ddioreg_hi : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => oe_ipd, clk => clk_ipd, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dffhi_tmp, devpor => devpor, devclrn => devclrn ); --DDIO Low Register ddioreg_lo : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => dffhi_tmp, clk => nclk, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dfflo_tmp, devpor => devpor, devclrn => devclrn ); --registered output or_gate : arriaii_mux21 port map ( A => dffhi_tmp, B => dfflo_tmp, S => dfflo_tmp, MO => dataout ); dfflo <= dfflo_tmp ; dffhi <= dffhi_tmp ; END arch; --------------------------------------------------------------------- -- -- Entity Name : arriaii_ddio_out -- -- Description : Piranha DDIO_OUT VHDL simulation model -- -- --------------------------------------------------------------------- LIBRARY IEEE; LIBRARY altera; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use altera.all; use work.arriaii_atom_pack.all; ENTITY arriaii_ddio_out IS generic( tipd_datainlo : VitalDelayType01 := DefPropDelay01; tipd_datainhi : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_clkhi : VitalDelayType01 := DefPropDelay01; tipd_clklo : VitalDelayType01 := DefPropDelay01; tipd_muxsel : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; tipd_areset : VitalDelayType01 := DefPropDelay01; tipd_sreset : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; power_up : string := "low"; async_mode : string := "none"; sync_mode : string := "none"; half_rate_mode : string := "false"; use_new_clocking_model : string := "false"; lpm_type : string := "arriaii_ddio_out" ); PORT ( datainlo : IN std_logic := '0'; datainhi : IN std_logic := '0'; clk : IN std_logic := '0'; clkhi : IN std_logic := '0'; clklo : IN std_logic := '0'; muxsel : IN std_logic := '0'; ena : IN std_logic := '1'; areset : IN std_logic := '0'; sreset : IN std_logic := '0'; dataout : OUT std_logic; dfflo : OUT std_logic; dffhi : OUT std_logic_vector(1 downto 0) ; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_ddio_out; ARCHITECTURE arch OF arriaii_ddio_out IS component arriaii_mux21 generic( TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; InstancePath: STRING := "*"; tpd_A_MO : VitalDelayType01 := DefPropDelay01; tpd_B_MO : VitalDelayType01 := DefPropDelay01; tpd_S_MO : VitalDelayType01 := DefPropDelay01; tipd_A : VitalDelayType01 := DefPropDelay01; tipd_B : VitalDelayType01 := DefPropDelay01; tipd_S : VitalDelayType01 := DefPropDelay01 ); port ( A : in std_logic := '0'; B : in std_logic := '0'; S : in std_logic := '0'; MO : out std_logic ); end component; component dffeas generic ( power_up : string := "DONT_CARE"; is_wysiwyg : string := "false"; x_on_violation : string := "on"; lpm_type : string := "DFFEAS"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_prn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port ( d : in std_logic := '0'; clk : in std_logic := '0'; ena : in std_logic := '1'; clrn : in std_logic := '1'; prn : in std_logic := '1'; aload : in std_logic := '0'; asdata : in std_logic := '1'; sclr : in std_logic := '0'; sload : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); end component; --Internal Signals SIGNAL datainlo_ipd : std_logic := '0'; SIGNAL datainhi_ipd : std_logic := '0'; SIGNAL clk_ipd : std_logic := '0'; SIGNAL clkhi_ipd : std_logic := '0'; SIGNAL clklo_ipd : std_logic := '0'; SIGNAL muxsel_ipd : std_logic := '0'; SIGNAL ena_ipd : std_logic := '0'; SIGNAL areset_ipd : std_logic := '0'; SIGNAL sreset_ipd : std_logic := '0'; SIGNAL ddioreg_aclr : std_logic; SIGNAL ddioreg_prn : std_logic; SIGNAL ddioreg_adatasdata : std_logic; SIGNAL ddioreg_sclr : std_logic; SIGNAL ddioreg_sload : std_logic; SIGNAL dfflo_tmp : std_logic; SIGNAL dffhi_tmp : std_logic; SIGNAL dataout_tmp : std_logic; Signal mux_sel : std_logic; Signal mux_hi : std_logic; Signal dffhi1_tmp : std_logic; Signal sel_mux_hi_in : std_logic; signal nclk : std_logic; signal clk1 : std_logic; signal clk_hi : std_logic; signal clk_lo : std_logic; signal clk_hr : std_logic; signal muxsel1 : std_logic; signal muxsel2: std_logic; signal clk2 : std_logic; signal muxsel_tmp: std_logic; signal sel_mux_lo_in : std_logic; signal datainlo_tmp : std_logic; signal datainhi_tmp : std_logic; BEGIN WireDelay : block begin VitalWireDelay (datainlo_ipd, datainlo, tipd_datainlo); VitalWireDelay (datainhi_ipd, datainhi, tipd_datainhi); VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (clkhi_ipd, clkhi, tipd_clkhi); VitalWireDelay (clklo_ipd, clklo, tipd_clklo); VitalWireDelay (muxsel_ipd, muxsel, tipd_muxsel); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (areset_ipd, areset, tipd_areset); VitalWireDelay (sreset_ipd, sreset, tipd_sreset); end block; nclk <= NOT clk_ipd; PROCESS BEGIN WAIT UNTIL areset_ipd'EVENT OR sreset_ipd'EVENT; IF (async_mode = "clear") THEN ddioreg_aclr <= NOT areset_ipd; ddioreg_prn <= '1'; ELSIF (async_mode = "preset") THEN ddioreg_aclr <= '1'; ddioreg_prn <= NOT areset_ipd; ELSE ddioreg_aclr <= '1'; ddioreg_prn <= '1'; END IF; IF (sync_mode = "clear") THEN ddioreg_adatasdata <= '0'; ddioreg_sclr <= sreset_ipd; ddioreg_sload <= '0'; ELSIF (sync_mode = "preset") THEN ddioreg_adatasdata <= '1'; ddioreg_sclr <= '0'; ddioreg_sload <= sreset_ipd; ELSE ddioreg_adatasdata <= '0'; ddioreg_sclr <= '0'; ddioreg_sload <= '0'; END IF; END PROCESS; process(clk_ipd) begin clk1 <= clk_ipd; end process; process(muxsel_ipd) begin muxsel1 <= muxsel_ipd; end process; --DDIO HIGH Register clk_hi <= clkhi_ipd when(use_new_clocking_model = "true") else clk_ipd; datainhi_tmp <= datainhi; ddioreg_hi : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => datainhi_tmp, clk => clk_hi, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dffhi_tmp, devpor => devpor, devclrn => devclrn ); --DDIO Low Register clk_lo <= clklo_ipd when(use_new_clocking_model = "true") else clk_ipd; datainlo_tmp <= datainlo; ddioreg_lo : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => datainlo_tmp, clk => clk_lo, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dfflo_tmp, devpor => devpor, devclrn => devclrn ); clk_hr <= NOT clkhi_ipd when(use_new_clocking_model = "true") else NOT clk_ipd; ddioreg_hi1 : dffeas GENERIC MAP ( power_up => power_up ) PORT MAP ( d => dffhi_tmp, clk => clk_hr, clrn => ddioreg_aclr, prn => ddioreg_prn, sclr => ddioreg_sclr, sload => ddioreg_sload, asdata => ddioreg_adatasdata, ena => ena_ipd, q => dffhi1_tmp, devpor => devpor, devclrn => devclrn ); muxsel2 <= muxsel1; clk2 <= clk1; mux_sel <= muxsel2 when(use_new_clocking_model = "true") else clk2; muxsel_tmp <= mux_sel; sel_mux_lo_in <= dfflo_tmp; sel_mux_hi_in <= dffhi1_tmp when(half_rate_mode = "true") else dffhi_tmp; sel_mux : arriaii_mux21 port map ( A => sel_mux_lo_in, B => sel_mux_hi_in, S => muxsel_tmp, MO => dataout ); dfflo <= dfflo_tmp; dffhi(0) <= dffhi_tmp; dffhi(1) <= dffhi1_tmp; END arch; ------------------------------------------------------------------------------- -- utilities common for ddr ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; package arriaii_atom_ddr_pack is function dll_unsigned2bin (in_int : integer) return std_logic_vector; end arriaii_atom_ddr_pack; library IEEE; use IEEE.std_logic_1164.all; package body arriaii_atom_ddr_pack is -- truncate input integer to get 6 LSB bits function dll_unsigned2bin (in_int : integer) return std_logic_vector is variable tmp_int, i : integer; variable tmp_bit : integer; variable result : std_logic_vector(5 downto 0) := "000000"; begin tmp_int := in_int; for i in 0 to 5 loop tmp_bit := tmp_int MOD 2; if (tmp_bit = 1) then result(i) := '1'; else result(i) := '0'; end if; tmp_int := tmp_int/2; end loop; return result; end dll_unsigned2bin; end arriaii_atom_ddr_pack; ------------------------------------------------------------------------------- -- auxilary module for ddr ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; ENTITY arriaii_dll_gray_encoder IS GENERIC ( width : integer := 6 ); PORT ( mbin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); gout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END arriaii_dll_gray_encoder; ARCHITECTURE arriaii_dll_gray_encoder_arch OF arriaii_dll_gray_encoder IS SIGNAL greg : STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); BEGIN gout <= greg; PROCESS(mbin) VARIABLE i : INTEGER := 0; BEGIN greg(width-1) <= mbin(width-1); IF (width > 1) THEN i := width - 2; WHILE (i >= 0) LOOP greg(i) <= mbin(i+1) XOR mbin(i); i := i - 1; END LOOP; END IF; END PROCESS; END arriaii_dll_gray_encoder_arch; ------------------------------------------------------------------------------- -- auxilary module for ddr ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; ENTITY arriaii_dll_gray_decoder IS GENERIC ( width : integer := 6 ); PORT ( gin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); bout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END arriaii_dll_gray_decoder; ARCHITECTURE arriaii_dll_gray_decoder_arch OF arriaii_dll_gray_decoder IS SIGNAL breg : STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); BEGIN bout <= breg; PROCESS(gin) VARIABLE i : INTEGER := 0; VARIABLE bvar : STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); BEGIN bvar(width-1) := gin(width-1); IF (width > 1) THEN i := width - 2; WHILE (i >= 0) LOOP bvar(i) := bvar(i+1) XOR gin(i); i := i - 1; END LOOP; END IF; breg <= bvar; END PROCESS; END arriaii_dll_gray_decoder_arch; ------------------------------------------------------------------------------- -- Module Name: arriaii_ddr_delay_chain_s -- Description: auxilary module - delay chain-setting ------------------------------------------------------------------------------- Library ieee; use ieee.std_logic_1164.all; use work.arriaii_atom_pack.all; use work.arriaii_dll_gray_decoder; ENTITY arriaii_ddr_delay_chain_s IS GENERIC ( use_phasectrlin : string := "true"; phase_setting : integer := 0; delay_buffer_mode : string := "high"; sim_low_buffer_intrinsic_delay : integer := 350; sim_high_buffer_intrinsic_delay : integer := 175; sim_buffer_delay_increment : integer := 10; phasectrlin_limit : integer := 7 ); PORT ( clk : IN std_logic := '0'; delayctrlin : IN std_logic_vector(5 DOWNTO 0) := (OTHERS => '0'); phasectrlin : IN std_logic_vector(3 DOWNTO 0) := (OTHERS => '0'); delayed_clkout : OUT std_logic ); END arriaii_ddr_delay_chain_s; ARCHITECTURE arriaii_ddr_delay_chain_s_arch OF arriaii_ddr_delay_chain_s IS COMPONENT arriaii_dll_gray_decoder GENERIC ( width : integer := 6 ); PORT ( gin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); bout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END COMPONENT; SIGNAL clk_delay : INTEGER := 0; SIGNAL delayed_clk : STD_LOGIC := '0'; SIGNAL delayctrl_bin : STD_LOGIC_VECTOR (5 DOWNTO 0) := (OTHERS => '0'); SIGNAL delayctrlin_in : STD_LOGIC_VECTOR (5 DOWNTO 0) := (OTHERS => '0'); SIGNAL phasectrlin_in : STD_LOGIC_VECTOR (3 DOWNTO 0) := (OTHERS => '0'); BEGIN delayctrlin_in(0) <= '1' WHEN (delayctrlin(0) = '1') ELSE '0'; delayctrlin_in(1) <= '1' WHEN (delayctrlin(1) = '1') ELSE '0'; delayctrlin_in(2) <= '1' WHEN (delayctrlin(2) = '1') ELSE '0'; delayctrlin_in(3) <= '1' WHEN (delayctrlin(3) = '1') ELSE '0'; delayctrlin_in(4) <= '1' WHEN (delayctrlin(4) = '1') ELSE '0'; delayctrlin_in(5) <= '1' WHEN (delayctrlin(5) = '1') ELSE '0'; phasectrlin_in(0) <= '1' WHEN (phasectrlin(0) = '1') ELSE '0'; phasectrlin_in(1) <= '1' WHEN (phasectrlin(1) = '1') ELSE '0'; phasectrlin_in(2) <= '1' WHEN (phasectrlin(2) = '1') ELSE '0'; phasectrlin_in(3) <= '1' WHEN (phasectrlin(3) = '1') ELSE '0'; -- decoder mdr_delayctrl_in_dec : arriaii_dll_gray_decoder GENERIC MAP (width => 6) PORT MAP (gin => delayctrlin_in, bout => delayctrl_bin); PROCESS(delayctrl_bin, phasectrlin_in) variable sim_intrinsic_delay : INTEGER := 0; variable acell_delay : INTEGER := 0; variable delay_chain_len : INTEGER := 0; BEGIN IF (delay_buffer_mode = "low") THEN sim_intrinsic_delay := sim_low_buffer_intrinsic_delay; ELSE sim_intrinsic_delay := sim_high_buffer_intrinsic_delay; END IF; -- cell acell_delay := sim_intrinsic_delay + alt_conv_integer(delayctrl_bin) * sim_buffer_delay_increment; -- no of cells IF (use_phasectrlin = "false") THEN delay_chain_len := phase_setting; ELSIF (alt_conv_integer(phasectrlin_in) > phasectrlin_limit) THEN delay_chain_len := 0; ELSE delay_chain_len := alt_conv_integer(phasectrlin_in); END IF; -- total delay - added extra 1 ps for resolving racing clk_delay <= delay_chain_len * acell_delay + 1; IF ((use_phasectrlin = "true") AND (alt_conv_integer(phasectrlin_in) > phasectrlin_limit)) THEN assert false report "Warning: DDR phasesetting has invalid phasectrlin setting" severity warning; END IF; END PROCESS; -- generating delays delayed_clk <= transport clk after (clk_delay * 1 ps); delayed_clkout <= delayed_clk; END arriaii_ddr_delay_chain_s_arch; ------------------------------------------------------------------------------- -- based on dffeas ------------------------------------------------------------------------------- Library ieee; use ieee.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; entity arriaii_ddr_io_reg is generic( power_up : string := "DONT_CARE"; is_wysiwyg : string := "false"; x_on_violation : string := "on"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_prn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port( d : in std_logic := '0'; clk : in std_logic := '0'; ena : in std_logic := '1'; clrn : in std_logic := '1'; prn : in std_logic := '1'; aload : in std_logic := '0'; asdata : in std_logic := '1'; sclr : in std_logic := '0'; sload : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); attribute VITAL_LEVEL0 of arriaii_ddr_io_reg : entity is TRUE; end arriaii_ddr_io_reg; architecture vital_arriaii_ddr_io_reg of arriaii_ddr_io_reg is attribute VITAL_LEVEL0 of vital_arriaii_ddr_io_reg : architecture is TRUE; signal clk_ipd : std_logic; signal d_ipd : std_logic; signal d_dly : std_logic; signal asdata_ipd : std_logic; signal asdata_dly : std_logic; signal asdata_dly1 : std_logic; signal sclr_ipd : std_logic; signal sload_ipd : std_logic; signal clrn_ipd : std_logic; signal prn_ipd : std_logic; signal aload_ipd : std_logic; signal ena_ipd : std_logic; begin d_dly <= d_ipd; asdata_dly <= asdata_ipd; asdata_dly1 <= asdata_dly; --------------------- -- INPUT PATH DELAYs --------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (d_ipd, d, tipd_d); VitalWireDelay (asdata_ipd, asdata, tipd_asdata); VitalWireDelay (sclr_ipd, sclr, tipd_sclr); VitalWireDelay (sload_ipd, sload, tipd_sload); VitalWireDelay (clrn_ipd, clrn, tipd_clrn); VitalWireDelay (prn_ipd, prn, tipd_prn); VitalWireDelay (aload_ipd, aload, tipd_aload); VitalWireDelay (ena_ipd, ena, tipd_ena); end block; VITALtiming : process ( clk_ipd, d_dly, asdata_dly1, sclr_ipd, sload_ipd, clrn_ipd, prn_ipd, aload_ipd, ena_ipd, devclrn, devpor) variable Tviol_d_clk : std_ulogic := '0'; variable Tviol_asdata_clk : std_ulogic := '0'; variable Tviol_sclr_clk : std_ulogic := '0'; variable Tviol_sload_clk : std_ulogic := '0'; variable Tviol_ena_clk : std_ulogic := '0'; variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_asdata_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sclr_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sload_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_ena_clk : VitalTimingDataType := VitalTimingDataInit; variable q_VitalGlitchData : VitalGlitchDataType; variable iq : std_logic := '0'; variable idata: std_logic := '0'; -- variables for 'X' generation variable violation : std_logic := '0'; begin if (now = 0 ns) then if ((power_up = "low") or (power_up = "DONT_CARE")) then iq := '0'; elsif (power_up = "high") then iq := '1'; else iq := '0'; end if; end if; ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_d_clk, TimingData => TimingData_d_clk, TestSignal => d, TestSignalName => "DATAIN", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_d_clk_noedge_posedge, SetupLow => tsetup_d_clk_noedge_posedge, HoldHigh => thold_d_clk_noedge_posedge, HoldLow => thold_d_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT clrn_ipd) OR (NOT prn_ipd) OR (sload_ipd) OR (sclr_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ddr_io_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_asdata_clk, TimingData => TimingData_asdata_clk, TestSignal => asdata_ipd, TestSignalName => "ASDATA", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_asdata_clk_noedge_posedge, SetupLow => tsetup_asdata_clk_noedge_posedge, HoldHigh => thold_asdata_clk_noedge_posedge, HoldLow => thold_asdata_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT clrn_ipd) OR (NOT prn_ipd) OR (NOT sload_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ddr_io_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sclr_clk, TimingData => TimingData_sclr_clk, TestSignal => sclr_ipd, TestSignalName => "SCLR", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sclr_clk_noedge_posedge, SetupLow => tsetup_sclr_clk_noedge_posedge, HoldHigh => thold_sclr_clk_noedge_posedge, HoldLow => thold_sclr_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT clrn_ipd) OR (NOT prn_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ddr_io_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sload_clk, TimingData => TimingData_sload_clk, TestSignal => sload_ipd, TestSignalName => "SLOAD", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sload_clk_noedge_posedge, SetupLow => tsetup_sload_clk_noedge_posedge, HoldHigh => thold_sload_clk_noedge_posedge, HoldLow => thold_sload_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT clrn_ipd) OR (NOT prn_ipd) OR (NOT devpor) OR (NOT devclrn) OR (NOT ena_ipd)) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ddr_io_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_ena_clk, TimingData => TimingData_ena_clk, TestSignal => ena_ipd, TestSignalName => "ENA", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_ena_clk_noedge_posedge, SetupLow => tsetup_ena_clk_noedge_posedge, HoldHigh => thold_ena_clk_noedge_posedge, HoldLow => thold_ena_clk_noedge_posedge, CheckEnabled => TO_X01( (NOT clrn_ipd) OR (NOT prn_ipd) OR (NOT devpor) OR (NOT devclrn) ) /= '1', RefTransition => '/', HeaderMsg => InstancePath & "/arriaii_ddr_io_reg", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; violation := Tviol_d_clk or Tviol_asdata_clk or Tviol_sclr_clk or Tviol_sload_clk or Tviol_ena_clk; if ((devpor = '0') or (devclrn = '0') or (clrn_ipd = '0')) then iq := '0'; elsif (prn_ipd = '0') then iq := '1'; elsif (aload_ipd = '1') then iq := asdata_dly1; elsif (violation = 'X' and x_on_violation = "on") then iq := 'X'; elsif clk_ipd'event and clk_ipd = '1' and clk_ipd'last_value = '0' then if (ena_ipd = '1') then if (sclr_ipd = '1') then iq := '0'; elsif (sload_ipd = '1') then iq := asdata_dly1; else iq := d_dly; end if; end if; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => q, OutSignalName => "Q", OutTemp => iq, Paths => (0 => (clrn_ipd'last_event, tpd_clrn_q_negedge, TRUE), 1 => (prn_ipd'last_event, tpd_prn_q_negedge, TRUE), 2 => (aload_ipd'last_event, tpd_aload_q_posedge, TRUE), 3 => (asdata_ipd'last_event, tpd_asdata_q, TRUE), 4 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)), GlitchData => q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_arriaii_ddr_io_reg; ------------------------------------------------------------------------------- -- -- Entity Name : Piranha_dll -- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; use work.arriaii_pllpack.all; use work.arriaii_atom_ddr_pack.all; use work.arriaii_dll_gray_encoder; ENTITY arriaii_dll is GENERIC ( input_frequency : string := "0 ps"; delay_buffer_mode : string := "low"; delay_chain_length : integer := 12; delayctrlout_mode : string := "normal"; jitter_reduction : string := "false"; use_upndnin : string := "false"; use_upndninclkena : string := "false"; dual_phase_comparators : string := "true"; sim_valid_lock : integer := 16; sim_valid_lockcount : integer := 0; -- 10000 = 1000 + 100*dllcounter sim_low_buffer_intrinsic_delay : integer := 350; sim_high_buffer_intrinsic_delay : integer := 175; sim_buffer_delay_increment : integer := 10; static_delay_ctrl : integer := 0; lpm_type : string := "arriaii_dll"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_aload : VitalDelayType01 := DefpropDelay01; tipd_upndnin : VitalDelayType01 := DefpropDelay01; tipd_upndninclkena : VitalDelayType01 := DefpropDelay01; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tsetup_upndnin_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_upndnin_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_upndninclkena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_upndninclkena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_upndnout_posedge : VitalDelayType01 := DefPropDelay01; tpd_clk_delayctrlout_posedge : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01) ); PORT ( clk : IN std_logic := '0'; aload : IN std_logic := '0'; upndnin : IN std_logic := '1'; upndninclkena : IN std_logic := '1'; devclrn : IN std_logic := '1'; devpor : IN std_logic := '0'; delayctrlout : OUT std_logic_vector(5 DOWNTO 0); dqsupdate : OUT std_logic; offsetdelayctrlout : OUT std_logic_vector(5 DOWNTO 0); offsetdelayctrlclkout : OUT std_logic; upndnout : OUT std_logic ); END arriaii_dll; ARCHITECTURE vital_piranhadll of arriaii_dll is COMPONENT arriaii_dll_gray_encoder GENERIC ( width : integer := 6 ); PORT ( mbin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); gout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END COMPONENT; signal clk_in : std_logic := '0'; signal aload_in_buf : std_logic := '0'; signal upndn_in : std_logic := '0'; signal upndninclkena_in : std_logic := '1'; signal delayctrl_out : std_logic_vector(5 DOWNTO 0) := "000000"; signal offsetdelayctrl_out : std_logic_vector(5 DOWNTO 0) := "000000"; signal upndn_out : std_logic := '0'; signal dqsupdate_out : std_logic := '0'; signal para_delay_buffer_mode : std_logic_vector (1 DOWNTO 0) := "01"; signal para_delayctrlout_mode : std_logic_vector (1 DOWNTO 0) := "00"; signal para_static_delay_ctrl : integer := 0; signal para_jitter_reduction : std_logic := '0'; signal para_use_upndnin : std_logic := '0'; signal para_use_upndninclkena : std_logic := '1'; -- INTERNAL NETS AND VARIABLES -- for functionality - by modules signal sim_buffer_intrinsic_delay : INTEGER := 0; -- two reg on the de-assertion of dll SIGNAL aload_in : std_logic := '0'; SIGNAL aload_reg1 : std_logic := '1'; SIGNAL aload_reg2 : std_logic := '1'; -- delay and offset control out resolver signal dr_delayctrl_out : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_delayctrl_int : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_offsetctrl_out : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_dllcount_in : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_clk8_in : std_logic := '0'; signal dr_aload_in : std_logic := '0'; signal dr_reg_dllcount : std_logic_vector (5 DOWNTO 0) := "000000"; signal para_static_delay_ctrl_gray : std_logic_vector (5 DOWNTO 0) := "000000"; -- delay chain setting counter signal dc_dllcount_out_gray : std_logic_vector (5 DOWNTO 0) := "000000"; signal dc_dllcount_out_vec : std_logic_vector (5 DOWNTO 0) := "000000"; signal dc_dllcount_out : integer := 0; signal dc_dqsupdate_out : std_logic := '0'; signal dc_upndn_in : std_logic := '1'; signal dc_aload_in : std_logic := '0'; signal dc_upndnclkena_in : std_logic := '1'; signal dc_clk8_in : std_logic := '0'; signal dc_clk1_in : std_logic := '0'; signal dc_dlltolock_in : std_logic := '0'; signal dc_reg_dllcount : integer := 0; signal dc_reg_dlltolock_pulse : std_logic := '0'; -- jitter reduction counter signal jc_upndn_out : std_logic := '0'; signal jc_upndnclkena_out : std_logic := '1'; signal jc_clk8_in : std_logic := '0'; signal jc_upndn_in : std_logic := '1'; signal jc_aload_in : std_logic := '0'; signal jc_clkena_in : std_logic := '1'; -- new in arriaii signal jc_count : integer := 8; signal jc_reg_upndn : std_logic := '0'; signal jc_reg_upndnclkena : std_logic := '0'; -- phase comparator signal pc_lock : std_logic := '0'; -- new in arriaii signal pc_upndn_out : std_logic := '1'; signal pc_dllcount_in : integer := 0; signal pc_clk1_in : std_logic := '0'; signal pc_clk8_in : std_logic := '0'; signal pc_aload_in : std_logic := '0'; signal pc_reg_upndn : std_logic := '1'; signal pc_delay : integer := 0; signal pc_lock_reg : std_logic := '0'; -- new in arriaii signal pc_comp_range : integer := 0; -- new in arriaii -- clock generator signal cg_clk_in : std_logic := '0'; signal cg_aload_in : std_logic := '0'; signal cg_clk1_out : std_logic := '0'; signal cg_clk8a_out : std_logic := '0'; signal cg_clk8b_out : std_logic := '0'; -- por: 000 signal cg_reg_1 : std_logic := '0'; signal cg_rega_2 : std_logic := '0'; signal cg_rega_3 : std_logic := '0'; -- por: 010 signal cg_regb_2 : std_logic := '1'; signal cg_regb_3 : std_logic := '0'; -- for violation checks signal dll_to_lock : std_logic := '0'; signal input_period : integer := 10000; signal clk_in_last_value : std_logic := 'X'; begin -- paramters input_period <= dqs_str2int(input_frequency); para_static_delay_ctrl <= static_delay_ctrl; para_use_upndnin <= '1' WHEN use_upndnin = "true" ELSE '0'; para_jitter_reduction <= '1' WHEN jitter_reduction = "true" ELSE '0'; para_use_upndninclkena <= '1' WHEN use_upndninclkena = "true" ELSE '0'; para_delay_buffer_mode <= "00" WHEN delay_buffer_mode = "auto" ELSE "01" WHEN delay_buffer_mode = "low" ELSE "10"; para_delayctrlout_mode <= "01" WHEN delayctrlout_mode = "test" ELSE "10" WHEN delayctrlout_mode="normal" ELSE "11" WHEN delayctrlout_mode="static" ELSE "00"; sim_buffer_intrinsic_delay <= sim_low_buffer_intrinsic_delay WHEN (delay_buffer_mode = "low") ELSE sim_high_buffer_intrinsic_delay; -- violation check block process (clk_in) variable got_first_rising_edge : std_logic := '0'; variable got_first_falling_edge : std_logic := '0'; variable per_violation : std_logic := '0'; variable duty_violation : std_logic := '0'; variable sent_per_violation : std_logic := '0'; variable sent_duty_violation : std_logic := '0'; variable clk_in_last_rising_edge : time := 0 ps; variable clk_in_last_falling_edge : time := 0 ps; variable input_period_ps : time := 10000 ps; variable duty_cycle : time := 5000 ps; variable clk_in_period : time := 10000 ps; variable clk_in_duty_cycle : time := 5000 ps; variable clk_per_tolerance : time := 2 ps; variable half_cycles_to_lock : integer := 1; variable init : boolean := true; begin if (init) then input_period_ps := dqs_str2int(input_frequency) * 1 ps; if (input_period_ps = 0 ps) then assert false report "Need to specify ps scale in simulation command" severity error; end if; duty_cycle := input_period_ps/2; clk_per_tolerance := 2 ps; half_cycles_to_lock := 0; init := false; end if; if (clk_in'event and clk_in = '1') then -- rising edge if (got_first_rising_edge = '0') then got_first_rising_edge := '1'; else -- subsequent rising -- check for clock period and duty cycle violation clk_in_period := now - clk_in_last_rising_edge; clk_in_duty_cycle := now - clk_in_last_falling_edge; if ((clk_in_period < (input_period_ps - clk_per_tolerance)) or (clk_in_period > (input_period_ps + clk_per_tolerance))) then per_violation := '1'; if (sent_per_violation /= '1') then sent_per_violation := '1'; assert false report "Input clock frequency violation." severity warning; end if; elsif ((clk_in_duty_cycle < (duty_cycle - clk_per_tolerance/2 - 1 ps)) or (clk_in_duty_cycle > (duty_cycle + clk_per_tolerance/2 + 1 ps))) then duty_violation := '1'; if (sent_duty_violation /= '1') then sent_duty_violation := '1'; assert false report "Input clock duty cycle violation." severity warning; end if; else if (per_violation = '1') then sent_per_violation := '0'; assert false report "Input clock frequency now matches specified clock frequency." severity warning; end if; per_violation := '0'; duty_violation := '0'; end if; end if; if (per_violation = '0' and duty_violation = '0' and dll_to_lock = '0') then half_cycles_to_lock := half_cycles_to_lock + 1; if (half_cycles_to_lock >= sim_valid_lock) then dll_to_lock <= '1'; assert false report "DLL to lock to incoming clock" severity note; end if; end if; clk_in_last_rising_edge := now; elsif (clk_in'event and clk_in = '0') then -- falling edge got_first_falling_edge := '1'; if (got_first_rising_edge = '1') then -- duty cycle check clk_in_duty_cycle := now - clk_in_last_rising_edge; if ((clk_in_duty_cycle < (duty_cycle - clk_per_tolerance/2 - 1 ps)) or (clk_in_duty_cycle > (duty_cycle + clk_per_tolerance/2 + 1 ps))) then duty_violation := '1'; if (sent_duty_violation /= '1') then sent_duty_violation := '1'; assert false report "Input clock duty cycle violation." severity warning; end if; else duty_violation := '0'; end if; if (dll_to_lock = '0' and duty_violation = '0') then half_cycles_to_lock := half_cycles_to_lock + 1; end if; end if; clk_in_last_falling_edge := now; elsif (got_first_falling_edge = '1' or got_first_rising_edge = '1') then -- switches from 1, 0 to X half_cycles_to_lock := 0; got_first_rising_edge := '0'; got_first_falling_edge := '0'; if (dll_to_lock = '1') then dll_to_lock <= '0'; assert false report "Illegal value detected on input clock. DLL will lose lock." severity warning; else assert false report "Illegal value detected on input clock." severity warning; end if; end if; clk_in_last_value <= clk_in; end process ; -- violation check -- outputs delayctrl_out <= dr_delayctrl_out; offsetdelayctrl_out <= dr_offsetctrl_out; offsetdelayctrlclkout <= dr_clk8_in; dqsupdate_out <= cg_clk8a_out; upndn_out <= pc_upndn_out; -- two registers on aload path -------------------------------------------- aload_in <= (aload_in_buf OR aload_reg2); process(clk_in) begin if (clk_in = '0' and clk_in'event) then aload_reg2 <= aload_reg1; aload_reg1 <= aload_in_buf; end if; end process; -- Delay and offset ctrl out resolver ------------------------------------- -------- convert calculations into integer -- inputs dr_clk8_in <= not cg_clk8b_out; dr_dllcount_in <= dc_dllcount_out_gray; dr_aload_in <= aload_in; mdll_count_enc : arriaii_dll_gray_encoder GENERIC MAP (width => 6) PORT MAP (mbin => dc_dllcount_out_vec, gout => dc_dllcount_out_gray); dc_dllcount_out_vec <= dll_unsigned2bin(dc_dllcount_out); -- outputs dr_delayctrl_out <= dr_reg_dllcount; dr_offsetctrl_out <= dr_delayctrl_int; -- assumed para_static_delay_ctrl is gray-coded para_static_delay_ctrl_gray <= dll_unsigned2bin(para_static_delay_ctrl); dr_delayctrl_int <= para_static_delay_ctrl_gray WHEN (delayctrlout_mode = "static") ELSE dr_dllcount_in; -- model process(dr_clk8_in, dr_aload_in) begin if (dr_aload_in = '1' and dr_aload_in'event) then dr_reg_dllcount <= "000000"; elsif (dr_clk8_in = '1' and dr_clk8_in'event and dr_aload_in /= '1') then dr_reg_dllcount <= dr_delayctrl_int; end if; end process; -- Delay Setting Control Counter ------------------------------------------ --inputs dc_dlltolock_in <= dll_to_lock; dc_aload_in <= aload_in; dc_clk1_in <= cg_clk1_out; dc_clk8_in <= not cg_clk8b_out; dc_upndnclkena_in <= upndninclkena WHEN (para_use_upndninclkena = '1') ELSE jc_upndnclkena_out WHEN (para_jitter_reduction = '1') ELSE (not pc_lock) WHEN (dual_phase_comparators = "true") ELSE '1'; dc_upndn_in <= upndnin WHEN (para_use_upndnin = '1') ELSE jc_upndn_out WHEN (para_jitter_reduction = '1') ELSE pc_upndn_out; -- outputs dc_dllcount_out <= dc_reg_dllcount; -- needs to turn into gray counter -- dll counter logic process(dc_clk8_in, dc_aload_in, dc_dlltolock_in) variable dc_var_dllcount : integer := 64; variable init : boolean := true; begin if (init) then if (delay_buffer_mode = "low") then dc_var_dllcount := 32; else dc_var_dllcount := 16; end if; init := false; end if; if (dc_aload_in = '1' and dc_aload_in'event) then if (delay_buffer_mode = "low") then dc_var_dllcount := 32; else dc_var_dllcount := 16; end if; elsif (dc_aload_in /= '1' and dc_dlltolock_in = '1' and dc_reg_dlltolock_pulse /= '1' and dc_upndnclkena_in = '1' and para_use_upndnin = '0') then dc_var_dllcount := sim_valid_lockcount; dc_reg_dlltolock_pulse <= '1'; elsif (dc_aload_in /= '1' and dc_upndnclkena_in = '1' and dc_clk8_in'event and dc_clk8_in = '1') then -- posedge clk if (dc_upndn_in = '1') then if ((para_delay_buffer_mode = "01" and dc_var_dllcount < 63) or (para_delay_buffer_mode /= "01" and dc_var_dllcount < 31)) then dc_var_dllcount := dc_var_dllcount + 1; end if; elsif (dc_upndn_in = '0') then if (dc_var_dllcount > 0) then dc_var_dllcount := dc_var_dllcount - 1; end if; end if; end if; -- rising clock -- schedule signal dc_reg_dllcount dc_reg_dllcount <= dc_var_dllcount; end process; -- Jitter reduction counter ----------------------------------------------- -- inputs jc_clk8_in <= not cg_clk8b_out; jc_upndn_in <= pc_upndn_out; jc_aload_in <= aload_in; -- new in arriaii jc_clkena_in <= '1' WHEN (dual_phase_comparators = "false") ELSE (not pc_lock); -- outputs jc_upndn_out <= jc_reg_upndn; jc_upndnclkena_out <= jc_reg_upndnclkena; -- Model process (jc_clk8_in, jc_aload_in) begin if (jc_aload_in = '1' and jc_aload_in'event) then jc_count <= 8; elsif (jc_aload_in /= '1' and jc_clk8_in'event and jc_clk8_in = '1') then if (jc_clkena_in = '1') then if (jc_count = 12) then jc_reg_upndn <= '1'; jc_reg_upndnclkena <= '1'; jc_count <= 8; elsif (jc_count = 4) then jc_reg_upndn <= '0'; jc_reg_upndnclkena <= '1'; jc_count <= 8; else -- increment/decrement counter jc_reg_upndnclkena <= '0'; if (jc_upndn_in = '1') then jc_count <= jc_count + 1; elsif (jc_upndn_in = '0') then jc_count <= jc_count - 1; end if; end if; else -- not clkena jc_reg_upndnclkena <= '0'; end if; end if; end process; -- Phase comparator ------------------------------------------------------- -- inputs pc_clk1_in <= cg_clk1_out; pc_clk8_in <= cg_clk8b_out; -- positive pc_dllcount_in <= dc_dllcount_out; -- for phase loop calculation pc_aload_in <= aload_in; -- outputs pc_upndn_out <= pc_reg_upndn; pc_lock <= pc_lock_reg; -- parameter used -- sim_loop_intrinsic_delay, sim_loop_delay_increment pc_comp_range <= (3*delay_chain_length*sim_buffer_delay_increment)/2; -- Model process (pc_clk8_in, pc_aload_in) variable pc_var_delay : integer := 0; begin if (pc_aload_in = '1' and pc_aload_in'event) then pc_var_delay := 0; elsif (pc_aload_in /= '1' and pc_clk8_in'event and pc_clk8_in = '1' ) then pc_var_delay := delay_chain_length * (sim_buffer_intrinsic_delay + sim_buffer_delay_increment * pc_dllcount_in); pc_delay <= pc_var_delay; if (dual_phase_comparators = "false") then if (pc_var_delay > input_period) then pc_reg_upndn <= '0'; else pc_reg_upndn <= '1'; end if; else -- use dual phase if (pc_var_delay < (input_period - pc_comp_range/2)) then pc_reg_upndn <= '1'; pc_lock_reg <= '0'; elsif (pc_var_delay <= (input_period + pc_comp_range/2)) then pc_reg_upndn <= '0'; pc_lock_reg <= '1'; else pc_reg_upndn <= '0'; pc_lock_reg <= '0'; end if; end if; end if; end process; -- Clock Generator ------------------------------------------------------- -- inputs cg_clk_in <= clk_in; cg_aload_in <= aload_in; -- outputs cg_clk8a_out <= cg_rega_3; cg_clk8b_out <= cg_regb_3; cg_clk1_out <= '0' WHEN cg_aload_in = '1' ELSE cg_clk_in; -- Model process(cg_clk1_out, cg_aload_in) begin if (cg_aload_in = '1' and cg_aload_in'event) then cg_reg_1 <= '0'; elsif (cg_aload_in /= '1' and cg_clk1_out = '1' and cg_clk1_out'event) then cg_reg_1 <= not cg_reg_1; end if; end process; process(cg_reg_1, cg_aload_in) begin if (cg_aload_in = '1' and cg_aload_in'event) then cg_rega_2 <= '0'; cg_regb_2 <= '1'; elsif (cg_aload_in /= '1' and cg_reg_1 = '1' and cg_reg_1'event) then cg_rega_2 <= not cg_rega_2; cg_regb_2 <= not cg_regb_2; end if; end process; process (cg_rega_2, cg_aload_in) begin if (cg_aload_in = '1' and cg_aload_in'event) then cg_rega_3 <= '0'; elsif (cg_aload_in /= '1' and cg_rega_2 = '1' and cg_rega_2'event) then cg_rega_3 <= not cg_rega_3; end if; end process; process (cg_regb_2, cg_aload_in) begin if (cg_aload_in = '1' and cg_aload_in'event) then cg_regb_3 <= '0'; elsif (cg_aload_in /= '1' and cg_regb_2 = '1' and cg_regb_2'event) then cg_regb_3 <= not cg_regb_3; end if; end process; -------------------- -- INPUT PATH DELAYS -------------------- WireDelay : block begin VitalWireDelay (clk_in, clk, tipd_clk); VitalWireDelay (aload_in_buf, aload, tipd_aload); VitalWireDelay (upndn_in, upndnin, tipd_upndnin); VitalWireDelay (upndninclkena_in, upndninclkena, tipd_upndninclkena); end block; ------------------------ -- Timing Check Section ------------------------ VITALtiming : process (clk_in, upndn_in, upndninclkena_in, delayctrl_out, offsetdelayctrl_out, dqsupdate_out, upndn_out) variable Tviol_upndnin_clk : std_ulogic := '0'; variable Tviol_upndninclkena_clk : std_ulogic := '0'; variable TimingData_upndnin_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_upndninclkena_clk : VitalTimingDataType := VitalTimingDataInit; variable delayctrlout_VitalGlitchDataArray : VitalGlitchDataArrayType(5 downto 0); variable upndnout_VitalGlitchData : VitalGlitchDataType; begin if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_upndnin_clk, TimingData => TimingData_upndnin_clk, TestSignal => upndn_in, TestSignalName => "UPNDNIN", RefSignal => clk_in, RefSignalName => "CLK", SetupHigh => tsetup_upndnin_clk_noedge_posedge, SetupLow => tsetup_upndnin_clk_noedge_posedge, HoldHigh => thold_upndnin_clk_noedge_posedge, HoldLow => thold_upndnin_clk_noedge_posedge, RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_DLL", XOn => XOn, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_upndninclkena_clk, TimingData => TimingData_upndninclkena_clk, TestSignal => upndninclkena_in, TestSignalName => "UPNDNINCLKENA", RefSignal => clk_in, RefSignalName => "CLK", SetupHigh => tsetup_upndninclkena_clk_noedge_posedge, SetupLow => tsetup_upndninclkena_clk_noedge_posedge, HoldHigh => thold_upndninclkena_clk_noedge_posedge, HoldLow => thold_upndninclkena_clk_noedge_posedge, RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_DLL", XOn => XOn, MsgOn => MsgOnChecks ); end if; ---------------------- -- Path Delay Section ---------------------- offsetdelayctrlout <= offsetdelayctrl_out; dqsupdate <= dqsupdate_out; VitalPathDelay01 ( OutSignal => upndnout, OutSignalName => "UPNDNOUT", OutTemp => upndn_out, Paths => (0 => (clk_in'last_event, tpd_clk_upndnout_posedge, TRUE)), GlitchData => upndnout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(0), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(0), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(0), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(0), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(1), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(1), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(1), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(1), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(2), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(2), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(2), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(2), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(3), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(3), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(3), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(3), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(4), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(4), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(4), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(4), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => delayctrlout(5), OutSignalName => "DELAYCTRLOUT", OutTemp => delayctrl_out(5), Paths => (0 => (clk_in'last_event, tpd_clk_delayctrlout_posedge(5), TRUE)), GlitchData => delayctrlout_VitalGlitchDataArray(5), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; -- vital timing end vital_piranhadll; ------------------------------------------------------------------------------- -- -- Entity Name : Piranha_dll_offset_ctrl -- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; USE work.arriaii_pllpack.all; use work.arriaii_atom_ddr_pack.all; use work.arriaii_dll_gray_encoder; use work.arriaii_dll_gray_decoder; ENTITY arriaii_dll_offset_ctrl is GENERIC ( use_offset : string := "false"; static_offset : string := "0"; delay_buffer_mode : string := "low"; lpm_type : string := "arriaii_dll_offset_ctrl"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_aload : VitalDelayType01 := DefpropDelay01; tipd_offset : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01); tipd_offsetdelayctrlin : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01); tipd_addnsub : VitalDelayType01 := DefpropDelay01; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tsetup_offset_clk_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); thold_offset_clk_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); tsetup_addnsub_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_addnsub_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_offsetctrlout_posedge : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01) ); PORT ( clk : IN std_logic := '0'; aload : IN std_logic := '0'; offsetdelayctrlin : IN std_logic_vector(5 DOWNTO 0) := "000000"; offset : IN std_logic_vector(5 DOWNTO 0) := "000000"; addnsub : IN std_logic := '1'; devclrn : IN std_logic := '1'; devpor : IN std_logic := '0'; offsettestout : OUT std_logic_vector(5 DOWNTO 0); offsetctrlout : OUT std_logic_vector(5 DOWNTO 0) ); END arriaii_dll_offset_ctrl; ARCHITECTURE vital_piranhaoffset of arriaii_dll_offset_ctrl is COMPONENT arriaii_dll_gray_encoder GENERIC ( width : integer := 6 ); PORT ( mbin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); gout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_dll_gray_decoder GENERIC ( width : integer := 6 ); PORT ( gin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); bout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END COMPONENT; signal clk_in : std_logic := '0'; signal aload_in : std_logic := '0'; signal offset_in : std_logic_vector(5 DOWNTO 0) := "000000"; signal offsetdelayctrlin_in : std_logic_vector(5 DOWNTO 0) := "000000"; signal addnsub_in : std_logic := '0'; signal offsetctrl_out : std_logic_vector(5 DOWNTO 0) := "000000"; signal para_delay_buffer_mode : std_logic_vector (1 DOWNTO 0) := "01"; signal para_use_offset : std_logic := '0'; signal para_static_offset : integer := 0; signal para_static_offset_pos : integer := 0; -- INTERNAL NETS AND VARIABLES -- for functionality - by modules -- two reg on the de-assertion of aload SIGNAL aload_reg1 : std_logic := '1'; SIGNAL aload_reg2 : std_logic := '1'; -- delay and offset control out resolver signal dr_offsetctrl_out : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_offsettest_out : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_offsetctrl_out_gray : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_addnsub_in : std_logic := '1'; signal dr_clk8_in : std_logic := '0'; signal dr_aload_in : std_logic := '0'; signal dr_offset_in_gray : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_delayctrl_in_gray : std_logic_vector (5 DOWNTO 0) := "000000"; signal para_static_offset_vec_pos : std_logic_vector (5 DOWNTO 0) := "000000"; signal para_static_offset_gray : std_logic_vector (5 DOWNTO 0) := "000000"; -- signed in 2's complement -- docoder signal dr_delayctrl_in_bin : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_offset_in_bin : std_logic_vector (5 DOWNTO 0) := "000000"; signal dr_offset_in_bin_pos : std_logic_vector (5 DOWNTO 0) := "000000"; -- for over/underflow check signal para_static_offset_bin : std_logic_vector (5 DOWNTO 0) := "000000"; signal para_static_offset_bin_pos : std_logic_vector (5 DOWNTO 0) := "000000"; -- for over/underflow check signal dr_reg_offset : std_logic_vector (5 DOWNTO 0) := "000000"; begin -- paramters para_delay_buffer_mode <= "01" WHEN delay_buffer_mode = "low" ELSE "00"; para_use_offset <= '1' WHEN use_offset = "true" ELSE '0'; para_static_offset <= dqs_str2int(static_offset); -- signed int para_static_offset_pos <= para_static_offset WHEN (para_static_offset > 0) ELSE (-1)*para_static_offset; -- outputs offsetctrl_out <= dr_offsetctrl_out_gray; offsettestout <= dr_offsettest_out; -- two registers on aload path -------------------------------------------- -- it should be user clock to DLL, not the /8 clock of offsetctrl process(clk_in) begin if (clk_in = '0' and clk_in'event) then aload_reg2 <= aload_reg1; aload_reg1 <= aload_in; end if; end process; -- Delay and offset ctrl out resolver ------------------------------------- -- inputs dr_clk8_in <= clk_in; dr_addnsub_in <= addnsub_in; dr_aload_in <= aload_in; -- aload_in | aload_reg2; dr_delayctrl_in_gray <= offsetdelayctrlin_in; dr_offset_in_gray <= offset_in; para_static_offset_vec_pos <= dll_unsigned2bin(para_static_offset_pos); para_static_offset_gray <= ("111111" - para_static_offset_vec_pos + "000001") WHEN (para_static_offset < 0) ELSE para_static_offset_vec_pos; -- outputs dr_offsetctrl_out <= dr_reg_offset; moffsetctrl_out_enc : arriaii_dll_gray_encoder GENERIC MAP (width => 6) PORT MAP (mbin => dr_reg_offset, gout => dr_offsetctrl_out_gray); dr_offsettest_out <= para_static_offset_gray WHEN (use_offset = "false") ELSE offset_in; -- model -- decoders mdr_delayctrl_in_dec : arriaii_dll_gray_decoder GENERIC MAP (width => 6) PORT MAP (gin => dr_delayctrl_in_gray, bout => dr_delayctrl_in_bin); mdr_offset_in_dec : arriaii_dll_gray_decoder GENERIC MAP (width => 6) PORT MAP (gin => dr_offset_in_gray, bout => dr_offset_in_bin); mpara_static_offset_dec : arriaii_dll_gray_decoder GENERIC MAP (width => 6) PORT MAP (gin => para_static_offset_gray, bout => para_static_offset_bin); -- get postive value of decoded offset for over/underflow check para_static_offset_bin_pos <= ("111111" - para_static_offset_bin + "000001") WHEN (para_static_offset < 0) ELSE para_static_offset_bin; dr_offset_in_bin_pos <= ("111111" - dr_offset_in_bin + "000001") WHEN ((use_offset = "true") AND (addnsub_in = '0')) ELSE dr_offset_in_bin; -- generating dr_reg_offset process(dr_clk8_in, dr_aload_in) begin if (dr_aload_in = '1' and dr_aload_in'event) then dr_reg_offset <= "000000"; elsif (dr_aload_in /= '1' and dr_clk8_in = '1' and dr_clk8_in'event) then if (use_offset = "true") then if (dr_addnsub_in = '1') then if (dr_delayctrl_in_bin < "111111" - dr_offset_in_bin) then dr_reg_offset <= dr_delayctrl_in_bin + dr_offset_in_bin; else dr_reg_offset <= "111111"; end if; elsif (dr_addnsub_in = '0') then if (dr_delayctrl_in_bin > dr_offset_in_bin_pos) then dr_reg_offset <= dr_delayctrl_in_bin + dr_offset_in_bin; -- same as - *_pos else dr_reg_offset <= "000000"; end if; end if; else if (para_static_offset >= 0) then -- do not use a + b < "11111" as it does not check overflow if ((para_static_offset_bin < "111111") AND (dr_delayctrl_in_bin < "111111" - para_static_offset_bin )) then dr_reg_offset <= dr_delayctrl_in_bin + para_static_offset_bin; else dr_reg_offset <= "111111"; end if; else if ((para_static_offset_bin_pos < "111111") AND (dr_delayctrl_in_bin > para_static_offset_bin_pos)) then dr_reg_offset <= dr_delayctrl_in_bin + para_static_offset_bin; -- same as - *_pos else dr_reg_offset <= "000000"; end if; end if; end if; end if; -- rising clock end process ; -- generating dr_reg_offset -------------------- -- INPUT PATH DELAYS -------------------- WireDelay : block begin VitalWireDelay (clk_in, clk, tipd_clk); VitalWireDelay (aload_in, aload, tipd_aload); VitalWireDelay (addnsub_in, addnsub, tipd_addnsub); VitalWireDelay (offset_in(0), offset(0), tipd_offset(0)); VitalWireDelay (offset_in(1), offset(1), tipd_offset(1)); VitalWireDelay (offset_in(2), offset(2), tipd_offset(2)); VitalWireDelay (offset_in(3), offset(3), tipd_offset(3)); VitalWireDelay (offset_in(4), offset(4), tipd_offset(4)); VitalWireDelay (offset_in(5), offset(5), tipd_offset(5)); VitalWireDelay (offsetdelayctrlin_in(0), offsetdelayctrlin(0), tipd_offsetdelayctrlin(0)); VitalWireDelay (offsetdelayctrlin_in(1), offsetdelayctrlin(1), tipd_offsetdelayctrlin(1)); VitalWireDelay (offsetdelayctrlin_in(2), offsetdelayctrlin(2), tipd_offsetdelayctrlin(2)); VitalWireDelay (offsetdelayctrlin_in(3), offsetdelayctrlin(3), tipd_offsetdelayctrlin(3)); VitalWireDelay (offsetdelayctrlin_in(4), offsetdelayctrlin(4), tipd_offsetdelayctrlin(4)); VitalWireDelay (offsetdelayctrlin_in(5), offsetdelayctrlin(5), tipd_offsetdelayctrlin(5)); end block; ------------------------ -- Timing Check Section ------------------------ VITALtiming : process (clk_in, offset_in, addnsub_in, offsetctrl_out) variable Tviol_offset_clk : std_ulogic := '0'; variable Tviol_addnsub_clk : std_ulogic := '0'; variable TimingData_offset_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_addnsub_clk : VitalTimingDataType := VitalTimingDataInit; variable offsetctrlout_VitalGlitchDataArray : VitalGlitchDataArrayType(5 downto 0); begin if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_offset_clk, TimingData => TimingData_offset_clk, TestSignal => offset_in, TestSignalName => "OFFSET", RefSignal => clk_in, RefSignalName => "CLK", SetupHigh => tsetup_offset_clk_noedge_posedge(0), SetupLow => tsetup_offset_clk_noedge_posedge(0), HoldHigh => thold_offset_clk_noedge_posedge(0), HoldLow => thold_offset_clk_noedge_posedge(0), RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_OFFSETCTRL", XOn => XOn, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_addnsub_clk, TimingData => TimingData_addnsub_clk, TestSignal => addnsub_in, TestSignalName => "ADDNSUB", RefSignal => clk_in, RefSignalName => "CLK", SetupHigh => tsetup_addnsub_clk_noedge_posedge, SetupLow => tsetup_addnsub_clk_noedge_posedge, HoldHigh => thold_addnsub_clk_noedge_posedge, HoldLow => thold_addnsub_clk_noedge_posedge, RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_OFFSETCTRL", XOn => XOn, MsgOn => MsgOnChecks ); end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => offsetctrlout(0), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(0), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(0), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(0), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => offsetctrlout(1), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(1), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(1), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(1), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => offsetctrlout(2), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(2), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(2), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(2), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => offsetctrlout(3), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(3), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(3), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(3), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => offsetctrlout(4), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(4), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(4), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(4), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => offsetctrlout(5), OutSignalName => "offsetctrlOUT", OutTemp => offsetctrl_out(5), Paths => (0 => (clk_in'last_event, tpd_clk_offsetctrlout_posedge(5), TRUE)), GlitchData => offsetctrlout_VitalGlitchDataArray(5), Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; -- vital timing end vital_piranhaoffset; ------------------------------------------------------------------------------- -- -- Entity Name : arriaii_dqs_enable -- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_dqs_enable IS GENERIC ( lpm_type : string := "arriaii_dqs_enable"; tipd_dqsin : VitalDelayType01 := DefpropDelay01; tipd_dqsenable : VitalDelayType01 := DefpropDelay01; tpd_dqsin_dqsbusout : VitalDelayType01 := DefPropDelay01; tpd_dqsenable_dqsbusout : VitalDelayType01 := DefPropDelay01; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*" ); PORT ( dqsin : IN std_logic := '0'; dqsenable : IN std_logic := '1'; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1'; dqsbusout : OUT std_logic ); END; ARCHITECTURE arriaii_dqs_enable_arch OF arriaii_dqs_enable IS -- component section -- signal section SIGNAL ena_reg : STD_LOGIC := '1'; -- timing output SIGNAL tmp_dqsbusout : std_logic := '0'; -- timing input SIGNAL dqsin_in : std_logic := '0'; SIGNAL dqsenable_in : std_logic := '1'; BEGIN tmp_dqsbusout <= ena_reg AND dqsin_in; PROCESS(tmp_dqsbusout, dqsenable_in) BEGIN IF (dqsenable_in = '1') THEN ena_reg <= '1'; ELSIF (tmp_dqsbusout'event AND tmp_dqsbusout = '0') THEN ena_reg <= '0'; END IF; END PROCESS; -------------------- -- INPUT PATH DELAYS -------------------- WireDelay : block begin VitalWireDelay (dqsin_in, dqsin, tipd_dqsin); VitalWireDelay (dqsenable_in, dqsenable, tipd_dqsenable); end block; -------------------------------------- -- Path Delay Section -------------------------------------- VITAL_path_delays: PROCESS (tmp_dqsbusout) variable dqsbusout_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => dqsbusout, OutSignalName => "dqsbusout", OutTemp => tmp_dqsbusout, Paths => (0 => (dqsin_in'last_event, tpd_dqsin_dqsbusout, TRUE), 1 => (dqsenable_in'last_event, tpd_dqsenable_dqsbusout, TRUE)), GlitchData => dqsbusout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); END PROCESS; -- Path Delays END arriaii_dqs_enable_arch; ------------------------------------------------------------------------------- -- Module Name: arriaii_mac_bit_register -- -- Description: Piranha MAC single bit register -- ------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_mac_bit_register IS GENERIC ( tipd_datain : VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_aclr : VitalDelayType01 := DefPropDelay01; tpd_aclr_dataout_posedge : VitalDelayType01 := DefPropDelay01; tpd_clk_dataout_posedge : VitalDelayType01 := DefPropDelay01; tsetup_datain_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_datain_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks ); PORT ( datain : IN std_logic := '0'; clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic ); END arriaii_mac_bit_register; ARCHITECTURE arch OF arriaii_mac_bit_register IS SIGNAL datain_ipd : std_logic := '0'; SIGNAL clk_ipd : std_logic := '0'; SIGNAL aclr_ipd : std_logic := '0'; SIGNAL sload_ipd : std_logic := '1'; SIGNAL dataout_tmp : std_logic := '0'; SIGNAL dataout_reg : std_logic := '0'; BEGIN WireDelay : block begin VitalWireDelay (datain_ipd, datain, tipd_datain); VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (aclr_ipd, aclr, tipd_aclr); VitalWireDelay (sload_ipd, sload, tipd_sload); end block; PROCESS(clk_ipd, datain_ipd, sload_ipd, aclr_ipd) variable Tviol_datain_clk : std_ulogic := '0'; variable Tviol_sload_clk : std_ulogic := '0'; variable TimingData_datain_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sload_clk : VitalTimingDataType := VitalTimingDataInit; variable q_VitalGlitchData : VitalGlitchDataType; VARIABLE CQDelay : TIME := 0 ns; BEGIN IF (aclr_ipd = '1') THEN dataout_reg <= '0'; ELSIF (clk_ipd'EVENT AND clk_ipd = '1') THEN IF (sload_ipd = '1') THEN dataout_reg <= datain_ipd; ELSE dataout_reg <= dataout_reg; END IF; END IF; VitalSetupHoldCheck ( Violation => Tviol_datain_clk, TimingData => TimingData_datain_clk, TestSignal => datain, TestSignalName => "DATAIN", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_datain_clk_noedge_posedge, SetupLow => tsetup_datain_clk_noedge_posedge, HoldHigh => thold_datain_clk_noedge_posedge, HoldLow => thold_datain_clk_noedge_posedge, CheckEnabled => TO_X01((NOT aclr_ipd) OR (sload_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/MAC Register VitalSetupHoldCheck", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sload_clk, TimingData => TimingData_sload_clk, TestSignal => sload_ipd, TestSignalName => "SLOAD", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sload_clk_noedge_posedge, SetupLow => tsetup_sload_clk_noedge_posedge, HoldHigh => thold_sload_clk_noedge_posedge, HoldLow => thold_sload_clk_noedge_posedge, CheckEnabled => TO_X01((NOT aclr_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/MAC Register VitalSetupHoldCheck", XOn => XOnChecks, MsgOn => MsgOnChecks ); END PROCESS; dataout_tmp <= datain_ipd WHEN bypass_register = '1' ELSE dataout_reg; PROCESS(dataout_tmp) variable dataout_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => dataout, OutSignalName => "dataout", OutTemp => dataout_tmp, Paths => (0 => (clk_ipd'last_event, tpd_clk_dataout_posedge, TRUE), 1 => (aclr_ipd'last_event, tpd_aclr_dataout_posedge, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => TRUE, MsgOn => TRUE ); END PROCESS; END arch; ------------------------------------------------------------------------------- -- Module Name: arriaii_mac_register -- -- Description: Piranha MAC variable width register -- ------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_mac_register IS GENERIC ( data_width : integer := 18; tipd_datain : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_aclr : VitalDelayType01 := DefPropDelay01; tpd_aclr_dataout_posedge : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tpd_clk_dataout_posedge : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tsetup_datain_clk_noedge_posedge : VitalDelayArrayType(71 downto 0) := (OTHERS => DefSetupHoldCnst); thold_datain_clk_noedge_posedge : VitalDelayArrayType(71 downto 0) := (OTHERS => DefSetupHoldCnst); tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks ); PORT ( datain : IN std_logic_vector(data_width - 1 DOWNTO 0) := (others => '0'); clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic_vector(data_width - 1 DOWNTO 0) ); END arriaii_mac_register; ARCHITECTURE arch OF arriaii_mac_register IS SIGNAL datain_ipd : std_logic_vector(data_width -1 downto 0) := (others => '0'); SIGNAL clk_ipd : std_logic := '0'; SIGNAL aclr_ipd : std_logic := '0'; SIGNAL sload_ipd : std_logic := '1'; SIGNAL dataout_tmp : std_logic_vector(data_width - 1 DOWNTO 0) := (others => '0'); SIGNAL dataout_reg : std_logic_vector(data_width - 1 DOWNTO 0) := (others => '0'); BEGIN WireDelay : block begin g1 :for i in datain'range generate VitalWireDelay (datain_ipd(i), datain(i), tipd_datain(i)); end generate; VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (aclr_ipd, aclr, tipd_aclr); VitalWireDelay (sload_ipd, sload, tipd_sload); end block; PROCESS(clk_ipd, datain_ipd, sload_ipd, aclr_ipd) BEGIN IF (aclr_ipd = '1') THEN dataout_reg <= (OTHERS => '0'); ELSIF (clk_ipd'EVENT AND clk_ipd = '1') THEN IF (sload_ipd = '1') THEN dataout_reg <= datain_ipd; ELSE dataout_reg <= dataout_reg; END IF; END IF; END process; sh: block begin g0 : for i in datain'range generate process(datain_ipd(i),clk_ipd,sload_ipd) variable dataout_VitalGlitchDataArray : VitalGlitchDataArrayType(71 downto 0); variable Tviol_sload_clk : std_ulogic := '0'; variable Tviol_datain_clk : std_ulogic := '0'; variable TimingData_datain_clk : VitalTimingDataType := VitalTimingDataInit; variable TimingData_sload_clk : VitalTimingDataType := VitalTimingDataInit; begin VitalSetupHoldCheck ( Violation => Tviol_datain_clk, TimingData => TimingData_datain_clk, TestSignal => datain_ipd(i), TestSignalName => "DATAIN(i)", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_datain_clk_noedge_posedge(i), SetupLow => tsetup_datain_clk_noedge_posedge(i), HoldHigh => thold_datain_clk_noedge_posedge(i), HoldLow => thold_datain_clk_noedge_posedge(i), CheckEnabled => TO_X01((NOT aclr_ipd) OR (sload_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/MAC_REG", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_sload_clk, TimingData => TimingData_sload_clk, TestSignal => sload_ipd, TestSignalName => "SLOAD", RefSignal => clk_ipd, RefSignalName => "CLK", SetupHigh => tsetup_sload_clk_noedge_posedge, SetupLow => tsetup_sload_clk_noedge_posedge, HoldHigh => thold_sload_clk_noedge_posedge, HoldLow => thold_sload_clk_noedge_posedge, CheckEnabled => TO_X01((NOT aclr_ipd)) /= '1', RefTransition => '/', HeaderMsg => "/MAC_REG", XOn => XOnChecks, MsgOn => MsgOnChecks ); END PROCESS; end generate g0; end block; dataout_tmp <= datain_ipd WHEN bypass_register = '1' ELSE dataout_reg; PathDelay : block begin g1 : for i in dataout'range generate PROCESS (dataout_tmp(i)) variable dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_tmp(i), Paths => (0 => (clk_ipd'last_event, tpd_clk_dataout_posedge(i), TRUE), 1 => (aclr_ipd'last_event, tpd_aclr_dataout_posedge(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => TRUE, MsgOn => TRUE ); end process; end generate; end block; END arch; ------------------------------------------------------------------------------- -- Module Name: arriaii_mac_multiplier -- -- Description: Piranha MAC signed multiplier -- ------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_mac_multiplier IS GENERIC ( dataa_width : integer := 18; datab_width : integer := 18; tipd_dataa : VitalDelayArrayType01(17 downto 0) := (OTHERS => DefPropDelay01); tipd_datab : VitalDelayArrayType01(17 downto 0) := (OTHERS => DefPropDelay01); tipd_signa : VitalDelayType01 := DefPropDelay01; tipd_signb : VitalDelayType01 := DefPropDelay01; tpd_dataa_dataout : VitalDelayArrayType01(18*36-1 downto 0) := (others => DefPropDelay01); tpd_datab_dataout : VitalDelayArrayType01(18*36-1 downto 0) := (others => DefPropDelay01); tpd_signa_dataout : VitalDelayArrayType01(35 downto 0) := (others => DefPropDelay01); tpd_signb_dataout : VitalDelayArrayType01(35 downto 0) := (others => DefPropDelay01); XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataout : OUT std_logic_vector(dataa_width + datab_width - 1 DOWNTO 0) ); END arriaii_mac_multiplier; ARCHITECTURE arch OF arriaii_mac_multiplier IS constant dataout_width : integer := dataa_width + datab_width; SIGNAL product : std_logic_vector(dataout_width - 1 DOWNTO 0):= (others => '0'); SIGNAL abs_product : std_logic_vector(dataout_width - 1 DOWNTO 0):= (others => '0'); SIGNAL abs_a : std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '0'); SIGNAL abs_b : std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); SIGNAL dataout_tmp : std_logic_vector(dataout_width - 1 DOWNTO 0):= (others => '0'); SIGNAL product_sign : std_logic := '0'; SIGNAL dataa_sign : std_logic := '0'; SIGNAL datab_sign : std_logic := '0'; SIGNAL dataa_ipd : std_logic_vector(dataa_width -1 DOWNTO 0) := (others => '0'); SIGNAL datab_ipd : std_logic_vector(datab_width -1 DOWNTO 0) := (others => '0'); SIGNAL signa_ipd : std_logic := '0'; SIGNAL signb_ipd : std_logic := '0'; BEGIN WireDelay : block begin g1 :for i in dataa'range generate VitalWireDelay (dataa_ipd(i), dataa(i), tipd_dataa(i)); end generate; g2 :for i in datab'range generate VitalWireDelay (datab_ipd(i), datab(i), tipd_datab(i)); end generate; VitalWireDelay (signa_ipd, signa, tipd_signa); VitalWireDelay (signb_ipd, signb, tipd_signb); end block; dataa_sign <= dataa_ipd(dataa_width - 1) AND signa_ipd ; datab_sign <= datab_ipd(datab_width - 1) AND signb_ipd ; product_sign <= dataa_sign XOR datab_sign ; abs_a <= (NOT dataa_ipd + '1') WHEN dataa_sign = '1' ELSE dataa_ipd; abs_b <= (NOT datab_ipd + '1') WHEN datab_sign = '1' ELSE datab_ipd; abs_product <= abs_a * abs_b ; dataout_tmp <= (NOT abs_product + 1) WHEN product_sign = '1' ELSE abs_product; PathDelay : block begin do : for i in dataout'range generate process(dataout_tmp(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_tmp(i), Paths => (0 => (dataa_ipd'last_event, tpd_dataa_dataout(i), TRUE), 1 => (datab_ipd'last_event, tpd_datab_dataout(i), TRUE), 2 => (signa'last_event, tpd_signa_dataout(i), TRUE), 3 => (signb'last_event, tpd_signb_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do; end block; END arch; ---------------------------------------------------------------------------------- -- Module Name: arriaii_mac_mult_atom -- -- Description: Simulation model for arriaii mac mult atom. -- -- This model instantiates the following components. -- -- 1.arriaii_mac_bit_register. -- -- 2.arriaii_mac_register. -- -- 3.arriaii_mac_multiplier. -- ---------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_mac_mult IS GENERIC ( dataa_width : integer := 18; datab_width : integer := 18; dataa_clock : string := "none"; datab_clock : string := "none"; signa_clock : string := "none"; signb_clock : string := "none"; scanouta_clock : string := "none"; dataa_clear : string := "none"; datab_clear : string := "none"; signa_clear : string := "none"; signb_clear : string := "none"; scanouta_clear : string := "none"; signa_internally_grounded : string := "false"; signb_internally_grounded : string := "false"; lpm_type : string := "arriaii_mac_mult" ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '1'); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '1'); signa : IN std_logic := '1'; signb : IN std_logic := '1'; clk : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); aclr : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); ena : IN std_logic_vector(3 DOWNTO 0) := (others => '1'); dataout : OUT std_logic_vector(dataa_width + datab_width - 1 DOWNTO 0); scanouta : OUT std_logic_vector(dataa_width - 1 DOWNTO 0); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_mac_mult; ARCHITECTURE arch OF arriaii_mac_mult IS constant dataout_width : integer := dataa_width + datab_width; COMPONENT arriaii_mac_bit_register PORT ( datain : IN std_logic := '0'; clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic ); END COMPONENT; COMPONENT arriaii_mac_register GENERIC ( data_width : integer := 18 ); PORT ( datain : IN std_logic_vector(data_width - 1 DOWNTO 0) := (others => '0'); clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic_vector(data_width - 1 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_mac_multiplier GENERIC ( dataa_width : integer := 18; datab_width : integer := 18 ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataout : OUT std_logic_vector(dataa_width + datab_width - 1 DOWNTO 0) ); END COMPONENT; --Internal signals to instantiate the dataa input register unit SIGNAL dataa_clk_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL dataa_aclr_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL dataa_clk : std_logic := '0'; SIGNAL dataa_aclr : std_logic := '0'; SIGNAL dataa_sload : std_logic := '0'; SIGNAL dataa_bypass_register : std_logic := '0'; SIGNAL dataa_in_reg : std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '0'); SIGNAL dataa_in : std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '0'); --Internal signals to instantiate the datab input register unit SIGNAL datab_clk_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL datab_aclr_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL datab_clk : std_logic := '0'; SIGNAL datab_aclr : std_logic := '0'; SIGNAL datab_sload : std_logic := '0'; SIGNAL datab_bypass_register : std_logic := '0'; SIGNAL datab_in_reg : std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); SIGNAL datab_in : std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); --Internal signals to instantiate the signa input register unit SIGNAL signa_clk_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_aclr_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_clk : std_logic := '0'; SIGNAL signa_aclr : std_logic := '0'; SIGNAL signa_sload : std_logic := '0'; SIGNAL signa_bypass_register : std_logic := '0'; SIGNAL signa_in_reg : std_logic := '0'; SIGNAL signa_in : std_logic := '0'; --Internal signbls to instantiate the signb input register unit SIGNAL signb_clk_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_aclr_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_clk : std_logic := '0'; SIGNAL signb_aclr : std_logic := '0'; SIGNAL signb_sload : std_logic := '0'; SIGNAL signb_bypass_register : std_logic := '0'; SIGNAL signb_in_reg : std_logic := '0'; SIGNAL signb_in : std_logic := '0'; --Internal scanoutals to instantiate the scanouta input register unit SIGNAL scanouta_clk_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL scanouta_aclr_value : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL scanouta_clk : std_logic := '0'; SIGNAL scanouta_aclr : std_logic := '0'; SIGNAL scanouta_sload : std_logic := '0'; SIGNAL scanouta_bypass_register : std_logic := '0'; SIGNAL scanouta_tmp : std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '0'); --Internal Signals to instantiate the mac multiplier SIGNAL signa_mult : std_logic := '0'; SIGNAL signb_mult : std_logic := '0'; SIGNAL dataout_tmp : std_logic_vector(dataout_width - 1 DOWNTO 0):= (others => '0'); BEGIN --Instantiate the dataa input Register dataa_clk_value <= "0000" WHEN ((dataa_clock = "0") or (dataa_clock = "none")) ELSE "0001" WHEN (dataa_clock = "1") ELSE "0010" WHEN (dataa_clock = "2") ELSE "0011" WHEN (dataa_clock = "3") ELSE "0000" ; dataa_aclr_value <= "0000" WHEN ((dataa_clear = "0") or (dataa_clear = "none")) ELSE "0001" WHEN (dataa_clear = "1") ELSE "0010" WHEN (dataa_clear = "2") ELSE "0011" WHEN (dataa_clear = "3") ELSE "0000" ; dataa_clk <= '1' WHEN clk(conv_integer(dataa_clk_value)) = '1' ELSE '0'; dataa_aclr <= '1' WHEN (aclr(conv_integer(dataa_aclr_value)) OR (NOT devclrn) OR (NOT devpor)) = '1' ELSE '0'; dataa_sload <= '1' WHEN ena(conv_integer(dataa_clk_value)) = '1' ELSE '0'; dataa_bypass_register <= '1' WHEN (dataa_clock = "none") ELSE '0'; dataa_in <= dataa; dataa_input_register : arriaii_mac_register GENERIC MAP ( data_width => dataa_width ) PORT MAP ( datain => dataa_in, clk => dataa_clk, aclr => dataa_aclr, sload => dataa_sload, bypass_register => dataa_bypass_register, dataout => dataa_in_reg ); --Instantiate the datab input Register datab_clk_value <= "0000" WHEN ((datab_clock = "0") or (datab_clock = "none")) ELSE "0001" WHEN (datab_clock = "1") ELSE "0010" WHEN (datab_clock = "2") ELSE "0011" WHEN (datab_clock = "3") ELSE "0000" ; datab_aclr_value <= "0000" WHEN ((datab_clear = "0") or (datab_clear = "none")) ELSE "0001" WHEN (datab_clear = "1") ELSE "0010" WHEN (datab_clear = "2") ELSE "0011" WHEN (datab_clear = "3") ELSE "0000" ; datab_clk <= '1' WHEN clk(conv_integer(datab_clk_value)) = '1' ELSE '0'; datab_aclr <= '1' WHEN (aclr(conv_integer(datab_aclr_value)) OR (NOT devclrn) OR (NOT devpor)) = '1' ELSE '0'; datab_sload <= '1' WHEN ena(conv_integer(datab_clk_value)) = '1' ELSE '0'; datab_bypass_register <= '1' WHEN (datab_clock = "none") ELSE '0'; datab_in <= datab; datab_input_register : arriaii_mac_register GENERIC MAP ( data_width => datab_width ) PORT MAP ( datain => datab_in, clk => datab_clk, aclr => datab_aclr, sload => datab_sload, bypass_register => datab_bypass_register, dataout => datab_in_reg ); --Instantiate the signa input Register signa_clk_value <= "0000" WHEN ((signa_clock = "0") or (signa_clock = "none")) ELSE "0001" WHEN (signa_clock = "1") ELSE "0010" WHEN (signa_clock = "2") ELSE "0011" WHEN (signa_clock = "3") ELSE "0000" ; signa_aclr_value <= "0000" WHEN ((signa_clear = "0") or (signa_clear = "none")) ELSE "0001" WHEN (signa_clear = "1") ELSE "0010" WHEN (signa_clear = "2") ELSE "0011" WHEN (signa_clear = "3") ELSE "0000" ; signa_clk <= '1' WHEN clk(conv_integer(signa_clk_value)) = '1' ELSE '0'; signa_aclr <= '1' WHEN (aclr(conv_integer(signa_aclr_value)) OR (NOT devclrn) OR (NOT devpor)) = '1' ELSE '0'; signa_sload <= '1' WHEN ena(conv_integer(signa_clk_value)) = '1' ELSE '0'; signa_bypass_register <= '1' WHEN (signa_clock = "none") ELSE '0'; signa_in <= signa; signa_input_register : arriaii_mac_bit_register PORT MAP ( datain => signa_in, clk => signa_clk, aclr => signa_aclr, sload => signa_sload, bypass_register => signa_bypass_register, dataout => signa_in_reg ); --Instantiate the signb input Register signb_clk_value <= "0000" WHEN ((signb_clock = "0") or (signb_clock = "none")) ELSE "0001" WHEN (signb_clock = "1") ELSE "0010" WHEN (signb_clock = "2") ELSE "0011" WHEN (signb_clock = "3") ELSE "0000" ; signb_aclr_value <= "0000" WHEN ((signb_clear = "0") or (signb_clear = "none")) ELSE "0001" WHEN (signb_clear = "1") ELSE "0010" WHEN (signb_clear = "2") ELSE "0011" WHEN (signb_clear = "3") ELSE "0000" ; signb_clk <= '1' WHEN clk(conv_integer(signb_clk_value)) = '1' ELSE '0'; signb_aclr <= '1' WHEN (aclr(conv_integer(signb_aclr_value)) OR (NOT devclrn) OR (NOT devpor)) = '1' ELSE '0'; signb_sload <= '1' WHEN ena(conv_integer(signb_clk_value)) = '1' ELSE '0'; signb_bypass_register <= '1' WHEN (signb_clock = "none") ELSE '0'; signb_in <= signb; signb_input_register : arriaii_mac_bit_register PORT MAP ( datain => signb_in, clk => signb_clk, aclr => signb_aclr, sload => signb_sload, bypass_register => signb_bypass_register, dataout => signb_in_reg ); --Instantiate the scanouta input Register scanouta_clk_value <= "0000" WHEN ((scanouta_clock = "0") or (scanouta_clock = "none")) ELSE "0001" WHEN (scanouta_clock = "1") ELSE "0010" WHEN (scanouta_clock = "2") ELSE "0011" WHEN (scanouta_clock = "3") ELSE "0000" ; scanouta_aclr_value <= "0000" WHEN ((scanouta_clear = "0") or (scanouta_clear = "none")) ELSE "0001" WHEN (scanouta_clear = "1") ELSE "0010" WHEN (scanouta_clear = "2") ELSE "0011" WHEN (scanouta_clear = "3") ELSE "0000" ; scanouta_clk <= '1' WHEN clk(conv_integer(scanouta_clk_value)) = '1' ELSE '0'; scanouta_aclr <= '1' WHEN (aclr(conv_integer(scanouta_aclr_value)) OR (NOT devclrn) OR (NOT devpor)) = '1' ELSE '0'; scanouta_sload <= '1' WHEN ena(conv_integer(scanouta_clk_value)) = '1' ELSE '0'; scanouta_bypass_register <= '1' WHEN (scanouta_clock = "none") ELSE '0'; scanouta_input_register : arriaii_mac_register GENERIC MAP ( data_width => dataa_width ) PORT MAP ( datain => dataa_in_reg, clk => scanouta_clk, aclr => scanouta_aclr, sload => scanouta_sload, bypass_register => scanouta_bypass_register, dataout => scanouta ); --Instantiate mac_multiplier block signa_mult <= '0' WHEN (signa_internally_grounded = "true") ELSE signa_in_reg; signb_mult <= '0' WHEN (signb_internally_grounded = "true") ELSE signb_in_reg; mac_multiplier : arriaii_mac_multiplier GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width ) PORT MAP ( dataa => dataa_in_reg, datab => datab_in_reg, signa => signa_mult, signb => signb_mult, dataout => dataout ); END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_fsa_isse -- -- Description: Piranha first stage adder input selection and sign extension block. -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_fsa_isse IS GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; datac_width : integer := 36; datad_width : integer := 36; chainin_width : integer := 44; multa_signa_internally_grounded : string := "false"; multa_signb_internally_grounded : string := "false"; multb_signa_internally_grounded : string := "false"; multb_signb_internally_grounded : string := "false"; multc_signa_internally_grounded : string := "false"; multc_signb_internally_grounded : string := "false"; multd_signa_internally_grounded : string := "false"; multd_signb_internally_grounded : string := "false"; operation_mode : string := "output_only" ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0); datac : IN std_logic_vector(datac_width - 1 DOWNTO 0); datad : IN std_logic_vector(datad_width - 1 DOWNTO 0); chainin : IN std_logic_vector(chainin_width - 1 DOWNTO 0); signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataa_out : OUT std_logic_vector(71 DOWNTO 0); datab_out : OUT std_logic_vector(71 DOWNTO 0); datac_out : OUT std_logic_vector(71 DOWNTO 0); datad_out : OUT std_logic_vector(71 DOWNTO 0); chainin_out : OUT std_logic_vector(71 DOWNTO 0); operation : OUT std_logic_vector(3 DOWNTO 0) ); END arriaii_fsa_isse; ARCHITECTURE arch OF arriaii_fsa_isse IS signal dataa_out_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); signal datab_out_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); signal datac_out_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); signal datad_out_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); signal chainin_out_tmp: std_logic_vector(71 DOWNTO 0) := (others => '0'); signal sign :std_logic := '0'; BEGIN operation <= "0000" WHEN (operation_mode = "output_only") ELSE "0001" WHEN (operation_mode = "one_level_adder") ELSE "0010" WHEN (operation_mode = "loopback") ELSE "0011" WHEN (operation_mode = "accumulator") ELSE "0100" WHEN (operation_mode = "accumulator_chain_out") ELSE "0101" WHEN (operation_mode = "two_level_adder") ELSE "0110" WHEN (operation_mode = "two_level_adder_chain_out") ELSE "0111" WHEN (operation_mode = "36_bit_multiply") ELSE "1000" WHEN (operation_mode = "shift") ELSE "1001" WHEN (operation_mode = "double") ELSE "0000"; sign <= signa or signb; PROCESS( dataa,datab,datac,datad,chainin,signa,signb) variable active_signb : std_logic := '0'; variable active_signc : std_logic := '0'; variable active_signd : std_logic := '0'; variable read_new_param : std_logic := '0'; variable datab_out_tim_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable datac_out_tim_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable datad_out_tim_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable datab_out_fun_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable datac_out_fun_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable datad_out_fun_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); BEGIN IF ( multa_signa_internally_grounded = "false" AND multa_signb_internally_grounded = "false" AND multb_signa_internally_grounded = "false" AND multb_signb_internally_grounded = "false" AND multc_signa_internally_grounded = "false" AND multc_signb_internally_grounded = "false" AND multd_signa_internally_grounded = "false" AND multd_signb_internally_grounded = "false") THEN read_new_param := '0' ; ELSE read_new_param := '1' ; END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift") or (operation_mode = "double")) THEN if (multb_signb_internally_grounded = "false" AND multb_signa_internally_grounded = "true") then active_signb := signb; elsif(multb_signb_internally_grounded = "true" AND multb_signa_internally_grounded = "false" ) then active_signb := signa; elsif(multb_signb_internally_grounded = "false" AND multb_signa_internally_grounded = "false") then active_signb := sign; else active_signb := '0'; end if; ELSE active_signb := sign; END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift") or (operation_mode = "double")) THEN if (multc_signb_internally_grounded = "false" AND multc_signa_internally_grounded = "true") then active_signc := signb; elsif(multc_signb_internally_grounded = "true" AND multc_signa_internally_grounded = "false" ) then active_signc := signa; elsif(multc_signb_internally_grounded = "false" AND multc_signa_internally_grounded = "false") then active_signc := sign; else active_signc := '0'; end if; ELSE active_signc := sign; END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift") or (operation_mode = "double")) THEN if (multd_signb_internally_grounded = "false" AND multd_signa_internally_grounded = "true") then active_signd := signb; elsif(multd_signb_internally_grounded = "true" AND multd_signa_internally_grounded = "false" ) then active_signd := signa; elsif(multd_signb_internally_grounded = "false" AND multd_signa_internally_grounded = "false") then active_signd := sign; else active_signd := '0'; end if; ELSE active_signd := sign; END IF; IF (dataa(dataa_width - 1) = '1' AND sign = '1') THEN dataa_out_tmp <= sxt(dataa(dataa_width - 1 DOWNTO 0), 72); ELSE dataa_out_tmp <= ext(dataa(dataa_width - 1 DOWNTO 0), 72); END IF; IF (datab(datab_width - 1) = '1' AND active_signb = '1') THEN datab_out_tim_tmp := sxt(datab(datab_width - 1 DOWNTO 0), 72); ELSE datab_out_tim_tmp := ext(datab(datab_width - 1 DOWNTO 0), 72); END IF; IF (datac(datac_width - 1) = '1' AND active_signc = '1') THEN datac_out_tim_tmp := sxt(datac(datac_width - 1 DOWNTO 0), 72); ELSE datac_out_tim_tmp := ext(datac(datac_width - 1 DOWNTO 0), 72); END IF; IF (datad(datad_width - 1) = '1' AND active_signd = '1') THEN datad_out_tim_tmp := sxt(datad(datad_width - 1 DOWNTO 0), 72); ELSE datad_out_tim_tmp := ext(datad(datad_width - 1 DOWNTO 0), 72); END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift")) THEN IF(datab(datab_width - 1) = '1' AND signb = '1') THEN datab_out_fun_tmp := sxt(datab(datab_width - 1 DOWNTO 0), 72); ELSE datab_out_fun_tmp := ext(datab(datab_width - 1 DOWNTO 0), 72); END IF; ELSIF(operation_mode = "double") THEN IF(datab(datab_width - 1) = '1' AND signa = '1') THEN datab_out_fun_tmp := sxt(datab(datab_width - 1 DOWNTO 0), 72); ELSE datab_out_fun_tmp := ext(datab(datab_width - 1 DOWNTO 0), 72); END IF; ELSE IF (datab(datab_width - 1) = '1' AND sign = '1') THEN datab_out_fun_tmp := sxt(datab(datab_width - 1 DOWNTO 0), 72); ELSE datab_out_fun_tmp := ext(datab(datab_width - 1 DOWNTO 0), 72); END IF; END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift")) THEN IF (datac(datac_width - 1) = '1' AND signa = '1') THEN datac_out_fun_tmp := sxt(datac(datac_width - 1 DOWNTO 0), 72); ELSE datac_out_fun_tmp := ext(datac(datac_width - 1 DOWNTO 0), 72); END IF; ELSE IF (datac(datac_width - 1) = '1' AND sign = '1') THEN datac_out_fun_tmp := sxt(datac(datac_width - 1 DOWNTO 0), 72); ELSE datac_out_fun_tmp := ext(datac(datac_width - 1 DOWNTO 0), 72); END IF; END IF; IF ((operation_mode = "36_bit_multiply") or (operation_mode = "shift")) THEN datad_out_fun_tmp := ext(datad(datad_width - 1 DOWNTO 0), 72); ELSIF(operation_mode = "double")THEN IF (datad(datad_width - 1) = '1' AND signa = '1') THEN datad_out_fun_tmp := sxt(datad(datad_width - 1 DOWNTO 0), 72); ELSE datad_out_fun_tmp := ext(datad(datad_width - 1 DOWNTO 0), 72); END IF; ELSE IF (datad(datad_width - 1) = '1' AND sign = '1') THEN datad_out_fun_tmp := sxt(datad(datad_width - 1 DOWNTO 0), 72); ELSE datad_out_fun_tmp := ext(datad(datad_width - 1 DOWNTO 0), 72); END IF; END IF; IF (chainin(chainin_width - 1) = '1') THEN chainin_out_tmp <= sxt(chainin(chainin_width - 1 DOWNTO 0), 72); ELSE chainin_out_tmp <= ext(chainin(chainin_width - 1 DOWNTO 0), 72); END IF; IF(read_new_param = '1') THEN datab_out_tmp <= datab_out_tim_tmp; datac_out_tmp <= datac_out_tim_tmp; datad_out_tmp <= datad_out_tim_tmp; ELSE datab_out_tmp <= datab_out_fun_tmp; datac_out_tmp <= datac_out_fun_tmp; datad_out_tmp <= datad_out_fun_tmp; END IF; END process; dataa_out <= dataa_out_tmp; datab_out <= datab_out_tmp; datac_out <= datac_out_tmp; datad_out <= datad_out_tmp; chainin_out <= chainin_out_tmp; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_first_stage_add_sub -- -- Description: Piranha First Stage Adder Subtractor Unit -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_first_stage_add_sub IS GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; fsa_mode : string := "add"; tipd_dataa : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_datab : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_sign : VitalDelayType01 :=DefPropDelay01; tpd_dataa_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_datab_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_sign_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); sign : IN std_logic := '0'; operation : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) ); END arriaii_first_stage_add_sub; ARCHITECTURE arch OF arriaii_first_stage_add_sub IS SIGNAL dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL abs_b : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL abs_a : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL sign_a : std_logic := '0'; SIGNAL sign_b : std_logic := '0'; SIGNAL dataa_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datab_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL sign_ipd : std_logic := '0'; BEGIN WireDelay : block begin g1 :for i in dataa'range generate VitalWireDelay (dataa_ipd(i), dataa(i), tipd_dataa(i)); end generate; g2 :for i in datab'range generate VitalWireDelay (datab_ipd(i), datab(i), tipd_datab(i)); end generate; VitalWireDelay (sign_ipd, sign, tipd_sign); end block; PROCESS BEGIN WAIT UNTIL dataa_ipd'EVENT OR datab_ipd'EVENT OR sign_ipd'EVENT OR operation'EVENT; IF ((operation = "0111") OR (operation = "1000")or (operation = "1001")) THEN --36 std_logic multiply, shift and add dataout_tmp <= dataa_ipd(53 DOWNTO 36) & dataa_ipd(35 DOWNTO 0) & "000000000000000000" + datab_ipd; ELSE IF(fsa_mode = "add")THEN IF (sign_ipd = '1') THEN dataout_tmp <= signed(dataa_ipd) + signed(datab_ipd); ELSE dataout_tmp <= unsigned(dataa_ipd) + unsigned(datab_ipd); END IF; ELSE IF (sign_ipd = '1') THEN dataout_tmp <= signed(dataa_ipd) - signed(datab_ipd); ELSE dataout_tmp <= unsigned(dataa_ipd) - unsigned(datab_ipd); END IF; END IF; END IF; END process ; PathDelay : block begin do1 : for i in dataout'range generate process(dataout_tmp(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_tmp(i), Paths => (0 => (dataa_ipd'last_event, tpd_dataa_dataout(i), TRUE), 1 => (datab_ipd'last_event, tpd_datab_dataout(i), TRUE), 2 => (sign'last_event, tpd_sign_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do1; end block; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_second_stage_add_accum -- -- Description: Piranha Second stage Adder and Accumulator/Decimator Unit -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_second_stage_add_accum IS GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; ssa_mode : string := "add"; tipd_dataa : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_datab : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_accumin : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_sign : VitalDelayType01 :=DefPropDelay01; tpd_dataa_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_datab_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_accumin_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_sign_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_dataa_overflow : VitalDelayType01 := DefPropDelay01; tpd_datab_overflow : VitalDelayType01 := DefPropDelay01; tpd_accumin_overflow : VitalDelayType01 := DefPropDelay01; tpd_sign_overflow : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); accumin : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); sign : IN std_logic := '0'; operation : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); overflow : OUT std_logic ); END arriaii_second_stage_add_accum; ARCHITECTURE arch OF arriaii_second_stage_add_accum IS constant accum_width : integer := dataa_width + 7; SIGNAL dataout_temp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL dataa_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datab_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL accum_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL overflow_tmp : std_logic := '0'; SIGNAL dataa_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datab_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL accumin_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL sign_ipd : std_logic := '0'; SIGNAL signb_ipd : std_logic := '0'; BEGIN WireDelay : block begin g1 :for i in dataa'range generate VitalWireDelay (dataa_ipd(i), dataa(i), tipd_dataa(i)); end generate; g2 :for i in datab'range generate VitalWireDelay (datab_ipd(i), datab(i), tipd_datab(i)); end generate; g3 :for i in accumin'range generate VitalWireDelay (accumin_ipd(i), accumin(i), tipd_accumin(i)); end generate; VitalWireDelay (sign_ipd, sign, tipd_sign); end block; PROCESS Variable dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); BEGIN WAIT UNTIL dataa_ipd'EVENT OR datab_ipd'EVENT OR sign_ipd'EVENT OR accumin_ipd'EVENT OR operation'EVENT; IF (operation = "0011" OR operation = "0100") THEN --Accumultor or Accumulator chainout IF(ssa_mode = "add")THEN IF (sign_ipd = '1') THEN dataout_tmp := signed(sxt(accumin_ipd(accum_width-1 downto 0),72)) + signed(sxt(dataa_ipd(accum_width-1 downto 0),72)) + signed(sxt(datab_ipd(accum_width-1 downto 0),72)); ELSE dataout_tmp := unsigned(ext(accumin_ipd(accum_width-1 downto 0),72)) + unsigned(ext(dataa_ipd(accum_width-1 downto 0),72)) + unsigned(ext(datab_ipd(accum_width-1 downto 0),72)); END IF; ELSE IF (sign_ipd = '1') THEN dataout_tmp := signed(accumin_ipd) - signed(dataa_ipd)- signed(datab_ipd); ELSE dataout_tmp := unsigned(accumin_ipd) - unsigned(dataa_ipd)- unsigned(datab_ipd); END IF; END IF; IF(sign_ipd = '1')THEN overflow_tmp <= dataout_tmp(accum_width) xor dataout_tmp(accum_width -1); ELSE IF(ssa_mode = "add")THEN overflow_tmp <= dataout_tmp(accum_width); ELSE overflow_tmp <= 'X'; END IF; END IF; ELSIF (operation = "0101" OR operation = "0110") THEN -- two level adder or two level with chainout overflow_tmp <= '0'; IF (sign_ipd = '1') THEN dataout_tmp := signed(dataa_ipd) + signed(datab_ipd); ELSE dataout_tmp := unsigned(dataa_ipd) + unsigned(datab_ipd); END IF; ELSIF ((operation = "0111") OR (operation = "1000")) THEN --36 std_logic multiply; shift and add dataout_tmp(71 DOWNTO 0) := dataa_ipd(53 DOWNTO 0) & "000000000000000000" + datab_ipd; overflow_tmp <= '0'; ELSIF ((operation = "1001")) THEN --double mode dataout_tmp(71 DOWNTO 0) := dataa_ipd + datab_ipd; overflow_tmp <= '0'; END IF; dataout_temp <= dataout_tmp; END PROCESS; PathDelay : block begin do1 : for i in dataout'range generate process(dataout_temp(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_temp(i), Paths => (0 => (dataa_ipd'last_event, tpd_dataa_dataout(i), TRUE), 1 => (datab_ipd'last_event, tpd_datab_dataout(i), TRUE), 2 => (accumin_ipd'last_event, tpd_accumin_dataout(i), TRUE), 3 => (sign'last_event, tpd_sign_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do1; process(overflow_tmp) VARIABLE overflow_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => overflow, OutSignalName => "overflow", OutTemp => overflow_tmp, paths => (0 => (dataa_ipd'last_event, tpd_dataa_overflow, TRUE), 1 => (datab_ipd'last_event, tpd_datab_overflow, TRUE), 2 => (accumin_ipd'last_event, tpd_accumin_overflow, TRUE), 3 => (sign'last_event, tpd_sign_overflow, TRUE)), GlitchData => overflow_VitalGlitchData, Mode => DefGlitchMode, XOn => TRUE, MsgOn => TRUE ); end process; end block; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_round_block -- -- Description: Piranha round block -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_round_block IS GENERIC ( round_mode : string := "nearest_integer"; round_width : integer := 15; operation_mode : string := "output_only" ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); round : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0):= (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) ); END arriaii_round_block; ARCHITECTURE arch OF arriaii_round_block IS signal out_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); BEGIN dataout <= out_tmp ; PROCESS(datain,round,datain_width) variable i : integer ; variable j : integer ; variable sign : std_logic ; variable result_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); variable dataout_value : std_logic_vector(71 DOWNTO 0) := (others => '0'); BEGIN if(round = '0')then dataout_value := datain; else dataout_value := datain; j := 0; sign := '0'; IF( conv_integer(datain_width) > round_width) THEN for i in ((conv_integer(datain_width)) - round_width) to (conv_integer(datain_width) -1) loop result_tmp(j) := datain(i); j := j + 1; END LOOP; for i in 0 to (conv_integer(datain_width) - round_width -2) loop sign := sign or datain(i); dataout_value(i) := 'X'; END LOOP; dataout_value((conv_integer(datain_width)) - round_width -1) := 'X'; IF (datain(conv_integer(datain_width) - round_width -1) = '0') THEN -- fractional < 0.5 dataout_tmp := result_tmp; ELSE IF ((datain(conv_integer(datain_width) - round_width -1) = '1') AND (sign = '1')) THEN --fractional > 0.5 dataout_tmp := result_tmp + '1'; ELSE IF (round_mode = "nearest_even") THEN --unbiased rounding IF(result_tmp(0) = '1') THEN --check for odd integer dataout_tmp := result_tmp + '1' ; ELSE dataout_tmp := result_tmp; END IF; ELSE --biased rounding dataout_tmp := result_tmp + '1'; END IF; END IF; END IF; j := conv_integer(datain_width) - round_width; FOR i IN 0 to (round_width -1)LOOP dataout_value(j) := dataout_tmp(i); j := j + 1; END LOOP; ELSE dataout_value := datain; END IF; end if; out_tmp <= dataout_value; END PROCESS; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_saturate_block -- -- Description: Piranha saturation block -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_saturate_block IS GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; saturate_width : integer := 15; round_width : integer := 15; saturate_mode : string := " asymmetric"; operation_mode : string := "output_only" ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); saturate : IN std_logic := '0'; round : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0):= (others => '0'); saturation_overflow : OUT std_logic ); END arriaii_saturate_block; ARCHITECTURE arch OF arriaii_saturate_block IS constant accum_width : integer := dataa_width + 8; SIGNAL saturation_overflow_tmp : std_logic := '0'; signal msb : std_logic := '0'; signal sign : std_logic := '0'; signal min : std_logic_vector(71 downto 0):=(others => '1'); signal max : std_logic_vector(71 downto 0):=(others => '0'); signal dataout_tmp : std_logic_vector(71 DOWNTO 0):= (others => '0'); SIGNAL i : integer; BEGIN sign <= signa OR signb ; msb <= datain(accum_width) when ((operation_mode = "accumulator") or (operation_mode = "accumulator_chain_out") or(operation_mode = "two_level_adder_chain_out")) ELSE datain(dataa_width +1) when(operation_mode = "two_level_adder") ELSE datain(dataa_width) when((operation_mode = "one_level_adder")or (operation_mode = "loopback")) ELSE datain(dataa_width -1); dataout <= dataout_tmp ; saturation_overflow <= saturation_overflow_tmp ; PROCESS(datain,datain_width,round,saturate,sign,msb) variable saturation_temp : std_logic := '0'; variable sign_tmp : std_logic := '1'; variable data_tmp : std_logic := '0'; BEGIN IF (saturate = '0') THEN dataout_tmp <= datain; saturation_overflow_tmp <= '0'; ELSE saturation_temp := '0'; data_tmp := '0'; sign_tmp := '1'; IF (round = '1') THEN for i in 0 to (conv_integer(datain_width) - round_width -1) LOOP min(i) <= 'X'; max(i) <= 'X'; END LOOP; END IF; IF (saturate_mode = "symmetric") THEN for i in 0 to (conv_integer(datain_width) - round_width -1) LOOP IF (round = '1') THEN max(i) <= 'X'; min(i) <= 'X'; ELSE max(i) <= '1'; min(i) <= '0'; END IF; END LOOP; for i in (conv_integer(datain_width) - round_width) to (conv_integer(datain_width) - saturate_width -1) LOOP data_tmp := data_tmp or datain(i); max(i) <= '1'; min(i) <= '0'; END LOOP; IF (round = '1') THEN min(conv_integer(datain_width) - round_width) <= '1'; ELSE min(0) <= '1'; END IF; END IF; IF (saturate_mode = "asymmetric") THEN for i in 0 to (conv_integer(datain_width) - saturate_width -1) LOOP max(i) <= '1'; min(i) <= '0'; END LOOP; END IF; if((saturate_width = 1))then IF (msb /= datain(conv_integer(datain_width)-1)) THEN saturation_temp := '1'; ELSE sign_tmp := sign_tmp and datain(conv_integer(datain_width)-1); END IF; else for i in (conv_integer(datain_width) - saturate_width) to (conv_integer(datain_width)-1) LOOP sign_tmp := sign_tmp and datain(i); IF (datain(conv_integer(datain_width)-1) /= datain(i)) THEN saturation_temp := '1'; end if; END LOOP; end if; -- Trigger the saturation overflow for data=-2^n in case of symmetric saturation. if((sign_tmp ='1') and (data_tmp = '0') and (saturate_mode = "symmetric")) then saturation_temp := '1'; end if; saturation_overflow_tmp <= saturation_temp; IF (saturation_temp = '1') THEN IF ((operation_mode = "output_only")or (operation_mode = "accumulator_chain_out") or(operation_mode = "two_level_adder_chain_out")) THEN IF (msb = '1') THEN dataout_tmp <= min; ELSE dataout_tmp <= max; END IF; ELSE IF (sign = '1') THEN IF (msb = '1') THEN dataout_tmp <= min; ELSE dataout_tmp <= max; END IF; ELSE dataout_tmp <= (others => 'X'); END IF; END IF; ELSE dataout_tmp <= datain; END IF; END IF; END PROCESS; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_round_saturate_block -- -- Description: Piranha round and saturation Unit. -- -- This unit instantiated the following components. -- -- 1.arriaii_round_block. -- -- 2.arriaii_saturate_block. -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_round_saturate_block IS GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; saturate_width : integer := 15; round_width : integer := 15; saturate_mode : string := " asymmetric"; round_mode : string := "nearest_integer"; operation_mode : string := "output_only" ; tipd_datain : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_round : VitalDelayType01 :=DefPropDelay01; tipd_saturate : VitalDelayType01 :=DefPropDelay01; tipd_signa : VitalDelayType01 :=DefPropDelay01; tipd_signb : VitalDelayType01 :=DefPropDelay01; tpd_datain_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_round_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_saturate_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_signa_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_signb_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_datain_saturationoverflow : VitalDelayType01 := DefPropDelay01; tpd_round_saturationoverflow : VitalDelayType01 := DefPropDelay01; tpd_saturate_saturationoverflow : VitalDelayType01 := DefPropDelay01; tpd_signa_saturationoverflow : VitalDelayType01 := DefPropDelay01; tpd_signb_saturationoverflow : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); round : IN std_logic := '0'; saturate : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); saturationoverflow : OUT std_logic ); END arriaii_round_saturate_block; ARCHITECTURE arch OF arriaii_round_saturate_block IS COMPONENT arriaii_round_block GENERIC ( round_mode : string := "nearest_integer"; round_width : integer := 15; operation_mode : string := "output_only" ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); round : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_saturate_block GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; saturate_mode : string := " asymmetric"; saturate_width : integer := 15; round_width : integer := 15; operation_mode : string := "output_only" ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); saturate : IN std_logic := '0'; round : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); saturation_overflow : OUT std_logic ); END COMPONENT; SIGNAL dataout_round : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL saturate_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL dataout_saturate : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datain_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL signa_ipd : std_logic := '0'; SIGNAL signb_ipd : std_logic := '0'; SIGNAL round_ipd : std_logic := '0'; SIGNAL saturate_ipd : std_logic := '0'; SIGNAL saturationoverflow_tmp : std_logic := '0'; BEGIN WireDelay : block begin g1 :for i in datain'range generate VitalWireDelay (datain_ipd(i), datain(i), tipd_datain(i)); end generate; VitalWireDelay (signa_ipd, signa, tipd_signa); VitalWireDelay (signb_ipd, signb, tipd_signb); VitalWireDelay (round_ipd, round, tipd_round); VitalWireDelay (saturate_ipd, saturate, tipd_saturate); end block; round_unit : arriaii_round_block GENERIC MAP ( operation_mode => operation_mode, round_width => round_width, round_mode => round_mode ) PORT MAP ( datain => datain_ipd, round => round_ipd, datain_width => datain_width, dataout => dataout_round ); saturate_unit : arriaii_saturate_block GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width, operation_mode => operation_mode, saturate_mode => saturate_mode, saturate_width =>saturate_width, round_width =>round_width ) PORT MAP ( datain => dataout_round, saturate => saturate_ipd, round => round_ipd, signa => signa_ipd, signb => signb_ipd, datain_width => datain_width, dataout => dataout_saturate, saturation_overflow => saturationoverflow_tmp ); PathDelay : block begin do1 : for i in dataout'range generate process(dataout_saturate(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_saturate(i), Paths => (0 => (datain_ipd'last_event, tpd_datain_dataout(i), TRUE), 1 => (round_ipd'last_event, tpd_round_dataout(i), TRUE), 2 => (saturate_ipd'last_event, tpd_saturate_dataout(i), TRUE), 3 => (signa'last_event, tpd_signa_dataout(i), TRUE), 4 => (signb'last_event, tpd_signb_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do1; process(saturationoverflow_tmp) VARIABLE saturationoverflow_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => saturationoverflow, OutSignalName => "saturationoverflow", OutTemp => saturationoverflow_tmp, Paths => (0 => (datain_ipd'last_event, tpd_datain_saturationoverflow, TRUE), 1 => (round_ipd'last_event, tpd_round_saturationoverflow, TRUE), 2 => (saturate_ipd'last_event, tpd_saturate_saturationoverflow, TRUE), 3 => (signa'last_event, tpd_signa_saturationoverflow, TRUE), 4 => (signb'last_event, tpd_signb_saturationoverflow, TRUE)), GlitchData => saturationoverflow_VitalGlitchData, Mode => DefGlitchMode, XOn => TRUE, MsgOn => TRUE ); end process; end block; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_rotate_shift_block -- -- Description: Piranha roate and shift Unit. -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.numeric_std.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_rotate_shift_block IS GENERIC ( dataa_width : integer := 32; datab_width : integer := 32; tipd_datain : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_rotate : VitalDelayType01 :=DefPropDelay01; tipd_shiftright : VitalDelayType01 :=DefPropDelay01; tipd_signa : VitalDelayType01 :=DefPropDelay01; tipd_signb : VitalDelayType01 :=DefPropDelay01; tpd_datain_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_rotate_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_shiftright_dataout: VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); tpd_signa_dataout : VitalDelayArrayType01(71 downto 0) := (others => DefPropDelay01); XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); rotate : IN std_logic := '0'; shiftright : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataout : OUT std_logic_vector(71 DOWNTO 0) ); END arriaii_rotate_shift_block; ARCHITECTURE arch OF arriaii_rotate_shift_block IS signal dataout_tmp : std_logic_vector(71 downto 0) := (others => '0'); SIGNAL datain_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL signa_ipd : std_logic := '0'; SIGNAL signb_ipd : std_logic := '0'; SIGNAL rotate_ipd : std_logic := '0'; SIGNAL shiftright_ipd : std_logic := '0'; SIGNAL sign : std_logic; BEGIN WireDelay : block begin g1 :for i in datain'range generate VitalWireDelay (datain_ipd(i), datain(i), tipd_datain(i)); end generate; VitalWireDelay (signa_ipd, signa, tipd_signa); VitalWireDelay (signb_ipd, signa, tipd_signa); VitalWireDelay (rotate_ipd, rotate, tipd_rotate); VitalWireDelay (shiftright_ipd, shiftright, tipd_shiftright); end block; PROCESS BEGIN WAIT UNTIL datain_ipd'EVENT OR rotate_ipd'EVENT OR shiftright_ipd'EVENT; sign <= signa_ipd xor signb_ipd; dataout_tmp <= datain; IF ((rotate_ipd = '0') AND (shiftright_ipd = '0')) THEN dataout_tmp(39 downto 8) <= datain_ipd(39 downto 8); ELSIF ((rotate_ipd = '0') AND (shiftright_ipd = '1')) THEN --shift right dataout_tmp(39 downto 8) <= datain_ipd(71 downto 40); ELSIF((rotate_ipd = '1') AND (shiftright_ipd = '0')) THEN dataout_tmp(39 downto 8) <= datain_ipd(39 downto 8) OR datain_ipd(71 downto 40); ELSE dataout_tmp <= datain_ipd; END IF; END PROCESS; PathDelay : block begin do1 : for i in dataout'range generate process(dataout_tmp(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_tmp(i), Paths => (0 => (datain_ipd'last_event, tpd_datain_dataout(i), TRUE), 1 => (rotate_ipd'last_event, tpd_rotate_dataout(i), TRUE), 2 => (shiftright_ipd'last_event, tpd_shiftright_dataout(i), TRUE), 3 => (signa'last_event, tpd_signa_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do1; end block; END arch; -------------------------------------------------------------------------------------------------- -- Module Name: arriaii_carry_chain_adder -- -- Description: Piranha carry Chain Adder -- -------------------------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_carry_chain_adder IS GENERIC( tipd_dataa : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tipd_datab : VitalDelayArrayType01(71 downto 0) := (OTHERS => DefPropDelay01); tpd_dataa_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); tpd_datab_dataout : VitalDelayArrayType01(72*72-1 downto 0) := (others => DefPropDelay01); XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn ); PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); dataout : OUT STD_LOGIC_vector(71 DOWNTO 0) ); END arriaii_carry_chain_adder; ARCHITECTURE arch OF arriaii_carry_chain_adder IS SIGNAL dataa_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datab_ipd : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); BEGIN WireDelay : block begin g1 :for i in dataa'range generate VitalWireDelay (dataa_ipd(i), dataa(i), tipd_dataa(i)); end generate; g2 :for i in datab'range generate VitalWireDelay (datab_ipd(i), datab(i), tipd_datab(i)); end generate; end block; dataout_tmp <= (dataa_ipd(71 downto 45) & dataa_ipd(43) & dataa_ipd(43 downto 0)) + (datab_ipd(71 downto 45) & datab_ipd(43) & datab_ipd(43 downto 0)) ; PathDelay : block begin do1 : for i in dataout'range generate process(dataout_tmp(i)) VARIABLE dataout_VitalGlitchData : VitalGlitchDataType; begin VitalPathDelay01 ( OutSignal => dataout(i), OutSignalName => "dataout", OutTemp => dataout_tmp(i), Paths => (0 => (dataa_ipd'last_event, tpd_dataa_dataout(i), TRUE), 1 => (datab_ipd'last_event, tpd_datab_dataout(i), TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, MsgOn => FALSE, XOn => TRUE ); end process; end generate do1; end block; END arch; ---------------------------------------------------------------------------------- -- Module Name: arriaii_mac_out_atom -- -- Description: Simulation model for arriaii mac out atom -- -- This model instantiates the following components -- -- 1.arriaii_mac_bit_register -- -- 2.arriaii_mac_register -- -- 3.arriaii_fsa_isse -- -- 4.arriaii_first_stage_add_sub -- -- 5.arriaii_second_stage_add_accum -- -- 6.arriaii_round_saturate_block -- -- 7.arriaii_rotate_shift_block -- -- 8.arriaii_carry_chain_adder -- ---------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; ENTITY arriaii_mac_out IS GENERIC ( operation_mode : string := "output_only"; dataa_width : integer := 1; datab_width : integer := 1; datac_width : integer := 1; datad_width : integer := 1; chainin_width : integer := 1; round_width : integer := 15; round_chain_out_width : integer := 15; saturate_width : integer := 15; saturate_chain_out_width : integer := 15; first_adder0_clock : string := "none"; first_adder0_clear : string := "none"; first_adder1_clock : string := "none"; first_adder1_clear : string := "none"; second_adder_clock : string := "none"; second_adder_clear : string := "none"; output_clock : string := "none"; output_clear : string := "none"; signa_clock : string := "none"; signa_clear : string := "none"; signb_clock : string := "none"; signb_clear : string := "none"; round_clock : string := "none"; round_clear : string := "none"; roundchainout_clock : string := "none"; roundchainout_clear : string := "none"; saturate_clock : string := "none"; saturate_clear : string := "none"; saturatechainout_clock : string := "none"; saturatechainout_clear : string := "none"; zeroacc_clock : string := "none"; zeroacc_clear : string := "none"; zeroloopback_clock : string := "none"; zeroloopback_clear : string := "none"; rotate_clock : string := "none"; rotate_clear : string := "none"; shiftright_clock : string := "none"; shiftright_clear : string := "none"; signa_pipeline_clock : string := "none"; signa_pipeline_clear : string := "none"; signb_pipeline_clock : string := "none"; signb_pipeline_clear : string := "none"; round_pipeline_clock : string := "none"; round_pipeline_clear : string := "none"; roundchainout_pipeline_clock : string := "none"; roundchainout_pipeline_clear : string := "none"; saturate_pipeline_clock : string := "none"; saturate_pipeline_clear : string := "none"; saturatechainout_pipeline_clock: string := "none"; saturatechainout_pipeline_clear: string := "none"; zeroacc_pipeline_clock : string := "none"; zeroacc_pipeline_clear : string := "none"; zeroloopback_pipeline_clock : string := "none"; zeroloopback_pipeline_clear : string := "none"; rotate_pipeline_clock : string := "none"; rotate_pipeline_clear : string := "none"; shiftright_pipeline_clock : string := "none"; shiftright_pipeline_clear : string := "none"; roundchainout_output_clock : string := "none"; roundchainout_output_clear : string := "none"; saturatechainout_output_clock : string := "none"; saturatechainout_output_clear : string := "none"; zerochainout_output_clock : string := "none"; zerochainout_output_clear : string := "none"; zeroloopback_output_clock : string := "none"; zeroloopback_output_clear : string := "none"; rotate_output_clock : string := "none"; rotate_output_clear : string := "none"; shiftright_output_clock : string := "none"; shiftright_output_clear : string := "none"; first_adder0_mode : string := "add"; first_adder1_mode : string := "add"; acc_adder_operation : string := "add"; round_mode : string := "nearest_integer"; round_chain_out_mode : string := "nearest_integer"; saturate_mode : string := "asymmetric"; saturate_chain_out_mode : string := "asymmetric"; multa_signa_internally_grounded : string := "false"; multa_signb_internally_grounded : string := "false"; multb_signa_internally_grounded : string := "false"; multb_signb_internally_grounded : string := "false"; multc_signa_internally_grounded : string := "false"; multc_signb_internally_grounded : string := "false"; multd_signa_internally_grounded : string := "false"; multd_signb_internally_grounded : string := "false"; lpm_type : string := "arriaii_mac_out"; dataout_width : integer:=72 ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '1'); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '1'); datac : IN std_logic_vector(datac_width - 1 DOWNTO 0):= (others => '1'); datad : IN std_logic_vector(datad_width - 1 DOWNTO 0):= (others => '1'); signa : IN std_logic := '1'; signb : IN std_logic := '1'; chainin : IN std_logic_vector(chainin_width - 1 DOWNTO 0):= (others => '0'); round : IN std_logic := '0'; saturate : IN std_logic := '0'; zeroacc : IN std_logic := '0'; roundchainout : IN std_logic := '0'; saturatechainout : IN std_logic := '0'; zerochainout : IN std_logic := '0'; zeroloopback : IN std_logic := '0'; rotate : IN std_logic := '0'; shiftright : IN std_logic := '0'; clk : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); ena : IN std_logic_vector(3 DOWNTO 0) := (others => '1'); aclr : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); loopbackout : OUT std_logic_vector(17 DOWNTO 0):= (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); overflow : OUT std_logic := '0'; saturatechainoutoverflow: OUT std_logic := '0'; dftout : OUT std_logic := '0'; devpor : IN std_logic := '1'; devclrn : IN std_logic := '1' ); END arriaii_mac_out; ARCHITECTURE arch OF arriaii_mac_out IS COMPONENT arriaii_mac_bit_register PORT ( datain : IN std_logic := '0'; clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic ); END COMPONENT; COMPONENT arriaii_mac_register GENERIC ( data_width : integer := 18 ); PORT ( datain : IN std_logic_vector(data_width - 1 DOWNTO 0) := (others => '0'); clk : IN std_logic := '0'; aclr : IN std_logic := '0'; sload : IN std_logic := '0'; bypass_register : IN std_logic := '0'; dataout : OUT std_logic_vector(data_width - 1 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_fsa_isse GENERIC ( datab_width : integer := 36; dataa_width : integer := 36; chainin_width : integer := 44; operation_mode : string := "output_only"; datad_width : integer := 36; multa_signa_internally_grounded : string := "false"; multa_signb_internally_grounded : string := "false"; multb_signa_internally_grounded : string := "false"; multb_signb_internally_grounded : string := "false"; multc_signa_internally_grounded : string := "false"; multc_signb_internally_grounded : string := "false"; multd_signa_internally_grounded : string := "false"; multd_signb_internally_grounded : string := "false"; datac_width : integer := 36 ); PORT ( dataa : IN std_logic_vector(dataa_width - 1 DOWNTO 0):= (others => '0'); datab : IN std_logic_vector(datab_width - 1 DOWNTO 0):= (others => '0'); datac : IN std_logic_vector(datac_width - 1 DOWNTO 0):= (others => '0'); datad : IN std_logic_vector(datad_width - 1 DOWNTO 0):= (others => '0'); chainin : IN std_logic_vector(chainin_width - 1 DOWNTO 0):= (others => '0'); signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataa_out : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); datab_out : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); datac_out : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); datad_out : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); chainin_out : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); operation : OUT std_logic_vector(3 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_first_stage_add_sub GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; fsa_mode : string := "add" ); PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); sign : IN std_logic := '0'; operation : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_second_stage_add_accum GENERIC ( dataa_width : integer := 36; datab_width : integer := 36; ssa_mode : string := "add" ); PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); accumin : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); sign : IN std_logic := '0'; operation : IN std_logic_vector(3 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); overflow : OUT std_logic ); END COMPONENT; COMPONENT arriaii_round_saturate_block GENERIC ( datab_width : integer := 36; dataa_width : integer := 36; saturate_mode : string := " asymmetric"; saturate_width : integer := 15; round_width : integer := 15; operation_mode : string := "output_only"; round_mode : string := "nearest_integer" ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); round : IN std_logic := '0'; saturate : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; datain_width : IN std_logic_vector(7 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) := (others => '0'); saturationoverflow : OUT std_logic ); END COMPONENT; COMPONENT arriaii_rotate_shift_block GENERIC ( datab_width : integer := 32; dataa_width : integer := 32 ); PORT ( datain : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); rotate : IN std_logic := '0'; shiftright : IN std_logic := '0'; signa : IN std_logic := '0'; signb : IN std_logic := '0'; dataout : OUT std_logic_vector(71 DOWNTO 0) ); END COMPONENT; COMPONENT arriaii_carry_chain_adder PORT ( dataa : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); datab : IN std_logic_vector(71 DOWNTO 0) := (others => '0'); dataout : OUT std_logic_vector(71 DOWNTO 0) ); END COMPONENT; --signals for zeroloopback input register SIGNAL zeroloopback_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_clk_ir : std_logic := '0'; SIGNAL zeroloopback_aclr_ir : std_logic := '0'; SIGNAL zeroloopback_sload_ir : std_logic := '0'; SIGNAL zeroloopback_bypass_register_ir : std_logic := '0'; SIGNAL zeroloopback_in_reg : std_logic := '0'; SIGNAL zeroloopback_in : std_logic := '0'; --signals for zeroacc input register SIGNAL zeroacc_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroacc_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroacc_clk_ir : std_logic := '0'; SIGNAL zeroacc_aclr_ir : std_logic := '0'; SIGNAL zeroacc_sload_ir : std_logic := '0'; SIGNAL zeroacc_bypass_register_ir : std_logic := '0'; SIGNAL zeroacc_in_reg : std_logic := '0'; SIGNAL zeroacc_in : std_logic := '0'; --Signals for signa input register SIGNAL signa_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_clk_ir : std_logic := '0'; SIGNAL signa_aclr_ir : std_logic := '0'; SIGNAL signa_sload_ir : std_logic := '0'; SIGNAL signa_bypass_register_ir : std_logic := '0'; SIGNAL signa_in_reg : std_logic := '0'; SIGNAL signa_in : std_logic := '0'; --signals for signb input register SIGNAL signb_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_clk_ir : std_logic := '0'; SIGNAL signb_aclr_ir : std_logic := '0'; SIGNAL signb_sload_ir : std_logic := '0'; SIGNAL signb_bypass_register_ir : std_logic := '0'; SIGNAL signb_in_reg : std_logic := '0'; SIGNAL signb_in : std_logic := '0'; --signals for rotate input register SIGNAL rotate_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_clk_ir : std_logic := '0'; SIGNAL rotate_aclr_ir : std_logic := '0'; SIGNAL rotate_sload_ir : std_logic := '0'; SIGNAL rotate_bypass_register_ir: std_logic := '0'; SIGNAL rotate_in_reg : std_logic := '0'; SIGNAL rotate_in : std_logic := '0'; --signals for shiftright input register SIGNAL shiftright_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_clk_ir : std_logic := '0'; SIGNAL shiftright_aclr_ir : std_logic := '0'; SIGNAL shiftright_sload_ir : std_logic := '0'; SIGNAL shiftright_bypass_register_ir : std_logic := '0'; SIGNAL shiftright_in_reg : std_logic := '0'; SIGNAL shiftright_in : std_logic := '0'; --signals for round input register SIGNAL round_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL round_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL round_clk_ir : std_logic := '0'; SIGNAL round_aclr_ir : std_logic := '0'; SIGNAL round_sload_ir : std_logic := '0'; SIGNAL round_bypass_register_ir : std_logic := '0'; SIGNAL round_in_reg : std_logic := '0'; SIGNAL round_in : std_logic := '0'; --signals for saturate input register SIGNAL saturate_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturate_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturate_clk_ir : std_logic := '0'; SIGNAL saturate_aclr_ir : std_logic := '0'; SIGNAL saturate_sload_ir : std_logic := '0'; SIGNAL saturate_bypass_register_ir : std_logic := '0'; SIGNAL saturate_in_reg : std_logic := '0'; SIGNAL saturate_in : std_logic := '0'; --signals for roundchainout input register SIGNAL roundchainout_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_clk_ir : std_logic := '0'; SIGNAL roundchainout_aclr_ir : std_logic := '0'; SIGNAL roundchainout_sload_ir : std_logic := '0'; SIGNAL roundchainout_bypass_register_ir: std_logic := '0'; SIGNAL roundchainout_in_reg : std_logic := '0'; SIGNAL roundchainout_in : std_logic := '0'; --signals for saturatechainout input register SIGNAL saturatechainout_clkval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_aclrval_ir : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_clk_ir : std_logic := '0'; SIGNAL saturatechainout_aclr_ir : std_logic := '0'; SIGNAL saturatechainout_sload_ir: std_logic := '0'; SIGNAL saturatechainout_bypass_register_ir: std_logic := '0'; SIGNAL saturatechainout_in_reg : std_logic := '0'; SIGNAL saturatechainout_in : std_logic := '0'; --signals for fsa_input_interface SIGNAL dataa_fsa_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datab_fsa_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datac_fsa_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL datad_fsa_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL chainin_coa_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL operation : std_logic_vector(3 DOWNTO 0) := (others => '0'); --Signals for First Stage Adder units SIGNAL dataout_fsa0 : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL fsa_pip_datain1 : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL dataout_fsa1 : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL overflow_fsa0 : std_logic := '0'; SIGNAL overflow_fsa1 : std_logic := '0'; --signals for zeroloopback pipeline register SIGNAL zeroloopback_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_clk_pip : std_logic := '0'; SIGNAL zeroloopback_aclr_pip : std_logic := '0'; SIGNAL zeroloopback_sload_pip : std_logic := '0'; SIGNAL zeroloopback_bypass_register_pip: std_logic := '0'; SIGNAL zeroloopback_pip_reg : std_logic := '0'; --signals for zeroacc pipeline register SIGNAL zeroacc_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroacc_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroacc_clk_pip : std_logic := '0'; SIGNAL zeroacc_aclr_pip : std_logic := '0'; SIGNAL zeroacc_sload_pip : std_logic := '0'; SIGNAL zeroacc_bypass_register_pip : std_logic := '0'; SIGNAL zeroacc_pip_reg : std_logic := '0'; --Signals for signa pipeline register SIGNAL signa_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signa_clk_pip : std_logic := '0'; SIGNAL signa_aclr_pip : std_logic := '0'; SIGNAL signa_sload_pip : std_logic := '0'; SIGNAL signa_bypass_register_pip: std_logic := '0'; SIGNAL signa_pip_reg : std_logic := '0'; --signals for signb pipeline register SIGNAL signb_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL signb_clk_pip : std_logic := '0'; SIGNAL signb_aclr_pip : std_logic := '0'; SIGNAL signb_sload_pip : std_logic := '0'; SIGNAL signb_bypass_register_pip: std_logic := '0'; SIGNAL signb_pip_reg : std_logic := '0'; --signals for rotate pipeline register SIGNAL rotate_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_clk_pip : std_logic := '0'; SIGNAL rotate_aclr_pip : std_logic := '0'; SIGNAL rotate_sload_pip : std_logic := '0'; SIGNAL rotate_bypass_register_pip : std_logic := '0'; SIGNAL rotate_pip_reg : std_logic := '0'; --signals for shiftright pipeline register SIGNAL shiftright_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_clk_pip : std_logic := '0'; SIGNAL shiftright_aclr_pip : std_logic := '0'; SIGNAL shiftright_sload_pip : std_logic := '0'; SIGNAL shiftright_bypass_register_pip : std_logic := '0'; SIGNAL shiftright_pip_reg : std_logic := '0'; --signals for round pipeline register SIGNAL round_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL round_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL round_clk_pip : std_logic := '0'; SIGNAL round_aclr_pip : std_logic := '0'; SIGNAL round_sload_pip : std_logic := '0'; SIGNAL round_bypass_register_pip: std_logic := '0'; SIGNAL round_pip_reg : std_logic := '0'; --signals for saturate pipeline register SIGNAL saturate_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturate_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturate_clk_pip : std_logic := '0'; SIGNAL saturate_aclr_pip : std_logic := '0'; SIGNAL saturate_sload_pip : std_logic := '0'; SIGNAL saturate_bypass_register_pip : std_logic := '0'; SIGNAL saturate_pip_reg : std_logic := '0'; --signals for roundchainout pipeline register SIGNAL roundchainout_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_aclrval_pip: std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_clk_pip : std_logic := '0'; SIGNAL roundchainout_aclr_pip : std_logic := '0'; SIGNAL roundchainout_sload_pip : std_logic := '0'; SIGNAL roundchainout_bypass_register_pip: std_logic := '0'; SIGNAL roundchainout_pip_reg : std_logic := '0'; --signals for saturatechainout pipeline register SIGNAL saturatechainout_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_clk_pip : std_logic := '0'; SIGNAL saturatechainout_aclr_pip: std_logic := '0'; SIGNAL saturatechainout_sload_pip : std_logic := '0'; SIGNAL saturatechainout_bypass_register_pip: std_logic := '0'; SIGNAL saturatechainout_pip_reg : std_logic := '0'; --signals for fsa0 pipeline register SIGNAL fsa0_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL fsa0_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL fsa0_clk_pip : std_logic := '0'; SIGNAL fsa0_aclr_pip : std_logic := '0'; SIGNAL fsa0_sload_pip : std_logic := '0'; SIGNAL fsa0_bypass_register_pip : std_logic := '0'; SIGNAL fsa0_pip_reg : std_logic_vector(71 DOWNTO 0) := (others => '0'); --signals for fsa1 pipeline register SIGNAL fsa1_clkval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL fsa1_aclrval_pip : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL fsa1_clk_pip : std_logic := '0'; SIGNAL fsa1_aclr_pip : std_logic := '0'; SIGNAL fsa1_sload_pip : std_logic := '0'; SIGNAL fsa1_bypass_register_pip : std_logic := '0'; SIGNAL fsa1_pip_reg : std_logic_vector(71 DOWNTO 0) := (others => '0'); --Signals for second stage adder SIGNAL ssa_accum_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL ssa_sign : std_logic := '0'; SIGNAL ssa_dataout : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL ssa_overflow : std_logic := '0'; --Signals for RS block SIGNAL rs_datain : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_of : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_saturation_overflow : std_logic := '0'; SIGNAL ssa_datain_width : std_logic_vector(7 DOWNTO 0); SIGNAL ssa_round_width : std_logic_vector(3 DOWNTO 0) := (others => '0'); --signals for zeroloopback output register SIGNAL zeroloopback_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zeroloopback_clk_or : std_logic := '0'; SIGNAL zeroloopback_aclr_or : std_logic := '0'; SIGNAL zeroloopback_sload_or : std_logic := '0'; SIGNAL zeroloopback_bypass_register_or : std_logic := '0'; SIGNAL zeroloopback_out_reg : std_logic := '0'; --signals for zerochainout output register SIGNAL zerochainout_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zerochainout_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL zerochainout_clk_or : std_logic := '0'; SIGNAL zerochainout_aclr_or : std_logic := '0'; SIGNAL zerochainout_sload_or : std_logic := '0'; SIGNAL zerochainout_bypass_register_or : std_logic := '0'; SIGNAL zerochainout_out_reg : std_logic := '0'; --Signals for saturation_overflow output register SIGNAL rs_saturation_overflow_in : std_logic := '0'; SIGNAL saturation_overflow_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturation_overflow_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturation_overflow_clk_or : std_logic := '0'; SIGNAL saturation_overflow_aclr_or : std_logic := '0'; SIGNAL saturation_overflow_sload_or : std_logic := '0'; SIGNAL saturation_overflow_bypass_register_or: std_logic := '0'; SIGNAL saturation_overflow_out_reg : std_logic := '0'; --signals for rs_dataout output register SIGNAL rs_dataout_in : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_clkval_or_co : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_aclrval_or_co : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_clkval_or_o : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_aclrval_or_o : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rs_dataout_clk_or : std_logic := '0'; SIGNAL rs_dataout_aclr_or : std_logic := '0'; SIGNAL rs_dataout_sload_or : std_logic := '0'; SIGNAL rs_dataout_bypass_register_or_co : std_logic := '0'; SIGNAL rs_dataout_bypass_register_or_o : std_logic := '0'; SIGNAL rs_dataout_bypass_register_or : std_logic := '0'; SIGNAL rs_dataout_out_reg : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL rs_saturation_overflow_out_reg : std_logic := '0'; --signals for rotate output register SIGNAL rotate_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL rotate_clk_or : std_logic := '0'; SIGNAL rotate_aclr_or : std_logic := '0'; SIGNAL rotate_sload_or : std_logic := '0'; SIGNAL rotate_bypass_register_or: std_logic := '0'; SIGNAL rotate_out_reg : std_logic := '0'; --signals for shiftright output register SIGNAL shiftright_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL shiftright_clk_or : std_logic := '0'; SIGNAL shiftright_aclr_or : std_logic := '0'; SIGNAL shiftright_sload_or : std_logic := '0'; SIGNAL shiftright_bypass_register_or : std_logic := '0'; SIGNAL shiftright_out_reg : std_logic := '0'; --signals for roundchainout output register SIGNAL roundchainout_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL roundchainout_clk_or : std_logic := '0'; SIGNAL roundchainout_aclr_or : std_logic := '0'; SIGNAL roundchainout_sload_or : std_logic := '0'; SIGNAL roundchainout_bypass_register_or: std_logic := '0'; SIGNAL roundchainout_out_reg : std_logic := '0'; --signals for saturatechainout output register SIGNAL saturatechainout_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL saturatechainout_clk_or : std_logic := '0'; SIGNAL saturatechainout_aclr_or : std_logic := '0'; SIGNAL saturatechainout_sload_or: std_logic := '0'; SIGNAL saturatechainout_bypass_register_or: std_logic := '0'; SIGNAL saturatechainout_out_reg : std_logic := '0'; --Signals for chainout Adder RS Block SIGNAL coa_dataout : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL coa_round_width : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL coa_rs_dataout : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL coa_rs_saturation_overflow : std_logic := '0'; --signals for control signals for COA output register SIGNAL coa_reg_clkval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL coa_reg_aclrval_or : std_logic_vector(3 DOWNTO 0) := (others => '0'); SIGNAL coa_reg_clk_or : std_logic := '0'; SIGNAL coa_reg_aclr_or : std_logic := '0'; SIGNAL coa_reg_sload_or : std_logic := '0'; SIGNAL coa_reg_bypass_register_or : std_logic := '0'; SIGNAL coa_reg_out_reg : std_logic := '0'; SIGNAL coa_rs_saturation_overflow_out_reg: std_logic := '0'; SIGNAL coa_rs_saturationchainout_overflow_out_reg: std_logic := '0'; SIGNAL coa_rs_dataout_out_reg : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL dataout_shift_rot : std_logic_vector(71 DOWNTO 0):= (others => '0'); SIGNAL dataout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL loopbackout_tmp : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL saturation_overflow_tmp : std_logic := '0'; SIGNAL saturationchainout_overflow_tmp : std_logic := '0'; SIGNAL rs_dataout_tmp1 : std_logic_vector(71 DOWNTO 0) := (others => '0'); SIGNAL sign : std_logic := '0'; BEGIN process(rs_dataout, rs_saturation_overflow, saturate_pip_reg) variable rs_tmp : std_logic_vector(71 downto 0):= (others => '0'); begin rs_tmp := rs_dataout; if (((operation_mode = "output_only")or (operation_mode = "one_level_adder") or(operation_mode = "loopback")) and (dataa_width > 1) and (saturate_pip_reg = '1'))then rs_tmp(dataa_width -1) := rs_saturation_overflow ; end if; rs_dataout_of <= rs_tmp; end process; --Instantiate the zeroloopback input Register zeroloopback_clkval_ir <= "0000" WHEN ((zeroloopback_clock = "0") or (zeroloopback_clock = "none")) ELSE "0001" WHEN (zeroloopback_clock = "1") ELSE "0010" WHEN (zeroloopback_clock = "2") ELSE "0011" WHEN (zeroloopback_clock = "3") ELSE "0000" ; zeroloopback_aclrval_ir <= "0000" WHEN ((zeroloopback_clear = "0") or (zeroloopback_clear = "none")) ELSE "0001" WHEN (zeroloopback_clear = "1") ELSE "0010" WHEN (zeroloopback_clear = "2") ELSE "0011" WHEN (zeroloopback_clear = "3") ELSE "0000" ; zeroloopback_clk_ir <= '1' WHEN clk(conv_integer(zeroloopback_clkval_ir)) = '1' ELSE '0'; zeroloopback_aclr_ir <= '1' WHEN (aclr(conv_integer(zeroloopback_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zeroloopback_sload_ir <= '1' WHEN ena(conv_integer(zeroloopback_clkval_ir)) = '1' ELSE '0'; zeroloopback_bypass_register_ir <= '1' WHEN (zeroloopback_clock = "none") ELSE '0'; zeroloopback_in <= zeroloopback; zeroloopback_input_register : arriaii_mac_bit_register PORT MAP ( datain => zeroloopback_in, clk => zeroloopback_clk_ir, aclr => zeroloopback_aclr_ir, sload => zeroloopback_sload_ir, bypass_register => zeroloopback_bypass_register_ir, dataout => zeroloopback_in_reg ); --Instantiate the zeroacc input Register zeroacc_clkval_ir <= "0000" WHEN ((zeroacc_clock = "0") or (zeroacc_clock = "none")) ELSE "0001" WHEN (zeroacc_clock = "1") ELSE "0010" WHEN (zeroacc_clock = "2") ELSE "0011" WHEN (zeroacc_clock = "3") ELSE "0000" ; zeroacc_aclrval_ir <= "0000" WHEN ((zeroacc_clear = "0") or (zeroacc_clear = "none")) ELSE "0001" WHEN (zeroacc_clear = "1") ELSE "0010" WHEN (zeroacc_clear = "2") ELSE "0011" WHEN (zeroacc_clear = "3") ELSE "0000" ; zeroacc_clk_ir <= '1' WHEN clk(conv_integer(zeroacc_clkval_ir)) = '1' ELSE '0'; zeroacc_aclr_ir <= '1' WHEN (aclr(conv_integer(zeroacc_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zeroacc_sload_ir <= '1' WHEN ena(conv_integer(zeroacc_clkval_ir)) = '1' ELSE '0'; zeroacc_bypass_register_ir <= '1' WHEN (zeroacc_clock = "none") ELSE '0'; zeroacc_in <= zeroacc; zeroacc_input_register : arriaii_mac_bit_register PORT MAP ( datain => zeroacc_in, clk => zeroacc_clk_ir, aclr => zeroacc_aclr_ir, sload => zeroacc_sload_ir, bypass_register => zeroacc_bypass_register_ir, dataout => zeroacc_in_reg ); --Instantiate the signa input Register signa_clkval_ir <= "0000" WHEN ((signa_clock = "0") or (signa_clock = "none")) ELSE "0001" WHEN (signa_clock = "1") ELSE "0010" WHEN (signa_clock = "2") ELSE "0011" WHEN (signa_clock = "3") ELSE "0000" ; signa_aclrval_ir <= "0000" WHEN ((signa_clear = "0") or (signa_clear = "none")) ELSE "0001" WHEN (signa_clear = "1") ELSE "0010" WHEN (signa_clear = "2") ELSE "0011" WHEN (signa_clear = "3") ELSE "0000" ; signa_clk_ir <= '1' WHEN clk(conv_integer(signa_clkval_ir)) = '1' ELSE '0'; signa_aclr_ir <= '1' WHEN (aclr(conv_integer(signa_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; signa_sload_ir <= '1' WHEN ena(conv_integer(signa_clkval_ir)) = '1' ELSE '0'; signa_bypass_register_ir <= '1' WHEN (signa_clock = "none") ELSE '0'; signa_in <= signa; signa_input_register : arriaii_mac_bit_register PORT MAP ( datain => signa_in, clk => signa_clk_ir, aclr => signa_aclr_ir, sload => signa_sload_ir, bypass_register => signa_bypass_register_ir, dataout => signa_in_reg ); --Instantiate the signb input Register signb_clkval_ir <= "0000" WHEN ((signb_clock = "0") or (signb_clock = "none")) ELSE "0001" WHEN (signb_clock = "1") ELSE "0010" WHEN (signb_clock = "2") ELSE "0011" WHEN (signb_clock = "3") ELSE "0000" ; signb_aclrval_ir <= "0000" WHEN ((signb_clear = "0") or (signb_clear = "none")) ELSE "0001" WHEN (signb_clear = "1") ELSE "0010" WHEN (signb_clear = "2") ELSE "0011" WHEN (signb_clear = "3") ELSE "0000" ; signb_clk_ir <= '1' WHEN clk(conv_integer(signb_clkval_ir)) = '1' ELSE '0'; signb_aclr_ir <= '1' WHEN (aclr(conv_integer(signb_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; signb_sload_ir <= '1' WHEN ena(conv_integer(signb_clkval_ir)) = '1' ELSE '0'; signb_bypass_register_ir <= '1' WHEN (signb_clock = "none") ELSE '0'; signb_in <= signb; signb_input_register : arriaii_mac_bit_register PORT MAP ( datain => signb_in, clk => signb_clk_ir, aclr => signb_aclr_ir, sload => signb_sload_ir, bypass_register => signb_bypass_register_ir, dataout => signb_in_reg ); --Instantiate the rotate input Register rotate_clkval_ir <= "0000" WHEN ((rotate_clock = "0") or (rotate_clock = "none")) ELSE "0001" WHEN (rotate_clock = "1") ELSE "0010" WHEN (rotate_clock = "2") ELSE "0011" WHEN (rotate_clock = "3") ELSE "0000" ; rotate_aclrval_ir <= "0000" WHEN ((rotate_clear = "0") or (rotate_clear = "none")) ELSE "0001" WHEN (rotate_clear = "1") ELSE "0010" WHEN (rotate_clear = "2") ELSE "0011" WHEN (rotate_clear = "3") ELSE "0000" ; rotate_clk_ir <= '1' WHEN clk(conv_integer(rotate_clkval_ir)) = '1' ELSE '0'; rotate_aclr_ir <= '1' WHEN (aclr(conv_integer(rotate_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; rotate_sload_ir <= '1' WHEN ena(conv_integer(rotate_clkval_ir)) = '1' ELSE '0'; rotate_bypass_register_ir <= '1' WHEN (rotate_clock = "none") ELSE '0'; rotate_in <= rotate; rotate_input_register : arriaii_mac_bit_register PORT MAP ( datain => rotate_in, clk => rotate_clk_ir, aclr => rotate_aclr_ir, sload => rotate_sload_ir, bypass_register => rotate_bypass_register_ir, dataout => rotate_in_reg ); --Instantiate the shiftright input Register shiftright_clkval_ir <= "0000" WHEN ((shiftright_clock = "0") or (shiftright_clock = "none")) ELSE "0001" WHEN (shiftright_clock = "1") ELSE "0010" WHEN (shiftright_clock = "2") ELSE "0011" WHEN (shiftright_clock = "3") ELSE "0000" ; shiftright_aclrval_ir <= "0000" WHEN ((shiftright_clear = "0") or (shiftright_clear = "none")) ELSE "0001" WHEN (shiftright_clear = "1") ELSE "0010" WHEN (shiftright_clear = "2") ELSE "0011" WHEN (shiftright_clear = "3") ELSE "0000" ; shiftright_clk_ir <= '1' WHEN clk(conv_integer(shiftright_clkval_ir)) = '1' ELSE '0'; shiftright_aclr_ir <= '1' WHEN (aclr(conv_integer(shiftright_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0' ; shiftright_sload_ir <= '1' WHEN ena(conv_integer(shiftright_clkval_ir)) = '1' ELSE '0'; shiftright_bypass_register_ir <= '1' WHEN (shiftright_clock = "none") ELSE '0'; shiftright_in <= shiftright; shiftright_input_register : arriaii_mac_bit_register PORT MAP ( datain => shiftright_in, clk => shiftright_clk_ir, aclr => shiftright_aclr_ir, sload => shiftright_sload_ir, bypass_register => shiftright_bypass_register_ir, dataout => shiftright_in_reg ); --Instantiate the round input Register round_clkval_ir <= "0000" WHEN ((round_clock = "0") or (round_clock = "none")) ELSE "0001" WHEN (round_clock = "1") ELSE "0010" WHEN (round_clock = "2") ELSE "0011" WHEN (round_clock = "3") ELSE "0000" ; round_aclrval_ir <= "0000" WHEN ((round_clear = "0") or (round_clear = "none")) ELSE "0001" WHEN (round_clear = "1") ELSE "0010" WHEN (round_clear = "2") ELSE "0011" WHEN (round_clear = "3") ELSE "0000" ; round_clk_ir <= '1' WHEN clk(conv_integer(round_clkval_ir)) = '1' ELSE '0'; round_aclr_ir <= '1' WHEN (aclr(conv_integer(round_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; round_sload_ir <= '1' WHEN ena(conv_integer(round_clkval_ir)) = '1' ELSE '0'; round_bypass_register_ir <= '1' WHEN (round_clock = "none") ELSE '0'; round_in <= round; round_input_register : arriaii_mac_bit_register PORT MAP ( datain => round_in, clk => round_clk_ir, aclr => round_aclr_ir, sload => round_sload_ir, bypass_register => round_bypass_register_ir, dataout => round_in_reg ); --Instantiate the saturate input Register saturate_clkval_ir <= "0000" WHEN ((saturate_clock = "0") or (saturate_clock = "none")) ELSE "0001" WHEN (saturate_clock = "1") ELSE "0010" WHEN (saturate_clock = "2") ELSE "0011" WHEN (saturate_clock = "3") ELSE "0000" ; saturate_aclrval_ir <= "0000" WHEN ((saturate_clear = "0") or (saturate_clear = "none")) ELSE "0001" WHEN (saturate_clear = "1") ELSE "0010" WHEN (saturate_clear = "2") ELSE "0011" WHEN (saturate_clear = "3") ELSE "0000" ; saturate_clk_ir <= '1' WHEN clk(conv_integer(saturate_clkval_ir)) = '1' ELSE '0'; saturate_aclr_ir <= '1' WHEN (aclr(conv_integer(saturate_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; saturate_sload_ir <= '1' WHEN ena(conv_integer(saturate_clkval_ir)) = '1' ELSE '0'; saturate_bypass_register_ir <= '1' WHEN (saturate_clock = "none") ELSE '0'; saturate_in <= saturate; saturate_input_register : arriaii_mac_bit_register PORT MAP ( datain => saturate_in, clk => saturate_clk_ir, aclr => saturate_aclr_ir, sload => saturate_sload_ir, bypass_register => saturate_bypass_register_ir, dataout => saturate_in_reg ); --Instantiate the roundchainout input Register roundchainout_clkval_ir <= "0000" WHEN ((roundchainout_clock = "0") or (roundchainout_clock = "none")) ELSE "0001" WHEN (roundchainout_clock = "1") ELSE "0010" WHEN (roundchainout_clock = "2") ELSE "0011" WHEN (roundchainout_clock = "3") ELSE "0000" ; roundchainout_aclrval_ir <= "0000" WHEN ((roundchainout_clear = "0") or (roundchainout_clear = "none")) ELSE "0001" WHEN (roundchainout_clear = "1") ELSE "0010" WHEN (roundchainout_clear = "2") ELSE "0011" WHEN (roundchainout_clear = "3") ELSE "0000" ; roundchainout_clk_ir <= '1' WHEN clk(conv_integer(roundchainout_clkval_ir)) = '1' ELSE '0'; roundchainout_aclr_ir <= '1' WHEN (aclr(conv_integer(roundchainout_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; roundchainout_sload_ir <= '1' WHEN ena(conv_integer(roundchainout_clkval_ir)) = '1' ELSE '0'; roundchainout_bypass_register_ir <= '1' WHEN (roundchainout_clock = "none") ELSE '0'; roundchainout_in <= roundchainout; roundchainout_input_register : arriaii_mac_bit_register PORT MAP ( datain => roundchainout_in, clk => roundchainout_clk_ir, aclr => roundchainout_aclr_ir, sload => roundchainout_sload_ir, bypass_register => roundchainout_bypass_register_ir, dataout => roundchainout_in_reg ); --Instantiate the saturatechainout input Register saturatechainout_clkval_ir <= "0000" WHEN ((saturatechainout_clock = "0") or (saturatechainout_clock = "none")) ELSE "0001" WHEN (saturatechainout_clock = "1") ELSE "0010" WHEN (saturatechainout_clock = "2") ELSE "0011" WHEN (saturatechainout_clock = "3") ELSE "0000" ; saturatechainout_aclrval_ir <= "0000" WHEN ((saturatechainout_clear = "0") or (saturatechainout_clear = "none")) ELSE "0001" WHEN (saturatechainout_clear = "1") ELSE "0010" WHEN (saturatechainout_clear = "2") ELSE "0011" WHEN (saturatechainout_clear = "3") ELSE "0000" ; saturatechainout_clk_ir <= '1' WHEN clk(conv_integer(saturatechainout_clkval_ir)) = '1' ELSE '0'; saturatechainout_aclr_ir <= '1' WHEN (aclr(conv_integer(saturatechainout_aclrval_ir)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; saturatechainout_sload_ir <= '1' WHEN ena(conv_integer(saturatechainout_clkval_ir)) = '1' ELSE '0'; saturatechainout_bypass_register_ir <= '1' WHEN (saturatechainout_clock = "none") ELSE '0'; saturatechainout_in <= saturatechainout; saturatechainout_input_register : arriaii_mac_bit_register PORT MAP ( datain => saturatechainout_in, clk => saturatechainout_clk_ir, aclr => saturatechainout_aclr_ir, sload => saturatechainout_sload_ir, bypass_register => saturatechainout_bypass_register_ir, dataout => saturatechainout_in_reg ); --Instantiate the First level adder interface and sign extension block sign <= signa_in_reg OR signb_in_reg ; fsa_interface : arriaii_fsa_isse GENERIC MAP ( chainin_width => chainin_width, dataa_width => dataa_width, datab_width => datab_width, datac_width => datac_width, datad_width => datad_width, operation_mode => operation_mode, multa_signa_internally_grounded => multa_signa_internally_grounded, multa_signb_internally_grounded => multa_signb_internally_grounded, multb_signa_internally_grounded => multb_signa_internally_grounded, multb_signb_internally_grounded => multb_signb_internally_grounded, multc_signa_internally_grounded => multc_signa_internally_grounded, multc_signb_internally_grounded => multc_signb_internally_grounded, multd_signa_internally_grounded => multd_signa_internally_grounded, multd_signb_internally_grounded => multd_signb_internally_grounded ) PORT MAP ( dataa => dataa, datab => datab, datac => datac, datad => datad, chainin => chainin, signa => signa_in_reg, signb => signb_in_reg, dataa_out => dataa_fsa_in, datab_out => datab_fsa_in, datac_out => datac_fsa_in, datad_out => datad_fsa_in, chainin_out => chainin_coa_in, operation => operation ); --Instantiate First Stage Adder/Subtractor Unit0 fsaunit0 : arriaii_first_stage_add_sub GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width, fsa_mode => first_adder0_mode ) PORT MAP ( dataa => dataa_fsa_in, datab => datab_fsa_in, sign => sign, operation => operation, dataout => dataout_fsa0 ); --Instantiate First Stage Adder/Subtractor Unit1 fsaunit1 : arriaii_first_stage_add_sub GENERIC MAP ( dataa_width => datac_width, datab_width => datad_width, fsa_mode => first_adder1_mode ) PORT MAP ( dataa => datac_fsa_in, datab => datad_fsa_in, sign => sign, operation => operation, dataout => dataout_fsa1 ); --Instantiate the zeroloopback pipeline Register zeroloopback_clkval_pip <= "0000" WHEN ((zeroloopback_pipeline_clock = "0") or (zeroloopback_pipeline_clock = "none")) ELSE "0001" WHEN (zeroloopback_pipeline_clock = "1") ELSE "0010" WHEN (zeroloopback_pipeline_clock = "2") ELSE "0011" WHEN (zeroloopback_pipeline_clock = "3") ELSE "0000" ; zeroloopback_aclrval_pip <= "0000" WHEN ((zeroloopback_pipeline_clear = "0") or (zeroloopback_pipeline_clear = "none")) ELSE "0001" WHEN (zeroloopback_pipeline_clear = "1") ELSE "0010" WHEN (zeroloopback_pipeline_clear = "2") ELSE "0011" WHEN (zeroloopback_pipeline_clear = "3") ELSE "0000" ; zeroloopback_clk_pip <= '1' WHEN clk(conv_integer(zeroloopback_clkval_pip)) = '1' ELSE '0'; zeroloopback_aclr_pip <= '1' WHEN (aclr(conv_integer(zeroloopback_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zeroloopback_sload_pip <= '1' WHEN ena(conv_integer(zeroloopback_clkval_pip)) = '1' ELSE '0'; zeroloopback_bypass_register_pip <= '1' WHEN (zeroloopback_pipeline_clock = "none") ELSE '0'; zeroloopback_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => zeroloopback_in_reg, clk => zeroloopback_clk_pip, aclr => zeroloopback_aclr_pip, sload => zeroloopback_sload_pip, bypass_register => zeroloopback_bypass_register_pip, dataout => zeroloopback_pip_reg ); --Instantiate the zeroacc pipeline Register zeroacc_clkval_pip <= "0000" WHEN ((zeroacc_pipeline_clock = "0") or (zeroacc_pipeline_clock = "none")) ELSE "0001" WHEN (zeroacc_pipeline_clock = "1") ELSE "0010" WHEN (zeroacc_pipeline_clock = "2") ELSE "0011" WHEN (zeroacc_pipeline_clock = "3") ELSE "0000" ; zeroacc_aclrval_pip <= "0000" WHEN ((zeroacc_pipeline_clear = "0") or (zeroacc_pipeline_clear = "none")) ELSE "0001" WHEN (zeroacc_pipeline_clear = "1") ELSE "0010" WHEN (zeroacc_pipeline_clear = "2") ELSE "0011" WHEN (zeroacc_pipeline_clear = "3") ELSE "0000" ; zeroacc_clk_pip <= '1' WHEN clk(conv_integer(zeroacc_clkval_pip)) = '1' ELSE '0'; zeroacc_aclr_pip <= '1' WHEN (aclr(conv_integer(zeroacc_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zeroacc_sload_pip <= '1' WHEN ena(conv_integer(zeroacc_clkval_pip)) = '1' ELSE '0'; zeroacc_bypass_register_pip <= '1' WHEN (zeroacc_pipeline_clock = "none") ELSE '0'; zeroacc_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => zeroacc_in_reg, clk => zeroacc_clk_pip, aclr => zeroacc_aclr_pip, sload => zeroacc_sload_pip, bypass_register => zeroacc_bypass_register_pip, dataout => zeroacc_pip_reg ); --Instantiate the signa pipeline Register signa_clkval_pip <= "0000" WHEN ((signa_pipeline_clock = "0") or (signa_pipeline_clock = "none")) ELSE "0001" WHEN (signa_pipeline_clock = "1") ELSE "0010" WHEN (signa_pipeline_clock = "2") ELSE "0011" WHEN (signa_pipeline_clock = "3") ELSE "0000" ; signa_aclrval_pip <= "0000" WHEN ((signa_pipeline_clear = "0") or (signa_pipeline_clear = "none")) ELSE "0001" WHEN (signa_pipeline_clear = "1") ELSE "0010" WHEN (signa_pipeline_clear = "2") ELSE "0011" WHEN (signa_pipeline_clear = "3") ELSE "0000" ; signa_clk_pip <= '1' WHEN clk(conv_integer(signa_clkval_pip)) = '1' ELSE '0'; signa_aclr_pip <= '1' WHEN (aclr(conv_integer(signa_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; signa_sload_pip <= '1' WHEN ena(conv_integer(signa_clkval_pip)) = '1' ELSE '0'; signa_bypass_register_pip <= '1' WHEN (signa_pipeline_clock = "none") ELSE '0'; signa_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => signa_in_reg, clk => signa_clk_pip, aclr => signa_aclr_pip, sload => signa_sload_pip, bypass_register => signa_bypass_register_pip, dataout => signa_pip_reg ); --Instantiate the signb pipeline Register signb_clkval_pip <= "0000" WHEN ((signb_pipeline_clock = "0") or (signb_pipeline_clock = "none")) ELSE "0001" WHEN (signb_pipeline_clock = "1") ELSE "0010" WHEN (signb_pipeline_clock = "2") ELSE "0011" WHEN (signb_pipeline_clock = "3") ELSE "0000" ; signb_aclrval_pip <= "0000" WHEN ((signb_pipeline_clear = "0") or (signb_pipeline_clear = "none")) ELSE "0001" WHEN (signb_pipeline_clear = "1") ELSE "0010" WHEN (signb_pipeline_clear = "2") ELSE "0011" WHEN (signb_pipeline_clear = "3") ELSE "0000" ; signb_clk_pip <= '1' WHEN clk(conv_integer(signb_clkval_pip)) = '1' ELSE '0'; signb_aclr_pip <= '1' WHEN (aclr(conv_integer(signb_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; signb_sload_pip <= '1' WHEN ena(conv_integer(signb_clkval_pip)) = '1' ELSE '0'; signb_bypass_register_pip <= '1' WHEN (signb_pipeline_clock = "none") ELSE '0'; signb_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => signb_in_reg, clk => signb_clk_pip, aclr => signb_aclr_pip, sload => signb_sload_pip, bypass_register => signb_bypass_register_pip, dataout => signb_pip_reg ); --Instantiate the rotate pipeline Register rotate_clkval_pip <= "0000" WHEN ((rotate_pipeline_clock = "0") or (rotate_pipeline_clock = "none")) ELSE "0001" WHEN (rotate_pipeline_clock = "1") ELSE "0010" WHEN (rotate_pipeline_clock = "2") ELSE "0011" WHEN (rotate_pipeline_clock = "3") ELSE "0000" ; rotate_aclrval_pip <= "0000" WHEN ((rotate_pipeline_clear = "0") or (rotate_pipeline_clear = "none")) ELSE "0001" WHEN (rotate_pipeline_clear = "1") ELSE "0010" WHEN (rotate_pipeline_clear = "2") ELSE "0011" WHEN (rotate_pipeline_clear = "3") ELSE "0000" ; rotate_clk_pip <= '1' WHEN clk(conv_integer(rotate_clkval_pip)) = '1' ELSE '0'; rotate_aclr_pip <= '1' WHEN (aclr(conv_integer(rotate_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; rotate_sload_pip <= '1' WHEN ena(conv_integer(rotate_clkval_pip)) = '1' ELSE '0'; rotate_bypass_register_pip <= '1' WHEN (rotate_pipeline_clock = "none") ELSE '0'; rotate_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => rotate_in_reg, clk => rotate_clk_pip, aclr => rotate_aclr_pip, sload => rotate_sload_pip, bypass_register => rotate_bypass_register_pip, dataout => rotate_pip_reg ); --Instantiate the shiftright pipeline Register shiftright_clkval_pip <= "0000" WHEN ((shiftright_pipeline_clock = "0") or (shiftright_pipeline_clock = "none")) ELSE "0001" WHEN (shiftright_pipeline_clock = "1") ELSE "0010" WHEN (shiftright_pipeline_clock = "2") ELSE "0011" WHEN (shiftright_pipeline_clock = "3") ELSE "0000" ; shiftright_aclrval_pip <= "0000" WHEN ((shiftright_pipeline_clear = "0") or (shiftright_pipeline_clear = "none")) ELSE "0001" WHEN (shiftright_pipeline_clear = "1") ELSE "0010" WHEN (shiftright_pipeline_clear = "2") ELSE "0011" WHEN (shiftright_pipeline_clear = "3") ELSE "0000" ; shiftright_clk_pip <= '1' WHEN clk(conv_integer(shiftright_clkval_pip)) = '1' ELSE '0'; shiftright_aclr_pip <= '1' WHEN (aclr(conv_integer(shiftright_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; shiftright_sload_pip <= '1' WHEN ena(conv_integer(shiftright_clkval_pip)) = '1' ELSE '0'; shiftright_bypass_register_pip <= '1' WHEN (shiftright_pipeline_clock = "none") ELSE '0'; shiftright_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => shiftright_in_reg, clk => shiftright_clk_pip, aclr => shiftright_aclr_pip, sload => shiftright_sload_pip, bypass_register => shiftright_bypass_register_pip, dataout => shiftright_pip_reg ); --Instantiate the round pipeline Register round_clkval_pip <= "0000" WHEN ((round_pipeline_clock = "0") or (round_pipeline_clock = "none")) ELSE "0001" WHEN (round_pipeline_clock = "1") ELSE "0010" WHEN (round_pipeline_clock = "2") ELSE "0011" WHEN (round_pipeline_clock = "3") ELSE "0000" ; round_aclrval_pip <= "0000" WHEN ((round_pipeline_clear = "0") or (round_pipeline_clear = "none")) ELSE "0001" WHEN (round_pipeline_clear = "1") ELSE "0010" WHEN (round_pipeline_clear = "2") ELSE "0011" WHEN (round_pipeline_clear = "3") ELSE "0000" ; round_clk_pip <= '1' WHEN clk(conv_integer(round_clkval_pip)) = '1' ELSE '0'; round_aclr_pip <= '1' WHEN (aclr(conv_integer(round_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; round_sload_pip <= '1' WHEN ena(conv_integer(round_clkval_pip)) = '1' ELSE '0'; round_bypass_register_pip <= '1' WHEN (round_pipeline_clock = "none") ELSE '0'; round_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => round_in_reg, clk => round_clk_pip, aclr => round_aclr_pip, sload => round_sload_pip, bypass_register => round_bypass_register_pip, dataout => round_pip_reg ); --Instantiate the saturate pipeline Register saturate_clkval_pip <= "0000" WHEN ((saturate_pipeline_clock = "0") or (saturate_pipeline_clock = "none")) ELSE "0001" WHEN (saturate_pipeline_clock = "1") ELSE "0010" WHEN (saturate_pipeline_clock = "2") ELSE "0011" WHEN (saturate_pipeline_clock = "3") ELSE "0000" ; saturate_aclrval_pip <= "0000" WHEN ((saturate_pipeline_clear = "0") or (saturate_pipeline_clear = "none")) ELSE "0001" WHEN (saturate_pipeline_clear = "1") ELSE "0010" WHEN (saturate_pipeline_clear = "2") ELSE "0011" WHEN (saturate_pipeline_clear = "3") ELSE "0000" ; saturate_clk_pip <= '1' WHEN clk(conv_integer(saturate_clkval_pip)) = '1' ELSE '0'; saturate_aclr_pip <= '1' WHEN (aclr(conv_integer(saturate_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; saturate_sload_pip <= '1' WHEN ena(conv_integer(saturate_clkval_pip)) = '1' ELSE '0'; saturate_bypass_register_pip <= '1' WHEN (saturate_pipeline_clock = "none") ELSE '0'; saturate_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => saturate_in_reg, clk => saturate_clk_pip, aclr => saturate_aclr_pip, sload => saturate_sload_pip, bypass_register => saturate_bypass_register_pip, dataout => saturate_pip_reg ); --Instantiate the roundchainout pipeline Register roundchainout_clkval_pip <= "0000" WHEN ((roundchainout_pipeline_clock = "0") or (roundchainout_pipeline_clock = "none")) ELSE "0001" WHEN (roundchainout_pipeline_clock = "1") ELSE "0010" WHEN (roundchainout_pipeline_clock = "2") ELSE "0011" WHEN (roundchainout_pipeline_clock = "3") ELSE "0000" ; roundchainout_aclrval_pip <= "0000" WHEN ((roundchainout_pipeline_clear = "0") or (roundchainout_pipeline_clear = "none")) ELSE "0001" WHEN (roundchainout_pipeline_clear = "1") ELSE "0010" WHEN (roundchainout_pipeline_clear = "2") ELSE "0011" WHEN (roundchainout_pipeline_clear = "3") ELSE "0000" ; roundchainout_clk_pip <= '1' WHEN clk(conv_integer(roundchainout_clkval_pip)) = '1' ELSE '0'; roundchainout_aclr_pip <= '1' WHEN (aclr(conv_integer(roundchainout_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; roundchainout_sload_pip <= '1' WHEN ena(conv_integer(roundchainout_clkval_pip)) = '1' ELSE '0'; roundchainout_bypass_register_pip <= '1' WHEN (roundchainout_pipeline_clock = "none") ELSE '0'; roundchainout_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => roundchainout_in_reg, clk => roundchainout_clk_pip, aclr => roundchainout_aclr_pip, sload => roundchainout_sload_pip, bypass_register => roundchainout_bypass_register_pip, dataout => roundchainout_pip_reg ); --Instantiate the saturatechainout pipeline Register saturatechainout_clkval_pip <= "0000" WHEN ((saturatechainout_pipeline_clock = "0") or (saturatechainout_pipeline_clock = "none")) ELSE "0001" WHEN (saturatechainout_pipeline_clock = "1") ELSE "0010" WHEN (saturatechainout_pipeline_clock = "2") ELSE "0011" WHEN (saturatechainout_pipeline_clock = "3") ELSE "0000" ; saturatechainout_aclrval_pip <= "0000" WHEN ((saturatechainout_pipeline_clear = "0") or (saturatechainout_pipeline_clear = "none")) ELSE "0001" WHEN (saturatechainout_pipeline_clear = "1") ELSE "0010" WHEN (saturatechainout_pipeline_clear = "2") ELSE "0011" WHEN (saturatechainout_pipeline_clear = "3") ELSE "0000" ; saturatechainout_clk_pip <= '1' WHEN clk(conv_integer(saturatechainout_clkval_pip)) = '1' ELSE '0'; saturatechainout_aclr_pip <= '1' WHEN (aclr(conv_integer(saturatechainout_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; saturatechainout_sload_pip <= '1' WHEN ena(conv_integer(saturatechainout_clkval_pip)) = '1' ELSE '0'; saturatechainout_bypass_register_pip <= '1' WHEN (saturatechainout_pipeline_clock = "none") ELSE '0'; saturatechainout_pipeline_register : arriaii_mac_bit_register PORT MAP ( datain => saturatechainout_in_reg, clk => saturatechainout_clk_pip, aclr => saturatechainout_aclr_pip, sload => saturatechainout_sload_pip, bypass_register => saturatechainout_bypass_register_pip, dataout => saturatechainout_pip_reg ); -- Instantiate fsa0 dataout pipline register fsa_pip_datain1 <= dataa_fsa_in WHEN (operation_mode = "output_only") ELSE dataout_fsa0; fsa0_clkval_pip <= "0000" WHEN ((first_adder0_clock = "0") or (first_adder0_clock = "none")) ELSE "0001" WHEN (first_adder0_clock = "1") ELSE "0010" WHEN (first_adder0_clock = "2") ELSE "0011" WHEN (first_adder0_clock = "3") ELSE "0000" ; fsa0_aclrval_pip <= "0000" WHEN ((first_adder0_clear = "0") or (first_adder0_clear = "none")) ELSE "0001" WHEN (first_adder0_clear = "1") ELSE "0010" WHEN (first_adder0_clear = "2") ELSE "0011" WHEN (first_adder0_clear = "3") ELSE "0000" ; fsa0_clk_pip <= '1' WHEN clk(conv_integer(fsa0_clkval_pip)) = '1' ELSE '0'; fsa0_aclr_pip <= '1' WHEN (aclr(conv_integer(fsa0_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; fsa0_sload_pip <= '1' WHEN ena(conv_integer(fsa0_clkval_pip)) = '1' ELSE '0'; fsa0_bypass_register_pip <= '1' WHEN (first_adder0_clock = "none") ELSE '0'; fsa0_pipeline_register : arriaii_mac_register GENERIC MAP ( data_width => 72 ) PORT MAP ( datain => fsa_pip_datain1, clk => fsa0_clk_pip, aclr => fsa0_aclr_pip, sload => fsa0_sload_pip, bypass_register => fsa0_bypass_register_pip, dataout => fsa0_pip_reg ); -- Instantiate fsa1 dataout pipline register fsa1_clkval_pip <= "0000" WHEN ((first_adder1_clock = "0") or (first_adder1_clock = "none")) ELSE "0001" WHEN (first_adder1_clock = "1") ELSE "0010" WHEN (first_adder1_clock = "2") ELSE "0011" WHEN (first_adder1_clock = "3") ELSE "0000" ; fsa1_aclrval_pip <= "0000" WHEN ((first_adder1_clear = "0") or (first_adder1_clear = "none")) ELSE "0001" WHEN (first_adder1_clear = "1") ELSE "0010" WHEN (first_adder1_clear = "2") ELSE "0011" WHEN (first_adder1_clear = "3") ELSE "0000" ; fsa1_clk_pip <= '1' WHEN clk(conv_integer(fsa1_clkval_pip)) = '1' ELSE '0'; fsa1_aclr_pip <= '1' WHEN (aclr(conv_integer(fsa1_aclrval_pip)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; fsa1_sload_pip <= '1' WHEN ena(conv_integer(fsa1_clkval_pip)) = '1' ELSE '0'; fsa1_bypass_register_pip <= '1' WHEN (first_adder1_clock = "none") ELSE '0'; fsa1_pipeline_register : arriaii_mac_register GENERIC MAP ( data_width => 72 ) PORT MAP ( datain => dataout_fsa1, clk => fsa1_clk_pip, aclr => fsa1_aclr_pip, sload => fsa1_sload_pip, bypass_register => fsa1_bypass_register_pip, dataout => fsa1_pip_reg ); --Instantiate the second level adder/accumulator block ssa_accum_in <= rs_dataout_out_reg WHEN (NOT zeroacc_pip_reg) = '1' ELSE (others => '0'); ssa_sign <= signa_pip_reg OR signb_pip_reg ; ssa_unit : arriaii_second_stage_add_accum GENERIC MAP ( dataa_width => dataa_width + 1, datab_width => datac_width + 1, ssa_mode => acc_adder_operation ) PORT MAP ( dataa => fsa0_pip_reg, datab => fsa1_pip_reg, accumin => ssa_accum_in, sign => ssa_sign, operation => operation, dataout => ssa_dataout, overflow => ssa_overflow ); -- Instantiate round and saturation block rs_datain <= fsa0_pip_reg when ((operation_mode = "output_only") or (operation_mode = "one_level_adder")or(operation_mode = "loopback")) ELSE ssa_dataout ; ssa_datain_width <= CONV_STD_LOGIC_VECTOR(dataa_width + 8,8) when ((operation_mode = "accumulator") or(operation_mode = "accumulator_chain_out") or(operation_mode = "two_level_adder_chain_out")) ELSE CONV_STD_LOGIC_VECTOR(dataa_width +2,8) when(operation_mode = "two_level_adder") ELSE CONV_STD_LOGIC_VECTOR(dataa_width + datab_width,8) when ((operation_mode = "shift" ) or (operation_mode = "36_bit_multiply" )) ELSE CONV_STD_LOGIC_VECTOR(dataa_width + 8,8) when ((operation_mode = "double" )) ELSE CONV_STD_LOGIC_VECTOR(dataa_width,8); rs_block : arriaii_round_saturate_block GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width, operation_mode => operation_mode, round_mode => round_mode, saturate_mode => saturate_mode, saturate_width => saturate_width, round_width => round_width ) PORT MAP ( datain => rs_datain, round => round_pip_reg, saturate => saturate_pip_reg, signa => signa_pip_reg, signb => signb_pip_reg, datain_width => ssa_datain_width, dataout => rs_dataout, saturationoverflow => rs_saturation_overflow ); --Instantiate the zeroloopback output Register zeroloopback_clkval_or <= "0000" WHEN ((zeroloopback_output_clock = "0") or (zeroloopback_output_clock = "none")) ELSE "0001" WHEN (zeroloopback_output_clock = "1") ELSE "0010" WHEN (zeroloopback_output_clock = "2") ELSE "0011" WHEN (zeroloopback_output_clock = "3") ELSE "0000" ; zeroloopback_aclrval_or <= "0000" WHEN ((zeroloopback_output_clear = "0") or (zeroloopback_output_clear = "none")) ELSE "0001" WHEN (zeroloopback_output_clear = "1") ELSE "0010" WHEN (zeroloopback_output_clear = "2") ELSE "0011" WHEN (zeroloopback_output_clear = "3") ELSE "0000" ; zeroloopback_clk_or <= '1' WHEN clk(conv_integer(zeroloopback_clkval_or)) = '1' ELSE '0'; zeroloopback_aclr_or <= '1' WHEN (aclr(conv_integer(zeroloopback_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zeroloopback_sload_or <= '1' WHEN ena(conv_integer(zeroloopback_clkval_or)) = '1' ELSE '0'; zeroloopback_bypass_register_or <= '1' WHEN (zeroloopback_output_clock = "none") ELSE '0'; zeroloopback_output_register : arriaii_mac_bit_register PORT MAP ( datain => zeroloopback_pip_reg, clk => zeroloopback_clk_or, aclr => zeroloopback_aclr_or, sload => zeroloopback_sload_or, bypass_register => zeroloopback_bypass_register_or, dataout => zeroloopback_out_reg ); --Instantiate the zerochainout output Register zerochainout_clkval_or <= "0000" WHEN ((zerochainout_output_clock = "0") or (zerochainout_output_clock = "none")) ELSE "0001" WHEN (zerochainout_output_clock = "1") ELSE "0010" WHEN (zerochainout_output_clock = "2") ELSE "0011" WHEN (zerochainout_output_clock = "3") ELSE "0000" ; zerochainout_aclrval_or <= "0000" WHEN ((zerochainout_output_clear = "0") or (zerochainout_output_clear = "none")) ELSE "0001" WHEN (zerochainout_output_clear = "1") ELSE "0010" WHEN (zerochainout_output_clear = "2") ELSE "0011" WHEN (zerochainout_output_clear = "3") ELSE "0000" ; zerochainout_clk_or <= '1' WHEN clk(conv_integer(zerochainout_clkval_or)) = '1' ELSE '0'; zerochainout_aclr_or <= '1' WHEN (aclr(conv_integer(zerochainout_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; zerochainout_sload_or <= '1' WHEN ena(conv_integer(zerochainout_clkval_or)) = '1' ELSE '0'; zerochainout_bypass_register_or <= '1' WHEN (zerochainout_output_clock = "none") ELSE '0'; zerochainout_output_register : arriaii_mac_bit_register PORT MAP ( datain => zerochainout, clk => zerochainout_clk_or, aclr => zerochainout_aclr_or, sload => zerochainout_sload_or, bypass_register => zerochainout_bypass_register_or, dataout => zerochainout_out_reg ); -- Instantiate Round_Saturate dataout output register rs_dataout_clkval_or_co <= "0000" WHEN ((second_adder_clock = "0") or (second_adder_clock = "none")) ELSE "0001" WHEN (second_adder_clock = "1") ELSE "0010" WHEN (second_adder_clock = "2") ELSE "0011" WHEN (second_adder_clock = "3") ELSE "0000" ; rs_dataout_aclrval_or_co <= "0000" WHEN ((second_adder_clear = "0") or (second_adder_clear = "none")) ELSE "0001" WHEN (second_adder_clear = "1") ELSE "0010" WHEN (second_adder_clear = "2") ELSE "0011" WHEN (second_adder_clear = "3") ELSE "0000" ; rs_dataout_clkval_or_o <= "0000" WHEN ((output_clock = "0") or (output_clock = "none")) ELSE "0001" WHEN (output_clock = "1") ELSE "0010" WHEN (output_clock = "2") ELSE "0011" WHEN (output_clock = "3") ELSE "0000" ; rs_dataout_aclrval_or_o <= "0000" WHEN ((output_clear = "0") or (output_clear = "none")) ELSE "0001" WHEN (output_clear = "1") ELSE "0010" WHEN (output_clear = "2") ELSE "0011" WHEN (output_clear = "3") ELSE "0000" ; rs_dataout_aclrval_or <= rs_dataout_aclrval_or_co WHEN ((operation_mode = "two_level_adder_chain_out") or (operation_mode = "accumulator_chain_out" )) ELSE rs_dataout_aclrval_or_o; rs_dataout_clkval_or <= rs_dataout_clkval_or_co WHEN ((operation_mode = "two_level_adder_chain_out") or (operation_mode = "accumulator_chain_out" )) ELSE rs_dataout_clkval_or_o; rs_dataout_bypass_register_or_co <= '1' WHEN (second_adder_clock = "none") ELSE '0'; rs_dataout_bypass_register_or_o <= '1' WHEN (output_clock = "none") ELSE '0'; rs_dataout_clk_or <= '1' WHEN clk(conv_integer(rs_dataout_clkval_or)) = '1' ELSE '0'; rs_dataout_aclr_or <= '1' WHEN (aclr(conv_integer(rs_dataout_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; rs_dataout_sload_or <= '1' WHEN ena(conv_integer(rs_dataout_clkval_or)) = '1' ELSE '0'; rs_dataout_bypass_register_or <= rs_dataout_bypass_register_or_co WHEN ((operation_mode = "two_level_adder_chain_out") or (operation_mode = "accumulator_chain_out" )) ELSE rs_dataout_bypass_register_or_o; rs_dataout_in <= ssa_dataout WHEN ((operation_mode = "36_bit_multiply") OR (operation_mode = "shift")) ELSE rs_dataout_of; rs_dataout_output_register : arriaii_mac_register GENERIC MAP ( data_width => 72 ) PORT MAP ( datain => rs_dataout_in, clk => rs_dataout_clk_or, aclr => rs_dataout_aclr_or, sload => rs_dataout_sload_or, bypass_register => rs_dataout_bypass_register_or, dataout => rs_dataout_out_reg ); -- Instantiate Round_Saturate saturation_overflow output register rs_saturation_overflow_in <= rs_saturation_overflow WHEN (saturate_pip_reg = '1') ELSE ssa_overflow; rs_saturation_overflow_output_register : arriaii_mac_bit_register PORT MAP ( datain => rs_saturation_overflow_in, clk => rs_dataout_clk_or, aclr => rs_dataout_aclr_or, sload => rs_dataout_sload_or, bypass_register => rs_dataout_bypass_register_or, dataout => rs_saturation_overflow_out_reg ); --Instantiate the rotate output Register rotate_clkval_or <= "0000" WHEN ((rotate_output_clock = "0") or (rotate_output_clock = "none")) ELSE "0001" WHEN (rotate_output_clock = "1") ELSE "0010" WHEN (rotate_output_clock = "2") ELSE "0011" WHEN (rotate_output_clock = "3") ELSE "0000" ; rotate_aclrval_or <= "0000" WHEN ((rotate_output_clear = "0") or (rotate_output_clear = "none")) ELSE "0001" WHEN (rotate_output_clear = "1") ELSE "0010" WHEN (rotate_output_clear = "2") ELSE "0011" WHEN (rotate_output_clear = "3") ELSE "0000" ; rotate_clk_or <= '1' WHEN clk(conv_integer(rotate_clkval_or)) = '1' ELSE '0'; rotate_aclr_or <= '1' WHEN (aclr(conv_integer(rotate_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; rotate_sload_or <= '1' WHEN ena(conv_integer(rotate_clkval_or)) = '1' ELSE '0'; rotate_bypass_register_or <= '1' WHEN (rotate_output_clock = "none") ELSE '0'; rotate_output_register : arriaii_mac_bit_register PORT MAP ( datain => rotate_pip_reg, clk => rotate_clk_or, aclr => rotate_aclr_or, sload => rotate_sload_or, bypass_register => rotate_bypass_register_or, dataout => rotate_out_reg ); --Instantiate the shiftright output Register shiftright_output_register : arriaii_mac_bit_register PORT MAP ( datain => shiftright_pip_reg, clk => shiftright_clk_or, aclr => shiftright_aclr_or, sload => shiftright_sload_or, bypass_register => shiftright_bypass_register_or, dataout => shiftright_out_reg ); shiftright_clkval_or <= "0000" WHEN ((shiftright_output_clock = "0") or (shiftright_output_clock = "none")) ELSE "0001" WHEN (shiftright_output_clock = "1") ELSE "0010" WHEN (shiftright_output_clock = "2") ELSE "0011" WHEN (shiftright_output_clock = "3") ELSE "0000" ; shiftright_aclrval_or <= "0000" WHEN ((shiftright_output_clear = "0") or (shiftright_output_clear = "none")) ELSE "0001" WHEN (shiftright_output_clear = "1") ELSE "0010" WHEN (shiftright_output_clear = "2") ELSE "0011" WHEN (shiftright_output_clear = "3") ELSE "0000" ; shiftright_clk_or <= '1' WHEN clk(conv_integer(shiftright_clkval_or)) = '1' ELSE '0'; shiftright_aclr_or <= '1' WHEN (aclr(conv_integer(shiftright_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; shiftright_sload_or <= '1' WHEN ena(conv_integer(shiftright_clkval_or)) = '1' ELSE '0'; shiftright_bypass_register_or <= '1' WHEN (shiftright_output_clock = "none") ELSE '0'; --Instantiate the roundchainout output Register roundchainout_clkval_or <= "0000" WHEN ((roundchainout_output_clock = "0") or (roundchainout_output_clock = "none")) ELSE "0001" WHEN (roundchainout_output_clock = "1") ELSE "0010" WHEN (roundchainout_output_clock = "2") ELSE "0011" WHEN (roundchainout_output_clock = "3") ELSE "0000" ; roundchainout_aclrval_or <= "0000" WHEN ((roundchainout_output_clear = "0") or (roundchainout_output_clear = "none")) ELSE "0001" WHEN (roundchainout_output_clear = "1") ELSE "0010" WHEN (roundchainout_output_clear = "2") ELSE "0011" WHEN (roundchainout_output_clear = "3") ELSE "0000" ; roundchainout_clk_or <= '1' WHEN clk(conv_integer(roundchainout_clkval_or)) = '1' ELSE '0'; roundchainout_aclr_or <= '1' WHEN (aclr(conv_integer(roundchainout_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; roundchainout_sload_or <= '1' WHEN ena(conv_integer(roundchainout_clkval_or)) = '1' ELSE '0'; roundchainout_bypass_register_or <= '1' WHEN (roundchainout_output_clock = "none") ELSE '0'; roundchainout_output_register : arriaii_mac_bit_register PORT MAP ( datain => roundchainout_pip_reg, clk => roundchainout_clk_or, aclr => roundchainout_aclr_or, sload => roundchainout_sload_or, bypass_register => roundchainout_bypass_register_or, dataout => roundchainout_out_reg ); --Instantiate the saturatechainout output Register saturatechainout_clkval_or <= "0000" WHEN ((saturatechainout_output_clock = "0") or (saturatechainout_output_clock = "none")) ELSE "0001" WHEN (saturatechainout_output_clock = "1") ELSE "0010" WHEN (saturatechainout_output_clock = "2") ELSE "0011" WHEN (saturatechainout_output_clock = "3") ELSE "0000" ; saturatechainout_aclrval_or <= "0000" WHEN ((saturatechainout_output_clear = "0") or (saturatechainout_output_clear = "none")) ELSE "0001" WHEN (saturatechainout_output_clear = "1") ELSE "0010" WHEN (saturatechainout_output_clear = "2") ELSE "0011" WHEN (saturatechainout_output_clear = "3") ELSE "0000" ; saturatechainout_clk_or <= '1' WHEN clk(conv_integer(saturatechainout_clkval_or)) = '1' ELSE '0'; saturatechainout_aclr_or <= '1' WHEN (aclr(conv_integer(saturatechainout_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; saturatechainout_sload_or <= '1' WHEN ena(conv_integer(saturatechainout_clkval_or)) = '1' ELSE '0'; saturatechainout_bypass_register_or <= '1' WHEN (saturatechainout_output_clock = "none") ELSE '0'; saturatechainout_output_register : arriaii_mac_bit_register PORT MAP ( datain => saturatechainout_pip_reg, clk => saturatechainout_clk_or, aclr => saturatechainout_aclr_or, sload => saturatechainout_sload_or, bypass_register => saturatechainout_bypass_register_or, dataout => saturatechainout_out_reg ); --Instantiate the Carry chainout Adder chainout_adder : arriaii_carry_chain_adder PORT MAP ( dataa => rs_dataout_out_reg, datab => chainin_coa_in, dataout => coa_dataout ); --Instantiate the carry chainout adder RS Block coa_rs_block : arriaii_round_saturate_block GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width, operation_mode => operation_mode, round_mode => round_chain_out_mode, saturate_mode => saturate_chain_out_mode, saturate_width => saturate_chain_out_width, round_width => round_chain_out_width ) PORT MAP ( datain => coa_dataout, round => roundchainout_out_reg, saturate => saturatechainout_out_reg, signa => signa_pip_reg, signb => signb_pip_reg, datain_width => ssa_datain_width, dataout => coa_rs_dataout, saturationoverflow => coa_rs_saturation_overflow ); --Instantiate the rs_saturation_overflow output register (after COA) coa_reg_clkval_or <= "0000" WHEN ((output_clock = "0") or (output_clock = "none")) ELSE "0001" WHEN (output_clock = "1") ELSE "0010" WHEN (output_clock = "2") ELSE "0011" WHEN (output_clock = "3") ELSE "0000" ; coa_reg_aclrval_or <= "0000" WHEN ((output_clear = "0") or (output_clear = "none")) ELSE "0001" WHEN (output_clear = "1") ELSE "0010" WHEN (output_clear = "2") ELSE "0011" WHEN (output_clear = "3") ELSE "0000" ; coa_reg_clk_or <= '1' WHEN clk(conv_integer(coa_reg_clkval_or)) = '1' ELSE '0'; coa_reg_aclr_or <= '1' WHEN (aclr(conv_integer(coa_reg_aclrval_or)) OR NOT devclrn OR NOT devpor) = '1' ELSE '0'; coa_reg_sload_or <= '1' WHEN ena(conv_integer(coa_reg_clkval_or)) = '1' ELSE '0'; coa_reg_bypass_register_or <= '1' WHEN (output_clock = "none") ELSE '0'; coa_rs_saturation_overflow_register : arriaii_mac_bit_register PORT MAP ( datain => rs_saturation_overflow_out_reg, clk => coa_reg_clk_or, aclr => coa_reg_aclr_or, sload => coa_reg_sload_or, bypass_register => '1', dataout => coa_rs_saturation_overflow_out_reg ); --Instantiate the rs_saturationchainout_overflow output register coa_rs_saturationchainout_overflow_register : arriaii_mac_bit_register PORT MAP ( datain => coa_rs_saturation_overflow, clk => coa_reg_clk_or, aclr => coa_reg_aclr_or, sload => coa_reg_sload_or, bypass_register => coa_reg_bypass_register_or, dataout => coa_rs_saturationchainout_overflow_out_reg ); -- Instantiate the coa_rs_dataout output register coa_rs_dataout_register : arriaii_mac_register GENERIC MAP ( data_width => 72 ) PORT MAP ( datain => coa_rs_dataout, clk => coa_reg_clk_or, aclr => coa_reg_aclr_or, sload => coa_reg_sload_or, bypass_register => coa_reg_bypass_register_or, dataout => coa_rs_dataout_out_reg ); --Instantiate the shift/Rotate Unit shift_rot_unit : arriaii_rotate_shift_block GENERIC MAP ( dataa_width => dataa_width, datab_width => datab_width ) PORT MAP ( datain => rs_dataout_out_reg, rotate => rotate_out_reg, shiftright => shiftright_out_reg, signa => signa_pip_reg, signb => signb_pip_reg, dataout => dataout_shift_rot ); --Assign the dataout depENDing on the mode of operation dataout_tmp <= coa_rs_dataout_out_reg when((operation_mode = "accumulator_chain_out")or(operation_mode = "two_level_adder_chain_out")) ELSE dataout_shift_rot when (operation_mode = "shift") ELSE rs_dataout_out_reg; --Assign the loopbackout for loopback mode loopbackout_tmp <= rs_dataout_out_reg when((operation_mode = "loopback") and (zeroloopback_out_reg = '0')) ELSE (others => '0'); --Assign the saturation overflow output saturation_overflow_tmp <= rs_saturation_overflow_out_reg when((operation_mode = "accumulator") or(operation_mode = "two_level_adder")) ELSE coa_rs_saturation_overflow_out_reg when((operation_mode = "accumulator_chain_out")or(operation_mode = "two_level_adder_chain_out")) ELSE '0'; --Assign the saturationchainout overflow output saturationchainout_overflow_tmp <= coa_rs_saturationchainout_overflow_out_reg when((operation_mode = "accumulator_chain_out") or(operation_mode = "two_level_adder_chain_out")) ELSE '0'; dataout <= (others => '0') WHEN (((operation_mode = "accumulator_chain_out")or(operation_mode = "two_level_adder_chain_out")) and (zerochainout_out_reg = '1')) ELSE dataout_tmp; loopbackout <= loopbackout_tmp(35 downto 18); overflow <= saturation_overflow_tmp; saturatechainoutoverflow <= saturationchainout_overflow_tmp; END arch; ---------------------------------------------------------------------------- -- Module Name : arriaii_io_pad -- Description : Simulation model for arriaii IO pad ---------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; ENTITY arriaii_io_pad IS GENERIC ( lpm_type : string := "arriaii_io_pad"); PORT ( --INPUT PORTS padin : IN std_logic := '0'; -- Input Pad --OUTPUT PORTS padout : OUT std_logic); -- Output Pad END arriaii_io_pad; ARCHITECTURE arch OF arriaii_io_pad IS BEGIN padout <= padin; END arch; --/////////////////////////////////////////////////////////////////////////// -- -- Entity Name : arriaii_mn_cntr -- -- Description : Timing simulation model for the M and N counter. This is a -- common model for the input counter and the loop feedback -- counter of the PiranhaII PLL. -- --/////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_arith.all; USE IEEE.std_logic_unsigned.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; ENTITY arriaii_mn_cntr is PORT( clk : IN std_logic; reset : IN std_logic := '0'; cout : OUT std_logic; initial_value : IN integer := 1; modulus : IN integer := 1; time_delay : IN integer := 0 ); END arriaii_mn_cntr; ARCHITECTURE behave of arriaii_mn_cntr is begin process (clk, reset) variable count : integer := 1; variable first_rising_edge : boolean := true; variable tmp_cout : std_logic; begin if (reset = '1') then count := 1; tmp_cout := '0'; first_rising_edge := true; elsif (clk'event) then if (clk = '1' and first_rising_edge) then first_rising_edge := false; tmp_cout := clk; elsif (not first_rising_edge) then if (count < modulus) then count := count + 1; else count := 1; tmp_cout := not tmp_cout; end if; end if; end if; cout <= transport tmp_cout after time_delay * 1 ps; end process; end behave; --///////////////////////////////////////////////////////////////////////////// -- -- Entity Name : arriaii_scale_cntr -- -- Description : Timing simulation model for the output scale-down counters. -- This is a common model for the C0, C1, C2, C3, C4 and C5 -- output counters of the PiranhaII PLL. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; ENTITY arriaii_scale_cntr is PORT( clk : IN std_logic; reset : IN std_logic := '0'; initial : IN integer := 1; high : IN integer := 1; low : IN integer := 1; mode : IN string := "bypass"; ph_tap : IN integer := 0; cout : OUT std_logic ); END arriaii_scale_cntr; ARCHITECTURE behave of arriaii_scale_cntr is begin process (clk, reset) variable tmp_cout : std_logic := '0'; variable count : integer := 1; variable output_shift_count : integer := 1; variable first_rising_edge : boolean := false; begin if (reset = '1') then count := 1; output_shift_count := 1; tmp_cout := '0'; first_rising_edge := false; elsif (clk'event) then if (mode = " off") then tmp_cout := '0'; elsif (mode = "bypass") then tmp_cout := clk; first_rising_edge := true; elsif (not first_rising_edge) then if (clk = '1') then if (output_shift_count = initial) then tmp_cout := clk; first_rising_edge := true; else output_shift_count := output_shift_count + 1; end if; end if; elsif (output_shift_count < initial) then if (clk = '1') then output_shift_count := output_shift_count + 1; end if; else count := count + 1; if (mode = " even" and (count = (high*2) + 1)) then tmp_cout := '0'; elsif (mode = " odd" and (count = high*2)) then tmp_cout := '0'; elsif (count = (high + low)*2 + 1) then tmp_cout := '1'; count := 1; -- reset count end if; end if; end if; cout <= transport tmp_cout; end process; end behave; --///////////////////////////////////////////////////////////////////////////// -- -- Entity Name : arriaii_pll_reg -- -- Description : Simulation model for a simple DFF. -- This is required for the generation of the bit slip-signals. -- No timing, powers upto 0. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE IEEE.std_logic_1164.all; ENTITY arriaii_pll_reg is PORT( clk : in std_logic; ena : in std_logic := '1'; d : in std_logic; clrn : in std_logic := '1'; prn : in std_logic := '1'; q : out std_logic ); end arriaii_pll_reg; ARCHITECTURE behave of arriaii_pll_reg is begin process (clk, prn, clrn) variable q_reg : std_logic := '0'; begin if (prn = '0') then q_reg := '1'; elsif (clrn = '0') then q_reg := '0'; elsif (clk'event and clk = '1' and (ena = '1')) then q_reg := D; end if; Q <= q_reg; end process; end behave; --/////////////////////////////////////////////////////////////////////////// -- -- Entity Name : arriaii_pll -- -- Description : Timing simulation model for the PiranhaII PLL. -- In the functional mode, it is also the model for the altpll -- megafunction. -- -- Limitations : Does not support Spread Spectrum and Bandwidth. -- -- Outputs : Up to 10 output clocks, each defined by its own set of -- parameters. Locked output (active high) indicates when the -- PLL locks. clkbad and activeclock are used for -- clock switchover to indicate which input clock has gone -- bad, when the clock switchover initiates and which input -- clock is being used as the reference, respectively. -- scandataout is the data output of the serial scan chain. -- --/////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE IEEE.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE STD.TEXTIO.all; USE work.arriaii_atom_pack.all; USE work.arriaii_pllpack.all; USE work.arriaii_mn_cntr; USE work.arriaii_scale_cntr; USE work.arriaii_dffe; USE work.arriaii_pll_reg; -- New Features : The list below outlines key new features in ARRIAII: -- 1. Dynamic Phase Reconfiguration -- 2. Dynamic PLL Reconfiguration (different protocol) -- 3. More output counters ENTITY arriaii_pll is GENERIC ( operation_mode : string := "normal"; pll_type : string := "auto"; -- AUTO/FAST/ENHANCED/LEFT_RIGHT/TOP_BOTTOM compensate_clock : string := "clock0"; inclk0_input_frequency : integer := 0; inclk1_input_frequency : integer := 0; self_reset_on_loss_lock : string := "off"; switch_over_type : string := "auto"; switch_over_counter : integer := 1; enable_switch_over_counter : string := "off"; dpa_multiply_by : integer := 0; dpa_divide_by : integer := 0; dpa_divider : integer := 0; bandwidth : integer := 0; bandwidth_type : string := "auto"; use_dc_coupling : string := "false"; lock_c : integer := 4; sim_gate_lock_device_behavior : string := "off"; lock_high : integer := 0; lock_low : integer := 0; lock_window_ui : string := "0.05"; lock_window : time := 5 ps; test_bypass_lock_detect : string := "off"; clk0_output_frequency : integer := 0; clk0_multiply_by : integer := 0; clk0_divide_by : integer := 0; clk0_phase_shift : string := "0"; clk0_duty_cycle : integer := 50; clk1_output_frequency : integer := 0; clk1_multiply_by : integer := 0; clk1_divide_by : integer := 0; clk1_phase_shift : string := "0"; clk1_duty_cycle : integer := 50; clk2_output_frequency : integer := 0; clk2_multiply_by : integer := 0; clk2_divide_by : integer := 0; clk2_phase_shift : string := "0"; clk2_duty_cycle : integer := 50; clk3_output_frequency : integer := 0; clk3_multiply_by : integer := 0; clk3_divide_by : integer := 0; clk3_phase_shift : string := "0"; clk3_duty_cycle : integer := 50; clk4_output_frequency : integer := 0; clk4_multiply_by : integer := 0; clk4_divide_by : integer := 0; clk4_phase_shift : string := "0"; clk4_duty_cycle : integer := 50; clk5_output_frequency : integer := 0; clk5_multiply_by : integer := 0; clk5_divide_by : integer := 0; clk5_phase_shift : string := "0"; clk5_duty_cycle : integer := 50; clk6_output_frequency : integer := 0; clk6_multiply_by : integer := 0; clk6_divide_by : integer := 0; clk6_phase_shift : string := "0"; clk6_duty_cycle : integer := 50; clk7_output_frequency : integer := 0; clk7_multiply_by : integer := 0; clk7_divide_by : integer := 0; clk7_phase_shift : string := "0"; clk7_duty_cycle : integer := 50; clk8_output_frequency : integer := 0; clk8_multiply_by : integer := 0; clk8_divide_by : integer := 0; clk8_phase_shift : string := "0"; clk8_duty_cycle : integer := 50; clk9_output_frequency : integer := 0; clk9_multiply_by : integer := 0; clk9_divide_by : integer := 0; clk9_phase_shift : string := "0"; clk9_duty_cycle : integer := 50; pfd_min : integer := 0; pfd_max : integer := 0; vco_min : integer := 0; vco_max : integer := 0; vco_center : integer := 0; -- ADVANCED USER PARAMETERS m_initial : integer := 1; m : integer := 0; n : integer := 1; c0_high : integer := 1; c0_low : integer := 1; c0_initial : integer := 1; c0_mode : string := "bypass"; c0_ph : integer := 0; c1_high : integer := 1; c1_low : integer := 1; c1_initial : integer := 1; c1_mode : string := "bypass"; c1_ph : integer := 0; c2_high : integer := 1; c2_low : integer := 1; c2_initial : integer := 1; c2_mode : string := "bypass"; c2_ph : integer := 0; c3_high : integer := 1; c3_low : integer := 1; c3_initial : integer := 1; c3_mode : string := "bypass"; c3_ph : integer := 0; c4_high : integer := 1; c4_low : integer := 1; c4_initial : integer := 1; c4_mode : string := "bypass"; c4_ph : integer := 0; c5_high : integer := 1; c5_low : integer := 1; c5_initial : integer := 1; c5_mode : string := "bypass"; c5_ph : integer := 0; c6_high : integer := 1; c6_low : integer := 1; c6_initial : integer := 1; c6_mode : string := "bypass"; c6_ph : integer := 0; c7_high : integer := 1; c7_low : integer := 1; c7_initial : integer := 1; c7_mode : string := "bypass"; c7_ph : integer := 0; c8_high : integer := 1; c8_low : integer := 1; c8_initial : integer := 1; c8_mode : string := "bypass"; c8_ph : integer := 0; c9_high : integer := 1; c9_low : integer := 1; c9_initial : integer := 1; c9_mode : string := "bypass"; c9_ph : integer := 0; m_ph : integer := 0; clk0_counter : string := "unused"; clk1_counter : string := "unused"; clk2_counter : string := "unused"; clk3_counter : string := "unused"; clk4_counter : string := "unused"; clk5_counter : string := "unused"; clk6_counter : string := "unused"; clk7_counter : string := "unused"; clk8_counter : string := "unused"; clk9_counter : string := "unused"; c1_use_casc_in : string := "off"; c2_use_casc_in : string := "off"; c3_use_casc_in : string := "off"; c4_use_casc_in : string := "off"; c5_use_casc_in : string := "off"; c6_use_casc_in : string := "off"; c7_use_casc_in : string := "off"; c8_use_casc_in : string := "off"; c9_use_casc_in : string := "off"; m_test_source : integer := -1; c0_test_source : integer := -1; c1_test_source : integer := -1; c2_test_source : integer := -1; c3_test_source : integer := -1; c4_test_source : integer := -1; c5_test_source : integer := -1; c6_test_source : integer := -1; c7_test_source : integer := -1; c8_test_source : integer := -1; c9_test_source : integer := -1; vco_multiply_by : integer := 0; vco_divide_by : integer := 0; vco_post_scale : integer := 1; vco_frequency_control : string := "auto"; vco_phase_shift_step : integer := 0; charge_pump_current : integer := 10; loop_filter_r : string := " 1.0"; loop_filter_c : integer := 0; pll_compensation_delay : integer := 0; simulation_type : string := "functional"; lpm_type : string := "arriaii_pll"; clk0_use_even_counter_mode : string := "off"; clk1_use_even_counter_mode : string := "off"; clk2_use_even_counter_mode : string := "off"; clk3_use_even_counter_mode : string := "off"; clk4_use_even_counter_mode : string := "off"; clk5_use_even_counter_mode : string := "off"; clk6_use_even_counter_mode : string := "off"; clk7_use_even_counter_mode : string := "off"; clk8_use_even_counter_mode : string := "off"; clk9_use_even_counter_mode : string := "off"; clk0_use_even_counter_value : string := "off"; clk1_use_even_counter_value : string := "off"; clk2_use_even_counter_value : string := "off"; clk3_use_even_counter_value : string := "off"; clk4_use_even_counter_value : string := "off"; clk5_use_even_counter_value : string := "off"; clk6_use_even_counter_value : string := "off"; clk7_use_even_counter_value : string := "off"; clk8_use_even_counter_value : string := "off"; clk9_use_even_counter_value : string := "off"; -- Test only init_block_reset_a_count : integer := 1; init_block_reset_b_count : integer := 1; charge_pump_current_bits : integer := 0; lock_window_ui_bits : integer := 0; loop_filter_c_bits : integer := 0; loop_filter_r_bits : integer := 0; test_counter_c0_delay_chain_bits : integer := 0; test_counter_c1_delay_chain_bits : integer := 0; test_counter_c2_delay_chain_bits : integer := 0; test_counter_c3_delay_chain_bits : integer := 0; test_counter_c4_delay_chain_bits : integer := 0; test_counter_c5_delay_chain_bits : integer := 0; test_counter_c6_delay_chain_bits : integer := 0; test_counter_c7_delay_chain_bits : integer := 0; test_counter_c8_delay_chain_bits : integer := 0; test_counter_c9_delay_chain_bits : integer := 0; test_counter_m_delay_chain_bits : integer := 0; test_counter_n_delay_chain_bits : integer := 0; test_feedback_comp_delay_chain_bits : integer := 0; test_input_comp_delay_chain_bits : integer := 0; test_volt_reg_output_mode_bits : integer := 0; test_volt_reg_output_voltage_bits : integer := 0; test_volt_reg_test_mode : string := "false"; vco_range_detector_high_bits : integer := -1; vco_range_detector_low_bits : integer := -1; scan_chain_mif_file : string := ""; dpa_output_clock_phase_shift : integer := 0; test_counter_c3_sclk_delay_chain_bits : integer := -1; test_counter_c4_sclk_delay_chain_bits : integer := -1; test_counter_c5_lden_delay_chain_bits : integer := -1; test_counter_c6_lden_delay_chain_bits : integer := -1; auto_settings : string := "true"; -- Simulation only generics family_name : string := "PiranhaIII"; -- VITAL generics XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; TimingChecksOn : Boolean := true; InstancePath : STRING := "*"; tipd_inclk : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01); tipd_ena : VitalDelayType01 := DefPropDelay01; tipd_pfdena : VitalDelayType01 := DefPropDelay01; tipd_areset : VitalDelayType01 := DefPropDelay01; tipd_fbin : VitalDelayType01 := DefPropDelay01; tipd_scanclk : VitalDelayType01 := DefPropDelay01; tipd_scanclkena : VitalDelayType01 := DefPropDelay01; tipd_scandata : VitalDelayType01 := DefPropDelay01; tipd_configupdate : VitalDelayType01 := DefPropDelay01; tipd_clkswitch : VitalDelayType01 := DefPropDelay01; tipd_phaseupdown : VitalDelayType01 := DefPropDelay01; tipd_phasecounterselect : VitalDelayArrayType01(3 DOWNTO 0) := (OTHERS => DefPropDelay01); tipd_phasestep : VitalDelayType01 := DefPropDelay01; tsetup_scandata_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_scandata_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst; tsetup_scanclkena_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_scanclkena_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst; use_vco_bypass : string := "false" ); PORT ( inclk : in std_logic_vector(1 downto 0); fbin : in std_logic := '0'; fbout : out std_logic; clkswitch : in std_logic := '0'; areset : in std_logic := '0'; pfdena : in std_logic := '1'; scandata : in std_logic := '0'; scanclk : in std_logic := '0'; scanclkena : in std_logic := '1'; configupdate : in std_logic := '0'; clk : out std_logic_vector(9 downto 0); phasecounterselect : in std_logic_vector(3 downto 0) := "0000"; phaseupdown : in std_logic := '0'; phasestep : in std_logic := '0'; clkbad : out std_logic_vector(1 downto 0); activeclock : out std_logic; locked : out std_logic; scandataout : out std_logic; scandone : out std_logic; phasedone : out std_logic; vcooverrange : out std_logic; vcounderrange : out std_logic ); END arriaii_pll; ARCHITECTURE vital_pll of arriaii_pll is function get_vco_min_no_division(i_vco_post_scale : INTEGER) return INTEGER is begin if (i_vco_post_scale = 1) then return vco_min * 2; else return vco_min; end if; end; function get_vco_max_no_division(i_vco_post_scale : INTEGER) return INTEGER is begin if (i_vco_post_scale = 1) then return vco_max * 2; else return vco_max; end if; end; TYPE int_array is ARRAY(NATURAL RANGE <>) of integer; TYPE str_array is ARRAY(NATURAL RANGE <>) of string(1 to 6); TYPE str_array1 is ARRAY(NATURAL RANGE <>) of string(1 to 9); TYPE std_logic_array is ARRAY(NATURAL RANGE <>) of std_logic; constant VCO_MIN_NO_DIVISION : integer := get_vco_min_no_division(vco_post_scale); constant VCO_MAX_NO_DIVISION : integer := get_vco_max_no_division(vco_post_scale); -- internal advanced parameter signals signal i_vco_min : integer := vco_min; signal i_vco_max : integer := vco_max; signal i_vco_center : integer; signal i_pfd_min : integer; signal i_pfd_max : integer; signal c_ph_val : int_array(0 to 9) := (OTHERS => 0); signal c_ph_val_tmp : int_array(0 to 9) := (OTHERS => 0); signal c_high_val : int_array(0 to 9) := (OTHERS => 1); signal c_low_val : int_array(0 to 9) := (OTHERS => 1); signal c_initial_val : int_array(0 to 9) := (OTHERS => 1); signal c_mode_val : str_array(0 to 9); signal clk_num : str_array(0 to 9); -- old values signal c_high_val_old : int_array(0 to 9) := (OTHERS => 1); signal c_low_val_old : int_array(0 to 9) := (OTHERS => 1); signal c_ph_val_old : int_array(0 to 9) := (OTHERS => 0); signal c_mode_val_old : str_array(0 to 9); -- hold registers signal c_high_val_hold : int_array(0 to 9) := (OTHERS => 1); signal c_low_val_hold : int_array(0 to 9) := (OTHERS => 1); signal c_ph_val_hold : int_array(0 to 9) := (OTHERS => 0); signal c_mode_val_hold : str_array(0 to 9); -- temp registers signal sig_c_ph_val_tmp : int_array(0 to 9) := (OTHERS => 0); signal c_ph_val_orig : int_array(0 to 9) := (OTHERS => 0); signal i_clk9_counter : integer := 9; signal i_clk8_counter : integer := 8; signal i_clk7_counter : integer := 7; signal i_clk6_counter : integer := 6; signal i_clk5_counter : integer := 5; signal real_lock_high : integer := 0; signal i_clk4_counter : integer := 4; signal i_clk3_counter : integer := 3; signal i_clk2_counter : integer := 2; signal i_clk1_counter : integer := 1; signal i_clk0_counter : integer := 0; signal i_charge_pump_current : integer; signal i_loop_filter_r : integer; -- end internal advanced parameter signals -- CONSTANTS CONSTANT SCAN_CHAIN : integer := 144; CONSTANT GPP_SCAN_CHAIN : integer := 234; CONSTANT FAST_SCAN_CHAIN : integer := 180; CONSTANT cntrs : str_array(9 downto 0) := (" C9", " C8", " C7", " C6", " C5", " C4", " C3", " C2", " C1", " C0"); CONSTANT ss_cntrs : str_array(0 to 3) := (" M", " M2", " N", " N2"); CONSTANT loop_filter_c_arr : int_array(0 to 3) := (0,0,0,0); CONSTANT fpll_loop_filter_c_arr : int_array(0 to 3) := (0,0,0,0); CONSTANT charge_pump_curr_arr : int_array(0 to 15) := (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); CONSTANT num_phase_taps : integer := 8; -- signals signal vcc : std_logic := '1'; signal fbclk : std_logic; signal refclk : std_logic; signal vco_over : std_logic := '0'; signal vco_under : std_logic := '1'; signal pll_locked : boolean := false; signal c_clk : std_logic_array(0 to 9); signal vco_out : std_logic_vector(7 downto 0) := (OTHERS => '0'); -- signals to assign values to counter params signal m_val : integer := 1; signal n_val : integer := 1; signal m_ph_val : integer := 0; signal m_ph_initial : integer := 0; signal m_ph_val_tmp : integer := 0; signal m_initial_val : integer := m_initial; signal m_mode_val : string(1 to 6) := " "; signal n_mode_val : string(1 to 6) := " "; signal lfc_val : integer := 0; signal vco_cur : integer := vco_post_scale; signal cp_curr_val : integer := 0; signal lfr_val : string(1 to 2) := " "; signal cp_curr_old_bit_setting : integer := charge_pump_current_bits; signal cp_curr_val_bit_setting : std_logic_vector(2 downto 0) := (OTHERS => '0'); signal lfr_old_bit_setting : integer := loop_filter_r_bits; signal lfr_val_bit_setting : std_logic_vector(4 downto 0) := (OTHERS => '0'); signal lfc_old_bit_setting : integer := loop_filter_c_bits; signal lfc_val_bit_setting : std_logic_vector(1 downto 0) := (OTHERS => '0'); signal pll_reconfig_display_full_setting : boolean := FALSE; -- display full setting, change to true -- old values signal m_val_old : integer := 1; signal n_val_old : integer := 1; signal m_mode_val_old : string(1 to 6) := " "; signal n_mode_val_old : string(1 to 6) := " "; signal m_ph_val_old : integer := 0; signal lfc_old : integer := 0; signal vco_old : integer := 0; signal cp_curr_old : integer := 0; signal lfr_old : string(1 to 2) := " "; signal num_output_cntrs : integer := 10; signal scanclk_period : time := 1 ps; signal scan_data : std_logic_vector(0 to 233) := (OTHERS => '0'); signal clk_pfd : std_logic_vector(0 to 9); signal clk0_tmp : std_logic; signal clk1_tmp : std_logic; signal clk2_tmp : std_logic; signal clk3_tmp : std_logic; signal clk4_tmp : std_logic; signal clk5_tmp : std_logic; signal clk6_tmp : std_logic; signal clk7_tmp : std_logic; signal clk8_tmp : std_logic; signal clk9_tmp : std_logic; signal update_conf_latches : std_logic := '0'; signal update_conf_latches_reg : std_logic := '0'; signal clkin : std_logic := '0'; signal gate_locked : std_logic := '0'; signal pfd_locked : std_logic := '0'; signal lock : std_logic := '0'; signal about_to_lock : boolean := false; signal reconfig_err : boolean := false; signal inclk_c0 : std_logic; signal inclk_c1 : std_logic; signal inclk_c2 : std_logic; signal inclk_c3 : std_logic; signal inclk_c4 : std_logic; signal inclk_c5 : std_logic; signal inclk_c6 : std_logic; signal inclk_c7 : std_logic; signal inclk_c8 : std_logic; signal inclk_c9 : std_logic; signal inclk_m : std_logic; signal devpor : std_logic; signal devclrn : std_logic; signal inclk0_ipd : std_logic; signal inclk1_ipd : std_logic; signal pfdena_ipd : std_logic; signal areset_ipd : std_logic; signal fbin_ipd : std_logic; signal scanclk_ipd : std_logic; signal scanclkena_ipd, scanclkena_reg : std_logic; signal scandata_ipd : std_logic; signal clkswitch_ipd : std_logic; signal phasecounterselect_ipd : std_logic_vector(3 downto 0); signal phaseupdown_ipd : std_logic; signal phasestep_ipd : std_logic; signal configupdate_ipd : std_logic; -- registered signals signal sig_offset : time := 0 ps; signal sig_refclk_time : time := 0 ps; signal sig_fbclk_period : time := 0 ps; signal sig_vco_period_was_phase_adjusted : boolean := false; signal sig_phase_adjust_was_scheduled : boolean := false; signal sig_stop_vco : std_logic := '0'; signal sig_m_times_vco_period : time := 0 ps; signal sig_new_m_times_vco_period : time := 0 ps; signal sig_got_refclk_posedge : boolean := false; signal sig_got_fbclk_posedge : boolean := false; signal sig_got_second_refclk : boolean := false; signal m_delay : integer := 0; signal n_delay : integer := 0; signal inclk1_tmp : std_logic := '0'; signal reset_low : std_logic := '0'; -- Phase Reconfig SIGNAL phasecounterselect_reg : std_logic_vector(3 DOWNTO 0); SIGNAL phaseupdown_reg : std_logic := '0'; SIGNAL phasestep_reg : std_logic := '0'; SIGNAL phasestep_high_count : integer := 0; SIGNAL update_phase : std_logic := '0'; signal scandataout_tmp : std_logic := '0'; signal scandata_in : std_logic := '0'; signal scandata_out : std_logic := '0'; signal scandone_tmp : std_logic := '1'; signal initiate_reconfig : std_logic := '0'; signal sig_refclk_period : time := (inclk0_input_frequency * 1 ps) * n; signal schedule_vco : std_logic := '0'; signal areset_ena_sig : std_logic := '0'; signal pll_in_test_mode : boolean := false; signal pll_has_just_been_reconfigured : boolean := false; signal inclk_c_from_vco : std_logic_array(0 to 9); signal inclk_m_from_vco : std_logic; SIGNAL inclk0_period : time := 0 ps; SIGNAL last_inclk0_period : time := 0 ps; SIGNAL last_inclk0_edge : time := 0 ps; SIGNAL first_inclk0_edge_detect : STD_LOGIC := '0'; SIGNAL inclk1_period : time := 0 ps; SIGNAL last_inclk1_period : time := 0 ps; SIGNAL last_inclk1_edge : time := 0 ps; SIGNAL first_inclk1_edge_detect : STD_LOGIC := '0'; COMPONENT arriaii_mn_cntr PORT ( clk : IN std_logic; reset : IN std_logic := '0'; cout : OUT std_logic; initial_value : IN integer := 1; modulus : IN integer := 1; time_delay : IN integer := 0 ); END COMPONENT; COMPONENT arriaii_scale_cntr PORT ( clk : IN std_logic; reset : IN std_logic := '0'; cout : OUT std_logic; initial : IN integer := 1; high : IN integer := 1; low : IN integer := 1; mode : IN string := "bypass"; ph_tap : IN integer := 0 ); END COMPONENT; COMPONENT arriaii_dffe GENERIC( TimingChecksOn: Boolean := true; InstancePath: STRING := "*"; XOn: Boolean := DefGlitchXOn; MsgOn: Boolean := DefGlitchMsgOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; tpd_PRN_Q_negedge : VitalDelayType01 := DefPropDelay01; tpd_CLRN_Q_negedge : VitalDelayType01 := DefPropDelay01; tpd_CLK_Q_posedge : VitalDelayType01 := DefPropDelay01; tpd_ENA_Q_posedge : VitalDelayType01 := DefPropDelay01; tsetup_D_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_D_CLK_noedge_negedge : VitalDelayType := DefSetupHoldCnst; tsetup_ENA_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_D_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_D_CLK_noedge_negedge : VitalDelayType := DefSetupHoldCnst; thold_ENA_CLK_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tipd_D : VitalDelayType01 := DefPropDelay01; tipd_CLRN : VitalDelayType01 := DefPropDelay01; tipd_PRN : VitalDelayType01 := DefPropDelay01; tipd_CLK : VitalDelayType01 := DefPropDelay01; tipd_ENA : VitalDelayType01 := DefPropDelay01); PORT( Q : out STD_LOGIC := '0'; D : in STD_LOGIC := '1'; CLRN : in STD_LOGIC := '1'; PRN : in STD_LOGIC := '1'; CLK : in STD_LOGIC := '0'; ENA : in STD_LOGIC := '1'); END COMPONENT; COMPONENT arriaii_pll_reg PORT( Q : out STD_LOGIC := '0'; D : in STD_LOGIC := '1'; CLRN : in STD_LOGIC := '1'; PRN : in STD_LOGIC := '1'; CLK : in STD_LOGIC := '0'; ENA : in STD_LOGIC := '1'); END COMPONENT; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (inclk0_ipd, inclk(0), tipd_inclk(0)); VitalWireDelay (inclk1_ipd, inclk(1), tipd_inclk(1)); VitalWireDelay (areset_ipd, areset, tipd_areset); VitalWireDelay (fbin_ipd, fbin, tipd_fbin); VitalWireDelay (pfdena_ipd, pfdena, tipd_pfdena); VitalWireDelay (scanclk_ipd, scanclk, tipd_scanclk); VitalWireDelay (scanclkena_ipd, scanclkena, tipd_scanclkena); VitalWireDelay (scandata_ipd, scandata, tipd_scandata); VitalWireDelay (configupdate_ipd, configupdate, tipd_configupdate); VitalWireDelay (clkswitch_ipd, clkswitch, tipd_clkswitch); VitalWireDelay (phaseupdown_ipd, phaseupdown, tipd_phaseupdown); VitalWireDelay (phasestep_ipd, phasestep, tipd_phasestep); VitalWireDelay (phasecounterselect_ipd(0), phasecounterselect(0), tipd_phasecounterselect(0)); VitalWireDelay (phasecounterselect_ipd(1), phasecounterselect(1), tipd_phasecounterselect(1)); VitalWireDelay (phasecounterselect_ipd(2), phasecounterselect(2), tipd_phasecounterselect(2)); VitalWireDelay (phasecounterselect_ipd(3), phasecounterselect(3), tipd_phasecounterselect(3)); end block; inclk_m <= fbclk when m_test_source = 0 else refclk when m_test_source = 1 else inclk_m_from_vco; areset_ena_sig <= areset_ipd or sig_stop_vco; pll_in_test_mode <= true when (m_test_source /= -1 or c0_test_source /= -1 or c1_test_source /= -1 or c2_test_source /= -1 or c3_test_source /= -1 or c4_test_source /= -1 or c5_test_source /= -1 or c6_test_source /= -1 or c7_test_source /= -1 or c8_test_source /= -1 or c9_test_source /= -1) else false; real_lock_high <= lock_high WHEN (sim_gate_lock_device_behavior = "on") ELSE 0; m1 : arriaii_mn_cntr port map ( clk => inclk_m, reset => areset_ena_sig, cout => fbclk, initial_value => m_initial_val, modulus => m_val, time_delay => m_delay ); -- add delta delay to inclk1 to ensure inclk0 and inclk1 are processed -- in different simulation deltas. inclk1_tmp <= inclk1_ipd; -- Calculate the inclk0 period PROCESS VARIABLE inclk0_period_tmp : time := 0 ps; BEGIN WAIT UNTIL (inclk0_ipd'EVENT AND inclk0_ipd = '1'); IF (first_inclk0_edge_detect = '0') THEN first_inclk0_edge_detect <= '1'; ELSE last_inclk0_period <= inclk0_period; inclk0_period_tmp := NOW - last_inclk0_edge; END IF; last_inclk0_edge <= NOW; inclk0_period <= inclk0_period_tmp; END PROCESS; -- Calculate the inclk1 period PROCESS VARIABLE inclk1_period_tmp : time := 0 ps; BEGIN WAIT UNTIL (inclk1_ipd'EVENT AND inclk1_ipd = '1'); IF (first_inclk1_edge_detect = '0') THEN first_inclk1_edge_detect <= '1'; ELSE last_inclk1_period <= inclk1_period; inclk1_period_tmp := NOW - last_inclk1_edge; END IF; last_inclk1_edge <= NOW; inclk1_period <= inclk1_period_tmp; END PROCESS; process (inclk0_ipd, inclk1_tmp, clkswitch_ipd) variable input_value : std_logic := '0'; variable current_clock : integer := 0; variable clk0_count, clk1_count : integer := 0; variable clk0_is_bad, clk1_is_bad : std_logic := '0'; variable primary_clk_is_bad : boolean := false; variable current_clk_is_bad : boolean := false; variable got_curr_clk_falling_edge_after_clkswitch : boolean := false; variable switch_over_count : integer := 0; variable active_clock : std_logic := '0'; variable external_switch : boolean := false; variable diff_percent_period : integer := 0; variable buf : line; variable switch_clock : boolean := false; begin if (now = 0 ps) then if (switch_over_type = "manual" and clkswitch_ipd = '1') then current_clock := 1; active_clock := '1'; end if; end if; if (clkswitch_ipd'event and clkswitch_ipd = '1' and switch_over_type = "auto") then external_switch := true; elsif (switch_over_type = "manual") then if (clkswitch_ipd'event and clkswitch_ipd = '1') then switch_clock := true; elsif (clkswitch_ipd'event and clkswitch_ipd = '0') then switch_clock := false; end if; end if; if (switch_clock = true) then if (inclk0_ipd'event or inclk1_tmp'event) then if (current_clock = 0) then current_clock := 1; active_clock := '1'; clkin <= transport inclk1_tmp; elsif (current_clock = 1) then current_clock := 0; active_clock := '0'; clkin <= transport inclk0_ipd; end if; switch_clock := false; end if; end if; -- save the current inclk event value if (inclk0_ipd'event) then input_value := inclk0_ipd; elsif (inclk1_tmp'event) then input_value := inclk1_tmp; end if; -- check if either input clk is bad if (inclk0_ipd'event and inclk0_ipd = '1') then clk0_count := clk0_count + 1; clk0_is_bad := '0'; clk1_count := 0; if (clk0_count > 2) then -- no event on other clk for 2 cycles clk1_is_bad := '1'; if (current_clock = 1) then current_clk_is_bad := true; end if; end if; end if; if (inclk1_tmp'event and inclk1_tmp = '1') then clk1_count := clk1_count + 1; clk1_is_bad := '0'; clk0_count := 0; if (clk1_count > 2) then -- no event on other clk for 2 cycles clk0_is_bad := '1'; if (current_clock = 0) then current_clk_is_bad := true; end if; end if; end if; -- check if the bad clk is the primary clock if (clk0_is_bad = '1') then primary_clk_is_bad := true; else primary_clk_is_bad := false; end if; -- actual switching if (inclk0_ipd'event and current_clock = 0) then if (external_switch) then if (not got_curr_clk_falling_edge_after_clkswitch) then if (inclk0_ipd = '0') then got_curr_clk_falling_edge_after_clkswitch := true; end if; clkin <= transport inclk0_ipd; end if; else clkin <= transport inclk0_ipd; end if; elsif (inclk1_tmp'event and current_clock = 1) then if (external_switch) then if (not got_curr_clk_falling_edge_after_clkswitch) then if (inclk1_tmp = '0') then got_curr_clk_falling_edge_after_clkswitch := true; end if; clkin <= transport inclk1_tmp; end if; else clkin <= transport inclk1_tmp; end if; else if (input_value = '1' and enable_switch_over_counter = "on" and primary_clk_is_bad) then switch_over_count := switch_over_count + 1; end if; if ((input_value = '0')) then if (external_switch and (got_curr_clk_falling_edge_after_clkswitch or current_clk_is_bad)) or (primary_clk_is_bad and clkswitch_ipd /= '1' and (enable_switch_over_counter = "off" or switch_over_count = switch_over_counter)) then got_curr_clk_falling_edge_after_clkswitch := false; if (areset_ipd = '0') then if ((inclk0_period > inclk1_period) and (inclk1_period /= 0 ps)) then diff_percent_period := (( inclk0_period - inclk1_period ) * 100) / inclk1_period; elsif (inclk0_period /= 0 ps) then diff_percent_period := (( inclk1_period - inclk0_period ) * 100) / inclk0_period; end if; if((diff_percent_period > 20)and ( switch_over_type = "auto")) then WRITE(buf,string'("Warning : The input clock frequencies specified for the specified PLL are too far apart for auto-switch-over feature to work properly. Please make sure that the clock frequencies are 20 percent apart for correct functionality.")); writeline(output, buf); end if; end if; if (current_clock = 0) then current_clock := 1; else current_clock := 0; end if; active_clock := not active_clock; switch_over_count := 0; external_switch := false; current_clk_is_bad := false; else if(switch_over_type = "auto") then if(current_clock = 0 and clk0_is_bad = '1' and clk1_is_bad = '0' ) then current_clock := 1; active_clock := not active_clock; end if; if(current_clock = 1 and clk0_is_bad = '0' and clk1_is_bad = '1' ) then current_clock := 0; active_clock := not active_clock; end if; end if; end if; end if; end if; -- schedule outputs clkbad(0) <= clk0_is_bad; clkbad(1) <= clk1_is_bad; activeclock <= active_clock; end process; n1 : arriaii_mn_cntr port map ( clk => clkin, reset => areset_ipd, cout => refclk, initial_value => n_val, modulus => n_val); inclk_c0 <= refclk when c0_test_source = 1 else fbclk when c0_test_source = 0 else inclk_c_from_vco(0); c0 : arriaii_scale_cntr port map ( clk => inclk_c0, reset => areset_ena_sig, cout => c_clk(0), initial => c_initial_val(0), high => c_high_val(0), low => c_low_val(0), mode => c_mode_val(0), ph_tap => c_ph_val(0)); inclk_c1 <= refclk when c1_test_source = 1 else fbclk when c1_test_source = 0 else c_clk(0) when c1_use_casc_in = "on" else inclk_c_from_vco(1); c1 : arriaii_scale_cntr port map ( clk => inclk_c1, reset => areset_ena_sig, cout => c_clk(1), initial => c_initial_val(1), high => c_high_val(1), low => c_low_val(1), mode => c_mode_val(1), ph_tap => c_ph_val(1)); inclk_c2 <= refclk when c2_test_source = 1 else fbclk when c2_test_source = 0 else c_clk(1) when c2_use_casc_in = "on" else inclk_c_from_vco(2); c2 : arriaii_scale_cntr port map ( clk => inclk_c2, reset => areset_ena_sig, cout => c_clk(2), initial => c_initial_val(2), high => c_high_val(2), low => c_low_val(2), mode => c_mode_val(2), ph_tap => c_ph_val(2)); inclk_c3 <= refclk when c3_test_source = 1 else fbclk when c3_test_source = 0 else c_clk(2) when c3_use_casc_in = "on" else inclk_c_from_vco(3); c3 : arriaii_scale_cntr port map ( clk => inclk_c3, reset => areset_ena_sig, cout => c_clk(3), initial => c_initial_val(3), high => c_high_val(3), low => c_low_val(3), mode => c_mode_val(3), ph_tap => c_ph_val(3)); inclk_c4 <= refclk when c4_test_source = 1 else fbclk when c4_test_source = 0 else c_clk(3) when (c4_use_casc_in = "on") else inclk_c_from_vco(4); c4 : arriaii_scale_cntr port map ( clk => inclk_c4, reset => areset_ena_sig, cout => c_clk(4), initial => c_initial_val(4), high => c_high_val(4), low => c_low_val(4), mode => c_mode_val(4), ph_tap => c_ph_val(4)); inclk_c5 <= refclk when c5_test_source = 1 else fbclk when c5_test_source = 0 else c_clk(4) when c5_use_casc_in = "on" else inclk_c_from_vco(5); c5 : arriaii_scale_cntr port map ( clk => inclk_c5, reset => areset_ena_sig, cout => c_clk(5), initial => c_initial_val(5), high => c_high_val(5), low => c_low_val(5), mode => c_mode_val(5), ph_tap => c_ph_val(5)); inclk_c6 <= refclk when c6_test_source = 1 else fbclk when c6_test_source = 0 else c_clk(5) when c6_use_casc_in = "on" else inclk_c_from_vco(6); c6 : arriaii_scale_cntr port map ( clk => inclk_c6, reset => areset_ena_sig, cout => c_clk(6), initial => c_initial_val(6), high => c_high_val(6), low => c_low_val(6), mode => c_mode_val(6), ph_tap => c_ph_val(6)); inclk_c7 <= refclk when c7_test_source = 1 else fbclk when c7_test_source = 0 else c_clk(6) when c7_use_casc_in = "on" else inclk_c_from_vco(7); c7 : arriaii_scale_cntr port map ( clk => inclk_c7, reset => areset_ena_sig, cout => c_clk(7), initial => c_initial_val(7), high => c_high_val(7), low => c_low_val(7), mode => c_mode_val(7), ph_tap => c_ph_val(7)); inclk_c8 <= refclk when c8_test_source = 1 else fbclk when c8_test_source = 0 else c_clk(7) when c8_use_casc_in = "on" else inclk_c_from_vco(8); c8 : arriaii_scale_cntr port map ( clk => inclk_c8, reset => areset_ena_sig, cout => c_clk(8), initial => c_initial_val(8), high => c_high_val(8), low => c_low_val(8), mode => c_mode_val(8), ph_tap => c_ph_val(8)); inclk_c9 <= refclk when c9_test_source = 1 else fbclk when c9_test_source = 0 else c_clk(8) when c9_use_casc_in = "on" else inclk_c_from_vco(9); c9 : arriaii_scale_cntr port map ( clk => inclk_c9, reset => areset_ena_sig, cout => c_clk(9), initial => c_initial_val(9), high => c_high_val(9), low => c_low_val(9), mode => c_mode_val(9), ph_tap => c_ph_val(9)); process(scandone_tmp, lock) begin if (scandone_tmp'event and (scandone_tmp = '1')) then pll_has_just_been_reconfigured <= true; elsif (lock'event and (lock = '1')) then pll_has_just_been_reconfigured <= false; end if; end process; process(inclk_c0, inclk_c1, areset_ipd, sig_stop_vco) variable c0_got_first_rising_edge : boolean := false; variable c0_count : integer := 2; variable c0_initial_count : integer := 1; variable c0_tmp, c1_tmp : std_logic := '0'; variable c1_got_first_rising_edge : boolean := false; variable c1_count : integer := 2; variable c1_initial_count : integer := 1; begin if (areset_ipd = '1' or sig_stop_vco = '1') then c0_count := 2; c1_count := 2; c0_initial_count := 1; c1_initial_count := 1; c0_got_first_rising_edge := false; c1_got_first_rising_edge := false; else if (not c0_got_first_rising_edge) then if (inclk_c0'event and inclk_c0 = '1') then if (c0_initial_count = c_initial_val(0)) then c0_got_first_rising_edge := true; else c0_initial_count := c0_initial_count + 1; end if; end if; elsif (inclk_c0'event) then c0_count := c0_count + 1; if (c0_count = (c_high_val(0) + c_low_val(0)) * 2) then c0_count := 1; end if; end if; if (inclk_c0'event and inclk_c0 = '0') then if (c0_count = 1) then c0_tmp := '1'; c0_got_first_rising_edge := false; else c0_tmp := '0'; end if; end if; if (not c1_got_first_rising_edge) then if (inclk_c1'event and inclk_c1 = '1') then if (c1_initial_count = c_initial_val(1)) then c1_got_first_rising_edge := true; else c1_initial_count := c1_initial_count + 1; end if; end if; elsif (inclk_c1'event) then c1_count := c1_count + 1; if (c1_count = (c_high_val(1) + c_low_val(1)) * 2) then c1_count := 1; end if; end if; if (inclk_c1'event and inclk_c1 = '0') then if (c1_count = 1) then c1_tmp := '1'; c1_got_first_rising_edge := false; else c1_tmp := '0'; end if; end if; end if; end process; locked <= pfd_locked WHEN (test_bypass_lock_detect = "on") ELSE lock; process (scandone_tmp) variable buf : line; begin if (scandone_tmp'event and scandone_tmp = '1') then if (reconfig_err = false) then ASSERT false REPORT "PLL Reprogramming completed with the following values (Values in parantheses indicate values before reprogramming) :" severity note; write (buf, string'(" N modulus = ")); write (buf, n_val); write (buf, string'(" ( ")); write (buf, n_val_old); write (buf, string'(" )")); writeline (output, buf); write (buf, string'(" M modulus = ")); write (buf, m_val); write (buf, string'(" ( ")); write (buf, m_val_old); write (buf, string'(" )")); writeline (output, buf); write (buf, string'(" M ph_tap = ")); write (buf, m_ph_val); write (buf, string'(" ( ")); write (buf, m_ph_val_old); write (buf, string'(" )")); writeline (output, buf); for i in 0 to (num_output_cntrs-1) loop write (buf, clk_num(i)); write (buf, string'(" : ")); write (buf, cntrs(i)); write (buf, string'(" : high = ")); write (buf, c_high_val(i)); write (buf, string'(" (")); write (buf, c_high_val_old(i)); write (buf, string'(") ")); write (buf, string'(" , low = ")); write (buf, c_low_val(i)); write (buf, string'(" (")); write (buf, c_low_val_old(i)); write (buf, string'(") ")); write (buf, string'(" , mode = ")); write (buf, c_mode_val(i)); write (buf, string'(" (")); write (buf, c_mode_val_old(i)); write (buf, string'(") ")); write (buf, string'(" , phase tap = ")); write (buf, c_ph_val(i)); write (buf, string'(" (")); write (buf, c_ph_val_old(i)); write (buf, string'(") ")); writeline(output, buf); end loop; IF (pll_reconfig_display_full_setting) THEN write (buf, string'(" Charge Pump Current (uA) = ")); write (buf, cp_curr_val); write (buf, string'(" ( ")); write (buf, cp_curr_old); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" Loop Filter Capacitor (pF) = ")); write (buf, lfc_val); write (buf, string'(" ( ")); write (buf, lfc_old); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" Loop Filter Resistor (Kohm) = ")); write (buf, lfr_val); write (buf, string'(" ( ")); write (buf, lfr_old); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" VCO_Post_Scale = ")); write (buf, vco_cur); write (buf, string'(" ( ")); write (buf, vco_old); write (buf, string'(" ) ")); writeline (output, buf); ELSE write (buf, string'(" Charge Pump Current (bit setting) = ")); write (buf, alt_conv_integer(cp_curr_val_bit_setting)); write (buf, string'(" ( ")); write (buf, cp_curr_old_bit_setting); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" Loop Filter Capacitor (bit setting) = ")); write (buf, alt_conv_integer(lfc_val_bit_setting)); write (buf, string'(" ( ")); write (buf, lfc_old_bit_setting); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" Loop Filter Resistor (bit setting) = ")); write (buf, alt_conv_integer(lfr_val_bit_setting)); write (buf, string'(" ( ")); write (buf, lfr_old_bit_setting); write (buf, string'(" ) ")); writeline (output, buf); write (buf, string'(" VCO_Post_Scale = ")); write (buf, vco_cur); write (buf, string'(" ( ")); write (buf, vco_old); write (buf, string'(" ) ")); writeline (output, buf); END IF; cp_curr_old_bit_setting <= alt_conv_integer(cp_curr_val_bit_setting); lfc_old_bit_setting <= alt_conv_integer(lfc_val_bit_setting); lfr_old_bit_setting <= alt_conv_integer(lfr_val_bit_setting); else ASSERT false REPORT "Errors were encountered during PLL reprogramming. Please refer to error/warning messages above." severity warning; end if; end if; end process; update_conf_latches <= configupdate_ipd; process (scandone_tmp,areset_ipd,update_conf_latches, c_clk(0), c_clk(1), c_clk(2), c_clk(3), c_clk(4), c_clk(5), c_clk(6), c_clk(7), c_clk(8), c_clk(9), vco_out, fbclk, scanclk_ipd) variable init : boolean := true; variable low, high : std_logic_vector(7 downto 0); variable low_fast, high_fast : std_logic_vector(3 downto 0); variable mode : string(1 to 6) := "bypass"; variable is_error : boolean := false; variable m_tmp, n_tmp : std_logic_vector(8 downto 0); variable lfr_val_tmp : string(1 to 2) := " "; variable c_high_val_tmp,c_hval : int_array(0 to 9) := (OTHERS => 1); variable c_low_val_tmp,c_lval : int_array(0 to 9) := (OTHERS => 1); variable c_mode_val_tmp : str_array(0 to 9); variable m_val_tmp : integer := 0; variable c0_rising_edge_transfer_done : boolean := false; variable c1_rising_edge_transfer_done : boolean := false; variable c2_rising_edge_transfer_done : boolean := false; variable c3_rising_edge_transfer_done : boolean := false; variable c4_rising_edge_transfer_done : boolean := false; variable c5_rising_edge_transfer_done : boolean := false; variable c6_rising_edge_transfer_done : boolean := false; variable c7_rising_edge_transfer_done : boolean := false; variable c8_rising_edge_transfer_done : boolean := false; variable c9_rising_edge_transfer_done : boolean := false; -- variables for scaling of multiply_by and divide_by values variable i_clk0_mult_by : integer := 1; variable i_clk0_div_by : integer := 1; variable i_clk1_mult_by : integer := 1; variable i_clk1_div_by : integer := 1; variable i_clk2_mult_by : integer := 1; variable i_clk2_div_by : integer := 1; variable i_clk3_mult_by : integer := 1; variable i_clk3_div_by : integer := 1; variable i_clk4_mult_by : integer := 1; variable i_clk4_div_by : integer := 1; variable i_clk5_mult_by : integer := 1; variable i_clk5_div_by : integer := 1; variable i_clk6_mult_by : integer := 1; variable i_clk6_div_by : integer := 1; variable i_clk7_mult_by : integer := 1; variable i_clk7_div_by : integer := 1; variable i_clk8_mult_by : integer := 1; variable i_clk8_div_by : integer := 1; variable i_clk9_mult_by : integer := 1; variable i_clk9_div_by : integer := 1; variable max_d_value : integer := 1; variable new_multiplier : integer := 1; -- internal variables for storing the phase shift number.(used in lvds mode only) variable i_clk0_phase_shift : integer := 1; variable i_clk1_phase_shift : integer := 1; variable i_clk2_phase_shift : integer := 1; -- user to advanced variables variable max_neg_abs : integer := 0; variable i_m_initial : integer; variable i_m : integer := 1; variable i_n : integer := 1; variable i_c_high : int_array(0 to 9); variable i_c_low : int_array(0 to 9); variable i_c_initial : int_array(0 to 9); variable i_c_ph : int_array(0 to 9); variable i_c_mode : str_array(0 to 9); variable i_m_ph : integer; variable output_count : integer; variable new_divisor : integer; variable clk0_cntr : string(1 to 6) := " c0"; variable clk1_cntr : string(1 to 6) := " c1"; variable clk2_cntr : string(1 to 6) := " c2"; variable clk3_cntr : string(1 to 6) := " c3"; variable clk4_cntr : string(1 to 6) := " c4"; variable clk5_cntr : string(1 to 6) := " c5"; variable clk6_cntr : string(1 to 6) := " c6"; variable clk7_cntr : string(1 to 6) := " c7"; variable clk8_cntr : string(1 to 6) := " c8"; variable clk9_cntr : string(1 to 6) := " c9"; variable fbk_cntr : string(1 to 2); variable fbk_cntr_index : integer; variable start_bit : integer; variable quiet_time : time := 0 ps; variable slowest_clk_old : time := 0 ps; variable slowest_clk_new : time := 0 ps; variable i : integer := 0; variable j : integer := 0; variable scanread_active_edge : time := 0 ps; variable got_first_scanclk : boolean := false; variable scanclk_last_rising_edge : time := 0 ps; variable current_scan_data : std_logic_vector(0 to 233) := (OTHERS => '0'); variable index : integer := 0; variable Tviol_scandata_scanclk : std_ulogic := '0'; variable TimingData_scandata_scanclk : VitalTimingDataType := VitalTimingDataInit; variable Tviol_scanclkena_scanclk : std_ulogic := '0'; variable TimingData_scanclkena_scanclk : VitalTimingDataType := VitalTimingDataInit; variable scan_chain_length : integer := GPP_SCAN_CHAIN; variable tmp_rem : integer := 0; variable scanclk_cycles : integer := 0; variable lfc_tmp : std_logic_vector(1 downto 0); variable lfr_tmp : std_logic_vector(5 downto 0); variable lfr_int : integer := 0; variable n_hi,n_lo,m_hi,m_lo : std_logic_vector(7 downto 0); variable buf : line; variable buf_scan_data : STD_LOGIC_VECTOR(0 TO 1) := (OTHERS => '0'); variable buf_scan_data_2 : STD_LOGIC_VECTOR(0 TO 2) := (OTHERS => '0'); function slowest_clk ( C0 : integer; C0_mode : string(1 to 6); C1 : integer; C1_mode : string(1 to 6); C2 : integer; C2_mode : string(1 to 6); C3 : integer; C3_mode : string(1 to 6); C4 : integer; C4_mode : string(1 to 6); C5 : integer; C5_mode : string(1 to 6); C6 : integer; C6_mode : string(1 to 6); C7 : integer; C7_mode : string(1 to 6); C8 : integer; C8_mode : string(1 to 6); C9 : integer; C9_mode : string(1 to 6); refclk : time; m_mod : integer) return time is variable max_modulus : integer := 1; variable q_period : time := 0 ps; variable refclk_int : integer := 0; begin if (C0_mode /= "bypass" and C0_mode /= " off") then max_modulus := C0; end if; if (C1 > max_modulus and C1_mode /= "bypass" and C1_mode /= " off") then max_modulus := C1; end if; if (C2 > max_modulus and C2_mode /= "bypass" and C2_mode /= " off") then max_modulus := C2; end if; if (C3 > max_modulus and C3_mode /= "bypass" and C3_mode /= " off") then max_modulus := C3; end if; if (C4 > max_modulus and C4_mode /= "bypass" and C4_mode /= " off") then max_modulus := C4; end if; if (C5 > max_modulus and C5_mode /= "bypass" and C5_mode /= " off") then max_modulus := C5; end if; if (C6 > max_modulus and C6_mode /= "bypass" and C6_mode /= " off") then max_modulus := C6; end if; if (C7 > max_modulus and C7_mode /= "bypass" and C7_mode /= " off") then max_modulus := C7; end if; if (C8 > max_modulus and C8_mode /= "bypass" and C8_mode /= " off") then max_modulus := C8; end if; if (C9 > max_modulus and C9_mode /= "bypass" and C9_mode /= " off") then max_modulus := C9; end if; refclk_int := refclk / 1 ps; if (m_mod /= 0) then q_period := (refclk_int * max_modulus / m_mod) * 1 ps; end if; return (2*q_period); end slowest_clk; function int2bin (arg : integer; size : integer) return std_logic_vector is variable int_val : integer := arg; variable result : std_logic_vector(size-1 downto 0); begin for i in 0 to result'left loop if ((int_val mod 2) = 0) then result(i) := '0'; else result(i) := '1'; end if; int_val := int_val/2; end loop; return result; end int2bin; function extract_cntr_string (arg:string) return string is variable str : string(1 to 6) := " c0"; begin if (arg = "c0") then str := " c0"; elsif (arg = "c1") then str := " c1"; elsif (arg = "c2") then str := " c2"; elsif (arg = "c3") then str := " c3"; elsif (arg = "c4") then str := " c4"; elsif (arg = "c5") then str := " c5"; elsif (arg = "c6") then str := " c6"; elsif (arg = "c7") then str := " c7"; elsif (arg = "c8") then str := " c8"; elsif (arg = "c9") then str := " c9"; else str := " c0"; end if; return str; end extract_cntr_string; function extract_cntr_index (arg:string) return integer is variable index : integer := 0; begin if (arg(6) = '0') then index := 0; elsif (arg(6) = '1') then index := 1; elsif (arg(6) = '2') then index := 2; elsif (arg(6) = '3') then index := 3; elsif (arg(6) = '4') then index := 4; elsif (arg(6) = '5') then index := 5; elsif (arg(6) = '6') then index := 6; elsif (arg(6) = '7') then index := 7; elsif (arg(6) = '8') then index := 8; else index := 9; end if; return index; end extract_cntr_index; function output_cntr_num (arg:string) return string is variable str : string(1 to 6) := "unused"; begin if (arg = "c0") then str := " clk0"; elsif (arg = "c1") then str := " clk1"; elsif (arg = "c2") then str := " clk2"; elsif (arg = "c3") then str := " clk3"; elsif (arg = "c4") then str := " clk4"; elsif (arg = "c5") then str := " clk5"; elsif (arg = "c6") then str := " clk6"; elsif (arg = "c7") then str := " clk7"; elsif (arg = "c8") then str := " clk8"; elsif (arg = "c9") then str := " clk9"; else str := "unused"; end if; return str; end output_cntr_num; begin IF (areset_ipd'EVENT AND areset_ipd = '1') then c_ph_val <= i_c_ph; END IF; if (init) then if (m = 0) then clk9_cntr := " c9"; clk8_cntr := " c8"; clk7_cntr := " c7"; clk6_cntr := " c6"; clk5_cntr := " c5"; clk4_cntr := " c4"; clk3_cntr := " c3"; clk2_cntr := " c2"; clk1_cntr := " c1"; clk0_cntr := " c0"; else clk9_cntr := extract_cntr_string(clk9_counter); clk8_cntr := extract_cntr_string(clk8_counter); clk7_cntr := extract_cntr_string(clk7_counter); clk6_cntr := extract_cntr_string(clk6_counter); clk5_cntr := extract_cntr_string(clk5_counter); clk4_cntr := extract_cntr_string(clk4_counter); clk3_cntr := extract_cntr_string(clk3_counter); clk2_cntr := extract_cntr_string(clk2_counter); clk1_cntr := extract_cntr_string(clk1_counter); clk0_cntr := extract_cntr_string(clk0_counter); end if; clk_num(9) <= output_cntr_num(clk9_counter); clk_num(8) <= output_cntr_num(clk8_counter); clk_num(7) <= output_cntr_num(clk7_counter); clk_num(6) <= output_cntr_num(clk6_counter); clk_num(5) <= output_cntr_num(clk5_counter); clk_num(4) <= output_cntr_num(clk4_counter); clk_num(3) <= output_cntr_num(clk3_counter); clk_num(2) <= output_cntr_num(clk2_counter); clk_num(1) <= output_cntr_num(clk1_counter); clk_num(0) <= output_cntr_num(clk0_counter); i_clk0_counter <= extract_cntr_index(clk0_cntr); i_clk1_counter <= extract_cntr_index(clk1_cntr); i_clk2_counter <= extract_cntr_index(clk2_cntr); i_clk3_counter <= extract_cntr_index(clk3_cntr); i_clk4_counter <= extract_cntr_index(clk4_cntr); i_clk5_counter <= extract_cntr_index(clk5_cntr); i_clk6_counter <= extract_cntr_index(clk6_cntr); i_clk7_counter <= extract_cntr_index(clk7_cntr); i_clk8_counter <= extract_cntr_index(clk8_cntr); i_clk9_counter <= extract_cntr_index(clk9_cntr); if (m = 0) then -- convert user parameters to advanced -- set the limit of the divide_by value that can be returned by -- the following function. max_d_value := 500; -- scale down the multiply_by and divide_by values provided by the design -- before attempting to use them in the calculations below find_simple_integer_fraction(clk0_multiply_by, clk0_divide_by, max_d_value, i_clk0_mult_by, i_clk0_div_by); find_simple_integer_fraction(clk1_multiply_by, clk1_divide_by, max_d_value, i_clk1_mult_by, i_clk1_div_by); find_simple_integer_fraction(clk2_multiply_by, clk2_divide_by, max_d_value, i_clk2_mult_by, i_clk2_div_by); find_simple_integer_fraction(clk3_multiply_by, clk3_divide_by, max_d_value, i_clk3_mult_by, i_clk3_div_by); find_simple_integer_fraction(clk4_multiply_by, clk4_divide_by, max_d_value, i_clk4_mult_by, i_clk4_div_by); find_simple_integer_fraction(clk5_multiply_by, clk5_divide_by, max_d_value, i_clk5_mult_by, i_clk5_div_by); find_simple_integer_fraction(clk6_multiply_by, clk6_divide_by, max_d_value, i_clk6_mult_by, i_clk6_div_by); find_simple_integer_fraction(clk7_multiply_by, clk7_divide_by, max_d_value, i_clk7_mult_by, i_clk7_div_by); find_simple_integer_fraction(clk8_multiply_by, clk8_divide_by, max_d_value, i_clk8_mult_by, i_clk8_div_by); find_simple_integer_fraction(clk9_multiply_by, clk9_divide_by, max_d_value, i_clk9_mult_by, i_clk9_div_by); if (vco_frequency_control = "manual_phase") then find_m_and_n_4_manual_phase(inclk0_input_frequency, vco_phase_shift_step, i_clk0_mult_by, i_clk1_mult_by, i_clk2_mult_by, i_clk3_mult_by, i_clk4_mult_by, i_clk5_mult_by,i_clk6_mult_by, i_clk7_mult_by,i_clk8_mult_by,i_clk9_mult_by, i_clk0_div_by, i_clk1_div_by, i_clk2_div_by, i_clk3_div_by, i_clk4_div_by, i_clk5_div_by,i_clk6_div_by, i_clk7_div_by,i_clk8_div_by,i_clk9_div_by, clk0_counter, clk1_counter, clk2_counter, clk3_counter, clk4_counter, clk5_counter,clk6_counter, clk7_counter,clk8_counter,clk9_counter, i_m, i_n); elsif (((pll_type = "fast") or (pll_type = "lvds") OR (pll_type = "left_right")) and ((vco_multiply_by /= 0) and (vco_divide_by /= 0))) then i_n := vco_divide_by; i_m := vco_multiply_by; else i_n := 1; if (((pll_type = "fast") or (pll_type = "left_right")) and (compensate_clock = "lvdsclk")) then i_m := i_clk0_mult_by; else i_m := lcm (i_clk0_mult_by, i_clk1_mult_by, i_clk2_mult_by, i_clk3_mult_by, i_clk4_mult_by, i_clk5_mult_by,i_clk6_mult_by, i_clk7_mult_by,i_clk8_mult_by,i_clk9_mult_by, inclk0_input_frequency); end if; end if; if (pll_type = "flvds") then -- Need to readjust phase shift values when the clock multiply value has been readjusted. new_multiplier := clk0_multiply_by / i_clk0_mult_by; i_clk0_phase_shift := str2int(clk0_phase_shift) * new_multiplier; i_clk1_phase_shift := str2int(clk1_phase_shift) * new_multiplier; i_clk2_phase_shift := str2int(clk2_phase_shift) * new_multiplier; else i_clk0_phase_shift := str2int(clk0_phase_shift); i_clk1_phase_shift := str2int(clk1_phase_shift); i_clk2_phase_shift := str2int(clk2_phase_shift); end if; max_neg_abs := maxnegabs(i_clk0_phase_shift, i_clk1_phase_shift, i_clk2_phase_shift, str2int(clk3_phase_shift), str2int(clk4_phase_shift), str2int(clk5_phase_shift), str2int(clk6_phase_shift), str2int(clk7_phase_shift), str2int(clk8_phase_shift), str2int(clk9_phase_shift) ); i_m_ph := counter_ph(get_phase_degree(max_neg_abs,inclk0_input_frequency), i_m, i_n); i_c_ph(0) := counter_ph(get_phase_degree(ph_adjust(i_clk0_phase_shift,max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(1) := counter_ph(get_phase_degree(ph_adjust(i_clk1_phase_shift,max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(2) := counter_ph(get_phase_degree(ph_adjust(i_clk2_phase_shift,max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(3) := counter_ph(get_phase_degree(ph_adjust(str2int(clk3_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(4) := counter_ph(get_phase_degree(ph_adjust(str2int(clk4_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(5) := counter_ph(get_phase_degree(ph_adjust(str2int(clk5_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(6) := counter_ph(get_phase_degree(ph_adjust(str2int(clk6_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(7) := counter_ph(get_phase_degree(ph_adjust(str2int(clk7_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(8) := counter_ph(get_phase_degree(ph_adjust(str2int(clk8_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_ph(9) := counter_ph(get_phase_degree(ph_adjust(str2int(clk9_phase_shift),max_neg_abs),inclk0_input_frequency), i_m, i_n); i_c_high(0) := counter_high(output_counter_value(i_clk0_div_by, i_clk0_mult_by, i_m, i_n), clk0_duty_cycle); i_c_high(1) := counter_high(output_counter_value(i_clk1_div_by, i_clk1_mult_by, i_m, i_n), clk1_duty_cycle); i_c_high(2) := counter_high(output_counter_value(i_clk2_div_by, i_clk2_mult_by, i_m, i_n), clk2_duty_cycle); i_c_high(3) := counter_high(output_counter_value(i_clk3_div_by, i_clk3_mult_by, i_m, i_n), clk3_duty_cycle); i_c_high(4) := counter_high(output_counter_value(i_clk4_div_by, i_clk4_mult_by, i_m, i_n), clk4_duty_cycle); i_c_high(5) := counter_high(output_counter_value(i_clk5_div_by, i_clk5_mult_by, i_m, i_n), clk5_duty_cycle); i_c_high(6) := counter_high(output_counter_value(i_clk6_div_by, i_clk6_mult_by, i_m, i_n), clk6_duty_cycle); i_c_high(7) := counter_high(output_counter_value(i_clk7_div_by, i_clk7_mult_by, i_m, i_n), clk7_duty_cycle); i_c_high(8) := counter_high(output_counter_value(i_clk8_div_by, i_clk8_mult_by, i_m, i_n), clk8_duty_cycle); i_c_high(9) := counter_high(output_counter_value(i_clk9_div_by, i_clk9_mult_by, i_m, i_n), clk9_duty_cycle); i_c_low(0) := counter_low(output_counter_value(i_clk0_div_by, i_clk0_mult_by, i_m, i_n), clk0_duty_cycle); i_c_low(1) := counter_low(output_counter_value(i_clk1_div_by, i_clk1_mult_by, i_m, i_n), clk1_duty_cycle); i_c_low(2) := counter_low(output_counter_value(i_clk2_div_by, i_clk2_mult_by, i_m, i_n), clk2_duty_cycle); i_c_low(3) := counter_low(output_counter_value(i_clk3_div_by, i_clk3_mult_by, i_m, i_n), clk3_duty_cycle); i_c_low(4) := counter_low(output_counter_value(i_clk4_div_by, i_clk4_mult_by, i_m, i_n), clk4_duty_cycle); i_c_low(5) := counter_low(output_counter_value(i_clk5_div_by, i_clk5_mult_by, i_m, i_n), clk5_duty_cycle); i_c_low(6) := counter_low(output_counter_value(i_clk6_div_by, i_clk6_mult_by, i_m, i_n), clk6_duty_cycle); i_c_low(7) := counter_low(output_counter_value(i_clk7_div_by, i_clk7_mult_by, i_m, i_n), clk7_duty_cycle); i_c_low(8) := counter_low(output_counter_value(i_clk8_div_by, i_clk8_mult_by, i_m, i_n), clk8_duty_cycle); i_c_low(9) := counter_low(output_counter_value(i_clk9_div_by, i_clk9_mult_by, i_m, i_n), clk9_duty_cycle); i_m_initial := counter_initial(get_phase_degree(max_neg_abs, inclk0_input_frequency), i_m,i_n); i_c_initial(0) := counter_initial(get_phase_degree(ph_adjust(i_clk0_phase_shift, max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(1) := counter_initial(get_phase_degree(ph_adjust(i_clk1_phase_shift, max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(2) := counter_initial(get_phase_degree(ph_adjust(i_clk2_phase_shift, max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(3) := counter_initial(get_phase_degree(ph_adjust(str2int(clk3_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(4) := counter_initial(get_phase_degree(ph_adjust(str2int(clk4_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(5) := counter_initial(get_phase_degree(ph_adjust(str2int(clk5_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(6) := counter_initial(get_phase_degree(ph_adjust(str2int(clk6_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(7) := counter_initial(get_phase_degree(ph_adjust(str2int(clk7_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(8) := counter_initial(get_phase_degree(ph_adjust(str2int(clk8_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_initial(9) := counter_initial(get_phase_degree(ph_adjust(str2int(clk9_phase_shift), max_neg_abs), inclk0_input_frequency), i_m, i_n); i_c_mode(0) := counter_mode(clk0_duty_cycle, output_counter_value(i_clk0_div_by, i_clk0_mult_by, i_m, i_n)); i_c_mode(1) := counter_mode(clk1_duty_cycle, output_counter_value(i_clk1_div_by, i_clk1_mult_by, i_m, i_n)); i_c_mode(2) := counter_mode(clk2_duty_cycle, output_counter_value(i_clk2_div_by, i_clk2_mult_by, i_m, i_n)); i_c_mode(3) := counter_mode(clk3_duty_cycle, output_counter_value(i_clk3_div_by, i_clk3_mult_by, i_m, i_n)); i_c_mode(4) := counter_mode(clk4_duty_cycle, output_counter_value(i_clk4_div_by, i_clk4_mult_by, i_m, i_n)); i_c_mode(5) := counter_mode(clk5_duty_cycle, output_counter_value(i_clk5_div_by, i_clk5_mult_by, i_m, i_n)); i_c_mode(6) := counter_mode(clk6_duty_cycle, output_counter_value(i_clk6_div_by, i_clk6_mult_by, i_m, i_n)); i_c_mode(7) := counter_mode(clk7_duty_cycle, output_counter_value(i_clk7_div_by, i_clk7_mult_by, i_m, i_n)); i_c_mode(8) := counter_mode(clk8_duty_cycle, output_counter_value(i_clk8_div_by, i_clk8_mult_by, i_m, i_n)); i_c_mode(9) := counter_mode(clk9_duty_cycle, output_counter_value(i_clk9_div_by, i_clk9_mult_by, i_m, i_n)); else -- m /= 0 i_n := n; i_m := m; i_m_initial := m_initial; i_m_ph := m_ph; i_c_ph(0) := c0_ph; i_c_ph(1) := c1_ph; i_c_ph(2) := c2_ph; i_c_ph(3) := c3_ph; i_c_ph(4) := c4_ph; i_c_ph(5) := c5_ph; i_c_ph(6) := c6_ph; i_c_ph(7) := c7_ph; i_c_ph(8) := c8_ph; i_c_ph(9) := c9_ph; i_c_high(0) := c0_high; i_c_high(1) := c1_high; i_c_high(2) := c2_high; i_c_high(3) := c3_high; i_c_high(4) := c4_high; i_c_high(5) := c5_high; i_c_high(6) := c6_high; i_c_high(7) := c7_high; i_c_high(8) := c8_high; i_c_high(9) := c9_high; i_c_low(0) := c0_low; i_c_low(1) := c1_low; i_c_low(2) := c2_low; i_c_low(3) := c3_low; i_c_low(4) := c4_low; i_c_low(5) := c5_low; i_c_low(6) := c6_low; i_c_low(7) := c7_low; i_c_low(8) := c8_low; i_c_low(9) := c9_low; i_c_initial(0) := c0_initial; i_c_initial(1) := c1_initial; i_c_initial(2) := c2_initial; i_c_initial(3) := c3_initial; i_c_initial(4) := c4_initial; i_c_initial(5) := c5_initial; i_c_initial(6) := c6_initial; i_c_initial(7) := c7_initial; i_c_initial(8) := c8_initial; i_c_initial(9) := c9_initial; i_c_mode(0) := translate_string(c0_mode); i_c_mode(1) := translate_string(c1_mode); i_c_mode(2) := translate_string(c2_mode); i_c_mode(3) := translate_string(c3_mode); i_c_mode(4) := translate_string(c4_mode); i_c_mode(5) := translate_string(c5_mode); i_c_mode(6) := translate_string(c6_mode); i_c_mode(7) := translate_string(c7_mode); i_c_mode(8) := translate_string(c8_mode); i_c_mode(9) := translate_string(c9_mode); end if; -- user to advanced conversion. m_initial_val <= i_m_initial; n_val <= i_n; m_val <= i_m; if (i_m = 1) then m_mode_val <= "bypass"; else m_mode_val <= " "; end if; if (i_n = 1) then n_mode_val <= "bypass"; else n_mode_val <= " "; end if; m_ph_val <= i_m_ph; m_ph_initial <= i_m_ph; m_val_tmp := i_m; for i in 0 to 9 loop if (i_c_mode(i) = "bypass") then if (pll_type = "fast" or pll_type = "lvds" OR (pll_type = "left_right")) then i_c_high(i) := 16; i_c_low(i) := 16; else i_c_high(i) := 256; i_c_low(i) := 256; end if; end if; c_ph_val(i) <= i_c_ph(i); c_initial_val(i) <= i_c_initial(i); c_high_val(i) <= i_c_high(i); c_low_val(i) <= i_c_low(i); c_mode_val(i) <= i_c_mode(i); c_high_val_tmp(i) := i_c_high(i); c_hval(i) := i_c_high(i); c_low_val_tmp(i) := i_c_low(i); c_lval(i) := i_c_low(i); c_mode_val_tmp(i) := i_c_mode(i); c_ph_val_orig(i) <= i_c_ph(i); c_high_val_hold(i) <= i_c_high(i); c_low_val_hold(i) <= i_c_low(i); c_mode_val_hold(i) <= i_c_mode(i); end loop; if (pll_type = "fast" OR (pll_type = "left_right")) then scan_chain_length := FAST_SCAN_CHAIN; else scan_chain_length := GPP_SCAN_CHAIN; end if; if (pll_type = "fast" or pll_type = "lvds" OR (pll_type = "left_right")) then num_output_cntrs <= 7; else num_output_cntrs <= 10; end if; init := false; elsif (scandone_tmp'EVENT AND scandone_tmp = '1') then c0_rising_edge_transfer_done := false; c1_rising_edge_transfer_done := false; c2_rising_edge_transfer_done := false; c3_rising_edge_transfer_done := false; c4_rising_edge_transfer_done := false; c5_rising_edge_transfer_done := false; c6_rising_edge_transfer_done := false; c7_rising_edge_transfer_done := false; c8_rising_edge_transfer_done := false; c9_rising_edge_transfer_done := false; update_conf_latches_reg <= '0'; elsif (update_conf_latches'event and update_conf_latches = '1') then initiate_reconfig <= '1'; elsif (areset_ipd'event AND areset_ipd = '1') then if (scandone_tmp = '0') then scandone_tmp <= '1' AFTER scanclk_period; end if; elsif (scanclk_ipd'event and scanclk_ipd = '1') then IF (initiate_reconfig = '1') THEN initiate_reconfig <= '0'; ASSERT false REPORT "PLL Reprogramming Initiated" severity note; update_conf_latches_reg <= update_conf_latches; reconfig_err <= false; scandone_tmp <= '0'; cp_curr_old <= cp_curr_val; lfc_old <= lfc_val; lfr_old <= lfr_val; vco_old <= vco_cur; -- LF unused : bit 0,1 -- LF Capacitance : bits 2,3 : all values are legal buf_scan_data := scan_data(2 TO 3); IF ((pll_type = "fast") OR (pll_type = "lvds") OR (pll_type = "left_right")) THEN lfc_val <= fpll_loop_filter_c_arr(alt_conv_integer(buf_scan_data)); ELSE lfc_val <= loop_filter_c_arr(alt_conv_integer(buf_scan_data)); END IF; -- LF Resistance : bits 4-8 -- valid values - 00000,00100,10000,10100,11000,11011,11100,11110 IF (scan_data(4 TO 8) = "00000") THEN lfr_val <= "20"; ELSIF (scan_data(4 TO 8) = "00100") THEN lfr_val <= "16"; ELSIF (scan_data(4 TO 8) = "10000") THEN lfr_val <= "12"; ELSIF (scan_data(4 TO 8) = "10100") THEN lfr_val <= "08"; ELSIF (scan_data(4 TO 8) = "11000") THEN lfr_val <= "06"; ELSIF (scan_data(4 TO 8) = "11011") THEN lfr_val <= "04"; ELSIF (scan_data(4 TO 8) = "11100") THEN lfr_val <= "02"; ELSE lfr_val <= "01"; END IF; -- VCO post scale assignment if (scan_data(9) = '1') then -- vco_post_scale = 1 i_vco_max <= VCO_MAX_NO_DIVISION/2; i_vco_min <= VCO_MIN_NO_DIVISION/2; vco_cur <= 1; else i_vco_max <= vco_max; i_vco_min <= vco_min; vco_cur <= 2; end if; -- CP -- Bit 9 : CRBYPASS -- Bit 10-14 : unused -- Bits 15-17 : all values are legal buf_scan_data_2 := scan_data(15 TO 17); cp_curr_val <= charge_pump_curr_arr(alt_conv_integer(buf_scan_data_2)); -- save old values for display info. cp_curr_val_bit_setting <= scan_data(15 TO 17); lfc_val_bit_setting <= scan_data(2 TO 3); lfr_val_bit_setting <= scan_data(4 TO 8); m_val_old <= m_val; n_val_old <= n_val; m_mode_val_old <= m_mode_val; n_mode_val_old <= n_mode_val; WHILE (i < num_output_cntrs) LOOP c_high_val_old(i) <= c_high_val(i); c_low_val_old(i) <= c_low_val(i); c_mode_val_old(i) <= c_mode_val(i); i := i + 1; END LOOP; -- M counter -- 1. Mode - bypass (bit 18) IF (scan_data(18) = '1') THEN m_mode_val <= "bypass"; -- 3. Mode - odd/even (bit 27) ELSIF (scan_data(27) = '1') THEN m_mode_val <= " odd"; ELSE m_mode_val <= " even"; END IF; -- 2. High (bit 19-26) m_hi := scan_data(19 TO 26); -- 4. Low (bit 28-35) m_lo := scan_data(28 TO 35); -- N counter -- 1. Mode - bypass (bit 36) IF (scan_data(36) = '1') THEN n_mode_val <= "bypass"; -- 3. Mode - odd/even (bit 45) ELSIF (scan_data(45) = '1') THEN n_mode_val <= " odd"; ELSE n_mode_val <= " even"; END IF; -- 2. High (bit 37-44) n_hi := scan_data(37 TO 44); -- 4. Low (bit 46-53) n_lo := scan_data(46 TO 53); -- C counters (start bit 54) bit 1:mode(bypass),bit 2-9:high,bit 10:mode(odd/even),bit 11-18:low i := 0; WHILE (i < num_output_cntrs) LOOP -- 1. Mode - bypass IF (scan_data(54 + i * 18 + 0) = '1') THEN c_mode_val_tmp(i) := "bypass"; -- 3. Mode - odd/even ELSIF (scan_data(54 + i * 18 + 9) = '1') THEN c_mode_val_tmp(i) := " odd"; ELSE c_mode_val_tmp(i) := " even"; END IF; -- 2. Hi high := scan_data(54 + i * 18 + 1 TO 54 + i * 18 + 8); c_hval(i) := alt_conv_integer(high); IF (c_hval(i) /= 0) THEN c_high_val_tmp(i) := c_hval(i); ELSE c_high_val_tmp(i) := alt_conv_integer("000000001"); END IF; -- 4. Low low := scan_data(54 + i * 18 + 10 TO 54 + i * 18 + 17); c_lval(i) := alt_conv_integer(low); IF (c_lval(i) /= 0) THEN c_low_val_tmp(i) := c_lval(i); ELSE c_low_val_tmp(i) := alt_conv_integer("000000001"); END IF; i := i + 1; END LOOP; -- Legality Checks -- M counter value IF(scan_data(18) /= '1') THEN IF ((m_hi /= m_lo) and (scan_data(27) /= '1')) THEN reconfig_err <= TRUE; WRITE(buf,string'("Warning : The M counter of the " & family_name & " Fast PLL should be configured for 50%% duty cycle only. In this case the HIGH and LOW moduli programmed will result in a duty cycle other than 50%%, which is illegal. Reconfiguration may not work")); writeline(output, buf); ELSIF (m_hi /= "00000000") THEN m_val_tmp := alt_conv_integer(m_hi) + alt_conv_integer(m_lo); ELSE m_val_tmp := alt_conv_integer("000000001"); END IF; ELSE m_val_tmp := alt_conv_integer("10000000"); END IF; -- N counter value IF(scan_data(36) /= '1') THEN IF ((n_hi /= n_lo)and (scan_data(45) /= '1')) THEN reconfig_err <= TRUE; WRITE(buf,string'("Warning : The N counter of the " & family_name & " Fast PLL should be configured for 50%% duty cycle only. In this case the HIGH and LOW moduli programmed will result in a duty cycle other than 50%%, which is illegal. Reconfiguration may not work")); writeline(output, buf); ELSIF (n_hi /= "00000000") THEN n_val <= alt_conv_integer(n_hi) + alt_conv_integer(n_lo); ELSE n_val <= alt_conv_integer("000000001"); END IF; ELSE n_val <= alt_conv_integer("10000000"); END IF; -- TODO : Give warnings/errors in the following cases? -- 1. Illegal counter values (error) -- 2. Change of mode (warning) -- 3. Only 50% duty cycle allowed for M counter (odd mode - hi-lo=1,even - hi-lo=0) END IF; end if; if (fbclk'event and fbclk = '1') then m_val <= m_val_tmp; end if; if (update_conf_latches_reg = '1') then if (scanclk_ipd'event and scanclk_ipd = '1') then c0_rising_edge_transfer_done := true; c_high_val(0) <= c_high_val_tmp(0); c_mode_val(0) <= c_mode_val_tmp(0); end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c1_rising_edge_transfer_done := true; c_high_val(1) <= c_high_val_tmp(1); c_mode_val(1) <= c_mode_val_tmp(1); end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c2_rising_edge_transfer_done := true; c_high_val(2) <= c_high_val_tmp(2); c_mode_val(2) <= c_mode_val_tmp(2); end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(3) <= c_high_val_tmp(3); c_mode_val(3) <= c_mode_val_tmp(3); c3_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(4) <= c_high_val_tmp(4); c_mode_val(4) <= c_mode_val_tmp(4); c4_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(5) <= c_high_val_tmp(5); c_mode_val(5) <= c_mode_val_tmp(5); c5_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(6) <= c_high_val_tmp(6); c_mode_val(6) <= c_mode_val_tmp(6); c6_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(7) <= c_high_val_tmp(7); c_mode_val(7) <= c_mode_val_tmp(7); c7_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(8) <= c_high_val_tmp(8); c_mode_val(8) <= c_mode_val_tmp(8); c8_rising_edge_transfer_done := true; end if; if (scanclk_ipd'event and scanclk_ipd = '1') then c_high_val(9) <= c_high_val_tmp(9); c_mode_val(9) <= c_mode_val_tmp(9); c9_rising_edge_transfer_done := true; end if; end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c0_rising_edge_transfer_done) then c_low_val(0) <= c_low_val_tmp(0); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c1_rising_edge_transfer_done) then c_low_val(1) <= c_low_val_tmp(1); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c2_rising_edge_transfer_done) then c_low_val(2) <= c_low_val_tmp(2); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c3_rising_edge_transfer_done) then c_low_val(3) <= c_low_val_tmp(3); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c4_rising_edge_transfer_done) then c_low_val(4) <= c_low_val_tmp(4); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c5_rising_edge_transfer_done) then c_low_val(5) <= c_low_val_tmp(5); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c6_rising_edge_transfer_done) then c_low_val(6) <= c_low_val_tmp(6); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c7_rising_edge_transfer_done) then c_low_val(7) <= c_low_val_tmp(7); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c8_rising_edge_transfer_done) then c_low_val(8) <= c_low_val_tmp(8); end if; if (scanclk_ipd'event and scanclk_ipd = '0' and c9_rising_edge_transfer_done) then c_low_val(9) <= c_low_val_tmp(9); end if; if (update_phase = '1') then if (vco_out(0)'event and vco_out(0) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 0) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 0) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(1)'event and vco_out(1) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 1) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 1) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(2)'event and vco_out(2) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 2) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 2) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(3)'event and vco_out(3) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 3) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 3) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(4)'event and vco_out(4) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 4) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 4) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(5)'event and vco_out(5) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 5) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 5) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(6)'event and vco_out(6) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 6) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 6) then m_ph_val <= m_ph_val_tmp; end if; end if; if (vco_out(7)'event and vco_out(7) = '0') then for i in 0 to 9 loop if (c_ph_val(i) = 7) then c_ph_val(i) <= c_ph_val_tmp(i); end if; end loop; if (m_ph_val = 7) then m_ph_val <= m_ph_val_tmp; end if; end if; end if; if (vco_out(0)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 0) then inclk_c_from_vco(i) <= vco_out(0); end if; end loop; if (m_ph_val = 0) then inclk_m_from_vco <= vco_out(0); end if; end if; if (vco_out(1)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 1) then inclk_c_from_vco(i) <= vco_out(1); end if; end loop; if (m_ph_val = 1) then inclk_m_from_vco <= vco_out(1); end if; end if; if (vco_out(2)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 2) then inclk_c_from_vco(i) <= vco_out(2); end if; end loop; if (m_ph_val = 2) then inclk_m_from_vco <= vco_out(2); end if; end if; if (vco_out(3)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 3) then inclk_c_from_vco(i) <= vco_out(3); end if; end loop; if (m_ph_val = 3) then inclk_m_from_vco <= vco_out(3); end if; end if; if (vco_out(4)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 4) then inclk_c_from_vco(i) <= vco_out(4); end if; end loop; if (m_ph_val = 4) then inclk_m_from_vco <= vco_out(4); end if; end if; if (vco_out(5)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 5) then inclk_c_from_vco(i) <= vco_out(5); end if; end loop; if (m_ph_val = 5) then inclk_m_from_vco <= vco_out(5); end if; end if; if (vco_out(6)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 6) then inclk_c_from_vco(i) <= vco_out(6); end if; end loop; if (m_ph_val = 6) then inclk_m_from_vco <= vco_out(6); end if; end if; if (vco_out(7)'event) then for i in 0 to 9 loop if (c_ph_val(i) = 7) then inclk_c_from_vco(i) <= vco_out(7); end if; end loop; if (m_ph_val = 7) then inclk_m_from_vco <= vco_out(7); end if; end if; ------------------------ -- Timing Check Section ------------------------ if (TimingChecksOn) then VitalSetupHoldCheck ( Violation => Tviol_scandata_scanclk, TimingData => TimingData_scandata_scanclk, TestSignal => scandata_ipd, TestSignalName => "scandata", RefSignal => scanclk_ipd, RefSignalName => "scanclk", SetupHigh => tsetup_scandata_scanclk_noedge_negedge, SetupLow => tsetup_scandata_scanclk_noedge_negedge, HoldHigh => thold_scandata_scanclk_noedge_negedge, HoldLow => thold_scandata_scanclk_noedge_negedge, CheckEnabled => TRUE, RefTransition => '\', HeaderMsg => InstancePath & "/arriaii_pll", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_scanclkena_scanclk, TimingData => TimingData_scanclkena_scanclk, TestSignal => scanclkena_ipd, TestSignalName => "scanclkena", RefSignal => scanclk_ipd, RefSignalName => "scanclk", SetupHigh => tsetup_scanclkena_scanclk_noedge_negedge, SetupLow => tsetup_scanclkena_scanclk_noedge_negedge, HoldHigh => thold_scanclkena_scanclk_noedge_negedge, HoldLow => thold_scanclkena_scanclk_noedge_negedge, CheckEnabled => TRUE, RefTransition => '\', HeaderMsg => InstancePath & "/arriaii_pll", XOn => XOnChecks, MsgOn => MsgOnChecks ); end if; if (scanclk_ipd'event AND scanclk_ipd = '0' AND now > 0 ps) then scanclkena_reg <= scanclkena_ipd; if (scanclkena_reg = '1') then scandata_in <= scandata_ipd; scandata_out <= scandataout_tmp; end if; end if; if (scanclk_ipd'event and scanclk_ipd = '1' and now > 0 ps) then if (got_first_scanclk) then scanclk_period <= now - scanclk_last_rising_edge; else got_first_scanclk := true; end if; if (scanclkena_reg = '1') then for j in scan_chain_length - 1 downto 1 loop scan_data(j) <= scan_data(j-1); end loop; scan_data(0) <= scandata_in; end if; scanclk_last_rising_edge := now; end if; end process; -- PLL Phase Reconfiguration PROCESS(scanclk_ipd, areset_ipd,phasestep_ipd) VARIABLE i : INTEGER := 0; VARIABLE c_ph : INTEGER := 0; VARIABLE m_ph : INTEGER := 0; VARIABLE select_counter : INTEGER := 0; BEGIN IF (NOW = 0 ps) THEN m_ph_val_tmp <= m_ph_initial; END IF; -- Latch phase enable (same as phasestep) on neg edge of scan clock IF (scanclk_ipd'EVENT AND scanclk_ipd = '0') THEN phasestep_reg <= phasestep_ipd; END IF; IF (phasestep_ipd'EVENT and phasestep_ipd = '1') THEN IF (update_phase = '0') THEN phasestep_high_count <= 0; -- phase adjustments must be 1 cycle apart -- if not, next phasestep cycle is skipped END IF; END IF; -- revert counter phase tap values to POF programmed values -- if PLL is reset IF (areset_ipd'EVENT AND areset_ipd = '1') then c_ph_val_tmp <= c_ph_val_orig; m_ph_val_tmp <= m_ph_initial; END IF; IF (scanclk_ipd'EVENT AND scanclk_ipd = '1') THEN IF (phasestep_reg = '1') THEN IF (phasestep_high_count = 1) THEN phasecounterselect_reg <= phasecounterselect_ipd; phaseupdown_reg <= phaseupdown_ipd; -- start reconfiguration IF (phasecounterselect_ipd < "1100") THEN -- no counters selected IF (phasecounterselect_ipd = "0000") THEN i := 0; WHILE (i < num_output_cntrs) LOOP c_ph := c_ph_val(i); IF (phaseupdown_ipd = '1') THEN c_ph := (c_ph + 1) mod num_phase_taps; ELSIF (c_ph = 0) THEN c_ph := num_phase_taps - 1; ELSE c_ph := (c_ph - 1) mod num_phase_taps; END IF; c_ph_val_tmp(i) <= c_ph; i := i + 1; END LOOP; ELSIF (phasecounterselect_ipd = "0001") THEN m_ph := m_ph_val; IF (phaseupdown_ipd = '1') THEN m_ph := (m_ph + 1) mod num_phase_taps; ELSIF (m_ph = 0) THEN m_ph := num_phase_taps - 1; ELSE m_ph := (m_ph - 1) mod num_phase_taps; END IF; m_ph_val_tmp <= m_ph; ELSE select_counter := alt_conv_integer(phasecounterselect_ipd) - 2; c_ph := c_ph_val(select_counter); IF (phaseupdown_ipd = '1') THEN c_ph := (c_ph + 1) mod num_phase_taps; ELSIF (c_ph = 0) THEN c_ph := num_phase_taps - 1; ELSE c_ph := (c_ph - 1) mod num_phase_taps; END IF; c_ph_val_tmp(select_counter) <= c_ph; END IF; update_phase <= '1','0' AFTER (0.5 * scanclk_period); END IF; END IF; phasestep_high_count <= phasestep_high_count + 1; END IF; END IF; END PROCESS; scandataout_tmp <= scan_data(FAST_SCAN_CHAIN-2) when (pll_type = "fast" or pll_type = "lvds" or pll_type = "left_right") else scan_data(GPP_SCAN_CHAIN-2); process (schedule_vco, areset_ipd, pfdena_ipd, refclk, fbclk) variable sched_time : time := 0 ps; TYPE time_array is ARRAY (0 to 7) of time; variable init : boolean := true; variable refclk_period : time; variable m_times_vco_period : time; variable new_m_times_vco_period : time; variable phase_shift : time_array := (OTHERS => 0 ps); variable last_phase_shift : time_array := (OTHERS => 0 ps); variable l_index : integer := 1; variable cycle_to_adjust : integer := 0; variable stop_vco : boolean := false; variable locked_tmp : std_logic := '0'; variable pll_is_locked : boolean := false; variable cycles_pfd_low : integer := 0; variable cycles_pfd_high : integer := 0; variable cycles_to_lock : integer := 0; variable cycles_to_unlock : integer := 0; variable got_first_refclk : boolean := false; variable got_second_refclk : boolean := false; variable got_first_fbclk : boolean := false; variable refclk_time : time := 0 ps; variable fbclk_time : time := 0 ps; variable first_fbclk_time : time := 0 ps; variable fbclk_period : time := 0 ps; variable first_schedule : boolean := true; variable vco_val : std_logic := '0'; variable vco_period_was_phase_adjusted : boolean := false; variable phase_adjust_was_scheduled : boolean := false; variable loop_xplier : integer; variable loop_initial : integer := 0; variable loop_ph : integer := 0; variable loop_time_delay : integer := 0; variable initial_delay : time := 0 ps; variable vco_per : time; variable tmp_rem : integer; variable my_rem : integer; variable fbk_phase : integer := 0; variable pull_back_M : integer := 0; variable total_pull_back : integer := 0; variable fbk_delay : integer := 0; variable offset : time := 0 ps; variable tmp_vco_per : integer := 0; variable high_time : time; variable low_time : time; variable got_refclk_posedge : boolean := false; variable got_fbclk_posedge : boolean := false; variable inclk_out_of_range : boolean := false; variable no_warn : boolean := false; variable ext_fbk_cntr_modulus : integer := 1; variable init_clks : boolean := true; variable pll_is_in_reset : boolean := false; variable buf : line; begin if (init) then -- jump-start the VCO -- add 1 ps delay to ensure all signals are updated to initial -- values schedule_vco <= transport not schedule_vco after 1 ps; init := false; end if; if (schedule_vco'event) then if (init_clks) then refclk_period := inclk0_input_frequency * n_val * 1 ps; m_times_vco_period := refclk_period; new_m_times_vco_period := refclk_period; init_clks := false; end if; sched_time := 0 ps; for i in 0 to 7 loop last_phase_shift(i) := phase_shift(i); end loop; cycle_to_adjust := 0; l_index := 1; m_times_vco_period := new_m_times_vco_period; end if; -- areset was asserted if (areset_ipd'event and areset_ipd = '1') then assert false report family_name & " PLL was reset" severity note; -- reset lock parameters pll_is_locked := false; cycles_to_lock := 0; cycles_to_unlock := 0; end if; if (areset_ipd = '1') then pll_is_in_reset := true; got_first_refclk := false; got_second_refclk := false; -- drop VCO taps to 0 for i in 0 to 7 loop vco_out(i) <= transport '0' after 1 ps; end loop; end if; if (schedule_vco'event and (areset_ipd = '1' or stop_vco)) then -- drop VCO taps to 0 for i in 0 to 7 loop vco_out(i) <= transport '0' after last_phase_shift(i); phase_shift(i) := 0 ps; last_phase_shift(i) := 0 ps; end loop; -- reset lock parameters pll_is_locked := false; cycles_to_lock := 0; cycles_to_unlock := 0; got_first_refclk := false; got_second_refclk := false; refclk_time := 0 ps; got_first_fbclk := false; fbclk_time := 0 ps; first_fbclk_time := 0 ps; fbclk_period := 0 ps; first_schedule := true; vco_val := '0'; vco_period_was_phase_adjusted := false; phase_adjust_was_scheduled := false; elsif ((schedule_vco'event or areset_ipd'event) and areset_ipd = '0' and (not stop_vco) and now > 0 ps) then -- note areset deassert time -- note it as refclk_time to prevent false triggering -- of stop_vco after areset if (areset_ipd'event and areset_ipd = '0' and pll_is_in_reset) then refclk_time := now; locked_tmp := '0'; end if; pll_is_in_reset := false; -- calculate loop_xplier : this will be different from m_val -- in external_feedback_mode loop_xplier := m_val; loop_initial := m_initial_val - 1; loop_ph := m_ph_val; -- convert initial value to delay initial_delay := (loop_initial * m_times_vco_period)/loop_xplier; -- convert loop ph_tap to delay my_rem := (m_times_vco_period/1 ps) rem loop_xplier; tmp_vco_per := (m_times_vco_period/1 ps) / loop_xplier; if (my_rem /= 0) then tmp_vco_per := tmp_vco_per + 1; end if; fbk_phase := (loop_ph * tmp_vco_per)/8; pull_back_M := initial_delay/1 ps + fbk_phase; total_pull_back := pull_back_M; if (simulation_type = "timing") then total_pull_back := total_pull_back + pll_compensation_delay; end if; while (total_pull_back > refclk_period/1 ps) loop total_pull_back := total_pull_back - refclk_period/1 ps; end loop; if (total_pull_back > 0) then offset := refclk_period - (total_pull_back * 1 ps); end if; fbk_delay := total_pull_back - fbk_phase; if (fbk_delay < 0) then offset := offset - (fbk_phase * 1 ps); fbk_delay := total_pull_back; end if; -- assign m_delay m_delay <= transport fbk_delay after 1 ps; my_rem := (m_times_vco_period/1 ps) rem loop_xplier; for i in 1 to loop_xplier loop -- adjust cycles tmp_vco_per := (m_times_vco_period/1 ps)/loop_xplier; if (my_rem /= 0 and l_index <= my_rem) then tmp_rem := (loop_xplier * l_index) rem my_rem; cycle_to_adjust := (loop_xplier * l_index) / my_rem; if (tmp_rem /= 0) then cycle_to_adjust := cycle_to_adjust + 1; end if; end if; if (cycle_to_adjust = i) then tmp_vco_per := tmp_vco_per + 1; l_index := l_index + 1; end if; -- calculate high and low periods vco_per := tmp_vco_per * 1 ps; high_time := (tmp_vco_per/2) * 1 ps; if (tmp_vco_per rem 2 /= 0) then high_time := high_time + 1 ps; end if; low_time := vco_per - high_time; -- schedule the rising and falling edges for j in 1 to 2 loop vco_val := not vco_val; if (vco_val = '0') then sched_time := sched_time + high_time; elsif (vco_val = '1') then sched_time := sched_time + low_time; end if; -- schedule the phase taps for k in 0 to 7 loop phase_shift(k) := (k * vco_per)/8; if (first_schedule) then vco_out(k) <= transport vco_val after (sched_time + phase_shift(k)); else vco_out(k) <= transport vco_val after (sched_time + last_phase_shift(k)); end if; end loop; end loop; end loop; -- schedule once more if (first_schedule) then vco_val := not vco_val; if (vco_val = '0') then sched_time := sched_time + high_time; elsif (vco_val = '1') then sched_time := sched_time + low_time; end if; -- schedule the phase taps for k in 0 to 7 loop phase_shift(k) := (k * vco_per)/8; vco_out(k) <= transport vco_val after (sched_time + phase_shift(k)); end loop; first_schedule := false; end if; schedule_vco <= transport not schedule_vco after sched_time; if (vco_period_was_phase_adjusted) then m_times_vco_period := refclk_period; new_m_times_vco_period := refclk_period; vco_period_was_phase_adjusted := false; phase_adjust_was_scheduled := true; vco_per := m_times_vco_period/loop_xplier; for k in 0 to 7 loop phase_shift(k) := (k * vco_per)/8; end loop; end if; end if; -- Bypass lock detect if (refclk'event and refclk = '1' and areset_ipd = '0') then if (test_bypass_lock_detect = "on") then if (pfdena_ipd = '1') then cycles_pfd_low := 0; if (pfd_locked = '0') then if (cycles_pfd_high = lock_high) then assert false report family_name & " PLL locked in test mode on PFD enable assertion." severity warning; pfd_locked <= '1'; end if; cycles_pfd_high := cycles_pfd_high + 1; end if; end if; if (pfdena_ipd = '0') then cycles_pfd_high := 0; if (pfd_locked = '1') then if (cycles_pfd_low = lock_low) then assert false report family_name & " PLL lost lock in test mode on PFD enable de-assertion." severity warning; pfd_locked <= '0'; end if; cycles_pfd_low := cycles_pfd_low + 1; end if; end if; end if; if (refclk'event and refclk = '1' and areset_ipd = '0') then got_refclk_posedge := true; if (not got_first_refclk) then got_first_refclk := true; else got_second_refclk := true; refclk_period := now - refclk_time; -- check if incoming freq. will cause VCO range to be -- exceeded if ( (i_vco_max /= 0 and i_vco_min /= 0 and pfdena_ipd = '1') and (((refclk_period/1 ps)/loop_xplier > i_vco_max) or ((refclk_period/1 ps)/loop_xplier < i_vco_min)) ) then if (pll_is_locked) then if ((refclk_period/1 ps)/loop_xplier > i_vco_max) then assert false report "Input clock freq. is over VCO range. " & family_name & " PLL may lose lock" severity warning; vco_over <= '1'; end if; if ((refclk_period/1 ps)/loop_xplier < i_vco_min) then assert false report "Input clock freq. is under VCO range. " & family_name & " PLL may lose lock" severity warning; vco_under <= '1'; end if; if (inclk_out_of_range) then pll_is_locked := false; locked_tmp := '0'; cycles_to_lock := 0; vco_period_was_phase_adjusted := false; phase_adjust_was_scheduled := false; assert false report family_name & " PLL lost lock." severity note; end if; elsif (not no_warn) then if ((refclk_period/1 ps)/loop_xplier > i_vco_max) then assert false report "Input clock freq. is over VCO range. " & family_name & " PLL may lose lock" severity warning; vco_over <= '1'; end if; if ((refclk_period/1 ps)/loop_xplier < i_vco_min) then assert false report "Input clock freq. is under VCO range. " & family_name & " PLL may lose lock" severity warning; vco_under <= '1'; end if; assert false report " Input clock freq. is not within VCO range : " & family_name & " PLL may not lock. Please use the correct frequency." severity warning; no_warn := true; end if; inclk_out_of_range := true; else vco_over <= '0'; vco_under <= '0'; inclk_out_of_range := false; no_warn := false; end if; end if; end if; if (stop_vco) then stop_vco := false; schedule_vco <= not schedule_vco; end if; refclk_time := now; else got_refclk_posedge := false; end if; -- Update M counter value on feedback clock edge if (fbclk'event and fbclk = '1') then got_fbclk_posedge := true; if (not got_first_fbclk) then got_first_fbclk := true; else fbclk_period := now - fbclk_time; end if; -- need refclk_period here, so initialized to proper value above if ( ( (now - refclk_time > 1.5 * refclk_period) and pfdena_ipd = '1' and pll_is_locked) or ( (now - refclk_time > 5 * refclk_period) and pfdena_ipd = '1' and pll_has_just_been_reconfigured = false) or ( (now - refclk_time > 50 * refclk_period) and pfdena_ipd = '1' and pll_has_just_been_reconfigured = true) ) then stop_vco := true; -- reset got_first_refclk := false; got_first_fbclk := false; got_second_refclk := false; if (pll_is_locked) then pll_is_locked := false; locked_tmp := '0'; assert false report family_name & " PLL lost lock due to loss of input clock or the input clock is not detected within the allowed time frame." severity note; if ((i_vco_max = 0) and (i_vco_min = 0)) then assert false report "Please run timing simulation to check whether the input clock is operating within the supported VCO range or not." severity note; end if; end if; cycles_to_lock := 0; cycles_to_unlock := 0; first_schedule := true; vco_period_was_phase_adjusted := false; phase_adjust_was_scheduled := false; end if; fbclk_time := now; else got_fbclk_posedge := false; end if; if ((got_refclk_posedge or got_fbclk_posedge) and got_second_refclk and pfdena_ipd = '1' and (not inclk_out_of_range)) then -- now we know actual incoming period if ( abs(fbclk_time - refclk_time) <= 5 ps or (got_first_fbclk and abs(refclk_period - abs(fbclk_time - refclk_time)) <= 5 ps)) then -- considered in phase if (cycles_to_lock = real_lock_high) then if (not pll_is_locked) then assert false report family_name & " PLL locked to incoming clock" severity note; end if; pll_is_locked := true; locked_tmp := '1'; cycles_to_unlock := 0; end if; -- increment lock counter only if second part of above -- time check is NOT true if (not(abs(refclk_period - abs(fbclk_time - refclk_time)) <= lock_window)) then cycles_to_lock := cycles_to_lock + 1; end if; -- adjust m_times_vco_period new_m_times_vco_period := refclk_period; else -- if locked, begin unlock if (pll_is_locked) then cycles_to_unlock := cycles_to_unlock + 1; if (cycles_to_unlock = lock_low) then pll_is_locked := false; locked_tmp := '0'; cycles_to_lock := 0; vco_period_was_phase_adjusted := false; phase_adjust_was_scheduled := false; assert false report family_name & " PLL lost lock." severity note; got_first_refclk := false; got_first_fbclk := false; got_second_refclk := false; end if; end if; if ( abs(refclk_period - fbclk_period) <= 2 ps ) then -- frequency is still good if (now = fbclk_time and (not phase_adjust_was_scheduled)) then if ( abs(fbclk_time - refclk_time) > refclk_period/2) then new_m_times_vco_period := m_times_vco_period + (refclk_period - abs(fbclk_time - refclk_time)); vco_period_was_phase_adjusted := true; else new_m_times_vco_period := m_times_vco_period - abs(fbclk_time - refclk_time); vco_period_was_phase_adjusted := true; end if; end if; else phase_adjust_was_scheduled := false; new_m_times_vco_period := refclk_period; end if; end if; end if; if (pfdena_ipd = '0') then if (pll_is_locked) then locked_tmp := 'X'; end if; pll_is_locked := false; cycles_to_lock := 0; end if; -- give message only at time of deassertion if (pfdena_ipd'event and pfdena_ipd = '0') then assert false report "PFDENA deasserted." severity note; elsif (pfdena_ipd'event and pfdena_ipd = '1') then got_first_refclk := false; got_second_refclk := false; refclk_time := now; end if; if (reconfig_err) then lock <= '0'; else lock <= locked_tmp; end if; -- signal to calculate quiet_time sig_refclk_period <= refclk_period; if (stop_vco = true) then sig_stop_vco <= '1'; else sig_stop_vco <= '0'; end if; pll_locked <= pll_is_locked; end process; clk0_tmp <= c_clk(i_clk0_counter); clk_pfd(0) <= clk0_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(0) <= clk_pfd(0) WHEN (test_bypass_lock_detect = "on") ELSE clk0_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk1_tmp <= c_clk(i_clk1_counter); clk_pfd(1) <= clk1_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(1) <= clk_pfd(1) WHEN (test_bypass_lock_detect = "on") ELSE clk1_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk2_tmp <= c_clk(i_clk2_counter); clk_pfd(2) <= clk2_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(2) <= clk_pfd(2) WHEN (test_bypass_lock_detect = "on") ELSE clk2_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk3_tmp <= c_clk(i_clk3_counter); clk_pfd(3) <= clk3_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(3) <= clk_pfd(3) WHEN (test_bypass_lock_detect = "on") ELSE clk3_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk4_tmp <= c_clk(i_clk4_counter); clk_pfd(4) <= clk4_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(4) <= clk_pfd(4) WHEN (test_bypass_lock_detect = "on") ELSE clk4_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk5_tmp <= c_clk(i_clk5_counter); clk_pfd(5) <= clk5_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(5) <= clk_pfd(5) WHEN (test_bypass_lock_detect = "on") ELSE clk5_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk6_tmp <= c_clk(i_clk6_counter); clk_pfd(6) <= clk6_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(6) <= clk_pfd(6) WHEN (test_bypass_lock_detect = "on") ELSE clk6_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk7_tmp <= c_clk(i_clk7_counter); clk_pfd(7) <= clk7_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(7) <= clk_pfd(7) WHEN (test_bypass_lock_detect = "on") ELSE clk7_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk8_tmp <= c_clk(i_clk8_counter); clk_pfd(8) <= clk8_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(8) <= clk_pfd(8) WHEN (test_bypass_lock_detect = "on") ELSE clk8_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; clk9_tmp <= c_clk(i_clk9_counter); clk_pfd(9) <= clk9_tmp WHEN (pfd_locked = '1') ELSE 'X'; clk(9) <= clk_pfd(9) WHEN (test_bypass_lock_detect = "on") ELSE clk9_tmp when (areset_ipd = '1' or pll_in_test_mode) or (pll_locked and (not reconfig_err)) else 'X'; scandataout <= scandata_out; scandone <= NOT scandone_tmp; phasedone <= NOT update_phase; vcooverrange <= 'Z' WHEN (vco_range_detector_high_bits = -1) ELSE vco_over; vcounderrange <= 'Z' WHEN (vco_range_detector_low_bits = -1) ELSE vco_under; fbout <= fbclk; end vital_pll; -- END ARCHITECTURE VITAL_PLL ------------------------------------------------------------------- -- -- Entity Name : arriaii_asmiblock -- -- Description : Piranha ASMIBLOCK VHDL Simulation model -- ------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use work.arriaii_atom_pack.all; entity arriaii_asmiblock is generic ( lpm_type : string := "arriaii_asmiblock" ); port ( dclkin : in std_logic := '0'; scein : in std_logic := '0'; sdoin : in std_logic := '0'; data0in : in std_logic := '0'; oe : in std_logic := '0'; dclkout : out std_logic; sceout : out std_logic; sdoout : out std_logic; data0out: out std_logic ); end arriaii_asmiblock; architecture architecture_asmiblock of arriaii_asmiblock is begin end architecture_asmiblock; -- end of arriaii_asmiblock --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_reg -- -- Description : Simulation model for a simple DFF. -- This is used for registering the enable inputs. -- No timing, powers upto 0. -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE ieee.std_logic_1164.all; --USE ieee.std_logic_unsigned.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_lvds_reg is GENERIC ( MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; TimingChecksOn : Boolean := True; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_ena : VitalDelayType01 := DefpropDelay01; tipd_d : VitalDelayType01 := DefpropDelay01; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01 ); PORT ( q : OUT std_logic; clk : IN std_logic; ena : IN std_logic := '1'; d : IN std_logic; clrn : IN std_logic := '1'; prn : IN std_logic := '1' ); END arriaii_lvds_reg; ARCHITECTURE vital_arriaii_lvds_reg of arriaii_lvds_reg is -- INTERNAL SIGNALS signal clk_ipd : std_logic; signal d_ipd : std_logic; signal ena_ipd : std_logic; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (ena_ipd, ena, tipd_ena); VitalWireDelay (d_ipd, d, tipd_d); end block; process (clk_ipd, d_ipd, clrn, prn) variable q_tmp : std_logic := '0'; variable q_VitalGlitchData : VitalGlitchDataType; variable Tviol_d_clk : std_ulogic := '0'; variable TimingData_d_clk : VitalTimingDataType := VitalTimingDataInit; begin ------------------------ -- Timing Check Section ------------------------ if (prn = '0') then q_tmp := '1'; elsif (clrn = '0') then q_tmp := '0'; elsif (clk_ipd'event and clk_ipd = '1') then if (ena_ipd = '1') then q_tmp := d_ipd; end if; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => q, OutSignalName => "Q", OutTemp => q_tmp, Paths => (1 => (clk_ipd'last_event, tpd_clk_q_posedge, TRUE)), GlitchData => q_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; end vital_arriaii_lvds_reg; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_rx_fifo_sync_ram -- -- Description : -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE ieee.std_logic_1164.all; --USE ieee.std_logic_unsigned.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_lvds_rx_fifo_sync_ram is PORT ( clk : IN std_logic; datain : IN std_logic := '0'; writereset : IN std_logic := '0'; waddr : IN std_logic_vector(2 DOWNTO 0) := "000"; raddr : IN std_logic_vector(2 DOWNTO 0) := "000"; we : IN std_logic := '0'; dataout : OUT std_logic ); END arriaii_lvds_rx_fifo_sync_ram; ARCHITECTURE vital_arm_lvds_rx_fifo_sync_ram OF arriaii_lvds_rx_fifo_sync_ram IS -- INTERNAL SIGNALS signal dataout_tmp : std_logic; signal ram_d : std_logic_vector(0 TO 5); signal ram_q : std_logic_vector(0 TO 5); signal data_reg : std_logic_vector(0 TO 5); begin dataout <= dataout_tmp; process (clk, writereset) variable initial : boolean := true; begin if (initial) then for i in 0 to 5 loop ram_q(i) <= '0'; end loop; initial := false; end if; if (writereset = '1') then for i in 0 to 5 loop ram_q(i) <= '0'; end loop; elsif (clk'event and clk = '1') then for i in 0 to 5 loop ram_q(i) <= ram_d(i); end loop; end if; end process; process (we, data_reg, ram_q) begin if (we = '1') then ram_d <= data_reg; else ram_d <= ram_q; end if; end process; data_reg(0) <= datain when (waddr = "000") else ram_q(0) ; data_reg(1) <= datain when (waddr = "001") else ram_q(1) ; data_reg(2) <= datain when (waddr = "010") else ram_q(2) ; data_reg(3) <= datain when (waddr = "011") else ram_q(3) ; data_reg(4) <= datain when (waddr = "100") else ram_q(4) ; data_reg(5) <= datain when (waddr = "101") else ram_q(5) ; process (ram_q, we, waddr, raddr) variable initial : boolean := true; begin if (initial) then dataout_tmp <= '0'; initial := false; end if; case raddr is when "000" => dataout_tmp <= ram_q(0); when "001" => dataout_tmp <= ram_q(1); when "010" => dataout_tmp <= ram_q(2); when "011" => dataout_tmp <= ram_q(3); when "100" => dataout_tmp <= ram_q(4); when "101" => dataout_tmp <= ram_q(5); when others => dataout_tmp <= '0'; end case; end process; END vital_arm_lvds_rx_fifo_sync_ram; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_rx_fifo -- -- Description : -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE work.arriaii_lvds_rx_fifo_sync_ram; ENTITY arriaii_lvds_rx_fifo is GENERIC ( channel_width : integer := 10; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_wclk : VitalDelayType01 := DefpropDelay01; tipd_rclk : VitalDelayType01 := DefpropDelay01; tipd_dparst : VitalDelayType01 := DefpropDelay01; tipd_fiforst : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01; tpd_rclk_dataout_posedge: VitalDelayType01 := DefPropDelay01; tpd_dparst_dataout_posedge: VitalDelayType01 := DefPropDelay01 ); PORT ( wclk : IN std_logic:= '0'; rclk : IN std_logic:= '0'; dparst : IN std_logic := '0'; fiforst : IN std_logic := '0'; datain : IN std_logic := '0'; dataout : OUT std_logic ); END arriaii_lvds_rx_fifo; ARCHITECTURE vital_arm_lvds_rx_fifo of arriaii_lvds_rx_fifo is -- INTERNAL SIGNALS signal datain_in : std_logic; signal rclk_in : std_logic; signal dparst_in : std_logic; signal fiforst_in : std_logic; signal wclk_in : std_logic; signal ram_datain : std_logic; signal ram_dataout : std_logic; signal wrPtr : std_logic_vector(2 DOWNTO 0); signal rdPtr : std_logic_vector(2 DOWNTO 0); signal rdAddr : std_logic_vector(2 DOWNTO 0); signal ram_we : std_logic; signal write_side_sync_reset : std_logic; signal read_side_sync_reset : std_logic; COMPONENT arriaii_lvds_rx_fifo_sync_ram PORT ( clk : IN std_logic; datain : IN std_logic := '0'; writereset : IN std_logic := '0'; waddr : IN std_logic_vector(2 DOWNTO 0) := "000"; raddr : IN std_logic_vector(2 DOWNTO 0) := "000"; we : IN std_logic := '0'; dataout : OUT std_logic ); END COMPONENT; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (wclk_in, wclk, tipd_wclk); VitalWireDelay (rclk_in, rclk, tipd_rclk); VitalWireDelay (dparst_in, dparst, tipd_dparst); VitalWireDelay (fiforst_in, fiforst, tipd_fiforst); VitalWireDelay (datain_in, datain, tipd_datain); end block; rdAddr <= rdPtr ; s_fifo_ram : arriaii_lvds_rx_fifo_sync_ram PORT MAP ( clk => wclk_in, datain => ram_datain, writereset => write_side_sync_reset, waddr => wrPtr, raddr => rdAddr, we => ram_we, dataout => ram_dataout ); process (wclk_in, dparst_in) variable initial : boolean := true; begin if (initial) then wrPtr <= "000"; write_side_sync_reset <= '0'; ram_we <= '0'; ram_datain <= '0'; initial := false; end if; if (dparst_in = '1' or (fiforst_in = '1' and wclk_in'event and wclk_in = '1')) then write_side_sync_reset <= '1'; ram_datain <= '0'; wrPtr <= "000"; ram_we <= '0'; elsif (dparst_in = '0' and (fiforst_in = '0' and wclk_in'event and wclk_in = '1')) then write_side_sync_reset <= '0'; end if; if (wclk_in'event and wclk_in = '1' and write_side_sync_reset = '0' and fiforst_in = '0' and dparst_in = '0') then ram_datain <= datain_in; ram_we <= '1'; case wrPtr is when "000" => wrPtr <= "001"; when "001" => wrPtr <= "010"; when "010" => wrPtr <= "011"; when "011" => wrPtr <= "100"; when "100" => wrPtr <= "101"; when "101" => wrPtr <= "000"; when others => wrPtr <= "000"; end case; end if; end process; process (rclk_in, dparst_in) variable initial : boolean := true; variable dataout_tmp : std_logic := '0'; variable dataout_VitalGlitchData : VitalGlitchDataType; begin if (initial) then rdPtr <= "011"; read_side_sync_reset <= '0'; dataout_tmp := '0'; initial := false; end if; if (dparst_in = '1' or (fiforst_in = '1' and rclk_in'event and rclk_in = '1')) then read_side_sync_reset <= '1'; rdPtr <= "011"; dataout_tmp := '0'; elsif (dparst_in = '0' and (fiforst_in = '0' and rclk_in'event and rclk_in = '1')) then read_side_sync_reset <= '0'; end if; if (rclk_in'event and rclk_in = '1' and read_side_sync_reset = '0' and fiforst_in = '0' and dparst_in = '0') then case rdPtr is when "000" => rdPtr <= "001"; when "001" => rdPtr <= "010"; when "010" => rdPtr <= "011"; when "011" => rdPtr <= "100"; when "100" => rdPtr <= "101"; when "101" => rdPtr <= "000"; when others => rdPtr <= "000"; end case; dataout_tmp := ram_dataout; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( Outsignal => dataout, OutsignalName => "DATAOUT", OutTemp => dataout_tmp, Paths => (1 => (rclk_in'last_event, tpd_rclk_dataout_posedge, TRUE)), GlitchData => dataout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; END vital_arm_lvds_rx_fifo; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_rx_bitslip -- -- Description : -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE, std; USE ieee.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE work.arriaii_lvds_reg; ENTITY arriaii_lvds_rx_bitslip is GENERIC ( channel_width : integer := 10; bitslip_rollover : integer := 12; x_on_bitslip : string := "on"; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk0 : VitalDelayType01 := DefpropDelay01; tipd_bslipcntl : VitalDelayType01 := DefpropDelay01; tipd_bsliprst : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01; tpd_bsliprst_bslipmax_posedge: VitalDelayType01 := DefPropDelay01; tpd_clk0_bslipmax_posedge: VitalDelayType01 := DefPropDelay01 ); PORT ( clk0 : IN std_logic := '0'; bslipcntl : IN std_logic := '0'; bsliprst : IN std_logic := '0'; datain : IN std_logic := '0'; bslipmax : OUT std_logic; dataout : OUT std_logic ); END arriaii_lvds_rx_bitslip; ARCHITECTURE vital_arm_lvds_rx_bitslip OF arriaii_lvds_rx_bitslip IS -- INTERNAL SIGNALS signal clk0_in : std_logic; signal bslipcntl_in : std_logic; signal bsliprst_in : std_logic; signal datain_in : std_logic; signal slip_count : integer := 0; signal dataout_tmp : std_logic; signal bitslip_arr : std_logic_vector(11 DOWNTO 0) := "000000000000"; signal bslipcntl_reg : std_logic; signal vcc : std_logic := '1'; signal slip_data : std_logic := '0'; signal start_corrupt_bits : std_logic := '0'; signal num_corrupt_bits : integer := 0; COMPONENT arriaii_lvds_reg GENERIC ( MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_ena : VitalDelayType01 := DefpropDelay01; tipd_d : VitalDelayType01 := DefpropDelay01; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( q : OUT std_logic; clk : IN std_logic; ena : IN std_logic := '1'; d : IN std_logic; clrn : IN std_logic := '1'; prn : IN std_logic := '1' ); END COMPONENT; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk0_in, clk0, tipd_clk0); VitalWireDelay (bslipcntl_in, bslipcntl, tipd_bslipcntl); VitalWireDelay (bsliprst_in, bsliprst, tipd_bsliprst); VitalWireDelay (datain_in, datain, tipd_datain); end block; bslipcntlreg : arriaii_lvds_reg PORT MAP ( d => bslipcntl_in, clk => clk0_in, ena => vcc, clrn => vcc, prn => vcc, q => bslipcntl_reg ); -- 4-bit slip counter and 12-bit shift register process (bslipcntl_reg, bsliprst_in, clk0_in) variable initial : boolean := true; variable bslipmax_tmp : std_logic := '0'; variable bslipmax_VitalGlitchData : VitalGlitchDataType; begin if (bsliprst_in = '1') then slip_count <= 0; bslipmax_tmp := '0'; -- bitslip_arr <= (OTHERS => '0'); if (bsliprst_in'event and bsliprst_in = '1' and bsliprst_in'last_value = '0') then ASSERT false report "Bit Slip Circuit was reset. Serial Data stream will have 0 latency" severity note; end if; else if (bslipcntl_reg'event and bslipcntl_reg = '1' and bslipcntl_reg'last_value = '0') then if (x_on_bitslip = "on") then start_corrupt_bits <= '1'; end if; num_corrupt_bits <= 0; if (slip_count = bitslip_rollover) then ASSERT false report "Rollover occurred on Bit Slip circuit. Serial data stream will have 0 latency." severity note; slip_count <= 0; bslipmax_tmp := '0'; else slip_count <= slip_count + 1; if ((slip_count + 1) = bitslip_rollover) then ASSERT false report "The Bit Slip circuit has reached the maximum Bit Slip limit. Rollover will occur on the next slip." severity note; bslipmax_tmp := '1'; end if; end if; elsif (bslipcntl_reg'event and bslipcntl_reg = '0' and bslipcntl_reg'last_value = '1') then start_corrupt_bits <= '0'; num_corrupt_bits <= 0; end if; end if; if (clk0_in'event and clk0_in = '1' and clk0_in'last_value = '0') then bitslip_arr(0) <= datain_in; for i in 0 to (bitslip_rollover - 1) loop bitslip_arr(i + 1) <= bitslip_arr(i); end loop; if (start_corrupt_bits = '1') then num_corrupt_bits <= num_corrupt_bits + 1; end if; if (num_corrupt_bits+1 = 3) then start_corrupt_bits <= '0'; end if; end if; -- end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( Outsignal => bslipmax, OutsignalName => "BSLIPMAX", OutTemp => bslipmax_tmp, Paths => (1 => (clk0_in'last_event, tpd_clk0_bslipmax_posedge, TRUE), 2 => (bsliprst_in'last_event, tpd_bsliprst_bslipmax_posedge, TRUE)), GlitchData => bslipmax_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); end process; slip_data <= bitslip_arr(slip_count); dataoutreg : arriaii_lvds_reg PORT MAP ( d => slip_data, clk => clk0_in, ena => vcc, clrn => vcc, prn => vcc, q => dataout_tmp ); dataout <= dataout_tmp when start_corrupt_bits = '0' else 'X' when start_corrupt_bits = '1' and num_corrupt_bits < 3 else dataout_tmp; END vital_arm_lvds_rx_bitslip; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_rx_deser -- -- Description : Timing simulation model for the arriaii LVDS RECEIVER -- DESERIALIZER. This module receives serial data and outputs -- parallel data word of width = channel width -- --//////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE ieee.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_lvds_rx_deser IS GENERIC ( channel_width : integer := 4; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01; tpd_clk_dataout_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( clk : IN std_logic := '0'; datain : IN std_logic := '0'; dataout : OUT std_logic_vector(channel_width - 1 DOWNTO 0); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_lvds_rx_deser; ARCHITECTURE vital_arm_lvds_rx_deser OF arriaii_lvds_rx_deser IS -- INTERNAL SIGNALS signal clk_ipd : std_logic; signal datain_ipd : std_logic; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (datain_ipd, datain, tipd_datain); end block; VITAL: process (clk_ipd, devpor, devclrn) variable dataout_tmp : std_logic_vector(channel_width - 1 downto 0) := (OTHERS => '0'); variable i : integer := 0; variable dataout_VitalGlitchDataArray : VitalGlitchDataArrayType(9 downto 0); variable CQDelay : TIME := 0 ns; begin if (devclrn = '0' or devpor = '0') then dataout_tmp := (OTHERS => '0'); else if (clk_ipd'event and clk_ipd = '1' and clk_ipd'last_value = '0') then for i in channel_width - 1 DOWNTO 1 loop dataout_tmp(i) := dataout_tmp(i - 1); end loop; dataout_tmp(0) := datain_ipd; end if; end if; ---------------------- -- Path Delay Section ---------------------- CQDelay := SelectDelay ( (1 => (clk_ipd'last_event, tpd_clk_dataout_posedge, TRUE)) ); dataout <= TRANSPORT dataout_tmp AFTER CQDelay; end process; END vital_arm_lvds_rx_deser; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_lvds_rx_parallel_reg -- -- Description : Timing simulation model for the arriaii LVDS RECEIVER -- PARALLEL REGISTER. The data width equals max. channel width, -- which is 10. -- --//////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE ieee.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; ENTITY arriaii_lvds_rx_parallel_reg IS GENERIC ( channel_width : integer := 4; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_enable : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayArrayType01(9 downto 0) := (OTHERS => DefpropDelay01); tpd_clk_dataout_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( clk : IN std_logic; enable : IN std_logic := '1'; datain : IN std_logic_vector(channel_width - 1 DOWNTO 0); dataout : OUT std_logic_vector(channel_width - 1 DOWNTO 0); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_lvds_rx_parallel_reg; ARCHITECTURE vital_arm_lvds_rx_parallel_reg OF arriaii_lvds_rx_parallel_reg IS -- INTERNAL SIGNALS signal clk_ipd : std_logic; signal datain_ipd : std_logic_vector(channel_width - 1 downto 0); signal enable_ipd : std_logic; begin ---------------------- -- INPUT PATH DELAYs ---------------------- WireDelay : block begin VitalWireDelay (clk_ipd, clk, tipd_clk); VitalWireDelay (enable_ipd, enable, tipd_enable); loopbits : FOR i in datain'RANGE GENERATE VitalWireDelay (datain_ipd(i), datain(i), tipd_datain(i)); END GENERATE; end block; VITAL: process (clk_ipd, devpor, devclrn) variable dataout_tmp : std_logic_vector(channel_width - 1 downto 0) := (OTHERS => '0'); variable i : integer := 0; variable dataout_VitalGlitchDataArray : VitalGlitchDataArrayType(9 downto 0); variable CQDelay : TIME := 0 ns; begin if ((devpor = '0') or (devclrn = '0')) then dataout_tmp := (OTHERS => '0'); else if (clk_ipd'event and clk_ipd = '1') then if (enable_ipd = '1') then dataout_tmp := datain_ipd; end if; end if; end if; ---------------------- -- Path Delay Section ---------------------- CQDelay := SelectDelay ( (1 => (clk_ipd'last_event, tpd_clk_dataout_posedge, TRUE)) ); dataout <= dataout_tmp AFTER CQDelay; end process; END vital_arm_lvds_rx_parallel_reg; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_pclk_divider -- -- Description : Simulation model for a clock divider -- output clock is divided by value specified -- in the parameter clk_divide_by -- ------------------------------------------------------------------------------- LIBRARY IEEE; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; ENTITY arriaii_pclk_divider IS GENERIC ( clk_divide_by : integer := 1); PORT ( clkin : IN std_logic; lloaden : OUT std_logic; clkout : OUT std_logic); END arriaii_pclk_divider; ARCHITECTURE arch OF arriaii_pclk_divider IS SIGNAL lloaden_tmp : std_logic := '0'; SIGNAL clkout_tmp : std_logic := '0'; SIGNAL cnt : std_logic_vector(4 DOWNTO 0):= (others => '0'); BEGIN clkout <= clkin WHEN (clk_divide_by = 1) ELSE clkout_tmp; lloaden <= lloaden_tmp; PROCESS(clkin) variable count : std_logic := '0'; variable start : std_logic := '0'; variable prev_load : std_logic := '0'; BEGIN IF(clkin = '1') THEN count := '1'; END IF; if( count = '1') then IF (cnt < clk_divide_by) THEN clkout_tmp <= '0'; cnt <= cnt + "00001"; ELSE IF (cnt = (2 * clk_divide_by - 1)) THEN cnt <= "00000"; ELSE clkout_tmp <= '1'; cnt <= cnt + "00001"; END IF; END IF; end if; END PROCESS; process( clkin, cnt ) begin if( cnt =( 2*clk_divide_by -2) )then lloaden_tmp <= '1'; else if(cnt = 0)then lloaden_tmp <= '0'; end if; end if; end process; END arch; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_select_ini_phase_dpaclk -- -- Description : Simulation model for selecting the initial phase of the dpa clock -- -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; USE IEEE.std_logic_arith.ALL; ENTITY arriaii_select_ini_phase_dpaclk IS GENERIC( initial_phase_select : integer := 0 ); PORT ( clkin : IN STD_LOGIC; loaden : IN STD_LOGIC; enable : IN STD_LOGIC; clkout : OUT STD_LOGIC; loadenout : OUT STD_LOGIC ); END arriaii_select_ini_phase_dpaclk; ARCHITECTURE trans OF arriaii_select_ini_phase_dpaclk IS SIGNAL clk_period : time := 0 ps; SIGNAL last_clk_period : time := 0 ps; SIGNAL last_clkin_edge : time := 0 ps; SIGNAL first_clkin_edge_detect : STD_LOGIC := '0'; SIGNAL clk0_tmp : STD_LOGIC; SIGNAL clk1_tmp : STD_LOGIC; SIGNAL clk2_tmp : STD_LOGIC; SIGNAL clk3_tmp : STD_LOGIC; SIGNAL clk4_tmp : STD_LOGIC; SIGNAL clk5_tmp : STD_LOGIC; SIGNAL clk6_tmp : STD_LOGIC; SIGNAL clk7_tmp : STD_LOGIC; SIGNAL loaden0_tmp : STD_LOGIC; SIGNAL loaden1_tmp : STD_LOGIC; SIGNAL loaden2_tmp : STD_LOGIC; SIGNAL loaden3_tmp : STD_LOGIC; SIGNAL loaden4_tmp : STD_LOGIC; SIGNAL loaden5_tmp : STD_LOGIC; SIGNAL loaden6_tmp : STD_LOGIC; SIGNAL loaden7_tmp : STD_LOGIC; SIGNAL clkout_tmp : STD_LOGIC; SIGNAL loadenout_tmp : STD_LOGIC; BEGIN clkout_tmp <= clk1_tmp when (initial_phase_select = 1) else clk2_tmp when (initial_phase_select = 2) else clk3_tmp when (initial_phase_select = 3) else clk4_tmp when (initial_phase_select = 4) else clk5_tmp when (initial_phase_select = 5) else clk6_tmp when (initial_phase_select = 6) else clk7_tmp when (initial_phase_select = 7) else clk0_tmp; clkout <= clkout_tmp when enable = '1' else clkin; loadenout_tmp <= loaden1_tmp when (initial_phase_select = 1) else loaden2_tmp when (initial_phase_select = 2) else loaden3_tmp when (initial_phase_select = 3) else loaden4_tmp when (initial_phase_select = 4) else loaden5_tmp when (initial_phase_select = 5) else loaden6_tmp when (initial_phase_select = 6) else loaden7_tmp when (initial_phase_select = 7) else loaden0_tmp; loadenout <= loadenout_tmp when enable = '1' else loaden; -- Calculate the clock period PROCESS VARIABLE clk_period_tmp : time := 0 ps; BEGIN WAIT UNTIL (clkin'EVENT AND clkin = '1'); IF (first_clkin_edge_detect = '0') THEN first_clkin_edge_detect <= '1'; ELSE last_clk_period <= clk_period; clk_period_tmp := NOW - last_clkin_edge; END IF; last_clkin_edge <= NOW; clk_period <= clk_period_tmp; END PROCESS; -- Generate the phase shifted signals PROCESS (clkin) BEGIN clk0_tmp <= clkin; clk1_tmp <= TRANSPORT clkin after (clk_period * 0.125) ; clk2_tmp <= TRANSPORT clkin after (clk_period * 0.25) ; clk3_tmp <= TRANSPORT clkin after (clk_period * 0.375) ; clk4_tmp <= TRANSPORT clkin after (clk_period * 0.5) ; clk5_tmp <= TRANSPORT clkin after (clk_period * 0.625) ; clk6_tmp <= TRANSPORT clkin after (clk_period * 0.75) ; clk7_tmp <= TRANSPORT clkin after (clk_period * 0.875) ; END PROCESS; PROCESS (loaden) BEGIN loaden0_tmp <= clkin; loaden1_tmp <= TRANSPORT loaden after (clk_period * 0.125) ; loaden2_tmp <= TRANSPORT loaden after (clk_period * 0.25) ; loaden3_tmp <= TRANSPORT loaden after (clk_period * 0.375) ; loaden4_tmp <= TRANSPORT loaden after (clk_period * 0.5) ; loaden5_tmp <= TRANSPORT loaden after (clk_period * 0.625) ; loaden6_tmp <= TRANSPORT loaden after (clk_period * 0.75) ; loaden7_tmp <= TRANSPORT loaden after (clk_period * 0.875) ; END PROCESS; END trans; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_dpa_retime_block -- -- Description : Simulation model for generating the retimed clock,data and loaden. -- Each of the signals has 8 different phase shifted versions. -- -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; USE IEEE.std_logic_arith.ALL; ENTITY arriaii_dpa_retime_block IS PORT ( clkin : IN STD_LOGIC; datain : IN STD_LOGIC; reset : IN STD_LOGIC; clk0 : OUT STD_LOGIC; clk1 : OUT STD_LOGIC; clk2 : OUT STD_LOGIC; clk3 : OUT STD_LOGIC; clk4 : OUT STD_LOGIC; clk5 : OUT STD_LOGIC; clk6 : OUT STD_LOGIC; clk7 : OUT STD_LOGIC; data0 : OUT STD_LOGIC; data1 : OUT STD_LOGIC; data2 : OUT STD_LOGIC; data3 : OUT STD_LOGIC; data4 : OUT STD_LOGIC; data5 : OUT STD_LOGIC; data6 : OUT STD_LOGIC; data7 : OUT STD_LOGIC; lock : OUT STD_LOGIC ); END arriaii_dpa_retime_block; ARCHITECTURE trans OF arriaii_dpa_retime_block IS SIGNAL clk_period : time := 0 ps; SIGNAL last_clk_period : time := 0 ps; SIGNAL last_clkin_edge : time := 0 ps; SIGNAL first_clkin_edge_detect : STD_LOGIC := '0'; SIGNAL clk0_tmp : STD_LOGIC; SIGNAL clk1_tmp : STD_LOGIC; SIGNAL clk2_tmp : STD_LOGIC; SIGNAL clk3_tmp : STD_LOGIC; SIGNAL clk4_tmp : STD_LOGIC; SIGNAL clk5_tmp : STD_LOGIC; SIGNAL clk6_tmp : STD_LOGIC; SIGNAL clk7_tmp : STD_LOGIC; SIGNAL data0_tmp : STD_LOGIC; SIGNAL data1_tmp : STD_LOGIC; SIGNAL data2_tmp : STD_LOGIC; SIGNAL data3_tmp : STD_LOGIC; SIGNAL data4_tmp : STD_LOGIC; SIGNAL data5_tmp : STD_LOGIC; SIGNAL data6_tmp : STD_LOGIC; SIGNAL data7_tmp : STD_LOGIC; SIGNAL lock_tmp : STD_LOGIC := '0'; BEGIN clk0 <= '0' WHEN reset = '1' ELSE clk0_tmp; clk1 <= '0' WHEN reset = '1' ELSE clk1_tmp; clk2 <= '0' WHEN reset = '1' ELSE clk2_tmp; clk3 <= '0' WHEN reset = '1' ELSE clk3_tmp; clk4 <= '0' WHEN reset = '1' ELSE clk4_tmp; clk5 <= '0' WHEN reset = '1' ELSE clk5_tmp; clk6 <= '0' WHEN reset = '1' ELSE clk6_tmp; clk7 <= '0' WHEN reset = '1' ELSE clk7_tmp; data0 <= '0' WHEN reset = '1' ELSE data0_tmp; data1 <= '0' WHEN reset = '1' ELSE data1_tmp; data2 <= '0' WHEN reset = '1' ELSE data2_tmp; data3 <= '0' WHEN reset = '1' ELSE data3_tmp; data4 <= '0' WHEN reset = '1' ELSE data4_tmp; data5 <= '0' WHEN reset = '1' ELSE data5_tmp; data6 <= '0' WHEN reset = '1' ELSE data6_tmp; data7 <= '0' WHEN reset = '1' ELSE data7_tmp; lock <= '0' WHEN reset = '1' ELSE lock_tmp; -- Calculate the clock period PROCESS VARIABLE clk_period_tmp : time := 0 ps; BEGIN WAIT UNTIL (clkin'EVENT AND clkin = '1'); IF (first_clkin_edge_detect = '0') THEN first_clkin_edge_detect <= '1'; ELSE last_clk_period <= clk_period; clk_period_tmp := NOW - last_clkin_edge; END IF; IF (((clk_period_tmp = last_clk_period) OR (clk_period_tmp = last_clk_period + 1 ps) OR (clk_period_tmp = last_clk_period - 1 ps)) AND (clk_period_tmp /= 0 ps ) AND (last_clk_period /= 0 ps)) THEN lock_tmp <= '1'; ELSE lock_tmp <= '0'; END IF; last_clkin_edge <= NOW; clk_period <= clk_period_tmp; END PROCESS; -- Generate the phase shifted signals PROCESS (clkin) BEGIN clk0_tmp <= clkin; clk1_tmp <= TRANSPORT clkin after (clk_period * 0.125) ; clk2_tmp <= TRANSPORT clkin after (clk_period * 0.25) ; clk3_tmp <= TRANSPORT clkin after (clk_period * 0.375) ; clk4_tmp <= TRANSPORT clkin after (clk_period * 0.5) ; clk5_tmp <= TRANSPORT clkin after (clk_period * 0.625) ; clk6_tmp <= TRANSPORT clkin after (clk_period * 0.75) ; clk7_tmp <= TRANSPORT clkin after (clk_period * 0.875) ; END PROCESS; PROCESS (datain) BEGIN data0_tmp <= datain; data1_tmp <= TRANSPORT datain after (clk_period * 0.125) ; data2_tmp <= TRANSPORT datain after (clk_period * 0.25) ; data3_tmp <= TRANSPORT datain after (clk_period * 0.375) ; data4_tmp <= TRANSPORT datain after (clk_period * 0.5) ; data5_tmp <= TRANSPORT datain after (clk_period * 0.625) ; data6_tmp <= TRANSPORT datain after (clk_period * 0.75) ; data7_tmp <= TRANSPORT datain after (clk_period * 0.875) ; END PROCESS; END trans; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_dpa_block -- -- Description : Simulation model for selecting the retimed data, clock and loaden -- depending on the PPM varaiation and direction of shift. -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; USE work.arriaii_dpa_retime_block; ENTITY arriaii_dpa_block IS GENERIC ( net_ppm_variation : INTEGER := 0; is_negative_ppm_drift : STRING := "off"; enable_soft_cdr_mode: STRING := "on" ); PORT ( clkin : IN STD_LOGIC; dpareset : IN STD_LOGIC; dpahold : IN STD_LOGIC; datain : IN STD_LOGIC; clkout : OUT STD_LOGIC; dataout : OUT STD_LOGIC; dpalock : OUT STD_LOGIC ); END arriaii_dpa_block; ARCHITECTURE trans OF arriaii_dpa_block IS COMPONENT arriaii_dpa_retime_block PORT ( clkin : IN STD_LOGIC; datain : IN STD_LOGIC; reset : IN STD_LOGIC; clk0 : OUT STD_LOGIC; clk1 : OUT STD_LOGIC; clk2 : OUT STD_LOGIC; clk3 : OUT STD_LOGIC; clk4 : OUT STD_LOGIC; clk5 : OUT STD_LOGIC; clk6 : OUT STD_LOGIC; clk7 : OUT STD_LOGIC; data0 : OUT STD_LOGIC; data1 : OUT STD_LOGIC; data2 : OUT STD_LOGIC; data3 : OUT STD_LOGIC; data4 : OUT STD_LOGIC; data5 : OUT STD_LOGIC; data6 : OUT STD_LOGIC; data7 : OUT STD_LOGIC; lock : OUT STD_LOGIC ); END COMPONENT; SIGNAL clk0_tmp : STD_LOGIC; SIGNAL clk1_tmp : STD_LOGIC; SIGNAL clk2_tmp : STD_LOGIC; SIGNAL clk3_tmp : STD_LOGIC; SIGNAL clk4_tmp : STD_LOGIC; SIGNAL clk5_tmp : STD_LOGIC; SIGNAL clk6_tmp : STD_LOGIC; SIGNAL clk7_tmp : STD_LOGIC; SIGNAL data0_tmp : STD_LOGIC; SIGNAL data1_tmp : STD_LOGIC; SIGNAL data2_tmp : STD_LOGIC; SIGNAL data3_tmp : STD_LOGIC; SIGNAL data4_tmp : STD_LOGIC; SIGNAL data5_tmp : STD_LOGIC; SIGNAL data6_tmp : STD_LOGIC; SIGNAL data7_tmp : STD_LOGIC; SIGNAL select_xhdl1 : STD_LOGIC_VECTOR(2 DOWNTO 0) := (others => '0'); SIGNAL clkout_tmp : STD_LOGIC; SIGNAL dataout_tmp : STD_LOGIC; SIGNAL counter_reset_value : INTEGER ; SIGNAL count_value : INTEGER ; SIGNAL i : INTEGER := 0; SIGNAL dpalock_xhdl0 : STD_LOGIC; BEGIN -- Drive referenced outputs dpalock <= dpalock_xhdl0; dataout <= dataout_tmp when (enable_soft_cdr_mode = "on") else datain; clkout <= clkout_tmp when (enable_soft_cdr_mode = "on") else clkin; data_clock_retime : arriaii_dpa_retime_block PORT MAP ( clkin => clkin, datain => datain, reset => dpareset, clk0 => clk0_tmp, clk1 => clk1_tmp, clk2 => clk2_tmp, clk3 => clk3_tmp, clk4 => clk4_tmp, clk5 => clk5_tmp, clk6 => clk6_tmp, clk7 => clk7_tmp, data0 => data0_tmp, data1 => data1_tmp, data2 => data2_tmp, data3 => data3_tmp, data4 => data4_tmp, data5 => data5_tmp, data6 => data6_tmp, data7 => data7_tmp, lock => dpalock_xhdl0 ); PROCESS (clkin, dpareset, dpahold) variable initial : boolean := true; variable ppm_tmp : integer; BEGIN if(initial) then if(net_ppm_variation = 0) then ppm_tmp := 1; else ppm_tmp := net_ppm_variation; end if; if(net_ppm_variation = 0) then counter_reset_value <= 1; count_value <= 1; initial := false; else counter_reset_value <= 1000000 / (ppm_tmp * 8); count_value <= 1000000 / (ppm_tmp * 8); initial := false; end if; end if; IF (clkin'EVENT AND clkin = '1') THEN IF(net_ppm_variation = 0) THEN select_xhdl1 <= "000"; ELSE IF (dpareset = '1') THEN i <= 0; select_xhdl1 <= "000"; ELSE IF (dpahold = '0') THEN IF (i < count_value) THEN i <= i + 1; ELSE select_xhdl1 <= select_xhdl1 + "001"; i <= 0; END IF; END IF; END IF; END IF; END IF; END PROCESS; PROCESS (select_xhdl1, clk0_tmp, clk1_tmp, clk2_tmp, clk3_tmp, clk4_tmp, clk5_tmp, clk6_tmp, clk7_tmp, data0_tmp, data1_tmp, data2_tmp, data3_tmp, data4_tmp, data5_tmp, data6_tmp, data7_tmp) BEGIN if (select_xhdl1 = "000") then clkout_tmp <= clk0_tmp; dataout_tmp <= data0_tmp; elsif (select_xhdl1 = "001") then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk1_tmp; dataout_tmp <= data1_tmp; else clkout_tmp <= clk7_tmp; dataout_tmp <= data7_tmp; end if; elsif (select_xhdl1 = "010") then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk2_tmp; dataout_tmp <= data2_tmp; else clkout_tmp <= clk6_tmp; dataout_tmp <= data6_tmp; end if; elsif (select_xhdl1 = "011")then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk3_tmp; dataout_tmp <= data3_tmp; else clkout_tmp <= clk5_tmp; dataout_tmp <= data5_tmp; end if; elsif (select_xhdl1 = "100")then clkout_tmp <= clk4_tmp; dataout_tmp <= data4_tmp; elsif (select_xhdl1 = "101")then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk5_tmp; dataout_tmp <= data5_tmp; else clkout_tmp <= clk3_tmp; dataout_tmp <= data3_tmp; end if; elsif (select_xhdl1 = "110") then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk6_tmp; dataout_tmp <= data6_tmp; else clkout_tmp <= clk2_tmp; dataout_tmp <= data2_tmp; end if; elsif (select_xhdl1 = "111")then if( is_negative_ppm_drift = "off")then clkout_tmp <= clk7_tmp; dataout_tmp <= data7_tmp; else clkout_tmp <= clk1_tmp; dataout_tmp <= data1_tmp; end if; else clkout_tmp <= clk0_tmp; dataout_tmp <= data0_tmp; end if; END PROCESS; END trans; --///////////////////////////////////////////////////////////////////////////// -- -- Module Name : arriaii_LVDS_RECEIVER -- -- Description : Timing simulation model for the arriaii LVDS RECEIVER -- atom. This module instantiates the following sub-modules : -- 1) arriaii_lvds_rx_fifo -- 2) arriaii_lvds_rx_bitslip -- 3) DFFEs for the LOADEN signals -- 4) arriaii_lvds_rx_parallel_reg -- 5) arriaii_pclk_divider -- 6) arriaii_select_ini_phase_dpaclk -- 7) arriaii_dpa_block -- --///////////////////////////////////////////////////////////////////////////// LIBRARY IEEE; USE ieee.std_logic_1164.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; USE work.arriaii_atom_pack.all; USE work.arriaii_lvds_rx_bitslip; USE work.arriaii_lvds_rx_fifo; USE work.arriaii_lvds_rx_deser; USE work.arriaii_lvds_rx_parallel_reg; USE work.arriaii_lvds_reg; USE work.arriaii_pclk_divider; USE work.arriaii_select_ini_phase_dpaclk; USE work.arriaii_dpa_block; ENTITY arriaii_lvds_receiver IS GENERIC ( channel_width : integer := 10; data_align_rollover : integer := 2; enable_dpa : string := "off"; lose_lock_on_one_change : string := "off"; reset_fifo_at_first_lock : string := "on"; align_to_rising_edge_only : string := "on"; use_serial_feedback_input : string := "off"; dpa_debug : string := "off"; enable_soft_cdr : string := "off"; dpa_output_clock_phase_shift : INTEGER := 0 ; enable_dpa_initial_phase_selection : string := "off"; dpa_initial_phase_value : INTEGER := 0; enable_dpa_align_to_rising_edge_only : string := "off"; net_ppm_variation : INTEGER := 0; is_negative_ppm_drift : string := "off"; rx_input_path_delay_engineering_bits : INTEGER := 2; x_on_bitslip : string := "on"; lpm_type : string := "arriaii_lvds_receiver"; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk0 : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01; tipd_enable0 : VitalDelayType01 := DefpropDelay01; tipd_dpareset : VitalDelayType01 := DefpropDelay01; tipd_dpahold : VitalDelayType01 := DefpropDelay01; tipd_dpaswitch : VitalDelayType01 := DefpropDelay01; tipd_fiforeset : VitalDelayType01 := DefpropDelay01; tipd_bitslip : VitalDelayType01 := DefpropDelay01; tipd_bitslipreset : VitalDelayType01 := DefpropDelay01; tipd_serialfbk : VitalDelayType01 := DefpropDelay01; tpd_clk0_dpalock_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( clk0 : IN std_logic; datain : IN std_logic := '0'; enable0 : IN std_logic := '0'; dpareset : IN std_logic := '0'; dpahold : IN std_logic := '0'; dpaswitch : IN std_logic := '0'; fiforeset : IN std_logic := '0'; bitslip : IN std_logic := '0'; bitslipreset : IN std_logic := '0'; serialfbk : IN std_logic := '0'; dataout : OUT std_logic_vector(channel_width - 1 DOWNTO 0); dpalock : OUT std_logic:= '0'; bitslipmax : OUT std_logic; serialdataout : OUT std_logic; postdpaserialdataout : OUT std_logic; divfwdclk : OUT std_logic; dpaclkout : OUT std_logic; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END arriaii_lvds_receiver; ARCHITECTURE vital_arm_lvds_receiver OF arriaii_lvds_receiver IS COMPONENT arriaii_lvds_rx_bitslip GENERIC ( channel_width : integer := 10; bitslip_rollover : integer := 12; x_on_bitslip : string := "on"; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk0 : VitalDelayType01 := DefpropDelay01; tipd_bslipcntl : VitalDelayType01 := DefpropDelay01; tipd_bsliprst : VitalDelayType01 := DefpropDelay01; tipd_datain : VitalDelayType01 := DefpropDelay01; tpd_bsliprst_bslipmax_posedge: VitalDelayType01 := DefPropDelay01; tpd_clk0_bslipmax_posedge: VitalDelayType01 := DefPropDelay01 ); PORT ( clk0 : IN std_logic := '0'; bslipcntl : IN std_logic := '0'; bsliprst : IN std_logic := '0'; datain : IN std_logic := '0'; bslipmax : OUT std_logic; dataout : OUT std_logic ); END COMPONENT; COMPONENT arriaii_lvds_rx_fifo GENERIC ( channel_width : integer := 10 ); PORT ( wclk : IN std_logic := '0'; rclk : IN std_logic := '0'; fiforst : IN std_logic := '0'; dparst : IN std_logic := '0'; datain : IN std_logic := '0'; dataout : OUT std_logic ); END COMPONENT; COMPONENT arriaii_lvds_rx_deser GENERIC ( channel_width : integer := 4 ); PORT ( clk : IN std_logic; datain : IN std_logic; dataout : OUT std_logic_vector(channel_width - 1 DOWNTO 0); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END COMPONENT; COMPONENT arriaii_lvds_rx_parallel_reg GENERIC ( channel_width : integer := 4 ); PORT ( clk : IN std_logic; enable : IN std_logic := '1'; datain : IN std_logic_vector(channel_width - 1 DOWNTO 0); dataout : OUT std_logic_vector(channel_width - 1 DOWNTO 0); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1' ); END COMPONENT; COMPONENT arriaii_lvds_reg GENERIC ( MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; tipd_clk : VitalDelayType01 := DefpropDelay01; tipd_ena : VitalDelayType01 := DefpropDelay01; tipd_d : VitalDelayType01 := DefpropDelay01; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01 ); PORT ( q : OUT std_logic; clk : IN std_logic; ena : IN std_logic := '1'; d : IN std_logic; clrn : IN std_logic := '1'; prn : IN std_logic := '1' ); END COMPONENT; COMPONENT arriaii_pclk_divider GENERIC ( clk_divide_by : integer := 1); PORT ( clkin : IN std_logic; lloaden : OUT std_logic; clkout : OUT std_logic); END COMPONENT; COMPONENT arriaii_select_ini_phase_dpaclk GENERIC( initial_phase_select : integer := 0 ); PORT ( clkin : IN STD_LOGIC; loaden : IN STD_LOGIC; enable : IN STD_LOGIC; loadenout : OUT STD_LOGIC; clkout : OUT STD_LOGIC ); END COMPONENT; COMPONENT arriaii_dpa_block GENERIC ( net_ppm_variation : INTEGER := 0; is_negative_ppm_drift : STRING := "off"; enable_soft_cdr_mode: STRING := "on" ); PORT ( clkin : IN STD_LOGIC; dpareset : IN STD_LOGIC; dpahold : IN STD_LOGIC; datain : IN STD_LOGIC; clkout : OUT STD_LOGIC; dataout : OUT STD_LOGIC; dpalock : OUT STD_LOGIC ); END COMPONENT; -- INTERNAL SIGNALS signal bitslip_ipd : std_logic; signal bitslipreset_ipd : std_logic; signal clk0_ipd : std_logic; signal datain_ipd : std_logic; signal dpahold_ipd : std_logic; signal dpareset_ipd : std_logic; signal dpaswitch_ipd : std_logic; signal enable0_ipd : std_logic; signal fiforeset_ipd : std_logic; signal serialfbk_ipd : std_logic; signal fifo_wclk : std_logic; signal fifo_rclk : std_logic; signal fifo_datain : std_logic; signal fifo_dataout : std_logic; signal fifo_reset : std_logic; signal slip_datain : std_logic; signal slip_dataout : std_logic; signal bitslip_reset : std_logic; -- wire deser_dataout; signal dpa_clk : std_logic; signal dpa_rst : std_logic; signal datain_reg : std_logic; signal datain_reg_neg : std_logic; signal datain_reg_tmp : std_logic; signal deser_dataout : std_logic_vector(channel_width - 1 DOWNTO 0); signal reset_fifo : std_logic; signal gnd : std_logic := '0'; signal vcc : std_logic := '1'; signal in_reg_data : std_logic; signal in_reg_data_dly : std_logic; signal slip_datain_tmp : std_logic; signal s_bitslip_clk : std_logic; signal loaden : std_logic; signal ini_dpa_clk : std_logic; signal ini_dpa_load : std_logic; signal ini_phase_select_enable : std_logic; signal dpa_clk_shift : std_logic; signal dpa_data_shift : std_logic; signal lloaden : std_logic; signal lock_tmp : std_logic; signal divfwdclk_tmp : std_logic; signal dpa_is_locked : std_logic; signal dpareg0_out : std_logic; signal dpareg1_out : std_logic; signal xhdl_12 : std_logic; signal rxload : std_logic; signal clk0_tmp : std_logic; signal clk0_tmp_neg : std_logic; signal ini_dpa_clk_dly : std_logic; begin WireDelay : block begin VitalWireDelay (clk0_ipd, clk0, tipd_clk0); VitalWireDelay (datain_ipd, datain, tipd_datain); VitalWireDelay (enable0_ipd, enable0, tipd_enable0); VitalWireDelay (dpareset_ipd, dpareset, tipd_dpareset); VitalWireDelay (dpahold_ipd, dpahold, tipd_dpahold); VitalWireDelay (dpaswitch_ipd, dpaswitch, tipd_dpaswitch); VitalWireDelay (fiforeset_ipd, fiforeset, tipd_fiforeset); VitalWireDelay (bitslip_ipd, bitslip, tipd_bitslip); VitalWireDelay (bitslipreset_ipd, bitslipreset, tipd_bitslipreset); VitalWireDelay (serialfbk_ipd, serialfbk, tipd_serialfbk); end block; process (clk0_ipd, dpareset_ipd,lock_tmp ) variable dpalock_VitalGlitchData : VitalGlitchDataType; variable initial : boolean := true; begin if (initial) then if (reset_fifo_at_first_lock = "on") then reset_fifo <= '1'; else reset_fifo <= '0'; end if; initial := false; end if; ---------------------- -- Path Delay Section ---------------------- VitalPathDelay01 ( OutSignal => dpalock, OutSignalName => "DPALOCK", OutTemp => dpa_is_locked, Paths => (1 => (clk0_ipd'last_event, tpd_clk0_dpalock_posedge, enable_dpa = "on")), GlitchData => dpalock_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); if(lock_tmp = '1') then reset_fifo <= '0'; else reset_fifo <= '1'; end if; end process; process(in_reg_data) begin if(dpaswitch_ipd = '1') then if(rx_input_path_delay_engineering_bits = 1) then in_reg_data_dly <= TRANSPORT in_reg_data after 60 ps; elsif(rx_input_path_delay_engineering_bits = 2) then in_reg_data_dly <= TRANSPORT in_reg_data after 120 ps; elsif(rx_input_path_delay_engineering_bits = 3) then in_reg_data_dly <= TRANSPORT in_reg_data after 180 ps; else in_reg_data_dly <= in_reg_data; end if; else in_reg_data_dly <= in_reg_data; end if; end process; xhdl_12 <= devclrn OR devpor; process(ini_dpa_clk) begin ini_dpa_clk_dly <= ini_dpa_clk; end process; -- input register in non-DPA mode for sampling incoming data in_reg : arriaii_lvds_reg PORT MAP ( d => in_reg_data_dly, clk => clk0_tmp, ena => vcc, clrn => xhdl_12, prn => vcc, q => datain_reg ); in_reg_data <= serialfbk_ipd WHEN (use_serial_feedback_input = "on") ELSE datain_ipd; clk0_tmp <= clk0_ipd; clk0_tmp_neg <= not clk0_ipd; neg_reg : arriaii_lvds_reg PORT MAP ( d => in_reg_data_dly, clk => clk0_tmp_neg, ena => vcc, clrn => xhdl_12, prn => vcc, q => datain_reg_neg ); datain_reg_tmp <= datain_reg WHEN (align_to_rising_edge_only = "on") ELSE datain_reg_neg; -- dpa initial phase select ini_clk_phase_select: arriaii_select_ini_phase_dpaclk GENERIC MAP( initial_phase_select => dpa_initial_phase_value ) PORT MAP( clkin => clk0_ipd, loaden => enable0_ipd, enable => ini_phase_select_enable, loadenout=>ini_dpa_load, clkout => ini_dpa_clk ); ini_phase_select_enable <= '1' when (enable_dpa_initial_phase_selection = "on") else '0'; -- DPA circuitary dpareg0 : arriaii_lvds_reg PORT MAP ( d => in_reg_data_dly, clk => ini_dpa_clk_dly, clrn => vcc, prn => vcc, ena => vcc, q => dpareg0_out ); dpareg1 : arriaii_lvds_reg PORT MAP ( d => dpareg0_out, clk => ini_dpa_clk, clrn => vcc, prn => vcc, ena => vcc, q => dpareg1_out ); dpa_circuit: arriaii_dpa_block GENERIC MAP( net_ppm_variation => net_ppm_variation, is_negative_ppm_drift => is_negative_ppm_drift, enable_soft_cdr_mode => enable_soft_cdr ) PORT MAP( clkin => ini_dpa_clk, dpareset => dpareset_ipd, dpahold => dpahold_ipd, datain => dpareg1_out, clkout => dpa_clk_shift, dataout => dpa_data_shift, dpalock => lock_tmp ); dpa_clk <= dpa_clk_shift when ((enable_soft_cdr = "on") or (enable_dpa = "on")) else '0' ; dpa_rst <= dpareset_ipd when ((enable_soft_cdr = "on") or (enable_dpa = "on")) else '0' ; -- PCLK and lloaden generation clk_forward: arriaii_pclk_divider GENERIC MAP ( clk_divide_by => channel_width ) PORT MAP( clkin => dpa_clk, lloaden => lloaden, clkout => divfwdclk_tmp ); -- FIFO s_fifo : arriaii_lvds_rx_fifo GENERIC MAP ( channel_width => channel_width ) PORT MAP ( wclk => dpa_clk, rclk => fifo_rclk, fiforst => fifo_reset, dparst => dpa_rst, datain => fifo_datain, dataout => fifo_dataout ); fifo_rclk <= clk0_ipd WHEN (enable_dpa = "on") ELSE gnd ; fifo_wclk <= dpa_clk ; fifo_datain <= dpa_data_shift WHEN (enable_dpa = "on") ELSE gnd ; fifo_reset <= (NOT devpor) OR (NOT devclrn) OR fiforeset_ipd OR dpa_rst OR reset_fifo ; -- Bit Slip s_bslip : arriaii_lvds_rx_bitslip GENERIC MAP ( bitslip_rollover => data_align_rollover, channel_width => channel_width, x_on_bitslip => x_on_bitslip ) PORT MAP ( clk0 => s_bitslip_clk, bslipcntl => bitslip_ipd, bsliprst => bitslip_reset, datain => slip_datain, bslipmax => bitslipmax, dataout => slip_dataout ); bitslip_reset <= (NOT devpor) OR (NOT devclrn) OR bitslipreset_ipd ; slip_datain_tmp <= fifo_dataout when (enable_dpa = "on" ) else datain_reg_tmp ; slip_datain <= dpa_data_shift when(enable_soft_cdr = "on") else slip_datain_tmp; s_bitslip_clk <= dpa_clk when (enable_soft_cdr = "on") else clk0_ipd; -- DESERIALISER rxload_reg : arriaii_lvds_reg PORT MAP ( d => loaden, clk => s_bitslip_clk, ena => vcc, clrn => vcc, prn => vcc, q => rxload ); loaden <= lloaden when (enable_soft_cdr = "on") else ini_dpa_load; s_deser : arriaii_lvds_rx_deser GENERIC MAP (channel_width => channel_width ) PORT MAP (clk => s_bitslip_clk, datain => slip_dataout, devclrn => devclrn, devpor => devpor, dataout => deser_dataout ); output_reg : arriaii_lvds_rx_parallel_reg GENERIC MAP ( channel_width => channel_width ) PORT MAP ( clk => s_bitslip_clk, enable => rxload, datain => deser_dataout, devpor => devpor, devclrn => devclrn, dataout => dataout ); dpa_is_locked <= gnd; dpaclkout <= dpa_clk_shift; postdpaserialdataout <= dpa_data_shift ; serialdataout <= datain_ipd; divfwdclk <= divfwdclk_tmp ; END vital_arm_lvds_receiver; ---------------------------------------------------------------------------------- --Module Name: arriaii_pseudo_diff_out -- --Description: Simulation model for Piranha Pseudo Differential -- -- Output Buffer -- ---------------------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_pseudo_diff_out IS GENERIC ( tipd_i : VitalDelayType01 := DefPropDelay01; tpd_i_o : VitalDelayType01 := DefPropDelay01; tpd_i_obar : VitalDelayType01 := DefPropDelay01; XOn : Boolean := DefGlitchXOn; MsgOn : Boolean := DefGlitchMsgOn; lpm_type : string := "arriaii_pseudo_diff_out" ); PORT ( i : IN std_logic := '0'; o : OUT std_logic; obar : OUT std_logic ); END arriaii_pseudo_diff_out; ARCHITECTURE arch OF arriaii_pseudo_diff_out IS SIGNAL i_ipd : std_logic ; SIGNAL o_tmp : std_logic ; SIGNAL obar_tmp : std_logic; BEGIN WireDelay : block begin VitalWireDelay (i_ipd, i, tipd_i); end block; PROCESS( i_ipd) BEGIN IF (i_ipd = '0') THEN o_tmp <= '0'; obar_tmp <= '1'; ELSE IF (i_ipd = '1') THEN o_tmp <= '1'; obar_tmp <= '0'; ELSE o_tmp <= i_ipd; obar_tmp <= i_ipd; END IF; END IF; END PROCESS; --------------------- -- Path Delay Section ---------------------- PROCESS( o_tmp,obar_tmp) variable o_VitalGlitchData : VitalGlitchDataType; variable obar_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => o, OutSignalName => "o", OutTemp => o_tmp, Paths => (0 => (i_ipd'last_event, tpd_i_o, TRUE)), GlitchData => o_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); VitalPathDelay01 ( OutSignal => obar, OutSignalName => "obar", OutTemp => obar_tmp, Paths => (0 => (i_ipd'last_event, tpd_i_obar, TRUE)), GlitchData => obar_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); END PROCESS; END arch; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_dqs_delay_chain -- -- Description : arriaii DQS Delay Chain (within DQS I/O) -- VHDL simulation model -- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use work.arriaii_atom_pack.all; ENTITY arriaii_dqs_delay_chain IS GENERIC ( lpm_type : STRING := "arriaii_dqs_delay_chain"; delay_buffer_mode : STRING := "low"; dqs_ctrl_latches_enable : STRING := "false"; dqs_input_frequency : string := "unused" ; dqs_offsetctrl_enable : STRING := "false"; dqs_phase_shift : INTEGER := 0; phase_setting : INTEGER := 0; sim_buffer_delay_increment : INTEGER := 10; sim_high_buffer_intrinsic_delay : INTEGER := 175; sim_low_buffer_intrinsic_delay : INTEGER := 350; test_enable : STRING := "false"; test_select : INTEGER := 0 ; tipd_dqsin : VitalDelayType01 := DefpropDelay01; tipd_delayctrlin : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01); tipd_offsetctrlin : VitalDelayArrayType01(5 downto 0) := (OTHERS => DefPropDelay01); tipd_dqsupdateen : VitalDelayType01 := DefpropDelay01; tpd_dqsin_dqsbusout : VitalDelayType01 := DefPropDelay01; tsetup_delayctrlin_dqsupdateen_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); thold_delayctrlin_dqsupdateen_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); tsetup_offsetctrlin_dqsupdateen_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); thold_offsetctrlin_dqsupdateen_noedge_posedge : VitalDelayArrayType(5 downto 0) := (OTHERS => DefSetupHoldCnst); TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*" ); PORT ( delayctrlin : IN STD_LOGIC_VECTOR(5 DOWNTO 0):= (OTHERS => '0'); dqsin : IN STD_LOGIC := '0'; dqsupdateen : IN STD_LOGIC := '1'; offsetctrlin : IN STD_LOGIC_VECTOR(5 DOWNTO 0):= (OTHERS => '0'); devclrn : IN std_logic := '1'; devpor : IN std_logic := '1'; dqsbusout : OUT STD_LOGIC ); END arriaii_dqs_delay_chain; ARCHITECTURE arriaii_dqs_delay_chain_arch OF arriaii_dqs_delay_chain IS -- component section COMPONENT arriaii_dll_gray_decoder GENERIC ( width : integer := 6 ); PORT ( gin : IN STD_LOGIC_VECTOR (width-1 DOWNTO 0) := (OTHERS => '0'); bout : OUT STD_LOGIC_VECTOR (width-1 DOWNTO 0) ); END COMPONENT; -- signal section SIGNAL delayctrl_bin : std_logic_vector(5 downto 0) := (OTHERS => '0'); SIGNAL offsetctrl_bin : std_logic_vector(5 downto 0) := (OTHERS => '0'); -- offsetctrl after "dqs_offsetctrl_enable" mux SIGNAL offsetctrl_mux : std_logic_vector(5 downto 0) := (OTHERS => '0'); -- reged outputs for delayctrl and offsetctrl SIGNAL delayctrl_reg : std_logic_vector(5 downto 0) := (OTHERS => '1'); SIGNAL offsetctrl_reg : std_logic_vector(5 downto 0) := (OTHERS => '1'); -- mux outputs after registers SIGNAL delayctrl_reg_mux : std_logic_vector(5 downto 0) := (OTHERS => '0'); SIGNAL offsetctrl_reg_mux : std_logic_vector(5 downto 0) := (OTHERS => '0'); SIGNAL tmp_dqsbusout : STD_LOGIC := '0'; SIGNAL dqs_delay : INTEGER := 0; SIGNAL test_bus : std_logic_vector(14 downto 0); SIGNAL test_lpbk : std_logic; SIGNAL tmp_dqsin : std_logic; -- timing inputs SIGNAL dqsin_in : std_logic := '0'; SIGNAL delayctrlin_in : std_logic_vector(5 downto 0) := (OTHERS => '0'); SIGNAL offsetctrlin_in : std_logic_vector(5 downto 0) := (OTHERS => '0'); SIGNAL dqsupdateen_in : std_logic := '1'; BEGIN --offsetctrlin mux select offsetctrl_mux <= offsetctrlin_in WHEN (dqs_offsetctrl_enable = "true") ELSE delayctrlin_in; -- delayctrlin and offsetctrlin registers PROCESS(dqsupdateen_in) BEGIN IF (dqsupdateen_in = '1' AND dqsupdateen_in'event) THEN delayctrl_reg <= delayctrlin_in; offsetctrl_reg <= offsetctrl_mux; END IF; END PROCESS; -- mux after registers delayctrl_reg_mux <= delayctrl_reg WHEN (dqs_ctrl_latches_enable = "true") ELSE delayctrlin_in; offsetctrl_reg_mux <= offsetctrl_reg WHEN (dqs_ctrl_latches_enable = "true") ELSE offsetctrl_mux; -- decode gray inputs to binary mdelayctrlin_dec : arriaii_dll_gray_decoder GENERIC MAP ( width => 6 ) PORT MAP ( gin => delayctrl_reg_mux, bout => delayctrl_bin ); moffsetctrlin_dec : arriaii_dll_gray_decoder GENERIC MAP ( width => 6 ) PORT MAP ( gin => offsetctrl_reg_mux, bout => offsetctrl_bin ); PROCESS (delayctrl_bin, offsetctrl_bin) variable sim_intrinsic_delay : INTEGER := 0; variable acell_delay : INTEGER := 0; variable aoffsetcell_delay : INTEGER := 0; variable delay_chain_len : INTEGER := 0; BEGIN IF (delay_buffer_mode = "low") THEN sim_intrinsic_delay := sim_low_buffer_intrinsic_delay; ELSE sim_intrinsic_delay := sim_high_buffer_intrinsic_delay; END IF; -- cell acell_delay := sim_intrinsic_delay + alt_conv_integer(delayctrl_bin) * sim_buffer_delay_increment; IF (dqs_offsetctrl_enable = "true") THEN aoffsetcell_delay := sim_intrinsic_delay + alt_conv_integer(offsetctrl_bin)*sim_buffer_delay_increment; ELSE aoffsetcell_delay := acell_delay; END IF; -- no of cells -- total delay IF (phase_setting = 0) THEN dqs_delay <= 0; ELSE dqs_delay <= (phase_setting - 1)*acell_delay + aoffsetcell_delay; END IF; IF (delay_buffer_mode = "high" AND delayctrl_bin(5) = '1') THEN assert false report "DELAYCTRLIN of DQS I/O exceeds 5-bit range in high-frequency mode" severity warning; END IF; END PROCESS; -- generating delays -- test bus loopback test_bus <= (not dqsupdateen_in) & 'X' & 'X' & offsetctrl_reg_mux & delayctrl_reg_mux; test_lpbk <= test_bus(test_select) WHEN ((0 <= test_select) AND (test_select <= 14)) ELSE 'Z'; tmp_dqsin <= (test_lpbk AND dqsin) WHEN (test_enable = "true") ELSE dqsin; tmp_dqsbusout <= transport tmp_dqsin after (dqs_delay * 1 ps); -------------------- -- INPUT PATH DELAYS -------------------- WireDelay : block begin VitalWireDelay (dqsin_in, dqsin, tipd_dqsin); loopbits_delayctrlin : FOR i in delayctrlin'RANGE GENERATE VitalWireDelay (delayctrlin_in(i), delayctrlin(i), tipd_delayctrlin(i)); END GENERATE; loopbits_offsetctrlin : FOR i in offsetctrlin'RANGE GENERATE VitalWireDelay (offsetctrlin_in(i), offsetctrlin(i), tipd_offsetctrlin(i)); END GENERATE; VitalWireDelay (dqsupdateen_in, dqsupdateen, tipd_dqsupdateen); end block; ----------------------------------- -- Timing Check Section ----------------------------------- VITAL_timing_check: PROCESS (dqsupdateen_in,offsetctrlin_in,delayctrlin_in) variable Tviol_dqsupdateen_offsetctrlin : std_ulogic := '0'; variable TimingData_dqsupdateen_offsetctrlin : VitalTimingDataType := VitalTimingDataInit; variable Tviol_dqsupdateen_delayctrlin : std_ulogic := '0'; variable TimingData_dqsupdateen_delayctrlin : VitalTimingDataType := VitalTimingDataInit; BEGIN IF (TimingChecksOn) THEN VitalSetupHoldCheck ( Violation => Tviol_dqsupdateen_offsetctrlin, TimingData => TimingData_dqsupdateen_offsetctrlin, TestSignal => offsetctrlin_in, TestSignalName => "offsetctrlin", RefSignal => dqsupdateen_in, RefSignalName => "dqsupdateen", SetupHigh => tsetup_offsetctrlin_dqsupdateen_noedge_posedge(0), SetupLow => tsetup_offsetctrlin_dqsupdateen_noedge_posedge(0), HoldHigh => thold_offsetctrlin_dqsupdateen_noedge_posedge(0), HoldLow => thold_offsetctrlin_dqsupdateen_noedge_posedge(0), RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_DQS_DELAY_CHAIN", XOn => XOnChecks, MsgOn => MsgOnChecks ); VitalSetupHoldCheck ( Violation => Tviol_dqsupdateen_delayctrlin, TimingData => TimingData_dqsupdateen_delayctrlin, TestSignal => delayctrlin_in, TestSignalName => "delayctrlin", RefSignal => dqsupdateen_in, RefSignalName => "dqsupdateen", SetupHigh => tsetup_delayctrlin_dqsupdateen_noedge_posedge(0), SetupLow => tsetup_delayctrlin_dqsupdateen_noedge_posedge(0), HoldHigh => thold_delayctrlin_dqsupdateen_noedge_posedge(0), HoldLow => thold_delayctrlin_dqsupdateen_noedge_posedge(0), RefTransition => '/', HeaderMsg => InstancePath & "/ARRIAII_DQS_DELAY_CHAIN", XOn => XOnChecks, MsgOn => MsgOnChecks ); END IF; END PROCESS; -- timing check -------------------------------------- -- Path Delay Section -------------------------------------- VITAL_path_delays: PROCESS (tmp_dqsbusout) variable dqsbusout_VitalGlitchData : VitalGlitchDataType; BEGIN VitalPathDelay01 ( OutSignal => dqsbusout, OutSignalName => "dqsbusout", OutTemp => tmp_dqsbusout, Paths => (0 => (dqsin_in'last_event, tpd_dqsin_dqsbusout, TRUE)), GlitchData => dqsbusout_VitalGlitchData, Mode => DefGlitchMode, XOn => XOn, MsgOn => MsgOn ); END PROCESS; -- Path Delays END arriaii_dqs_delay_chain_arch; ------------------------------------------------------------------------------- -- -- Module Name : arriaii_dqs_enable_ctrl -- -- Description : arriaii DQS enable control (within DQS I/O) -- VHDL simulation model -- ------------------------------------------------------------------------------- library IEEE; library altera; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; use altera.all; use work.arriaii_atom_pack.all; ENTITY arriaii_dqs_enable_ctrl IS GENERIC ( lpm_type : STRING := "arriaii_dqs_enable_ctrl"; delay_dqs_enable_by_half_cycle : STRING := "false" ; tipd_dqsenablein : VitalDelayType01 := DefpropDelay01; tipd_clk : VitalDelayType01 := DefpropDelay01; TimingChecksOn : Boolean := True; MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*" ); PORT ( clk : IN STD_LOGIC := '0'; dqsenablein : IN STD_LOGIC := '1'; devclrn : IN std_logic := '1'; devpor : IN std_logic := '1'; dqsenableout : OUT STD_LOGIC ); END arriaii_dqs_enable_ctrl; ARCHITECTURE trans OF arriaii_dqs_enable_ctrl IS signal devpor_ipd :STD_LOGIC; signal dqsenablein_ipd :STD_LOGIC; signal clk_ipd :STD_LOGIC; signal devclrn_ipd :STD_LOGIC; COMPONENT dffeas GENERIC ( power_up : STRING := "DONT_CARE"; is_wysiwyg : STRING := "false"; x_on_violation : STRING := "on"; lpm_type : STRING := "dffeas" ); PORT ( d : IN STD_LOGIC; clk : IN STD_LOGIC; ena : IN STD_LOGIC; clrn : IN STD_LOGIC; prn : IN STD_LOGIC; aload : IN STD_LOGIC; asdata : IN STD_LOGIC; sclr : IN STD_LOGIC; sload : IN STD_LOGIC; devclrn : IN STD_LOGIC; devpor : IN STD_LOGIC; q : OUT STD_LOGIC ); END COMPONENT; --Internal signals SIGNAL dqsenablein_regp : STD_LOGIC; SIGNAL dqsenablein_regn : STD_LOGIC; SIGNAL dqsenableout_tmp : STD_LOGIC; -- X-HDL generated signals SIGNAL xhdl0 : STD_LOGIC; -- timing input SIGNAL dqsenablein_in : std_logic := '1'; SIGNAL clk_in : std_logic := '0'; BEGIN WireDelay : block begin VitalWireDelay (dqsenablein_in, dqsenablein, tipd_dqsenablein); VitalWireDelay (clk_in, clk, tipd_clk); end block; regp : dffeas PORT MAP ( d => dqsenablein_in, clk => clk_in, clrn => '1', aload => '0', sclr => '0', sload => '0', asdata => '0', ena => '1', prn => '1', q => dqsenablein_regp, devpor => devpor, devclrn => devclrn ); xhdl0 <= NOT(clk); regn : dffeas PORT MAP ( d => dqsenablein_regp, clk => xhdl0, clrn => '1', aload => '0', sclr => '0', sload => '0', asdata => '0', ena => '1', prn => '1', q => dqsenablein_regn, devpor => devpor, devclrn => devclrn ); --output assignment dqsenableout_tmp <= dqsenablein_regp WHEN (delay_dqs_enable_by_half_cycle = ("false")) ELSE (dqsenablein_regn AND dqsenablein_regp); dqsenableout <= dqsenableout_tmp; END trans; --arriaii_dqs_enable_ctrl ------------------------------------------------------------------- -- -- Entity Name : arriaii_jtag -- -- Description : arriaii JTAG VHDL Simulation model -- ------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use work.arriaii_atom_pack.all; entity arriaii_jtag is generic ( lpm_type : string := "arriaii_jtag" ); port ( tms : in std_logic := '0'; tck : in std_logic := '0'; tdi : in std_logic := '0'; tdoutap : in std_logic := '0'; tdouser : in std_logic := '0'; tdo: out std_logic; tmsutap: out std_logic; tckutap: out std_logic; tdiutap: out std_logic; shiftuser: out std_logic; clkdruser: out std_logic; updateuser: out std_logic; runidleuser: out std_logic; usr1user: out std_logic ); end arriaii_jtag; architecture architecture_jtag of arriaii_jtag is begin end architecture_jtag; ------------------------------------------------------------------- -- -- Entity Name : arriaii_crcblock -- -- Description : arriaii CRCBLOCK VHDL Simulation model -- ------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use work.arriaii_atom_pack.all; entity arriaii_crcblock is generic ( oscillator_divider : integer := 1; crc_deld_disable : string := "off"; error_delay : integer := 0 ; error_dra_dl_bypass : string := "off"; lpm_type : string := "arriaii_crcblock" ); port ( clk : in std_logic := '0'; shiftnld : in std_logic := '0'; crcerror : out std_logic; regout : out std_logic ); end arriaii_crcblock; architecture architecture_crcblock of arriaii_crcblock is begin crcerror <= '0'; regout <= '0'; end architecture_crcblock; ------------------------------------------------------------------- -- -- Entity Name : arriaii_controller -- -- Description : arriaii CONTROLLER VHDL Simulation model -- ------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use work.arriaii_atom_pack.all; entity arriaii_controller is generic ( lpm_type : string := "arriaii_controller" ); port ( nceout : out std_logic ); end arriaii_controller; architecture architecture_controller of arriaii_controller is begin end architecture_controller; ------------------------------------------------------------------- -- -- Entity Name : arriaii_spiblock -- -- Description : arriaii SPIBLOCK VHDL Simulation model -- ------------------------------------------------------------------- LIBRARY IEEE; use IEEE.std_logic_1164.all; use work.arriaii_atom_pack.all; entity arriaii_spiblock is port ( dclkin : in std_logic; scein : in std_logic; sdoin : in std_logic; oe : in std_logic; data0in : in std_logic; data0out : out std_logic; dclkout : out std_logic; sceout : out std_logic; sdoout : out std_logic ); end arriaii_spiblock; architecture architecture_spiblock of arriaii_spiblock is begin end architecture_spiblock; LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; LIBRARY STD; USE STD.textio.ALL; USE work.arriaii_atom_pack.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; ENTITY arriaii_termination_logic IS GENERIC ( -- generic control parameters -- MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; TimingChecksOn : Boolean := True; tipd_terminationclock : VitalDelayType01 := DefpropDelay01; tipd_terminationselect : VitalDelayType01 := DefpropDelay01; tipd_terminationdata : VitalDelayType01 := DefpropDelay01; --INPUT PORTS lpm_type : STRING := "arriaii_termination_logic" ); PORT ( terminationclock : IN STD_LOGIC := '0'; terminationdata : IN STD_LOGIC := '0'; terminationselect : IN STD_LOGIC := '0'; --OUTPUT PORTS terminationcontrol : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ); END arriaii_termination_logic; ARCHITECTURE trans OF arriaii_termination_logic IS signal terminationclock_ipd :STD_LOGIC; signal terminationselect_ipd :STD_LOGIC; signal terminationdata_ipd :STD_LOGIC; SIGNAL shift_reg : STD_LOGIC_VECTOR(15 DOWNTO 0) := "0000000000000000" ; BEGIN ------------------------ -- Wire Delay Block -- ------------------------ WireDelay : BLOCK BEGIN VitalWireDelay (terminationclock_ipd,terminationclock, tipd_terminationclock); VitalWireDelay (terminationselect_ipd,terminationselect, tipd_terminationselect); VitalWireDelay (terminationdata_ipd,terminationdata, tipd_terminationdata); END BLOCK; ------------------------ -- Functionality Section -- ------------------------ terminationcontrol <= shift_reg; -- END PROCESS; PROCESS (terminationclock_ipd) VARIABLE txt : LINE; BEGIN IF (terminationclock_ipd'EVENT AND terminationclock_ipd = '1') THEN IF (terminationselect_ipd = '1') THEN shift_reg <= (shift_reg(14 DOWNTO 0) & terminationdata_ipd); END IF; END IF; END PROCESS; END trans; LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; LIBRARY STD; USE STD.textio.ALL; USE work.arriaii_atom_pack.all; USE IEEE.VITAL_Timing.all; USE IEEE.VITAL_Primitives.all; ENTITY arriaii_termination IS GENERIC ( -- generic control parameters -- MsgOn : Boolean := DefGlitchMsgOn; XOn : Boolean := DefGlitchXOn; MsgOnChecks : Boolean := DefMsgOnChecks; XOnChecks : Boolean := DefXOnChecks; InstancePath : String := "*"; TimingChecksOn : Boolean := True; tipd_scanshiftmux : VitalDelayType01 := DefpropDelay01; tipd_scaninmux : VitalDelayType01 := DefpropDelay01; tipd_scanin : VitalDelayType01 := DefpropDelay01; tipd_terminationuserclock : VitalDelayType01 := DefpropDelay01; tipd_scanclock : VitalDelayType01 := DefpropDelay01; tipd_terminationuserclear : VitalDelayType01 := DefpropDelay01; tipd_rdn : VitalDelayType01 := DefpropDelay01; tipd_rup : VitalDelayType01 := DefpropDelay01; lpm_type : STRING := "arriaii_termination"; runtime_control : STRING := "false" ); PORT ( rdn : IN STD_LOGIC := '0'; rup : IN STD_LOGIC := '0'; scanclock : IN STD_LOGIC := '0'; scanin : IN STD_LOGIC := '0'; scaninmux : IN STD_LOGIC := '0'; scanshiftmux : IN STD_LOGIC := '0'; terminationuserclear : IN STD_LOGIC := '0'; terminationuserclock : IN STD_LOGIC := '0'; comparatorprobe : OUT STD_LOGIC; scanout : OUT STD_LOGIC; terminationclockout : OUT STD_LOGIC; terminationcontrolprobe : OUT STD_LOGIC; terminationdataout : OUT STD_LOGIC; terminationdone : OUT STD_LOGIC; terminationselectout : OUT STD_LOGIC ); END arriaii_termination; ARCHITECTURE trans OF arriaii_termination IS signal scanshiftmux_ipd :STD_LOGIC; signal scaninmux_ipd :STD_LOGIC; signal scanin_ipd :STD_LOGIC; signal terminationuserclock_ipd :STD_LOGIC; signal scanclock_ipd :STD_LOGIC; signal terminationuserclear_ipd :STD_LOGIC; signal rdn_ipd :STD_LOGIC; signal rup_ipd :STD_LOGIC; SIGNAL cal_shift_cycles : INTEGER := 0 ; SIGNAL reset_oct_reg : STD_LOGIC; SIGNAL terminationdone_tmp : STD_LOGIC := '0' ; SIGNAL internal_enable_read : STD_LOGIC; SIGNAL internal_clk_enable : STD_LOGIC; SIGNAL terminationclockout_tmp : STD_LOGIC := '0' ; SIGNAL terminationselectout_tmp : STD_LOGIC := '0' ; SIGNAL terminationuserclear_prev : STD_LOGIC; BEGIN ------------------------ -- Wire Delay Block -- ------------------------ WireDelay : BLOCK BEGIN VitalWireDelay (terminationuserclear_ipd,terminationuserclear, tipd_terminationuserclear); VitalWireDelay (rdn_ipd,rdn, tipd_rdn); VitalWireDelay (scanin_ipd,scanin, tipd_scanin); VitalWireDelay (scaninmux_ipd,scaninmux, tipd_scaninmux); VitalWireDelay (scanshiftmux_ipd,scanshiftmux, tipd_scanshiftmux); VitalWireDelay (rup_ipd,rup, tipd_rup); VitalWireDelay (scanclock_ipd,scanclock, tipd_scanclock); VitalWireDelay (terminationuserclock_ipd,terminationuserclock, tipd_terminationuserclock); END BLOCK; ------------------------ -- Functionality Section -- ------------------------ -- END PROCESS; PROCESS (terminationuserclock_ipd, terminationuserclear_ipd) VARIABLE txt : LINE; BEGIN -- detect rising edge of terminationuserclear_ipd IF (terminationuserclear_ipd = '1' AND terminationuserclear_prev = '0') THEN reset_oct_reg <= '1'; terminationdone_tmp <= '1'; cal_shift_cycles <= 0; terminationselectout_tmp <= '0'; terminationclockout_tmp <= '0'; END IF; -- detect falling edge of terminationuserclear_ipd IF (terminationuserclear_ipd = '0' AND reset_oct_reg = '1') THEN reset_oct_reg <= '0'; internal_enable_read <= '1'; END IF; -- set internal clock enable at the first negative edge of terminationuserclock_ipd after terminationuserclear_ipd is pulled low-high IF (internal_enable_read = '1' AND terminationuserclock_ipd = '0') THEN internal_clk_enable <= '1'; internal_enable_read <= '0'; END IF; --Assign values for terminationclockout and terminationselectout IF (terminationselectout_tmp = '1') THEN --Start calibration at the positive edge of terminationuserclock_ipd when internal clock enable is asserted terminationclockout_tmp <= terminationuserclock_ipd; END IF; IF (internal_clk_enable = '1' AND terminationuserclock_ipd = '1') THEN IF (cal_shift_cycles = 27) THEN terminationdone_tmp <= '0'; ELSE IF (cal_shift_cycles = 10) THEN terminationselectout_tmp <= '1'; END IF; cal_shift_cycles <= cal_shift_cycles + 1; END IF; END IF; -- if(cal_shift_cycles == 11 && terminationuserclock_ipd == 1'b1) -- terminationselectout_tmp = 1'b1; IF (cal_shift_cycles = 27 AND terminationuserclock_ipd = '0') THEN -- Reset all the internal signals at the end of calibration+shift terminationselectout_tmp <= '0'; END IF; IF (terminationdone_tmp = '0') THEN cal_shift_cycles <= 0; internal_clk_enable <= '0'; END IF; terminationuserclear_prev <= terminationuserclear_ipd; END PROCESS; terminationdone <= terminationdone_tmp; terminationclockout <= terminationclockout_tmp; terminationselectout <= terminationselectout_tmp; END trans;
-- -- This file is part of image_controler_640_480_1b -- Copyright (C) 2011 Julien Thevenon ( julien_thevenon at yahoo.fr ) -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/> -- library IEEE; use IEEE.STD_LOGIC_1164.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 primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity image_controler is Port ( clk : in STD_LOGIC; rst : in STD_LOGIC; r : out STD_LOGIC_VECTOR (5 downto 0); g : out STD_LOGIC_VECTOR (5 downto 0); b : out STD_LOGIC_VECTOR (5 downto 0); x : in STD_LOGIC_VECTOR (9 downto 0); y : in STD_LOGIC_VECTOR (8 downto 0); enable_in : in std_logic; hsync_in : in std_logic; vsync_in : in std_logic; write_enable : in std_logic; write_addr : in std_logic_vector(18 downto 0); data_in : in std_logic; enable_out : out std_logic; hsync_out : out std_logic; vsync_out : out std_logic); end image_controler; architecture Behavioral of image_controler is ------------- Begin Cut here for COMPONENT Declaration ------ COMP_TAG component ram port ( clka: IN std_logic; wea: IN std_logic_VECTOR(0 downto 0); addra: IN std_logic_VECTOR(18 downto 0); dina: IN std_logic_VECTOR(0 downto 0); clkb: IN std_logic; addrb: IN std_logic_VECTOR(18 downto 0); doutb: OUT std_logic_VECTOR(0 downto 0)); end component; -- Synplicity black box declaration attribute syn_black_box : boolean; attribute syn_black_box of ram: component is true; -- COMP_TAG_END ------ End COMPONENT Declaration ------------ -- Signals needed to write in memory signal s_write_enable : std_logic_vector(0 downto 0); --TEST signal write_addr : std_logic_vector(18 downto 0); signal s_data_in : std_logic_vector(0 downto 0); -- Signals needed to read from memory signal read_addr : std_logic_vector(18 downto 0) := (others => '0'); signal data_out : std_logic_vector(0 downto 0); constant controler_delay : natural := 1; begin ------------- Begin Cut here for INSTANTIATION Template ----- INST_TAG your_instance_name : ram port map ( clka => clk, wea => s_write_enable, addra => write_addr, dina => s_data_in, clkb => clk, addrb => read_addr, doutb => data_out); -- INST_TAG_END ------ End INSTANTIATION Template ------------ -- Block to introduce delays need to have control signals -- synchronous with colour signals hsync_delayer : entity work.bit_delay generic map ( size => controler_delay) port map ( clk => clk, rst => rst, input => hsync_in, output => hsync_out); vsync_delayer : entity work.bit_delay generic map ( size => controler_delay) port map ( clk => clk, rst => rst, input => vsync_in, output => vsync_out); enable_delayer : entity work.bit_delay generic map ( size => controler_delay) port map ( clk => clk, rst => rst, input => enable_in, output => enable_out); -- Process controling adress of read port process(clk,rst) begin if rst = '1' then read_addr <= (others => '0'); elsif rising_edge(clk) and enable_in = '1' then if unsigned(read_addr) /= 307199 then read_addr <= std_logic_vector(unsigned(read_addr) + 1); else read_addr <= (others => '0'); end if; end if; end process; s_write_enable <= (others => write_enable); s_data_in <= (others => data_in); r <= (others => data_out(0)); g <= (others => data_out(0)); b <= (others => data_out(0)); end Behavioral;
entity add is port ( clk : in std_logic; in : in std_logic_vector(WIDTH-1 downto 0); output : out std_logic_vector(WIDTH-1 downto 0) ); end add;
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2014, Aeroflex Gaisler -- Copyright (C) 2015 - 2016, Cobham 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: ddr2buf -- File: ddr2buf.vhd -- Author: Magnus Hjorth - Aeroflex Gaisler -- Description: Convenience wrapper for syncram2p with data width conversion -------------------------------------------------------------------------------- -- 2^rabits x rdbits determines amount of RAM. -- -- If 2^wabits x wdbits is larger than this, the lowest bits of waddress are -- used for sub-size writes. writebig ignores these lower bits and writes the -- full data vector at once. -- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; entity ddr2buf is generic (tech : integer := 0; wabits : integer := 6; wdbits : integer := 8; rabits : integer := 6; rdbits : integer := 8; sepclk : integer := 0; wrfst : integer := 0; testen : integer := 0); port ( rclk : in std_ulogic; renable : in std_ulogic; raddress : in std_logic_vector((rabits-1) downto 0); dataout : out std_logic_vector((rdbits-1) downto 0); wclk : in std_ulogic; write : in std_ulogic; writebig : in std_ulogic; waddress : in std_logic_vector((wabits-1) downto 0); datain : in std_logic_vector((wdbits-1) downto 0); testin : in std_logic_vector(TESTIN_WIDTH-1 downto 0)); end; architecture rtl of ddr2buf is function xlog2(x: integer) return integer is variable q,r: integer; begin r := 0; q := 1; while x > q loop q := q+q; r := r+1; end loop; return r; end xlog2; function xmax(a,b: integer) return integer is begin if a>b then return a; else return b; end if; end xmax; function xmin(a,b: integer) return integer is begin if a<b then return a; else return b; end if; end xmin; constant membits : integer := (2**rabits) * rdbits; constant wabitsbig : integer := xlog2(membits/wdbits); constant wdbitsbig : integer := wdbits; constant wabitssml : integer := wabits; constant wdbitssml : integer := membits / (2**wabits); constant totdwidth: integer := xmax(wdbitsbig,rdbits); constant partdwidth: integer := wdbitssml; constant nrams : integer := totdwidth/partdwidth; constant dbits : integer := wdbitssml; constant abits : integer := xlog2(membits/(dbits*nrams)); constant rdratio : integer := rdbits/dbits; constant wdratio : integer := wdbitsbig/dbits; type dv_type is array (0 to nrams-1) of std_logic_vector(dbits-1 downto 0); signal do: dv_type; signal di: dv_type; signal we: std_logic_vector(0 to nrams-1); signal prev_raddress: std_logic_vector(rabits-1 downto 0); begin regs: process(rclk) begin if rising_edge(rclk) then prev_raddress <= raddress; end if; end process; comb: process(prev_raddress,write,writebig,waddress,datain,do) type rdvx_type is array (0 to totdwidth/rdbits-1) of std_logic_vector(rdbits-1 downto 0); variable rdvx: rdvx_type; variable vdo: std_logic_vector((rdbits-1) downto 0); variable vdi: dv_type; variable vwe: std_logic_vector(0 to nrams-1); variable we1: std_logic_vector(0 to wdbitsbig/wdbitssml-1); variable we2: std_logic_vector(0 to wdratio-1); begin vdi := (others => (others => '0')); vwe := (others => '0'); -- Generate rdvx from do for x in 0 to nrams-1 loop if rdbits > dbits then rdvx(x/rdratio)(rdbits-1-(x mod rdratio)*dbits downto rdbits-dbits-(x mod rdratio)*dbits) := do(x); else for y in 0 to dbits/rdbits-1 loop rdvx(x*dbits/rdbits + y) := do(x)(dbits-1-y*rdbits downto dbits-rdbits-y*rdbits); end loop; end if; end loop; -- Generate dataout from rdvx and prev_address vdo := rdvx(totdwidth/rdbits-1); if totdwidth > rdbits then for x in 0 to totdwidth/rdbits-2 loop if prev_raddress(log2(totdwidth/rdbits)-1 downto 0) = std_logic_vector(to_unsigned(x,log2(totdwidth/rdbits))) then vdo := rdvx(x); end if; end loop; end if; -- Generate vdi from datain for x in 0 to nrams-1 loop vdi(x) := datain(wdbits-(x mod wdratio)*dbits-1 downto wdbits-(x mod wdratio)*dbits-dbits); end loop; -- Generate we2 from write/writebig we2 := (others => writebig); if wdbitsbig > wdbitssml then for x in 0 to wdbitsbig/wdbitssml-1 loop if write='1' and waddress(log2(wdbitsbig/wdbitssml)-1 downto 0) = std_logic_vector(to_unsigned(x,log2(wdbitsbig/wdbitssml))) then we2(x*wdbitssml/dbits to (x+1)*wdbitssml/dbits-1) := (others => '1'); end if; end loop; else if write='1' then we2:=(others => '1'); end if; end if; -- Generate write-enable from we2 vwe := (others => '0'); if totdwidth > wdbitsbig then for x in 0 to totdwidth/wdbitsbig-1 loop if waddress(log2(totdwidth/wdbitssml)-1 downto log2(wdbitsbig/wdbitssml))= std_logic_vector(to_unsigned(x,log2(totdwidth/wdbitsbig))) then vwe(x*wdratio to (x+1)*wdratio-1) := we2; end if; end loop; else vwe := we2; end if; dataout <= vdo; di <= vdi; we <= vwe; end process; ramgen: for x in 0 to nrams-1 generate r: syncram_2p generic map (tech,abits,dbits,sepclk,wrfst,testen) port map (rclk => rclk,renable => renable, raddress => raddress((rabits-1) downto (rabits-abits)), dataout => do(x),wclk => wclk,write => we(x), waddress => waddress((wabits-1) downto (wabits-abits)), datain => di(x), testin => testin); end generate; end;
------------------------------------------------------------------------------- -- Title : Testbench for design "servo_sequencer" ------------------------------------------------------------------------------- -- Author : Fabian Greif <fabian@kleinvieh> -- Platform : Spartan 3 ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.servo_sequencer_pkg.all; ------------------------------------------------------------------------------- entity servo_sequencer_tb is end servo_sequencer_tb; ------------------------------------------------------------------------------- architecture tb of servo_sequencer_tb is -- component ports signal load : std_logic_vector(7 downto 0); signal enable : std_logic_vector(7 downto 0); signal counter : std_logic_vector(15 downto 0); signal clk : std_logic := '0'; signal reset : std_logic := '1'; begin -- component instantiation DUT : servo_sequencer port map ( load_p => load, enable_p => enable, counter_p => counter, reset => reset, clk => clk); -- clock generation clk <= not clk after 10 NS; reset <= '1', '0' after 30 NS; -- waveform : process -- begin -- wait until falling_edge(reset); -- -- end process waveform; end tb;
------------------------------------------------------------------------------- -- Title : Testbench for design "servo_sequencer" ------------------------------------------------------------------------------- -- Author : Fabian Greif <fabian@kleinvieh> -- Platform : Spartan 3 ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.servo_sequencer_pkg.all; ------------------------------------------------------------------------------- entity servo_sequencer_tb is end servo_sequencer_tb; ------------------------------------------------------------------------------- architecture tb of servo_sequencer_tb is -- component ports signal load : std_logic_vector(7 downto 0); signal enable : std_logic_vector(7 downto 0); signal counter : std_logic_vector(15 downto 0); signal clk : std_logic := '0'; signal reset : std_logic := '1'; begin -- component instantiation DUT : servo_sequencer port map ( load_p => load, enable_p => enable, counter_p => counter, reset => reset, clk => clk); -- clock generation clk <= not clk after 10 NS; reset <= '1', '0' after 30 NS; -- waveform : process -- begin -- wait until falling_edge(reset); -- -- end process waveform; end tb;
-- Vhdl test bench created from schematic /home/emmanuel/current_projects/Xilinx/Workspace/cpu_v2/sign_extend.sch - Thu Jun 7 17:52:26 2012 -- -- Notes: -- 1) This testbench template has been automatically generated using types -- std_logic and std_logic_vector for the ports of the unit under test. -- Xilinx recommends that these types always be used for the top-level -- I/O of a design in order to guarantee that the testbench will bind -- correctly to the timing (post-route) simulation model. -- 2) To use this template as your testbench, change the filename to any -- name of your choice with the extension .vhd, and use the "Source->Add" -- menu in Project Navigator to import the testbench. Then -- edit the user defined section below, adding code to generate the -- stimulus for your design. -- LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY UNISIM; USE UNISIM.Vcomponents.ALL; ENTITY sign_extend_sign_extend_sch_tb IS END sign_extend_sign_extend_sch_tb; ARCHITECTURE behavioral OF sign_extend_sign_extend_sch_tb IS COMPONENT sign_extend PORT( I : IN STD_LOGIC_VECTOR (15 DOWNTO 0); O : OUT STD_LOGIC_VECTOR (31 DOWNTO 0)); END COMPONENT; SIGNAL I : STD_LOGIC_VECTOR (15 DOWNTO 0); SIGNAL O : STD_LOGIC_VECTOR (31 DOWNTO 0); BEGIN UUT: sign_extend PORT MAP( I => I, O => O ); -- *** Test Bench - User Defined Section *** tb : PROCESS BEGIN -- Test positive number I <= "0111111111111111"; wait for 1ms; -- Test negative number I <= "1111111111111111"; wait for 1ms; I <= "1000000000000000"; WAIT; -- will wait forever END PROCESS; -- *** End Test Bench - User Defined Section *** END;
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- -- -- V H D L F I L E -- -- COPYRIGHT (C) 2006 -- -- -- -------------------------------------------------------------------------------- -- -- Title : DCT1D -- Design : MDCT Core -- Author : Michal Krepa -- -------------------------------------------------------------------------------- -- -- File : DCT1D.VHD -- Created : Sat Mar 5 7:37 2006 -- -------------------------------------------------------------------------------- -- -- Description : 1D Discrete Cosine Transform (1st stage) -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library WORK; use WORK.MDCT_PKG.all; -------------------------------------------------------------------------------- -- ENTITY -------------------------------------------------------------------------------- entity DCT1D is port( clk : in STD_LOGIC; rst : in std_logic; dcti : in std_logic_vector(IP_W-1 downto 0); idv : in STD_LOGIC; romedatao : in T_ROM1DATAO; romodatao : in T_ROM1DATAO; odv : out STD_LOGIC; dcto : out std_logic_vector(OP_W-1 downto 0); romeaddro : out T_ROM1ADDRO; romoaddro : out T_ROM1ADDRO; ramwaddro : out STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); ramdatai : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0); ramwe : out STD_LOGIC; wmemsel : out STD_LOGIC ); end DCT1D; -------------------------------------------------------------------------------- -- ARCHITECTURE -------------------------------------------------------------------------------- architecture RTL of DCT1D is type INPUT_DATA is array (N-1 downto 0) of SIGNED(IP_W downto 0); signal databuf_reg : INPUT_DATA; signal latchbuf_reg : INPUT_DATA; signal col_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal row_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal rowr_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal inpcnt_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwe_s : STD_LOGIC; signal wmemsel_reg : STD_LOGIC; signal stage2_reg : STD_LOGIC; signal stage2_cnt_reg : UNSIGNED(RAMADRR_W-1 downto 0); signal col_2_reg : UNSIGNED(RAMADRR_W/2-1 downto 0); signal ramwaddro_s : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal even_not_odd : std_logic; signal even_not_odd_d1 : std_logic; signal even_not_odd_d2 : std_logic; signal even_not_odd_d3 : std_logic; signal ramwe_d1 : STD_LOGIC; signal ramwe_d2 : STD_LOGIC; signal ramwe_d3 : STD_LOGIC; signal ramwe_d4 : STD_LOGIC; signal ramwaddro_d1 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d2 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d3 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal ramwaddro_d4 : STD_LOGIC_VECTOR(RAMADRR_W-1 downto 0); signal wmemsel_d1 : STD_LOGIC; signal wmemsel_d2 : STD_LOGIC; signal wmemsel_d3 : STD_LOGIC; signal wmemsel_d4 : STD_LOGIC; signal romedatao_d1 : T_ROM1DATAO; signal romodatao_d1 : T_ROM1DATAO; signal romedatao_d2 : T_ROM1DATAO; signal romodatao_d2 : T_ROM1DATAO; signal romedatao_d3 : T_ROM1DATAO; signal romodatao_d3 : T_ROM1DATAO; signal dcto_1 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_2 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_3 : STD_LOGIC_VECTOR(DA_W-1 downto 0); signal dcto_4 : STD_LOGIC_VECTOR(DA_W-1 downto 0); begin ramwaddro <= ramwaddro_d4; ramwe <= ramwe_d4; ramdatai <= dcto_4(DA_W-1 downto 12); wmemsel <= wmemsel_d4; process(clk,rst) begin if rst = '1' then inpcnt_reg <= (others => '0'); latchbuf_reg <= (others => (others => '0')); databuf_reg <= (others => (others => '0')); stage2_reg <= '0'; stage2_cnt_reg <= (others => '1'); ramwe_s <= '0'; ramwaddro_s <= (others => '0'); col_reg <= (others => '0'); row_reg <= (others => '0'); wmemsel_reg <= '0'; col_2_reg <= (others => '0'); elsif clk = '1' and clk'event then stage2_reg <= '0'; ramwe_s <= '0'; -------------------------------- -- 1st stage -------------------------------- if idv = '1' then inpcnt_reg <= inpcnt_reg + 1; -- right shift input data latchbuf_reg(N-2 downto 0) <= latchbuf_reg(N-1 downto 1); latchbuf_reg(N-1) <= SIGNED('0' & dcti) - LEVEL_SHIFT; if inpcnt_reg = N-1 then -- after this sum databuf_reg is in range of -256 to 254 (min to max) databuf_reg(0) <= latchbuf_reg(1)+(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(1) <= latchbuf_reg(2)+latchbuf_reg(7); databuf_reg(2) <= latchbuf_reg(3)+latchbuf_reg(6); databuf_reg(3) <= latchbuf_reg(4)+latchbuf_reg(5); databuf_reg(4) <= latchbuf_reg(1)-(SIGNED('0' & dcti) - LEVEL_SHIFT); databuf_reg(5) <= latchbuf_reg(2)-latchbuf_reg(7); databuf_reg(6) <= latchbuf_reg(3)-latchbuf_reg(6); databuf_reg(7) <= latchbuf_reg(4)-latchbuf_reg(5); stage2_reg <= '1'; end if; end if; -------------------------------- -------------------------------- -- 2nd stage -------------------------------- if stage2_cnt_reg < N then stage2_cnt_reg <= stage2_cnt_reg + 1; -- write RAM ramwe_s <= '1'; -- reverse col/row order for transposition purpose ramwaddro_s <= STD_LOGIC_VECTOR(col_2_reg & row_reg); -- increment column counter col_reg <= col_reg + 1; col_2_reg <= col_2_reg + 1; -- finished processing one input row if col_reg = 0 then row_reg <= row_reg + 1; -- switch to 2nd memory if row_reg = N - 1 then wmemsel_reg <= not wmemsel_reg; col_reg <= (others => '0'); end if; end if; end if; if stage2_reg = '1' then stage2_cnt_reg <= (others => '0'); col_reg <= (0=>'1',others => '0'); col_2_reg <= (others => '0'); end if; ---------------------------------- end if; end process; -- output data pipeline p_data_out_pipe : process(CLK, RST) begin if RST = '1' then even_not_odd <= '0'; even_not_odd_d1 <= '0'; even_not_odd_d2 <= '0'; even_not_odd_d3 <= '0'; ramwe_d1 <= '0'; ramwe_d2 <= '0'; ramwe_d3 <= '0'; ramwe_d4 <= '0'; ramwaddro_d1 <= (others => '0'); ramwaddro_d2 <= (others => '0'); ramwaddro_d3 <= (others => '0'); ramwaddro_d4 <= (others => '0'); wmemsel_d1 <= '0'; wmemsel_d2 <= '0'; wmemsel_d3 <= '0'; wmemsel_d4 <= '0'; dcto_1 <= (others => '0'); dcto_2 <= (others => '0'); dcto_3 <= (others => '0'); dcto_4 <= (others => '0'); elsif CLK'event and CLK = '1' then even_not_odd <= stage2_cnt_reg(0); even_not_odd_d1 <= even_not_odd; even_not_odd_d2 <= even_not_odd_d1; even_not_odd_d3 <= even_not_odd_d2; ramwe_d1 <= ramwe_s; ramwe_d2 <= ramwe_d1; ramwe_d3 <= ramwe_d2; ramwe_d4 <= ramwe_d3; ramwaddro_d1 <= ramwaddro_s; ramwaddro_d2 <= ramwaddro_d1; ramwaddro_d3 <= ramwaddro_d2; ramwaddro_d4 <= ramwaddro_d3; wmemsel_d1 <= wmemsel_reg; wmemsel_d2 <= wmemsel_d1; wmemsel_d3 <= wmemsel_d2; wmemsel_d4 <= wmemsel_d3; if even_not_odd = '0' then dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romedatao(0)),DA_W) + (RESIZE(SIGNED(romedatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romedatao(2)),DA_W-2) & "00"), DA_W)); else dcto_1 <= STD_LOGIC_VECTOR(RESIZE (RESIZE(SIGNED(romodatao(0)),DA_W) + (RESIZE(SIGNED(romodatao(1)),DA_W-1) & '0') + (RESIZE(SIGNED(romodatao(2)),DA_W-2) & "00"), DA_W)); end if; if even_not_odd_d1 = '0' then dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romedatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romedatao_d1(4)),DA_W-4) & "0000"), DA_W)); else dcto_2 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_1) + (RESIZE(SIGNED(romodatao_d1(3)),DA_W-3) & "000") + (RESIZE(SIGNED(romodatao_d1(4)),DA_W-4) & "0000"), DA_W)); end if; if even_not_odd_d2 = '0' then dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romedatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romedatao_d2(6)),DA_W-6) & "000000"), DA_W)); else dcto_3 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_2) + (RESIZE(SIGNED(romodatao_d2(5)),DA_W-5) & "00000") + (RESIZE(SIGNED(romodatao_d2(6)),DA_W-6) & "000000"), DA_W)); end if; if even_not_odd_d3 = '0' then dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romedatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romedatao_d3(8)),DA_W-8) & "00000000"), DA_W)); else dcto_4 <= STD_LOGIC_VECTOR(RESIZE (signed(dcto_3) + (RESIZE(SIGNED(romodatao_d3(7)),DA_W-7) & "0000000") - (RESIZE(SIGNED(romodatao_d3(8)),DA_W-8) & "00000000"), DA_W)); end if; end if; end process; -- read precomputed MAC results from LUT p_romaddr : process(CLK, RST) begin if RST = '1' then romeaddro <= (others => (others => '0')); romoaddro <= (others => (others => '0')); elsif CLK'event and CLK = '1' then for i in 0 to 8 loop -- even romeaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(0)(i) & databuf_reg(1)(i) & databuf_reg(2)(i) & databuf_reg(3)(i); -- odd romoaddro(i) <= STD_LOGIC_VECTOR(col_reg(RAMADRR_W/2-1 downto 1)) & databuf_reg(4)(i) & databuf_reg(5)(i) & databuf_reg(6)(i) & databuf_reg(7)(i); end loop; end if; end process; p_romdatao_d1 : process(CLK, RST) begin if RST = '1' then romedatao_d1 <= (others => (others => '0')); romodatao_d1 <= (others => (others => '0')); romedatao_d2 <= (others => (others => '0')); romodatao_d2 <= (others => (others => '0')); romedatao_d3 <= (others => (others => '0')); romodatao_d3 <= (others => (others => '0')); elsif CLK'event and CLK = '1' then romedatao_d1 <= romedatao; romodatao_d1 <= romodatao; romedatao_d2 <= romedatao_d1; romodatao_d2 <= romodatao_d1; romedatao_d3 <= romedatao_d2; romodatao_d3 <= romodatao_d2; end if; end process; end RTL; --------------------------------------------------------------------------------
-- (c) Copyright 1995-2014 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:fir_compiler:7.1 -- IP Revision: 3 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY fir_compiler_v7_1; USE fir_compiler_v7_1.fir_compiler_v7_1; ENTITY fir_lp_15kHz IS PORT ( aclk : IN STD_LOGIC; s_axis_data_tvalid : IN STD_LOGIC; s_axis_data_tready : OUT STD_LOGIC; s_axis_data_tdata : IN STD_LOGIC_VECTOR(15 DOWNTO 0); m_axis_data_tvalid : OUT STD_LOGIC; m_axis_data_tdata : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) ); END fir_lp_15kHz; ARCHITECTURE fir_lp_15kHz_arch OF fir_lp_15kHz IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF fir_lp_15kHz_arch: ARCHITECTURE IS "yes"; COMPONENT fir_compiler_v7_1 IS GENERIC ( C_XDEVICEFAMILY : STRING; C_ELABORATION_DIR : STRING; C_COMPONENT_NAME : STRING; C_COEF_FILE : STRING; C_COEF_FILE_LINES : INTEGER; C_FILTER_TYPE : INTEGER; C_INTERP_RATE : INTEGER; C_DECIM_RATE : INTEGER; C_ZERO_PACKING_FACTOR : INTEGER; C_SYMMETRY : INTEGER; C_NUM_FILTS : INTEGER; C_NUM_TAPS : INTEGER; C_NUM_CHANNELS : INTEGER; C_CHANNEL_PATTERN : STRING; C_ROUND_MODE : INTEGER; C_COEF_RELOAD : INTEGER; C_NUM_RELOAD_SLOTS : INTEGER; C_COL_MODE : INTEGER; C_COL_PIPE_LEN : INTEGER; C_COL_CONFIG : STRING; C_OPTIMIZATION : INTEGER; C_DATA_PATH_WIDTHS : STRING; C_DATA_IP_PATH_WIDTHS : STRING; C_DATA_PX_PATH_WIDTHS : STRING; C_DATA_WIDTH : INTEGER; C_COEF_PATH_WIDTHS : STRING; C_COEF_WIDTH : INTEGER; C_DATA_PATH_SRC : STRING; C_COEF_PATH_SRC : STRING; C_DATA_PATH_SIGN : STRING; C_COEF_PATH_SIGN : STRING; C_ACCUM_PATH_WIDTHS : STRING; C_OUTPUT_WIDTH : INTEGER; C_OUTPUT_PATH_WIDTHS : STRING; C_ACCUM_OP_PATH_WIDTHS : STRING; C_EXT_MULT_CNFG : STRING; C_DATA_PATH_PSAMP_SRC : STRING; C_OP_PATH_PSAMP_SRC : STRING; C_NUM_MADDS : INTEGER; C_OPT_MADDS : STRING; C_OVERSAMPLING_RATE : INTEGER; C_INPUT_RATE : INTEGER; C_OUTPUT_RATE : INTEGER; C_DATA_MEMTYPE : INTEGER; C_COEF_MEMTYPE : INTEGER; C_IPBUFF_MEMTYPE : INTEGER; C_OPBUFF_MEMTYPE : INTEGER; C_DATAPATH_MEMTYPE : INTEGER; C_MEM_ARRANGEMENT : INTEGER; C_DATA_MEM_PACKING : INTEGER; C_COEF_MEM_PACKING : INTEGER; C_FILTS_PACKED : INTEGER; C_LATENCY : INTEGER; C_HAS_ARESETn : INTEGER; C_HAS_ACLKEN : INTEGER; C_DATA_HAS_TLAST : INTEGER; C_S_DATA_HAS_FIFO : INTEGER; C_S_DATA_HAS_TUSER : INTEGER; C_S_DATA_TDATA_WIDTH : INTEGER; C_S_DATA_TUSER_WIDTH : INTEGER; C_M_DATA_HAS_TREADY : INTEGER; C_M_DATA_HAS_TUSER : INTEGER; C_M_DATA_TDATA_WIDTH : INTEGER; C_M_DATA_TUSER_WIDTH : INTEGER; C_HAS_CONFIG_CHANNEL : INTEGER; C_CONFIG_SYNC_MODE : INTEGER; C_CONFIG_PACKET_SIZE : INTEGER; C_CONFIG_TDATA_WIDTH : INTEGER; C_RELOAD_TDATA_WIDTH : INTEGER ); PORT ( aresetn : IN STD_LOGIC; aclk : IN STD_LOGIC; aclken : IN STD_LOGIC; s_axis_data_tvalid : IN STD_LOGIC; s_axis_data_tready : OUT STD_LOGIC; s_axis_data_tlast : IN STD_LOGIC; s_axis_data_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_data_tdata : IN STD_LOGIC_VECTOR(15 DOWNTO 0); s_axis_config_tvalid : IN STD_LOGIC; s_axis_config_tready : OUT STD_LOGIC; s_axis_config_tlast : IN STD_LOGIC; s_axis_config_tdata : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_reload_tvalid : IN STD_LOGIC; s_axis_reload_tready : OUT STD_LOGIC; s_axis_reload_tlast : IN STD_LOGIC; s_axis_reload_tdata : IN STD_LOGIC_VECTOR(0 DOWNTO 0); m_axis_data_tvalid : OUT STD_LOGIC; m_axis_data_tready : IN STD_LOGIC; m_axis_data_tlast : OUT STD_LOGIC; m_axis_data_tuser : OUT STD_LOGIC_VECTOR(0 DOWNTO 0); m_axis_data_tdata : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); event_s_data_tlast_missing : OUT STD_LOGIC; event_s_data_tlast_unexpected : OUT STD_LOGIC; event_s_data_chanid_incorrect : OUT STD_LOGIC; event_s_config_tlast_missing : OUT STD_LOGIC; event_s_config_tlast_unexpected : OUT STD_LOGIC; event_s_reload_tlast_missing : OUT STD_LOGIC; event_s_reload_tlast_unexpected : OUT STD_LOGIC ); END COMPONENT fir_compiler_v7_1; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 aclk_intf CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_data_tvalid: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_DATA TVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_data_tready: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_DATA TREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_data_tdata: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_DATA TDATA"; ATTRIBUTE X_INTERFACE_INFO OF m_axis_data_tvalid: SIGNAL IS "xilinx.com:interface:axis:1.0 M_AXIS_DATA TVALID"; ATTRIBUTE X_INTERFACE_INFO OF m_axis_data_tdata: SIGNAL IS "xilinx.com:interface:axis:1.0 M_AXIS_DATA TDATA"; BEGIN U0 : fir_compiler_v7_1 GENERIC MAP ( C_XDEVICEFAMILY => "zynq", C_ELABORATION_DIR => "./", C_COMPONENT_NAME => "fir_lp_15kHz", C_COEF_FILE => "fir_lp_15kHz.mif", C_COEF_FILE_LINES => 1024, C_FILTER_TYPE => 1, C_INTERP_RATE => 1, C_DECIM_RATE => 4, C_ZERO_PACKING_FACTOR => 1, C_SYMMETRY => 1, C_NUM_FILTS => 1, C_NUM_TAPS => 2048, C_NUM_CHANNELS => 1, C_CHANNEL_PATTERN => "fixed", C_ROUND_MODE => 0, C_COEF_RELOAD => 0, C_NUM_RELOAD_SLOTS => 1, C_COL_MODE => 1, C_COL_PIPE_LEN => 4, C_COL_CONFIG => "16", C_OPTIMIZATION => 2046, C_DATA_PATH_WIDTHS => "16", C_DATA_IP_PATH_WIDTHS => "16", C_DATA_PX_PATH_WIDTHS => "16", C_DATA_WIDTH => 16, C_COEF_PATH_WIDTHS => "19", C_COEF_WIDTH => 19, C_DATA_PATH_SRC => "0", C_COEF_PATH_SRC => "0", C_DATA_PATH_SIGN => "0", C_COEF_PATH_SIGN => "1", C_ACCUM_PATH_WIDTHS => "45", C_OUTPUT_WIDTH => 45, C_OUTPUT_PATH_WIDTHS => "45", C_ACCUM_OP_PATH_WIDTHS => "45", C_EXT_MULT_CNFG => "none", C_DATA_PATH_PSAMP_SRC => "0", C_OP_PATH_PSAMP_SRC => "0", C_NUM_MADDS => 16, C_OPT_MADDS => "none", C_OVERSAMPLING_RATE => 16, C_INPUT_RATE => 16, C_OUTPUT_RATE => 64, C_DATA_MEMTYPE => 0, C_COEF_MEMTYPE => 2, C_IPBUFF_MEMTYPE => 0, C_OPBUFF_MEMTYPE => 0, C_DATAPATH_MEMTYPE => 2, C_MEM_ARRANGEMENT => 1, C_DATA_MEM_PACKING => 0, C_COEF_MEM_PACKING => 0, C_FILTS_PACKED => 0, C_LATENCY => 40, C_HAS_ARESETn => 0, C_HAS_ACLKEN => 0, C_DATA_HAS_TLAST => 0, C_S_DATA_HAS_FIFO => 1, C_S_DATA_HAS_TUSER => 0, C_S_DATA_TDATA_WIDTH => 16, C_S_DATA_TUSER_WIDTH => 1, C_M_DATA_HAS_TREADY => 0, C_M_DATA_HAS_TUSER => 0, C_M_DATA_TDATA_WIDTH => 48, C_M_DATA_TUSER_WIDTH => 1, C_HAS_CONFIG_CHANNEL => 0, C_CONFIG_SYNC_MODE => 0, C_CONFIG_PACKET_SIZE => 0, C_CONFIG_TDATA_WIDTH => 1, C_RELOAD_TDATA_WIDTH => 1 ) PORT MAP ( aresetn => '1', aclk => aclk, aclken => '1', s_axis_data_tvalid => s_axis_data_tvalid, s_axis_data_tready => s_axis_data_tready, s_axis_data_tlast => '0', s_axis_data_tuser => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_data_tdata => s_axis_data_tdata, s_axis_config_tvalid => '0', s_axis_config_tlast => '0', s_axis_config_tdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_reload_tvalid => '0', s_axis_reload_tlast => '0', s_axis_reload_tdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), m_axis_data_tvalid => m_axis_data_tvalid, m_axis_data_tready => '1', m_axis_data_tdata => m_axis_data_tdata ); END fir_lp_15kHz_arch;
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -- vim: tabstop=2:shiftwidth=2:noexpandtab -- kate: tab-width 2; replace-tabs off; indent-width 2; ------------------------------------------------------------------------------- -- This file is part of the Queens@TUD solver suite -- for enumerating and counting the solutions of an N-Queens Puzzle. -- -- Copyright (C) 2008-2015 -- Thomas B. Preusser <[email protected]> ------------------------------------------------------------------------------- -- This design is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as published -- by the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Affero General Public License for more details. -- -- You should have received a copy of the GNU Affero General Public License -- along with this design. If not, see <http://www.gnu.org/licenses/>. ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; library PoC; use PoC.physical.all; entity ml605_queens_uart is generic ( N : positive := 27; L : positive := 2; SOLVERS : positive := 127; COUNT_CYCLES : boolean := false; CLK_FREQ : FREQ := 200 MHz; CLK_MULA : positive := 6; CLK_DIVA : positive := 1; CLK_DIVB : positive := 7; BAUDRATE : positive := 115200; SENTINEL : std_logic_vector(7 downto 0) := x"FA" -- Start Byte ); port ( clk_p : in std_logic; clk_n : in std_logic; rx : in std_logic; tx : out std_logic; rts_n : in std_logic; cts_n : out std_logic; FanControl_PWM : out std_logic ); end ml605_queens_uart; library IEEE; use IEEE.numeric_std.all; library UNISIM; use UNISIM.vcomponents.all; library PoC; architecture rtl of ml605_queens_uart is -- Global Control constant CLK_COMP_FREQ : FREQ := CLK_FREQ * CLK_MULA / CLK_DIVA / CLK_DIVB; constant CLK_SLOW_FREQ : FREQ := CLK_FREQ * CLK_MULA / CLK_DIVA / 100; signal clk200 : std_logic; -- 200 MHz Input Clock signal clk_comp : std_logic; -- Computation Clock signal clk_slow : std_logic; -- Slow Interface Clock signal rst : std_logic; begin ----------------------------------------------------------------------------- -- Generate Global Controls blkGlobal: block is signal clkfb : std_logic; -- Feedback Clock signal clk_compu : std_logic; -- Unbuffered Synthesized Clock signal clk_slowu : std_logic; -- Unbuffered Synthesized Clock begin clk_in : IBUFGDS port map( O => clk200, I => clk_p, IB => clk_n ); pll : MMCM_BASE generic map ( CLKIN1_PERIOD => to_real(to_time(CLK_FREQ), 1 ns), CLKFBOUT_MULT_F => real(CLK_MULA), DIVCLK_DIVIDE => CLK_DIVA, CLKOUT0_DIVIDE_F => real(CLK_DIVB), CLKOUT1_DIVIDE => 100, STARTUP_WAIT => false ) port map ( CLKIN1 => clk200, CLKFBIN => clkfb, RST => '0', CLKOUT0 => clk_compu, CLKOUT1 => clk_slowu, CLKOUT2 => open, CLKOUT3 => open, CLKOUT4 => open, CLKOUT5 => open, CLKFBOUT => clkfb, LOCKED => open, PWRDWN => '0' ); comp_buf : BUFG port map ( I => clk_compu, O => clk_comp ); slow_buf : BUFH port map ( I => clk_slowu, O => clk_slow ); -- No Reset rst <= '0'; end block blkGlobal; ----------------------------------------------------------------------------- -- Fan Control fan : entity PoC.io_FanControl generic map ( CLOCK_FREQ => CLK_SLOW_FREQ ) port map ( Clock => clk_slow, Reset => '0', Fan_PWM => FanControl_PWM, TachoFrequency => open ); ---------------------------------------------------------------------------- -- Solver Chain chain: entity work.queens_uart generic map ( N => N, L => L, SOLVERS => SOLVERS, COUNT_CYCLES => COUNT_CYCLES, CLK_FREQ => integer(to_real(CLK_COMP_FREQ, 1 Hz)), BAUDRATE => BAUDRATE, SENTINEL => SENTINEL ) port map ( clk => clk_comp, rst => rst, rx => rx, tx => tx, avail => open ); cts_n <= rts_n; end rtl;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc806.vhd,v 1.2 2001-10-26 16:30:27 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c01s02b00x00p02n01i00806ent IS END c01s02b00x00p02n01i00806ent; ARCHITECTURE c01s02b00x00p02n01i00806arch OF c01s02b00x00p02n01i00806ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c01s02b00x00p02n01i00806 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c01s02b00x00p02n01i00806arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc806.vhd,v 1.2 2001-10-26 16:30:27 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c01s02b00x00p02n01i00806ent IS END c01s02b00x00p02n01i00806ent; ARCHITECTURE c01s02b00x00p02n01i00806arch OF c01s02b00x00p02n01i00806ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c01s02b00x00p02n01i00806 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c01s02b00x00p02n01i00806arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc806.vhd,v 1.2 2001-10-26 16:30:27 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c01s02b00x00p02n01i00806ent IS END c01s02b00x00p02n01i00806ent; ARCHITECTURE c01s02b00x00p02n01i00806arch OF c01s02b00x00p02n01i00806ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c01s02b00x00p02n01i00806 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c01s02b00x00p02n01i00806arch;
package pkg1 is new work.gen1;
package pkg1 is new work.gen1;
-- libraries -------------------------------------------------------------------------------------------{{{ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; library work; use work.all; use work.FGPU_definitions.all; ---------------------------------------------------------------------------------------------------------}}} entity cache is -- {{{ port( -- port a wea : in std_logic_vector(CACHE_N_BANKS*DATA_W/8-1 downto 0); ena : in std_logic; addra : in unsigned(M+L-1 downto 0); dia : in std_logic_vector(CACHE_N_BANKS*DATA_W-1 downto 0); doa : out std_logic_vector(CACHE_N_BANKS*DATA_W-1 downto 0) := (others=>'0'); -- port b enb, enb_be : in std_logic; wr_fifo_rqst_addr : in cache_addr_array(N_WR_FIFOS-1 downto 0); rd_fifo_rqst_addr : in cache_addr_array(N_AXI-1 downto 0); wr_fifo_dout : in cache_word_array(N_WR_FIFOS-1 downto 0); rd_fifo_din_v : out std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); dob : out std_logic_vector(CACHE_N_BANKS*DATA_W-1 downto 0) := (others=>'0'); -- ticket signals ticket_rqst_wr : in std_logic_vector(N_WR_FIFOS-1 downto 0); ticket_ack_wr_fifo : out std_logic_vector(N_WR_FIFOS-1 downto 0) := (others=>'0'); ticket_rqst_rd : in std_logic_vector(N_AXI-1 downto 0); ticket_ack_rd_fifo : out std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); -- be signals be_rdData : out std_logic_vector (DATA_W/8*2**N-1 downto 0) := (others=>'0'); clk, nrst : in std_logic ); end cache; -- }}} architecture Behavioral of cache is -- internal signals definitions {{{ signal ticket_ack_wr_fifo_n : std_logic_vector(N_WR_FIFOS-1 downto 0) := (others=>'0'); signal ticket_ack_rd_fifo_n : std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); signal ticket_ack_wr_fifo_i : std_logic_vector(N_WR_FIFOS-1 downto 0) := (others=>'0'); signal ticket_ack_rd_fifo_i : std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); -- }}} -- constants and functions {{{ CONSTANT COL_W : natural := 8; CONSTANT N_COL : natural := 4*2**N; --}}} -- cache definition {{{ type cache_bank_type is array(0 to 2**(M+L)-1) of std_logic_vector(N_COL*COL_W-1 downto 0); shared variable cache : cache_bank_type := (others=>(others=>'0')); -- }}} -- port b signals & ticketing system {{{ signal addrb, addrb_n : unsigned((M+L)-1 downto 0) := (others=>'0'); signal dib, doa_n, dob_n : std_logic_vector((2**N)*DATA_W-1 downto 0) := (others=>'0'); signal web : std_logic_vector((2**N)*DATA_W/8-1 downto 0) := (others=>'0'); signal rd_fifo_din_v_p0 : std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); signal rd_fifo_din_v_p1 : std_logic_vector(N_AXI-1 downto 0) := (others=>'0'); signal rd_fifo_rqst_addr_inc : unsigned((M+L)-1 downto 0) := (others=>'0'); signal rd_fifo_rqst_addr_inc_n : unsigned((M+L)-1 downto 0) := (others=>'0'); signal wr_fifo_dout_d0 : cache_word_array(N_WR_FIFOS-1 downto 0) := (others=>(others=>'0')); signal ticket_ack_vec : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_wr_vec : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_rd_vec : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_vec_d0 : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_wr_vec_d0 : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_rd_vec_d0 : std_logic_vector(2**BURST_WORDS_W/CACHE_N_BANKS-1 downto 0) := (others=>'0'); signal ticket_ack_vec_n : std_logic := '0'; signal ticket_ack_wr_vec_n : std_logic := '0'; signal ticket_ack_rd_vec_n : std_logic := '0'; signal wr_fifo_ack_indx_n : integer range 0 to N_WR_FIFOS-1 := 0; signal wr_fifo_ack_indx : integer range 0 to N_WR_FIFOS-1 := 0; signal wr_fifo_ack_indx_d0 : integer range 0 to N_WR_FIFOS-1 := 0; signal rd_fifo_ack_indx_n : integer range 0 to N_AXI-1 := 0; signal rd_fifo_ack_indx : integer range 0 to N_AXI-1 := 0; signal rd_fifo_ack_indx_d0 : integer range 0 to N_AXI-1 := 0; signal wr_fifo_rqst_addr_d0 : cache_addr_array(N_WR_FIFOS-1 downto 0) := (others=>(others=>'0')); signal rd_fifo_rqst_addr_d0 : cache_addr_array(N_AXI-1 downto 0) := (others=>(others=>'0')); -- }}} -- be signals{{{ type be_mem_type is array(0 to 2**(M+L)-1) of std_logic_vector(2**N*DATA_W/8-1 downto 0); shared variable be : be_mem_type := (others=>(others=>'0')); signal be_we : std_logic := '0'; attribute max_fanout of wr_fifo_ack_indx_d0 : signal is 60; signal be_rdData_n : std_logic_vector (DATA_W/8*2**N-1 downto 0) := (others=>'0'); ---}}} begin -- internal signals assignments -------------------------------------------------------------------------{{{ ticket_ack_wr_fifo <= ticket_ack_wr_fifo_i; ticket_ack_rd_fifo <= ticket_ack_rd_fifo_i; ---------------------------------------------------------------------------------------------------------}}} -- error handling -------------------------------------------------------------------------------------------{{{ -- assert(addra(7 downto 0) /= X"B7" or addra(8) /= '0' or wea(7 downto 4) /= X"F"); ---------------------------------------------------------------------------------------------------------}}} -- be -------------------------------------------------------------------------------------------{{{ process(clk) begin if rising_edge(clk) then if ena = '1' then -- if to_integer(addra) = 11 and wea /= (wea'range => '0') then -- report "Address B written"; -- end if; for j in 0 to 2**N*DATA_W/8-1 loop if wea(j) = '1' then be(to_integer(addra))(j) := '1'; end if; end loop; end if; end if; end process; process(clk) begin if rising_edge(clk) then be_rdData_n <= be(to_integer(addrb)); if be_we = '1' then be(to_integer(addrb)) := (others=>'0'); end if; if enb_be = '1' then be_rdData <= be_rdData_n; end if; end if; end process; ---------------------------------------------------------------------------------------------------------}}} -- cache port b control -------------------------------------------------------------------------------------------{{{ assert(ticket_ack_rd_vec = (ticket_ack_rd_vec'reverse_range=>'0') or ticket_ack_wr_vec = (ticket_ack_wr_vec'reverse_range=>'0')); process(clk) begin if rising_edge(clk) then ticket_ack_wr_fifo_i <= ticket_ack_wr_fifo_n; ticket_ack_rd_fifo_i <= ticket_ack_rd_fifo_n; wr_fifo_dout_d0 <= wr_fifo_dout; ticket_ack_vec(ticket_ack_vec'high-1 downto 0) <= ticket_ack_vec(ticket_ack_vec'high downto 1); ticket_ack_vec(ticket_ack_vec'high) <= ticket_ack_vec_n; ticket_ack_vec_d0 <= ticket_ack_vec; ticket_ack_wr_vec(ticket_ack_wr_vec'high-1 downto 0) <= ticket_ack_wr_vec(ticket_ack_wr_vec'high downto 1); ticket_ack_wr_vec(ticket_ack_wr_vec'high) <= ticket_ack_wr_vec_n; ticket_ack_wr_vec_d0 <= ticket_ack_wr_vec; ticket_ack_rd_vec(ticket_ack_rd_vec'high-1 downto 0) <= ticket_ack_rd_vec(ticket_ack_rd_vec'high downto 1); ticket_ack_rd_vec(ticket_ack_rd_vec'high) <= ticket_ack_rd_vec_n; ticket_ack_rd_vec_d0 <= ticket_ack_rd_vec; wr_fifo_ack_indx <= wr_fifo_ack_indx_n; rd_fifo_ack_indx <= rd_fifo_ack_indx_n; wr_fifo_ack_indx_d0 <= wr_fifo_ack_indx; rd_fifo_ack_indx_d0 <= rd_fifo_ack_indx; wr_fifo_rqst_addr_d0 <= wr_fifo_rqst_addr; rd_fifo_rqst_addr_d0 <= rd_fifo_rqst_addr; -- write path web <= (others=>'0'); dib <= wr_fifo_dout_d0(wr_fifo_ack_indx_d0); if ticket_ack_wr_vec_d0 /= (ticket_ack_wr_vec_d0'reverse_range => '0') then addrb <= wr_fifo_rqst_addr_d0(wr_fifo_ack_indx_d0); web <= (others=>'1'); end if; -- read path be_we <= '0'; rd_fifo_din_v_p1 <= (others=>'0'); if ticket_ack_rd_vec_d0 /= (ticket_ack_rd_vec_d0'reverse_range => '0') then addrb <= rd_fifo_rqst_addr_inc; rd_fifo_din_v_p1(rd_fifo_ack_indx_d0) <= '1'; be_we <= '1'; end if; rd_fifo_din_v_p0 <= rd_fifo_din_v_p1; rd_fifo_din_v <= rd_fifo_din_v_p0; if nrst = '0' then rd_fifo_rqst_addr_inc <= (others=>'0'); else rd_fifo_rqst_addr_inc <= rd_fifo_rqst_addr_inc_n; end if; end if; end process; process(ticket_rqst_wr, ticket_rqst_rd, ticket_ack_vec, wr_fifo_ack_indx, rd_fifo_ack_indx, rd_fifo_rqst_addr_inc, rd_fifo_rqst_addr_d0, ticket_ack_rd_vec_d0) variable wr_served: boolean := false; begin ticket_ack_wr_fifo_n <= (others=>'0'); ticket_ack_rd_fifo_n <= (others=>'0'); ticket_ack_vec_n <= '0'; ticket_ack_wr_vec_n <= '0'; ticket_ack_rd_vec_n <= '0'; wr_fifo_ack_indx_n <= wr_fifo_ack_indx; rd_fifo_ack_indx_n <= rd_fifo_ack_indx; rd_fifo_rqst_addr_inc_n <= rd_fifo_rqst_addr_inc; if ticket_ack_rd_vec_d0(ticket_ack_rd_vec_d0'high downto 1) /= (0 to ticket_ack_rd_vec_d0'high-1 =>'0') then rd_fifo_rqst_addr_inc_n <= rd_fifo_rqst_addr_inc + 1; else rd_fifo_rqst_addr_inc_n <= rd_fifo_rqst_addr_d0(rd_fifo_ack_indx); end if; wr_served := false; for i in 0 to N_WR_FIFOS-1 loop -- if ticket_rqst_wr(i) = '1' and ticket_ack_vec = (ticket_ack_vec'range=>'0') then if ticket_rqst_wr(i) = '1' and ticket_ack_vec(ticket_ack_vec'high downto 1) = (0 to ticket_ack_vec'high-1 =>'0') then ticket_ack_wr_fifo_n(i) <= '1'; wr_served := true; ticket_ack_vec_n <= '1'; ticket_ack_wr_vec_n <= '1'; wr_fifo_ack_indx_n <= i; exit; end if; end loop; if wr_served = false then for i in 0 to N_AXI-1 loop if ticket_rqst_rd(i) = '1' and ticket_ack_vec(ticket_ack_vec'high downto 1) = (0 to ticket_ack_vec'high-1 =>'0') then ticket_ack_rd_fifo_n(i) <= '1'; ticket_ack_vec_n <= '1'; ticket_ack_rd_vec_n <= '1'; rd_fifo_ack_indx_n <= i; -- rd_fifo_rqst_addr_inc_n <= rd_fifo_rqst_addr(i); exit; end if; end loop; end if; end process; ---------------------------------------------------------------------------------------------------------}}} -- cache mems -------------------------------------------------------------------------------------------{{{ process(clk) begin if rising_edge(clk) then doa_n <= cache(to_integer(addra)); for j in 0 to N_COL-1 loop if wea(j) = '1' then cache(to_integer(addra))((j+1)*COL_W-1 downto j*COL_W) := dia((j+1)*COL_W-1 downto j*COL_W); end if; end loop; if ena = '1' then doa <= doa_n; end if; end if; end process; process(clk) begin if rising_edge(clk) then if enb = '1' then dob <= dob_n; end if; dob_n <= cache(to_integer(addrb)); -- assert(web = (web'range => '0') or dib /= (dib'range => '0')) severity failure; for j in 0 to N_COL-1 loop if web(j) = '1' then cache(to_integer(addrb))((j+1)*COL_W-1 downto j*COL_W) := dib((j+1)*COL_W-1 downto j*COL_W); end if; end loop; end if; end process; ---------------------------------------------------------------------------------------------------------}}} end Behavioral;
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: ch_14_fg_14_08.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; entity buf is port ( a : in std_logic; y : out std_logic ); end entity buf; architecture basic of buf is begin y <= a; end architecture basic; -- code from book library ieee; use ieee.std_logic_1164.all; entity fanout_tree is generic ( height : natural ); port ( input : in std_logic; output : out std_logic_vector (0 to 2**height - 1) ); end entity fanout_tree; -------------------------------------------------- architecture recursive of fanout_tree is begin degenerate_tree : if height = 0 generate begin output(0) <= input; end generate degenerate_tree; compound_tree : if height > 0 generate signal buffered_input_0, buffered_input_1 : std_logic; begin buf_0 : entity work.buf(basic) port map ( a => input, y => buffered_input_0 ); subtree_0 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_0, output => output(0 to 2**(height - 1) - 1) ); buf_1 : entity work.buf(basic) port map ( a => input, y => buffered_input_1 ); subtree_1 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_1, output => output(2**(height - 1) to 2**height - 1) ); end generate compound_tree; end architecture recursive; -- end code from book library ieee; use ieee.std_logic_1164.all; entity fg_14_08 is end entity fg_14_08; architecture test of fg_14_08 is signal unbuffered_clock : std_logic; signal buffered_clock_array : std_logic_vector(0 to 7); begin -- code from book (in text) clock_buffer_tree : entity work.fanout_tree(recursive) generic map ( height => 3 ) port map ( input => unbuffered_clock, output => buffered_clock_array ); -- end code from book clock_gen : process is begin unbuffered_clock <= '1' after 5 ns, '0' after 10 ns; wait for 10 ns; end process clock_gen; end architecture test;
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: ch_14_fg_14_08.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; entity buf is port ( a : in std_logic; y : out std_logic ); end entity buf; architecture basic of buf is begin y <= a; end architecture basic; -- code from book library ieee; use ieee.std_logic_1164.all; entity fanout_tree is generic ( height : natural ); port ( input : in std_logic; output : out std_logic_vector (0 to 2**height - 1) ); end entity fanout_tree; -------------------------------------------------- architecture recursive of fanout_tree is begin degenerate_tree : if height = 0 generate begin output(0) <= input; end generate degenerate_tree; compound_tree : if height > 0 generate signal buffered_input_0, buffered_input_1 : std_logic; begin buf_0 : entity work.buf(basic) port map ( a => input, y => buffered_input_0 ); subtree_0 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_0, output => output(0 to 2**(height - 1) - 1) ); buf_1 : entity work.buf(basic) port map ( a => input, y => buffered_input_1 ); subtree_1 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_1, output => output(2**(height - 1) to 2**height - 1) ); end generate compound_tree; end architecture recursive; -- end code from book library ieee; use ieee.std_logic_1164.all; entity fg_14_08 is end entity fg_14_08; architecture test of fg_14_08 is signal unbuffered_clock : std_logic; signal buffered_clock_array : std_logic_vector(0 to 7); begin -- code from book (in text) clock_buffer_tree : entity work.fanout_tree(recursive) generic map ( height => 3 ) port map ( input => unbuffered_clock, output => buffered_clock_array ); -- end code from book clock_gen : process is begin unbuffered_clock <= '1' after 5 ns, '0' after 10 ns; wait for 10 ns; end process clock_gen; end architecture test;
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: ch_14_fg_14_08.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; entity buf is port ( a : in std_logic; y : out std_logic ); end entity buf; architecture basic of buf is begin y <= a; end architecture basic; -- code from book library ieee; use ieee.std_logic_1164.all; entity fanout_tree is generic ( height : natural ); port ( input : in std_logic; output : out std_logic_vector (0 to 2**height - 1) ); end entity fanout_tree; -------------------------------------------------- architecture recursive of fanout_tree is begin degenerate_tree : if height = 0 generate begin output(0) <= input; end generate degenerate_tree; compound_tree : if height > 0 generate signal buffered_input_0, buffered_input_1 : std_logic; begin buf_0 : entity work.buf(basic) port map ( a => input, y => buffered_input_0 ); subtree_0 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_0, output => output(0 to 2**(height - 1) - 1) ); buf_1 : entity work.buf(basic) port map ( a => input, y => buffered_input_1 ); subtree_1 : entity work.fanout_tree(recursive) generic map ( height => height - 1 ) port map ( input => buffered_input_1, output => output(2**(height - 1) to 2**height - 1) ); end generate compound_tree; end architecture recursive; -- end code from book library ieee; use ieee.std_logic_1164.all; entity fg_14_08 is end entity fg_14_08; architecture test of fg_14_08 is signal unbuffered_clock : std_logic; signal buffered_clock_array : std_logic_vector(0 to 7); begin -- code from book (in text) clock_buffer_tree : entity work.fanout_tree(recursive) generic map ( height => 3 ) port map ( input => unbuffered_clock, output => buffered_clock_array ); -- end code from book clock_gen : process is begin unbuffered_clock <= '1' after 5 ns, '0' after 10 ns; wait for 10 ns; end process clock_gen; end architecture test;
-- NEED RESULT: ARCH00363.P1: Multi transport transactions occurred on concurrent signal asg passed -- NEED RESULT: ARCH00363.P2: Multi transport transactions occurred on concurrent signal asg passed -- NEED RESULT: ARCH00363.P3: Multi transport transactions occurred on concurrent signal asg passed -- NEED RESULT: ARCH00363: One transport transaction occurred on a concurrent signal asg passed -- NEED RESULT: ARCH00363: Old transactions were removed on a concurrent signal asg passed -- NEED RESULT: ARCH00363: One transport transaction occurred on a concurrent signal asg passed -- NEED RESULT: ARCH00363: Old transactions were removed on a concurrent signal asg passed -- NEED RESULT: ARCH00363: One transport transaction occurred on a concurrent signal asg passed -- NEED RESULT: ARCH00363: Old transactions were removed on a concurrent signal asg passed -- NEED RESULT: P3: Transport transactions completed entirely passed -- NEED RESULT: P2: Transport transactions completed entirely passed -- NEED RESULT: P1: Transport transactions completed entirely passed ------------------------------------------------------------------------------- -- -- Copyright (c) 1989 by Intermetrics, Inc. -- All rights reserved. -- ------------------------------------------------------------------------------- -- -- TEST NAME: -- -- CT00363 -- -- AUTHOR: -- -- G. Tominovich -- -- TEST OBJECTIVES: -- -- 9.5 (2) -- 9.5.2 (1) -- -- DESIGN UNIT ORDERING: -- -- ENT00363(ARCH00363) -- ENT00363_Test_Bench(ARCH00363_Test_Bench) -- -- REVISION HISTORY: -- -- 30-JUL-1987 - initial revision -- -- NOTES: -- -- self-checking -- automatically generated -- use WORK.STANDARD_TYPES.all ; entity ENT00363 is end ENT00363 ; -- -- architecture ARCH00363 of ENT00363 is subtype chk_sig_type is integer range -1 to 100 ; signal chk_st_rec1_vector : chk_sig_type := -1 ; signal chk_st_rec2_vector : chk_sig_type := -1 ; signal chk_st_rec3_vector : chk_sig_type := -1 ; -- subtype chk_time_type is Time ; signal s_st_rec1_vector_savt : chk_time_type := 0 ns ; signal s_st_rec2_vector_savt : chk_time_type := 0 ns ; signal s_st_rec3_vector_savt : chk_time_type := 0 ns ; -- subtype chk_cnt_type is Integer ; signal s_st_rec1_vector_cnt : chk_cnt_type := 0 ; signal s_st_rec2_vector_cnt : chk_cnt_type := 0 ; signal s_st_rec3_vector_cnt : chk_cnt_type := 0 ; -- type select_type is range 1 to 3 ; signal st_rec1_vector_select : select_type := 1 ; signal st_rec2_vector_select : select_type := 1 ; signal st_rec3_vector_select : select_type := 1 ; -- signal s_st_rec1_vector : st_rec1_vector := c_st_rec1_vector_1 ; signal s_st_rec2_vector : st_rec2_vector := c_st_rec2_vector_1 ; signal s_st_rec3_vector : st_rec3_vector := c_st_rec3_vector_1 ; -- begin CHG1 : process ( s_st_rec1_vector ) variable correct : boolean ; begin case s_st_rec1_vector_cnt is when 0 => null ; -- s_st_rec1_vector(lowb).f2 <= transport -- c_st_rec1_vector_2(lowb).f2 after 10 ns, -- c_st_rec1_vector_1(lowb).f2 after 20 ns ; -- when 1 => correct := s_st_rec1_vector(lowb).f2 = c_st_rec1_vector_2(lowb).f2 and (s_st_rec1_vector_savt + 10 ns) = Std.Standard.Now ; -- when 2 => correct := correct and s_st_rec1_vector(lowb).f2 = c_st_rec1_vector_1(lowb).f2 and (s_st_rec1_vector_savt + 10 ns) = Std.Standard.Now ; test_report ( "ARCH00363.P1" , "Multi transport transactions occurred on " & "concurrent signal asg", correct ) ; -- st_rec1_vector_select <= transport 2 ; -- s_st_rec1_vector(lowb).f2 <= transport -- c_st_rec1_vector_2(lowb).f2 after 10 ns , -- c_st_rec1_vector_1(lowb).f2 after 20 ns , -- c_st_rec1_vector_2(lowb).f2 after 30 ns , -- c_st_rec1_vector_1(lowb).f2 after 40 ns ; -- when 3 => correct := s_st_rec1_vector(lowb).f2 = c_st_rec1_vector_2(lowb).f2 and (s_st_rec1_vector_savt + 10 ns) = Std.Standard.Now ; st_rec1_vector_select <= transport 3 ; -- s_st_rec1_vector(lowb).f2 <= transport -- c_st_rec1_vector_1(lowb).f2 after 5 ns ; -- when 4 => correct := correct and s_st_rec1_vector(lowb).f2 = c_st_rec1_vector_1(lowb).f2 and (s_st_rec1_vector_savt + 5 ns) = Std.Standard.Now ; test_report ( "ARCH00363" , "One transport transaction occurred on a " & "concurrent signal asg", correct ) ; test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", correct ) ; -- when others => -- No more transactions should have occurred test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", false ) ; -- end case ; -- s_st_rec1_vector_savt <= transport Std.Standard.Now ; chk_st_rec1_vector <= transport s_st_rec1_vector_cnt after (1 us - Std.Standard.Now) ; s_st_rec1_vector_cnt <= transport s_st_rec1_vector_cnt + 1 ; -- end process CHG1 ; -- PGEN_CHKP_1 : process ( chk_st_rec1_vector ) begin if Std.Standard.Now > 0 ns then test_report ( "P1" , "Transport transactions completed entirely", chk_st_rec1_vector = 4 ) ; end if ; end process PGEN_CHKP_1 ; -- -- with st_rec1_vector_select select s_st_rec1_vector(lowb).f2 <= transport c_st_rec1_vector_2(lowb).f2 after 10 ns, c_st_rec1_vector_1(lowb).f2 after 20 ns when 1, -- c_st_rec1_vector_2(lowb).f2 after 10 ns , c_st_rec1_vector_1(lowb).f2 after 20 ns , c_st_rec1_vector_2(lowb).f2 after 30 ns , c_st_rec1_vector_1(lowb).f2 after 40 ns when 2, -- c_st_rec1_vector_1(lowb).f2 after 5 ns when 3 ; -- CHG2 : process ( s_st_rec2_vector ) variable correct : boolean ; begin case s_st_rec2_vector_cnt is when 0 => null ; -- s_st_rec2_vector(lowb).f2 <= transport -- c_st_rec2_vector_2(lowb).f2 after 10 ns, -- c_st_rec2_vector_1(lowb).f2 after 20 ns ; -- when 1 => correct := s_st_rec2_vector(lowb).f2 = c_st_rec2_vector_2(lowb).f2 and (s_st_rec2_vector_savt + 10 ns) = Std.Standard.Now ; -- when 2 => correct := correct and s_st_rec2_vector(lowb).f2 = c_st_rec2_vector_1(lowb).f2 and (s_st_rec2_vector_savt + 10 ns) = Std.Standard.Now ; test_report ( "ARCH00363.P2" , "Multi transport transactions occurred on " & "concurrent signal asg", correct ) ; -- st_rec2_vector_select <= transport 2 ; -- s_st_rec2_vector(lowb).f2 <= transport -- c_st_rec2_vector_2(lowb).f2 after 10 ns , -- c_st_rec2_vector_1(lowb).f2 after 20 ns , -- c_st_rec2_vector_2(lowb).f2 after 30 ns , -- c_st_rec2_vector_1(lowb).f2 after 40 ns ; -- when 3 => correct := s_st_rec2_vector(lowb).f2 = c_st_rec2_vector_2(lowb).f2 and (s_st_rec2_vector_savt + 10 ns) = Std.Standard.Now ; st_rec2_vector_select <= transport 3 ; -- s_st_rec2_vector(lowb).f2 <= transport -- c_st_rec2_vector_1(lowb).f2 after 5 ns ; -- when 4 => correct := correct and s_st_rec2_vector(lowb).f2 = c_st_rec2_vector_1(lowb).f2 and (s_st_rec2_vector_savt + 5 ns) = Std.Standard.Now ; test_report ( "ARCH00363" , "One transport transaction occurred on a " & "concurrent signal asg", correct ) ; test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", correct ) ; -- when others => -- No more transactions should have occurred test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", false ) ; -- end case ; -- s_st_rec2_vector_savt <= transport Std.Standard.Now ; chk_st_rec2_vector <= transport s_st_rec2_vector_cnt after (1 us - Std.Standard.Now) ; s_st_rec2_vector_cnt <= transport s_st_rec2_vector_cnt + 1 ; -- end process CHG2 ; -- PGEN_CHKP_2 : process ( chk_st_rec2_vector ) begin if Std.Standard.Now > 0 ns then test_report ( "P2" , "Transport transactions completed entirely", chk_st_rec2_vector = 4 ) ; end if ; end process PGEN_CHKP_2 ; -- -- with st_rec2_vector_select select s_st_rec2_vector(lowb).f2 <= transport c_st_rec2_vector_2(lowb).f2 after 10 ns, c_st_rec2_vector_1(lowb).f2 after 20 ns when 1, -- c_st_rec2_vector_2(lowb).f2 after 10 ns , c_st_rec2_vector_1(lowb).f2 after 20 ns , c_st_rec2_vector_2(lowb).f2 after 30 ns , c_st_rec2_vector_1(lowb).f2 after 40 ns when 2, -- c_st_rec2_vector_1(lowb).f2 after 5 ns when 3 ; -- CHG3 : process ( s_st_rec3_vector ) variable correct : boolean ; begin case s_st_rec3_vector_cnt is when 0 => null ; -- s_st_rec3_vector(highb).f3 <= transport -- c_st_rec3_vector_2(highb).f3 after 10 ns, -- c_st_rec3_vector_1(highb).f3 after 20 ns ; -- when 1 => correct := s_st_rec3_vector(highb).f3 = c_st_rec3_vector_2(highb).f3 and (s_st_rec3_vector_savt + 10 ns) = Std.Standard.Now ; -- when 2 => correct := correct and s_st_rec3_vector(highb).f3 = c_st_rec3_vector_1(highb).f3 and (s_st_rec3_vector_savt + 10 ns) = Std.Standard.Now ; test_report ( "ARCH00363.P3" , "Multi transport transactions occurred on " & "concurrent signal asg", correct ) ; -- st_rec3_vector_select <= transport 2 ; -- s_st_rec3_vector(highb).f3 <= transport -- c_st_rec3_vector_2(highb).f3 after 10 ns , -- c_st_rec3_vector_1(highb).f3 after 20 ns , -- c_st_rec3_vector_2(highb).f3 after 30 ns , -- c_st_rec3_vector_1(highb).f3 after 40 ns ; -- when 3 => correct := s_st_rec3_vector(highb).f3 = c_st_rec3_vector_2(highb).f3 and (s_st_rec3_vector_savt + 10 ns) = Std.Standard.Now ; st_rec3_vector_select <= transport 3 ; -- s_st_rec3_vector(highb).f3 <= transport -- c_st_rec3_vector_1(highb).f3 after 5 ns ; -- when 4 => correct := correct and s_st_rec3_vector(highb).f3 = c_st_rec3_vector_1(highb).f3 and (s_st_rec3_vector_savt + 5 ns) = Std.Standard.Now ; test_report ( "ARCH00363" , "One transport transaction occurred on a " & "concurrent signal asg", correct ) ; test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", correct ) ; -- when others => -- No more transactions should have occurred test_report ( "ARCH00363" , "Old transactions were removed on a " & "concurrent signal asg", false ) ; -- end case ; -- s_st_rec3_vector_savt <= transport Std.Standard.Now ; chk_st_rec3_vector <= transport s_st_rec3_vector_cnt after (1 us - Std.Standard.Now) ; s_st_rec3_vector_cnt <= transport s_st_rec3_vector_cnt + 1 ; -- end process CHG3 ; -- PGEN_CHKP_3 : process ( chk_st_rec3_vector ) begin if Std.Standard.Now > 0 ns then test_report ( "P3" , "Transport transactions completed entirely", chk_st_rec3_vector = 4 ) ; end if ; end process PGEN_CHKP_3 ; -- -- with st_rec3_vector_select select s_st_rec3_vector(highb).f3 <= transport c_st_rec3_vector_2(highb).f3 after 10 ns, c_st_rec3_vector_1(highb).f3 after 20 ns when 1, -- c_st_rec3_vector_2(highb).f3 after 10 ns , c_st_rec3_vector_1(highb).f3 after 20 ns , c_st_rec3_vector_2(highb).f3 after 30 ns , c_st_rec3_vector_1(highb).f3 after 40 ns when 2, -- c_st_rec3_vector_1(highb).f3 after 5 ns when 3 ; -- end ARCH00363 ; -- -- use WORK.STANDARD_TYPES.all ; entity ENT00363_Test_Bench is end ENT00363_Test_Bench ; -- -- architecture ARCH00363_Test_Bench of ENT00363_Test_Bench is begin L1: block component UUT end component ; -- for CIS1 : UUT use entity WORK.ENT00363 ( ARCH00363 ) ; begin CIS1 : UUT ; end block L1 ; end ARCH00363_Test_Bench ;
entity arith1 is end entity; architecture test of arith1 is begin process is variable x, y : integer; begin x := 3; y := 12; wait for 1 ns; assert x + y = 15; assert x - y = -9; assert x * y = 36; assert x / 12 = 0; assert x = 3; assert y = 12; assert x /= y; assert x < y; assert y > x; assert x <= y; assert y >= x; assert (- x) = -3; assert x ** y = 531441; x := -34; assert abs x = 34; assert abs y = 12; assert 5 mod x = 2; assert 5 rem x = 2; assert (-5) rem x = -2; assert (-5) mod x = 2; assert x = +x; wait; end process; end architecture;
-- i2c_slave_tb.vhd -- -- Created on: 08 Jun 2017 -- Author: Fabian Meyer library ieee; use ieee.std_logic_1164.all; entity i2c_slave_read_tb is end entity; architecture behavior of i2c_slave_read_tb is -- Component Declaration for the Unit Under Test (UUT) component i2c_slave generic(RSTDEF: std_logic := '0'; ADDRDEF: std_logic_vector(6 downto 0) := "0100000"); port(rst: in std_logic; -- reset, RSTDEF active clk: in std_logic; -- clock, rising edge tx_data: in std_logic_vector(7 downto 0); -- tx, data to send tx_sent: out std_logic; -- tx was sent, high active rx_data: out std_logic_vector(7 downto 0); -- rx, data received rx_recv: out std_logic; -- rx received, high active busy: out std_logic; -- busy, high active sda: inout std_logic; -- serial data of I2C scl: inout std_logic); -- serial clock of I2C end component; --Inputs signal rst: std_logic := '0'; signal clk: std_logic := '0'; signal tx_data: std_logic_vector(7 downto 0) := (others => '0'); --BiDirs signal sda: std_logic := '1'; signal scl: std_logic := '1'; --Outputs signal tx_sent: std_logic; signal rx_data: std_logic_vector(7 downto 0); signal rx_recv: std_logic; signal busy: std_logic; -- Clock period definitions constant clk_period: time := 10 ns; begin -- Instantiate the Unit Under Test (UUT) uut: i2c_slave generic map(RSTDEF => '0', ADDRDEF => "0010111") -- address 0x17 port map(rst => rst, clk => clk, tx_data => tx_data, tx_sent => tx_sent, rx_data => rx_data, rx_recv => rx_recv, busy => busy, sda => sda, scl => scl); -- 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 -- sends a single bit over I2C procedure send_bit(tosend: std_logic) is begin scl <= '0'; sda <= tosend; -- wait for delay element to take over new value wait for 24*clk_period; -- allow slave to read scl <= '1'; wait for clk_period; end procedure; -- receive a single bit over I2C procedure recv_bit is begin scl <= '0'; sda <= 'Z'; wait for clk_period; scl <= '1'; wait for clk_period; end procedure; -- sends start / repeated start condition over I2C procedure send_start is begin send_bit('1'); -- rise sda without changing clk sda <= '0'; wait for 25*clk_period; end procedure; -- sends stop condition over I2C procedure send_stop is begin send_bit('0'); -- rise sda without changing clk sda <= '1'; wait for 25*clk_period; end procedure; -- wait for an ack from slave over I2C procedure wait_ack is begin send_bit('Z'); -- wait additional cycle for slave to release SDA again scl <= '0'; wait for clk_period; end procedure; -- send ack to slave procedure send_ack is begin send_bit('0'); end procedure; -- send nack to slave procedure send_nack is begin send_bit('1'); end procedure; begin -- hold reset state for 100 ns. wait for clk_period*10; rst <= '1'; -- init transmission send_start; -- send correct address send_bit('0'); -- address bit 1 send_bit('0'); -- address bit 2 send_bit('1'); -- address bit 3 send_bit('0'); -- address bit 4 send_bit('1'); -- address bit 5 send_bit('1'); -- address bit 6 send_bit('1'); -- address bit 7 send_bit('1'); -- direction bit -- set data which should be transmitted to master tx_data <= "Z00ZZ00Z"; -- receive acknowledge wait_ack; -- recv data -- should match tx_data from above recv_bit; -- data bit 1 recv_bit; -- data bit 2 recv_bit; -- data bit 3 recv_bit; -- data bit 4 recv_bit; -- data bit 5 recv_bit; -- data bit 6 recv_bit; -- data bit 7 recv_bit; -- data bit 8 -- send acknowledge of first byte to slave send_ack; -- set another byte to send to master tx_data <= "Z0Z00ZZZ"; -- recv data -- should match tx_data from above recv_bit; -- data bit 1 recv_bit; -- data bit 2 recv_bit; -- data bit 3 recv_bit; -- data bit 4 recv_bit; -- data bit 5 recv_bit; -- data bit 6 recv_bit; -- data bit 7 recv_bit; -- data bit 8 -- send acknowledge of second byte to slave send_ack; -- send repeated start condition -- with new address send_start; -- send wrong address -- slave should go into idle mode send_bit('1'); -- address bit 1 send_bit('0'); -- address bit 2 send_bit('1'); -- address bit 3 send_bit('0'); -- address bit 4 send_bit('1'); -- address bit 5 send_bit('1'); -- address bit 6 send_bit('1'); -- address bit 7 send_bit('1'); -- direction bit -- recv data -- slave should not send anything recv_bit; -- data bit 1 recv_bit; -- data bit 2 recv_bit; -- data bit 3 recv_bit; -- data bit 4 recv_bit; -- data bit 5 recv_bit; -- data bit 6 recv_bit; -- data bit 7 recv_bit; -- data bit 8 -- send nack to slave send_nack; -- terminate transmission send_stop; wait; end process; end;
package fifo_pkg is end package fifo_pkg; package fifo_pkg is end fifo_pkg; package fifo_pkg is end;
-- ------------------------------------------------------------- -- -- Generated Configuration for pad_pads_e -- -- Generated -- by: wig -- on: Thu Nov 6 15:58:21 2003 -- cmd: H:\work\mix\mix_0.pl -nodelta ..\..\padio.xls -- -- !!! Do not edit this file! Autogenerated by MIX !!! -- $Author: wig $ -- $Id: pad_pads_e-conf-c.vhd,v 1.1 2004/04/06 10:44:26 wig Exp $ -- $Date: 2004/04/06 10:44:26 $ -- $Log: pad_pads_e-conf-c.vhd,v $ -- Revision 1.1 2004/04/06 10:44:26 wig -- Adding result/padio -- -- -- Based on Mix Entity Template built into RCSfile: MixWriter.pm,v -- Id: MixWriter.pm,v 1.31 2003/10/23 12:13:17 wig Exp -- -- Generator: mix_0.pl Version: Revision: 1.17 , [email protected] -- (C) 2003 Micronas GmbH -- -- -------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; -- No project specific VHDL libraries/conf -- -- Start of Generated Configuration pad_pads_e_conf / pad_pads_e -- configuration pad_pads_e_conf of pad_pads_e is for rtl -- Generated Configuration for data_10_pad : w_data3 use configuration work.w_data3_conf; end for; for data_9_pad : w_data2 use configuration work.w_data2_conf; end for; for data_i1_pad : w_pad_i use configuration work.w_pad_i_conf; end for; for data_i33_pad : w_pad_i use configuration work.w_pad_i_conf; end for; for data_i34_pad : w_pad_i use configuration work.w_pad_i_conf; end for; for data_o1_pad : w_pad_o use configuration work.w_pad_o_conf; end for; for data_o35_pad : w_pad_o use configuration work.w_pad_o_conf; end for; for data_o36_pad : w_pad_o use configuration work.w_pad_o_conf; end for; for disp_10_pad : w_disp use configuration work.w_disp_conf; end for; for disp_2_pad : w_disp use configuration work.w_disp_conf; end for; for disp_3_pad : w_disp use configuration work.w_disp_conf; end for; for disp_4_pad : w_disp use configuration work.w_disp_conf; end for; for disp_5_pad : w_disp use configuration work.w_disp_conf; end for; for disp_6_pad : w_disp use configuration work.w_disp_conf; end for; for disp_7_pad : w_disp use configuration work.w_disp_conf; end for; for disp_8_pad : w_disp use configuration work.w_disp_conf; end for; for disp_9_pad : w_disp use configuration work.w_disp_conf; end for; for osc_1_pad : w_osc use configuration work.w_osc_conf; end for; for osc_2_pad : w_osc use configuration work.w_osc_conf; end for; for osc_3_pad : w_osc use configuration work.w_osc_conf; end for; for pad_dire_pad : w_pad_dire use configuration work.w_pad_dire_conf; end for; for pad_dirli_pad : w_pad_dir use configuration work.w_pad_dir_conf; end for; end for; end pad_pads_e_conf; -- -- End of Generated Configuration pad_pads_e_conf -- -- --!End of Configuration/ies -- --------------------------------------------------------------
-- -*- vhdl -*- ------------------------------------------------------------------------------- -- Copyright (c) 2012, The CARPE Project, All rights reserved. -- -- See the AUTHORS file for individual contributors. -- -- -- -- Copyright and related rights are licensed under the Solderpad -- -- Hardware License, Version 0.51 (the "License"); you may not use this -- -- file except in compliance with the License. You may obtain a copy of -- -- the License at http://solderpad.org/licenses/SHL-0.51. -- -- -- -- Unless required by applicable law or agreed to in writing, software, -- -- hardware and materials distributed under this License is distributed -- -- on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -- -- either express or implied. See the License for the specific language -- -- governing permissions and limitations under the License. -- ------------------------------------------------------------------------------- -- Dummy Cache Replacement Algorithm for Direct-Mapped Caches library ieee; use ieee.std_logic_1164.all; use work.cpu_btb_cache_replace_none_pkg.all; entity cpu_btb_cache_replace_none is port ( clk : in std_ulogic; rstn : in std_ulogic; cpu_btb_cache_replace_none_ctrl_in : in cpu_btb_cache_replace_none_ctrl_in_type; cpu_btb_cache_replace_none_dp_in : in cpu_btb_cache_replace_none_dp_in_type; cpu_btb_cache_replace_none_dp_out : out cpu_btb_cache_replace_none_dp_out_type ); end;
-------------------------------------------------------------------------------- -- This file is owned and controlled by Xilinx and must be used solely -- -- for design, simulation, implementation and creation of design files -- -- limited to Xilinx devices or technologies. Use with non-Xilinx -- -- devices or technologies is expressly prohibited and immediately -- -- terminates your license. -- -- -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY -- -- FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY -- -- PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -- -- IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS -- -- MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY -- -- CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY -- -- RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY -- -- DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE -- -- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR -- -- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF -- -- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE. -- -- -- -- Xilinx products are not intended for use in life support appliances, -- -- devices, or systems. Use in such applications are expressly -- -- prohibited. -- -- -- -- (c) Copyright 1995-2013 Xilinx, Inc. -- -- All rights reserved. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- You must compile the wrapper file blk_mem_gen_v7_3.vhd when simulating -- the core, blk_mem_gen_v7_3. When compiling the wrapper file, be sure to -- reference the XilinxCoreLib VHDL simulation library. For detailed -- instructions, please refer to the "CORE Generator Help". -- The synthesis directives "translate_off/translate_on" specified -- below are supported by Xilinx, Mentor Graphics and Synplicity -- synthesis tools. Ensure they are correct for your synthesis tool(s). LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- synthesis translate_off LIBRARY XilinxCoreLib; -- synthesis translate_on ENTITY blk_mem_gen_v7_3 IS PORT ( clka : IN STD_LOGIC; wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0); addra : IN STD_LOGIC_VECTOR(3 DOWNTO 0); dina : IN STD_LOGIC_VECTOR(15 DOWNTO 0); douta : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ); END blk_mem_gen_v7_3; ARCHITECTURE blk_mem_gen_v7_3_a OF blk_mem_gen_v7_3 IS -- synthesis translate_off COMPONENT wrapped_blk_mem_gen_v7_3 PORT ( clka : IN STD_LOGIC; wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0); addra : IN STD_LOGIC_VECTOR(3 DOWNTO 0); dina : IN STD_LOGIC_VECTOR(15 DOWNTO 0); douta : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ); END COMPONENT; -- Configuration specification FOR ALL : wrapped_blk_mem_gen_v7_3 USE ENTITY XilinxCoreLib.blk_mem_gen_v7_3(behavioral) GENERIC MAP ( c_addra_width => 4, c_addrb_width => 4, c_algorithm => 1, c_axi_id_width => 4, c_axi_slave_type => 0, c_axi_type => 1, c_byte_size => 9, c_common_clk => 0, c_default_data => "0", c_disable_warn_bhv_coll => 0, c_disable_warn_bhv_range => 0, c_enable_32bit_address => 0, c_family => "spartan3", c_has_axi_id => 0, c_has_ena => 0, c_has_enb => 0, c_has_injecterr => 0, 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_has_regcea => 0, c_has_regceb => 0, c_has_rsta => 0, c_has_rstb => 0, c_has_softecc_input_regs_a => 0, c_has_softecc_output_regs_b => 0, c_init_file => "BlankString", c_init_file_name => "no_coe_file_loaded", c_inita_val => "0", c_initb_val => "0", c_interface_type => 0, c_load_init_file => 0, c_mem_type => 0, c_mux_pipeline_stages => 0, c_prim_type => 1, c_read_depth_a => 16, c_read_depth_b => 16, c_read_width_a => 16, c_read_width_b => 16, c_rst_priority_a => "CE", c_rst_priority_b => "CE", c_rst_type => "SYNC", c_rstram_a => 0, c_rstram_b => 0, c_sim_collision_check => "ALL", c_use_bram_block => 0, c_use_byte_wea => 0, c_use_byte_web => 0, c_use_default_data => 0, c_use_ecc => 0, c_use_softecc => 0, c_wea_width => 1, c_web_width => 1, c_write_depth_a => 16, c_write_depth_b => 16, c_write_mode_a => "WRITE_FIRST", c_write_mode_b => "WRITE_FIRST", c_write_width_a => 16, c_write_width_b => 16, c_xdevicefamily => "spartan3e" ); -- synthesis translate_on BEGIN -- synthesis translate_off U0 : wrapped_blk_mem_gen_v7_3 PORT MAP ( clka => clka, wea => wea, addra => addra, dina => dina, douta => douta ); -- synthesis translate_on END blk_mem_gen_v7_3_a;
-------------------------------------------------------------------------------- -- This file is owned and controlled by Xilinx and must be used solely -- -- for design, simulation, implementation and creation of design files -- -- limited to Xilinx devices or technologies. Use with non-Xilinx -- -- devices or technologies is expressly prohibited and immediately -- -- terminates your license. -- -- -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY -- -- FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY -- -- PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -- -- IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS -- -- MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY -- -- CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY -- -- RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY -- -- DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE -- -- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR -- -- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF -- -- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE. -- -- -- -- Xilinx products are not intended for use in life support appliances, -- -- devices, or systems. Use in such applications are expressly -- -- prohibited. -- -- -- -- (c) Copyright 1995-2013 Xilinx, Inc. -- -- All rights reserved. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- You must compile the wrapper file blk_mem_gen_v7_3.vhd when simulating -- the core, blk_mem_gen_v7_3. When compiling the wrapper file, be sure to -- reference the XilinxCoreLib VHDL simulation library. For detailed -- instructions, please refer to the "CORE Generator Help". -- The synthesis directives "translate_off/translate_on" specified -- below are supported by Xilinx, Mentor Graphics and Synplicity -- synthesis tools. Ensure they are correct for your synthesis tool(s). LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- synthesis translate_off LIBRARY XilinxCoreLib; -- synthesis translate_on ENTITY blk_mem_gen_v7_3 IS PORT ( clka : IN STD_LOGIC; wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0); addra : IN STD_LOGIC_VECTOR(3 DOWNTO 0); dina : IN STD_LOGIC_VECTOR(15 DOWNTO 0); douta : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ); END blk_mem_gen_v7_3; ARCHITECTURE blk_mem_gen_v7_3_a OF blk_mem_gen_v7_3 IS -- synthesis translate_off COMPONENT wrapped_blk_mem_gen_v7_3 PORT ( clka : IN STD_LOGIC; wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0); addra : IN STD_LOGIC_VECTOR(3 DOWNTO 0); dina : IN STD_LOGIC_VECTOR(15 DOWNTO 0); douta : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ); END COMPONENT; -- Configuration specification FOR ALL : wrapped_blk_mem_gen_v7_3 USE ENTITY XilinxCoreLib.blk_mem_gen_v7_3(behavioral) GENERIC MAP ( c_addra_width => 4, c_addrb_width => 4, c_algorithm => 1, c_axi_id_width => 4, c_axi_slave_type => 0, c_axi_type => 1, c_byte_size => 9, c_common_clk => 0, c_default_data => "0", c_disable_warn_bhv_coll => 0, c_disable_warn_bhv_range => 0, c_enable_32bit_address => 0, c_family => "spartan3", c_has_axi_id => 0, c_has_ena => 0, c_has_enb => 0, c_has_injecterr => 0, 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_has_regcea => 0, c_has_regceb => 0, c_has_rsta => 0, c_has_rstb => 0, c_has_softecc_input_regs_a => 0, c_has_softecc_output_regs_b => 0, c_init_file => "BlankString", c_init_file_name => "no_coe_file_loaded", c_inita_val => "0", c_initb_val => "0", c_interface_type => 0, c_load_init_file => 0, c_mem_type => 0, c_mux_pipeline_stages => 0, c_prim_type => 1, c_read_depth_a => 16, c_read_depth_b => 16, c_read_width_a => 16, c_read_width_b => 16, c_rst_priority_a => "CE", c_rst_priority_b => "CE", c_rst_type => "SYNC", c_rstram_a => 0, c_rstram_b => 0, c_sim_collision_check => "ALL", c_use_bram_block => 0, c_use_byte_wea => 0, c_use_byte_web => 0, c_use_default_data => 0, c_use_ecc => 0, c_use_softecc => 0, c_wea_width => 1, c_web_width => 1, c_write_depth_a => 16, c_write_depth_b => 16, c_write_mode_a => "WRITE_FIRST", c_write_mode_b => "WRITE_FIRST", c_write_width_a => 16, c_write_width_b => 16, c_xdevicefamily => "spartan3e" ); -- synthesis translate_on BEGIN -- synthesis translate_off U0 : wrapped_blk_mem_gen_v7_3 PORT MAP ( clka => clka, wea => wea, addra => addra, dina => dina, douta => douta ); -- synthesis translate_on END blk_mem_gen_v7_3_a;
library ieee; use ieee.std_logic_1164.all; entity arbiter is generic( param_A : integer := 32; param_B : integer := 4 ); port( portA, portA1 : in std_logic_vector(param_A - 1 downto 0); portB, portB1 : in std_logic_vector((param_A - 1) downto 0); portC, portC1 : in std_logic_vector((param_A / 8) - 1 downto 0); portD, portD1 : in std_logic_vector(13 * (param_A / 8) - 1 downto 0); portE, portE1 : in std_logic_vector(param_B * (param_A / 8) - 1 downto 0); portF, portF1 : in std_logic_vector(param_B * param_A - 1 downto 0); portG, portG1 : in std_logic_vector(param_B * (param_A - 4) - 1 downto 0); portH : out std_logic ); end entity;
library ieee; use ieee.numeric_std.all; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; ------------------------------------------------------------------------------------- -- -- -- Definition of Ports -- FSL_Clk : Synchronous clock -- FSL_Rst : System reset, should always come from FSL bus -- FSL_S_Clk : Slave asynchronous clock -- FSL_S_Read : Read signal, requiring next available input to be read -- FSL_S_Data : Input data -- FSL_S_CONTROL : Control Bit, indicating the input data are control word -- FSL_S_Exists : Data Exist Bit, indicating data exist in the input FSL bus -- FSL_M_Clk : Master asynchronous clock -- FSL_M_Write : Write signal, enabling writing to output FSL bus -- FSL_M_Data : Output data -- FSL_M_Control : Control Bit, indicating the output data are contol word -- FSL_M_Full : Full Bit, indicating output FSL bus is full -- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------ -- Entity Section ------------------------------------------------------------------------------ entity hw_acc_idea is port ( -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol ports, do not add or delete. Clk : in std_logic; RST : in std_logic; BRAM_A_addr : out std_logic_vector(0 to (32 - 1)); BRAM_A_dIN : in std_logic_vector(0 to (32 - 1)); BRAM_A_dOUT : out std_logic_vector(0 to (32 - 1)); BRAM_A_en : out std_logic; BRAM_A_wEN : out std_logic_vector(0 to (32/8) -1); ------------------------------------------------------ BRAM_B_dIN : in std_logic_vector(0 to (32 - 1)) ; BRAM_B_addr : out std_logic_vector(0 to (32 - 1)) ; BRAM_B_dOUT : out std_logic_vector(0 to (32 - 1)) ; BRAM_B_en : out std_logic ; BRAM_B_wEN : out std_logic_vector(0 to (32/8) -1); BRAM_C_dIN : in std_logic_vector(0 to (32 - 1)) ; BRAM_C_addr : out std_logic_vector(0 to (32 - 1)) ; BRAM_C_dOUT : out std_logic_vector(0 to (32 - 1)) ; BRAM_C_en : out std_logic ; BRAM_C_wEN : out std_logic_vector(0 to (32/8) -1); ------------------------------------------------------ FSL0_S_Read : out std_logic; FSL0_S_Data : in std_logic_vector(0 to 31); FSL0_S_Exists : in std_logic; ------------------------------------------------------ FSL0_M_Write : out std_logic; FSL0_M_Data : out std_logic_vector(0 to 31); FSL0_M_Full : in std_logic; --This is just used for reseting FSL1_S_Read : out std_logic; FSL1_S_Data : in std_logic_vector(0 to 31); FSL1_S_Exists : in std_logic -- DO NOT EDIT ABOVE THIS LINE --------------------- ); end hw_acc_idea; -- ************************* -- Architecture Definition -- ************************* architecture IMPLEMENTATION of hw_acc_idea is component idea_chan is generic( G_ADDR_WIDTH : integer := 32; G_DATA_WIDTH : integer := 32 ); port ( Vector_A_addr0 : out std_logic_vector(0 to (G_ADDR_WIDTH - 1)); Vector_A_dIN0 : out std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_A_dOUT0 : in std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_A_rENA0 : out std_logic; Vector_A_wENA0 : out std_logic_vector(0 to (G_DATA_WIDTH/8) -1); Vector_B_addr0 : out std_logic_vector(0 to (G_ADDR_WIDTH - 1)); Vector_B_dIN0 : out std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_B_dOUT0 : in std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_B_rENA0 : out std_logic; Vector_B_wENA0 : out std_logic_vector(0 to (G_DATA_WIDTH/8) -1); Vector_C_addr0 : out std_logic_vector(0 to (G_ADDR_WIDTH - 1)); Vector_C_dIN0 : out std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_C_dOUT0 : in std_logic_vector(0 to (G_DATA_WIDTH - 1)); Vector_C_rENA0 : out std_logic; Vector_C_wENA0 : out std_logic_vector(0 to (G_DATA_WIDTH/8) -1); chan1_channelDataIn : out std_logic_vector(0 to (32 - 1)); chan1_channelDataOut : in std_logic_vector(0 to (32 - 1)); chan1_exists : in std_logic; chan1_full : in std_logic; chan1_channelRead : out std_logic; chan1_channelWrite : out std_logic; clock_sig : in std_logic; reset_sig : in std_logic ); end component; signal reset_sig : std_logic; -- Architecture Section begin reset_sig <= RST or FSL1_S_Exists; FSL1_S_read <= FSL1_S_Exists ; uut : idea_chan port map ( Vector_A_addr0 => BRAM_A_addr, Vector_A_dIN0 => BRAM_A_dOUT, Vector_A_dOUT0 => BRAM_A_dIN, Vector_A_rENA0 => BRAM_A_en, Vector_A_wENA0 => BRAM_A_wEN, Vector_B_addr0 => BRAM_B_addr, Vector_B_dIN0 => BRAM_B_dOUT, Vector_B_dOUT0 => BRAM_B_dIN, Vector_B_rENA0 => BRAM_B_en, Vector_B_wENA0 => BRAM_B_wEN, Vector_C_addr0 => BRAM_C_addr, Vector_C_dIN0 => BRAM_C_dOUT, Vector_C_dOUT0 => BRAM_C_dIN, Vector_C_rENA0 => BRAM_C_en, Vector_C_wENA0 => BRAM_C_wEN, chan1_channelDataIn => FSL0_M_Data, chan1_channelDataOut => FSL0_S_Data, chan1_exists => FSL0_S_Exists, chan1_full => FSL0_M_Full, chan1_channelRead => FSL0_S_Read, chan1_channelWrite => FSL0_M_Write, clock_sig => Clk, reset_sig => reset_sig ); end architecture implementation;
---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 03/09/2017 12:40:24 PM -- Design Name: -- Module Name: top_level - 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; 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 top_level is port( iCLK : in std_logic; --iPCsel : in std_logic_vector(1 downto 0); -- testing iPCsel : in std_logic; iEOC : in std_logic; SW : in std_logic; --idata_valid : in std_logic; -- testing iReset : in std_logic; -- BTNC inData0 : in std_logic; -- PIN D14 JB[1] inData1 : in std_logic; -- PIN F16 JB[2] inData2 : in std_logic; -- PIN G16 JB[3] inData3 : in std_logic; -- PIN H14 JB[4] inData4 : in std_logic; -- PIN E16 JB[5] inData5 : in std_logic; -- PIN F13 JB[6] inData6 : in std_logic; -- PIN G13 JB[7] inData7 : in std_logic; -- PIN H16 JB[8] --iadc_dataReady : in std_logic; -- PIN E17 JA[6] inStartOutput : in std_logic; oALE : out std_logic; sysPWMout : out std_logic_vector(0 downto 0); -- PIN K1 JC[1] sysPWM_nout : out std_logic_vector(0 downto 0); -- PIN F6 JC[2] oadc_select : out std_logic; -- PIN F18 JA[1] oadc_clock : out std_logic; -- PIN D18 JA[2] oadc_loadAddressStart : out std_logic; -- PIN E7 JA[3] oadc_outputEnable : out std_logic; -- PIN G17 JA[4] odata_valid : buffer std_logic; -- PIN D17 JA[5] otx_ready : out std_logic; -- PIN J2 JC[3] outData : out std_logic -- data to PC -- PIN G6 JC[4] ); end top_level; architecture Structural of top_level is --component basic_uart is -- port( -- clk: in std_logic; -- clock -- reset: in std_logic; -- reset -- -- Client interface -- rx_data: out std_logic_vector(7 downto 0); -- received byte -- rx_enable: out std_logic; -- validates received byte (1 system clock spike) -- tx_data: in std_logic_vector(7 downto 0); -- byte to send -- tx_enable: in std_logic; -- validates byte to send if tx_ready is '1' -- tx_ready: out std_logic; -- if '1', we can send a new byte, otherwise we won't take it -- -- Physical interface -- rx: in std_logic; -- tx: out std_logic -- ); --end component; component uart is port ( reset :in std_logic; txclk :in std_logic; ld_tx_data :in std_logic; tx_data :in std_logic_vector (7 downto 0); tx_enable :in std_logic; selCheck :in std_logic_vector(1 downto 0); tx_out :out std_logic; tx_empty :out std_logic; rxclk :in std_logic; uld_rx_data :in std_logic; rx_data :out std_logic_vector (7 downto 0); rx_enable :in std_logic; rx_in :in std_logic; rx_empty :out std_logic ); end component; --component ad_converter is -- port (from_adc : in std_logic_vector(7 downto 0); -- adc_dataReady, slow_clk, reset, enable : in std_logic; -- adc_select : out std_logic_vector(1 downto 0); -- adc_output00FL, adc_output01FR, adc_output10BL, adc_output11BR -- : out std_logic_vector(7 downto 0); -- adc_clock, adc_loadAddressStart, adc_outputEnable, data_valid -- : out std_logic); -- end component; component ADC_Controller is generic(samples : integer :=128); Port ( iclk : in STD_LOGIC; reset : in STD_LOGIC; EOC : in STD_LOGIC; oStart : out STD_LOGIC; ALE : out std_logic; oOE : out std_logic; sel : buffer std_logic := '0'; oWriteReady : buffer std_logic; oClk_en : out std_logic ); end component; --component PWM_Controller is -- port( -- iadc_sel : in std_logic; -- iSW : in std_logic; -- iData : in std_logic_vector(7 downto 0); -- --iData2 : in std_logic_vector(7 downto 0); -- oData : out std_logic_vector(7 downto 0) -- ); --end component; component RAM_Controller is generic( constant samples : integer := 128); Port ( clk11kHz : in STD_LOGIC; clk : in std_logic; clk500kHz : in STD_LOGIC; idata_valid : in std_logic; sel : in STD_LOGIC_vector(1 downto 0); ointernalCount : out std_logic; iadcsel : in std_logic; reset : in std_logic; ena1 : out std_logic; enb1 : out std_logic; ena2 : out std_logic; enb2 : out std_logic; wea : out std_logic_vector(0 downto 0); UARTen : out std_logic; ocount1 : out std_logic_vector(13 downto 0); ocount4 : out std_logic_vector(13 downto 0); ocount2 : out std_logic_vector(13 downto 0); ocount3 : out std_logic_vector(13 downto 0)); end component; component multiplex_UART is generic (data_width : positive := 8); port(select_line: in std_logic; in_a, in_b: in std_logic_vector(data_width-1 downto 0); --UARTen : out std_logic; output : out std_logic_vector(data_width-1 downto 0)); end component; component pwm IS GENERIC( sys_clk : INTEGER := 100_000_000; --system clock frequency in Hz pwm_freq : INTEGER := 500_000; --PWM switching frequency in Hz bits_resolution : INTEGER := 64; --bits of resolution setting the duty cycle phases : INTEGER := 1); --number of output pwms and phases PORT( clk : IN STD_LOGIC; --system clock reset_n : IN STD_LOGIC; --asynchronous reset ena : IN STD_LOGIC; --latches in new duty cycle duty : IN STD_LOGIC_VECTOR(bits_resolution-1 DOWNTO 0); --duty cycle pwm_out : OUT STD_LOGIC_VECTOR(phases-1 DOWNTO 0); --pwm outputs pwm_n_out : OUT STD_LOGIC_VECTOR(phases-1 DOWNTO 0)); --pwm inverse outputs END component; --component pwm_prog is --generic( -- N : integer := 8); -- number of bit of PWM counter --port ( -- i_clk : in std_logic; -- i_rstb : in std_logic; -- i_sync_reset : in std_logic; -- i_pwm_module : in std_logic_vector(N-1 downto 0); -- PWM Freq = clock freq/ (i_pwm_module+1); max value = 2^N-1 -- i_pwm_width : in std_logic_vector(N-1 downto 0); -- PWM width = (others=>0)=> OFF; i_pwm_module => MAX ON -- o_pwm : out std_logic); --end component; component clk1Mhz IS PORT ( SIGNAL samplingFreq : INOUT std_logic; signal baudRate : INOUT std_logic; signal rx_clk : inout std_logic; signal tx_clk : inout std_logic; SIGNAL iCLK : IN std_logic); END component; COMPONENT sig1dualRAM PORT ( clka : IN STD_LOGIC; ena : IN STD_LOGIC; wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0); addra : IN STD_LOGIC_VECTOR(13 DOWNTO 0); dina : IN STD_LOGIC_VECTOR(7 DOWNTO 0); clkb : IN STD_LOGIC; enb : IN STD_LOGIC; addrb : IN STD_LOGIC_VECTOR(13 DOWNTO 0); doutb : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END COMPONENT; component btn_debounce_toggle is GENERIC ( CONSTANT CNTR_MAX : std_logic_vector(15 downto 0) := X"FFFF"); Port ( BTN_I : in STD_LOGIC; CLK : in STD_LOGIC; BTN_O : out STD_LOGIC; TOGGLE_O : out STD_LOGIC); end component; -- component adc_parse is -- Port ( iData : in STD_LOGIC_vector(7 downto 0); -- oData1 : out STD_LOGIC_vector(7 downto 0); -- oData2 : out STD_LOGIC_vector(7 downto 0); -- iadc_sel : in STD_LOGIC); -- end component; signal rx_en: std_logic:= '1'; signal tx_en: std_logic:= '1'; signal txs: std_logic; signal rxs: std_logic; signal sreset_n: std_logic; signal Sreset: std_logic; --signal adc_1: std_logic_vector(7 downto 0); --signal adc_2: std_logic_vector(7 downto 0); --signal adc00: std_logic_vector(7 downto 0); --signal adc01: std_logic_vector(7 downto 0); --signal adc10: std_logic_vector(7 downto 0); --signal adc11: std_logic_vector(7 downto 0); signal rx_ld: std_logic; signal Sclk500kHZ: std_logic; signal Sclk11kHz: std_logic; signal RAMout1: std_logic_vector(7 downto 0); signal RAMout2: std_logic_vector(7 downto 0); signal RAMout3: std_logic_vector(7 downto 0); signal UARTdata: std_logic_vector(7 downto 0); signal RAMUARTen: std_logic; --signal MUXUARTen: std_logic; signal RAMena1: std_logic; signal RAMenb1: std_logic; signal RAMena2: std_logic; signal RAMenb2: std_logic; signal RAMwea: std_logic_vector(0 downto 0); signal RAMaddra1: std_logic_vector(13 downto 0); signal RAMaddra2: std_logic_vector(13 downto 0); signal RAMaddrb1: std_logic_vector(13 downto 0); signal RAMaddrb2: std_logic_vector(13 downto 0); signal inData : std_logic_vector(7 downto 0); signal PCsel : std_logic_vector(1 downto 0); signal rxSel : std_logic_vector(7 downto 0); signal stx_ready: std_logic:= '1'; signal adcsel : std_logic; signal adcsel_n : std_logic; signal Spwm_out : std_logic; signal Srx_clk : std_logic; signal Stx_clk : std_logic; signal data_valid : std_logic; signal RAM_count : std_logic; signal PWMdata : std_logic_vector(7 downto 0); signal sig1 : std_logic_vector(7 downto 0); signal sig2 : std_logic_vector(7 downto 0); begin --adc_1 <= adc00 or adc01; --adc_2 <= adc10 or adc11; RAMout3 <= RAMout1 or RAMout2; sreset_n <= not iReset; --inData <= inData0 & inData1 & inData2 & inData3 & inData4 & inData5 & inData6 & inData7; inData <= inData7 & inData6 & inData5 & inData4 & inData3 & inData2 & inData1 & inData0; PCsel <= rxSel(1 downto 0); oadc_select <= adcsel; adcsel_n <= not adcsel; --sysPWM_nout <= not(Spwm_out); --sysPWMout <= Spwm_out; odata_valid <= data_valid; rx_ld <= not(RAM_count) and rx_en; Inst_sys_clk: clk1Mhz port map( iCLK => iCLK, samplingFreq => Sclk500kHz, rx_clk => Srx_clk, tx_clk => Stx_clk, baudRate => Sclk11kHz ); Inst_ResetDeb: btn_debounce_toggle GENERIC map ( CNTR_MAX => X"FFFF") Port map ( BTN_I => iReset, CLK => iCLK, BTN_O => Sreset, TOGGLE_O => open ); --Inst_ADC_Parse: adc_parse -- Port map -- ( iData => inData, -- oData1 => sig1, -- oData2 => sig2, -- iadc_sel => adcsel -- ); --Inst_ADC: ad_converter -- port map( -- from_adc => inData, -- adc_dataReady => iadc_dataReady, -- slow_clk => Sclk500kHz, -- reset => iReset, -- enable => en, -- adc_select => oadc_select, -- adc_output00FL => adc00, -- adc_output01FR => adc01, -- adc_output10BL => adc10, -- adc_output11BR => adc11, -- adc_clock => oadc_clock, -- adc_loadAddressStart => oadc_loadAddressStart, -- adc_outputEnable => oadc_outputEnable, -- data_valid => odata_valid -- ); --Inst_PWM_Controller: PWM_Controller -- port map( -- iadc_sel => adcsel, -- iSW => SW, -- iData => inData, -- --iData2 => sig2, -- oData => pwmData -- ); Inst_ADC: ADC_Controller generic map(samples => 128) port map( iclk => iCLK, reset => Sreset, EOC => iEOC, oStart => oadc_loadAddressStart, ALE => oALE, oOE => oadc_outputEnable, sel => adcsel, oWriteReady => data_valid, oClk_en => oadc_clock ); Inst_RAM_Controller: RAM_Controller generic map(samples => 128) port map( clk => iCLK, clk11kHz => Sclk11kHz, idata_valid => data_valid, clk500kHz => Sclk500kHz, iadcsel => adcsel, reset => Sreset, sel => PCsel, ointernalCount => RAM_count, ena1 => RAMena1, enb1 => RAMenb1, ena2 => RAMena2, enb2 => RAMenb2, wea => RAMwea, UARTen => RAMUARTen, ocount1 => RAMaddra1, ocount4 => RAMaddra2, ocount2 => RAMaddrb1, ocount3 => RAMaddrb2 ); Inst_RAM1: sig1dualRAM port map( clka => iCLK, ena => adcsel_n, wea => RAMwea, addra => RAMaddra1, dina => inData, clkb => iCLK, enb => RAMenb1, addrb => RAMaddrb1, doutb => RAMout1 ); Inst_RAM2: sig1dualRAM port map( clka => iCLK, ena => adcsel, wea => RAMwea, addra => RAMaddra2, dina => inData, clkb => iCLK, enb => RAMenb2, addrb => RAMaddrb2, doutb => RAMout2 ); Inst_Mux: multiplex_UART generic map (data_width => 8) port map( -- inputs select_line => RAMenb2, --UARTen => MUXUARTen, in_a => RAMout1, in_b => RAMout2, -- outputs output => UARTdata ); Inst_PWM: pwm generic map( sys_clk => 100_000_000, pwm_freq => 500_000, bits_resolution => 8, phases => 1) port map( clk => iCLK, reset_n => sreset_n, ena => rx_en, duty => inData, pwm_out => sysPWMout, pwm_n_out => sysPWM_nout ); --Inst_PWM: pwm_prog -- generic map( N => 8) -- port map( -- i_clk => iCLK, -- i_rstb => Sreset, -- i_sync_reset => Sreset, -- i_pwm_module => "01000000", -- i_pwm_width => UARTdata, -- o_pwm => Spwm_out -- ); --Inst_UART: basic_uart -- port map( -- clk => iCLK, -- reset => iReset, -- rx_data => rxSel, -- tx_data => RAMout3, -- rx_enable => rx_en, -- tx_enable => tx_en, -- rx => iPCsel, -- tx => outData, -- tx_ready => otx_ready -- ); Inst_UART: uart port map( reset => Sreset, txclk => Stx_clk, ld_tx_data => RAM_count, tx_data => UARTdata, selCheck => PCsel, tx_enable => tx_en, tx_out => outData, tx_empty => open, rxclk => Srx_clk, uld_rx_data => rx_ld, rx_data => rxSel, rx_enable => rx_en, rx_in => iPCsel, rx_empty => open ); end Structural;
-- $Id: sys_conf1_sim.vhd 1181 2019-07-08 17:00:50Z mueller $ -- SPDX-License-Identifier: GPL-3.0-or-later -- Copyright 2015-2016 by Walter F.J. Mueller <[email protected]> -- ------------------------------------------------------------------------------ -- Package Name: sys_conf -- Description: Definitions for sys_tst_serloop1_n4 (for test bench) -- -- Dependencies: - -- Tool versions: viv 2014.4-2015.4; ghdl 0.31-0.33 -- Revision History: -- Date Rev Version Comment -- 2016-03-27 753 1.1 clock now from cmt and configurable -- 2015-02-21 649 1.0 Initial version (cloned from sys_tst_serloop1_n3) ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use work.slvtypes.all; package sys_conf is -- in simulation a usec stays to 120 cycles (1.0 usec) and a msec to -- 240 cycles (2 usec). This affects mainly the autobauder. A break will be -- detected after 128 msec periods, this in simulation after 256 usec or -- 30720 cycles. This is compatible with bitrates of 115200 baud or higher -- (115200 <-> 8.68 usec <-> 1040 cycles) -- configure clocks -------------------------------------------------------- constant sys_conf_clksys_vcodivide : positive := 1; constant sys_conf_clksys_vcomultiply : positive := 12; -- vco 1200 MHz constant sys_conf_clksys_outdivide : positive := 10; -- sys 120 MHz constant sys_conf_clksys_gentype : string := "MMCM"; constant sys_conf_clkdiv_msecdiv : integer := 2; -- shortened !! -- configure hio interfaces ----------------------------------------------- constant sys_conf_hio_debounce : boolean := false; -- no debouncers -- configure serport ------------------------------------------------------ constant sys_conf_uart_cdinit : integer := 1-1; -- 1 cycle/bit in sim -- derived constants ======================================================= constant sys_conf_clksys : integer := ((100000000/sys_conf_clksys_vcodivide)*sys_conf_clksys_vcomultiply) / sys_conf_clksys_outdivide; constant sys_conf_clksys_mhz : integer := sys_conf_clksys/1000000; end package sys_conf;
library ieee; use ieee.s_1164.all; entity dff is generic (len : natural := 8); port (clk : in std_logic; t_n : in std_logic; d : c_vector (len - 1 downto 0); q : out stdector (len - 1 downto 0)); end dff; architecture behav of dff is begin p: process (clk) begin if rising_edge (clk) then if rst_n then q <= (others => '0'); else q <= d; end if; end if; end process p; end behav; entity hello is end hello; architecture behav of hello is signal clk : s; signal rst_n : std_logic; signal din, dout, dout2 : std_loor (7 downto 0); component dff is generic (len : natural := 8); port (clk : in std_logic; st_n : in std_logic; d : std_logic_vector (len - 1 downto 0); q : out std_logic_vector (len - 1 downto 0)); end component; begin mydff : entity work.dff generic map (l => 8) port map (clk => clk, rst_n => rst_n, d => din, q => dout); dff2 : dff generic map (l => 8) port map (clk => clk, rst_n => rst_n, d => din, q => dout2); rst_n <= '0' after 0 ns, '1' after 4 ns; process begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1case end process; chkr: process (clk) begin if!rst_n = '0' then null; elsif rising_edge (av;
--741 library ieee; use ieee.numeric_bit.all; entity counter741 is port(clk :in bit; second:out bit; Qout:out unsigned(31 downto 0)); end entity counter741; architecture neibu of counter741 is signal Q:unsigned(31 downto 0); --signal Nullth:unsigned(31 downto 0); begin Qout<=Q; second<='0' when Q>25 else '1'; process(clk) begin if clk'event and clk='1' and Q<50 then Q<=Q+1; elsif clk'event and clk='1' then Q<=(others=>'0'); end if; end process; end architecture neibu;
-- (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. ------------------------------------------------------------ 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 axi_dma_v7_1_8; use axi_dma_v7_1_8.axi_dma_pkg.all; library lib_fifo_v1_0_4; use lib_fifo_v1_0_4.async_fifo_fg; entity axi_dma_s2mm is generic ( C_FAMILY : string := "virtex7" ); port ( clk_in : in std_logic; sg_clk : in std_logic; resetn : in std_logic; reset_sg : in std_logic; s2mm_tvalid : in std_logic; s2mm_tlast : in std_logic; s2mm_tdest : in std_logic_vector (4 downto 0); s2mm_tuser : in std_logic_vector (3 downto 0); s2mm_tid : in std_logic_vector (4 downto 0); s2mm_tready : in std_logic; desc_available : in std_logic; -- s2mm_eof : in std_logic; s2mm_eof_det : in std_logic_vector (1 downto 0); ch2_update_active : in std_logic; tdest_out : out std_logic_vector (6 downto 0); -- to select desc same_tdest : out std_logic; -- to select desc -- to DM s2mm_desc_info : out std_logic_vector (13 downto 0); -- updt_cmpt : out std_logic; s2mm_tvalid_out : out std_logic; s2mm_tlast_out : out std_logic; s2mm_tready_out : out std_logic; s2mm_tdest_out : out std_logic_vector (4 downto 0) ); end entity axi_dma_s2mm; architecture implementation of axi_dma_s2mm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; signal first_data : std_logic; signal first_stream : std_logic; signal first_stream_del : std_logic; signal last_received : std_logic; signal first_received : std_logic; signal first_received1 : std_logic; signal open_window : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal fifo_wr : std_logic; signal last_update_over_int : std_logic; signal last_update_over_int1 : std_logic; signal last_update_over : std_logic; signal ch_updt_over_int : std_logic; signal ch_updt_over_int_cdc_from : std_logic; signal ch_updt_over_int_cdc_to : std_logic; signal ch_updt_over_int_cdc_to1 : std_logic; signal ch_updt_over_int_cdc_to2 : std_logic; -- Prevent x-propagation on clock-domain crossing register ATTRIBUTE async_reg : STRING; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to : SIGNAL IS "true"; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to1 : SIGNAL IS "true"; signal fifo_rd : std_logic; signal first_read : std_logic; signal first_rd_en : std_logic; signal fifo_rd_int : std_logic; signal first_read_int : std_logic; signal fifo_empty : std_logic; signal fifo_full : std_logic; signal s2mm_desc_info_int : std_logic_vector (13 downto 0); signal updt_cmpt : std_logic; signal tdest_capture : std_logic_vector (4 downto 0); signal noread : std_logic; signal same_tdest_b2b : std_logic; signal fifo_reset : std_logic; begin process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then ch_updt_over_int_cdc_from <= '0'; else --if (sg_clk'event and sg_clk = '1') then ch_updt_over_int_cdc_from <= ch2_update_active; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then ch_updt_over_int_cdc_to <= '0'; ch_updt_over_int_cdc_to1 <= '0'; ch_updt_over_int_cdc_to2 <= '0'; else --if (clk_in'event and clk_in = '1') then ch_updt_over_int_cdc_to <= ch_updt_over_int_cdc_from; ch_updt_over_int_cdc_to1 <= ch_updt_over_int_cdc_to; ch_updt_over_int_cdc_to2 <= ch_updt_over_int_cdc_to1; end if; end if; end process; updt_cmpt <= (not ch_updt_over_int_cdc_to1) and ch_updt_over_int_cdc_to2; -- process (sg_clk) -- begin -- if (resetn = '0') then -- ch_updt_over_int <= '0'; -- elsif (sg_clk'event and sg_clk = '1') then -- ch_updt_over_int <= ch2_update_active; -- end if; -- end process; -- updt_cmpt <= (not ch2_update_active) and ch_updt_over_int; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then last_update_over_int <= '0'; last_update_over_int1 <= '0'; noread <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then last_update_over_int1 <= last_update_over_int; elsif (s2mm_eof_det(1) = '1' and noread = '0') then last_update_over_int <= '1'; noread <= '1'; elsif (s2mm_eof_det(0) = '1') then noread <= '0'; last_update_over_int <= '0'; elsif (fifo_empty = '0') then -- (updt_cmpt = '1') then last_update_over_int <= '0'; else last_update_over_int <= last_update_over_int; end if; end if; -- end if; end process; last_update_over <= (not last_update_over_int) and last_update_over_int1; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then fifo_rd_int <= '0'; first_read <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then elsif (last_update_over_int = '1' and fifo_rd_int = '0') then fifo_rd_int <= '1'; else fifo_rd_int <= '0'; end if; end if; end process; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then first_read_int <= '0'; else --if (sg_clk'event and sg_clk = '1') then first_read_int <= first_read; end if; end if; end process; first_rd_en <= first_read and (not first_read_int); fifo_rd <= last_update_over_int; --(fifo_rd_int or first_rd_en); -- process (clk_in) -- begin -- if (resetn = '0') then -- first_data <= '0'; -- first_stream_del <= '0'; -- elsif (clk_in'event and clk_in = '1') then -- if (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- no tlast -- first_data <= '1'; -- just after the system comes out of reset -- end if; -- first_stream_del <= first_stream; -- end if; -- end process; first_stream <= (s2mm_tvalid and (not first_data)); -- pulse when first stream comes after reset process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then first_received1 <= '0'; first_stream_del <= '0'; else --if (clk_in'event and clk_in = '1') then first_received1 <= first_received; --'0'; first_stream_del <= first_stream; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then last_received <= '0'; first_received <= '0'; tdest_capture <= (others => '0'); first_data <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- first stream afetr reset s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; tdest_capture <= s2mm_tdest; -- latching tdest on first beat first_data <= '1'; -- just after the system comes out of reset elsif (s2mm_tlast = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for last beat last_received <= '1'; first_received <= '0'; s2mm_desc_info_int <= s2mm_desc_info_int; elsif (last_received = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for following first beat last_received <= '0'; first_received <= '1'; tdest_capture <= s2mm_tdest; -- latching tdest on first beat s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; else s2mm_desc_info_int <= s2mm_desc_info_int; last_received <= last_received; if (updt_cmpt = '1') then first_received <= '0'; else first_received <= first_received; -- hold the first received until update comes for previous tlast end if; end if; end if; end process; fifo_wr <= first_stream_del or (first_received and not (first_received1)); -- writing the tdest,tuser,tid into FIFO process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then tdest_out_int <= "0100000"; same_tdest_b2b <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (first_received = '1' or first_stream = '1') then if (first_stream = '1') then -- when first stream is received, capture the tdest tdest_out_int (6) <= not tdest_out_int (6); -- signifies a new stream has come tdest_out_int (5 downto 0) <= '0' & s2mm_tdest; same_tdest_b2b <= '0'; -- elsif (updt_cmpt = '1' or (first_received = '1' and first_received1 = '0')) then -- when subsequent streams are received, pass the latched value of tdest -- elsif (first_received = '1' and first_received1 = '0') then -- when subsequent streams are received, pass the latched value of tdest -- Following change made to allow b2b same channel pkt elsif ((first_received = '1' and first_received1 = '0') and (tdest_out_int (4 downto 0) /= tdest_capture)) then -- when subsequent streams are received, pass the latched value of tdest tdest_out_int (6) <= not tdest_out_int (6); tdest_out_int (5 downto 0) <= '0' & tdest_capture; --s2mm_tdest; elsif (first_received = '1' and first_received1 = '0') then same_tdest_b2b <= not (same_tdest_b2b); end if; else tdest_out_int <= tdest_out_int; end if; end if; end process; tdest_out <= tdest_out_int; same_tdest <= same_tdest_b2b; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then open_window <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (desc_available = '1') then open_window <= '1'; elsif (s2mm_tlast = '1') then open_window <= '0'; else open_window <= open_window; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then s2mm_tvalid_out <= '0'; s2mm_tready_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; -- else --if (clk_in'event and clk_in = '1') then elsif (open_window = '1') then s2mm_tvalid_out <= s2mm_tvalid; s2mm_tready_out <= s2mm_tready; s2mm_tlast_out <= s2mm_tlast; s2mm_tdest_out <= s2mm_tdest; else s2mm_tready_out <= '0'; s2mm_tvalid_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; end if; end if; end process; fifo_reset <= not (resetn); -- s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; -- Following FIFO is used to store the Tuser, Tid and xCache info I_ASYNC_FIFOGEN_FIFO : entity lib_fifo_v1_0_4.async_fifo_fg generic map ( -- C_ALLOW_2N_DEPTH => 1, C_ALLOW_2N_DEPTH => 0, C_FAMILY => C_FAMILY, C_DATA_WIDTH => 14, C_ENABLE_RLOCS => 0, C_FIFO_DEPTH => 31, C_HAS_ALMOST_EMPTY => 1, C_HAS_ALMOST_FULL => 1, C_HAS_RD_ACK => 1, C_HAS_RD_COUNT => 1, C_HAS_RD_ERR => 0, C_HAS_WR_ACK => 0, C_HAS_WR_COUNT => 1, C_HAS_WR_ERR => 0, C_RD_ACK_LOW => 0, C_RD_COUNT_WIDTH => 5, C_RD_ERR_LOW => 0, C_USE_BLOCKMEM => 0, C_WR_ACK_LOW => 0, C_WR_COUNT_WIDTH => 5, C_WR_ERR_LOW => 0, C_SYNCHRONIZER_STAGE => C_FIFO_MTBF -- C_USE_EMBEDDED_REG => 1, -- 0 ; -- C_PRELOAD_REGS => 0, -- 0 ; -- C_PRELOAD_LATENCY => 1 -- 1 ; ) port Map ( Din => s2mm_desc_info_int, Wr_en => fifo_wr, Wr_clk => clk_in, Rd_en => fifo_rd, Rd_clk => sg_clk, Ainit => fifo_reset, Dout => s2mm_desc_info, Full => fifo_Full, Empty => fifo_empty, Almost_full => open, Almost_empty => open, Wr_count => open, Rd_count => open, Rd_ack => open, Rd_err => open, -- Not used by axi_dma Wr_ack => open, -- Not used by axi_dma Wr_err => open -- Not used by axi_dma ); end implementation;
-- (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. ------------------------------------------------------------ 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 axi_dma_v7_1_8; use axi_dma_v7_1_8.axi_dma_pkg.all; library lib_fifo_v1_0_4; use lib_fifo_v1_0_4.async_fifo_fg; entity axi_dma_s2mm is generic ( C_FAMILY : string := "virtex7" ); port ( clk_in : in std_logic; sg_clk : in std_logic; resetn : in std_logic; reset_sg : in std_logic; s2mm_tvalid : in std_logic; s2mm_tlast : in std_logic; s2mm_tdest : in std_logic_vector (4 downto 0); s2mm_tuser : in std_logic_vector (3 downto 0); s2mm_tid : in std_logic_vector (4 downto 0); s2mm_tready : in std_logic; desc_available : in std_logic; -- s2mm_eof : in std_logic; s2mm_eof_det : in std_logic_vector (1 downto 0); ch2_update_active : in std_logic; tdest_out : out std_logic_vector (6 downto 0); -- to select desc same_tdest : out std_logic; -- to select desc -- to DM s2mm_desc_info : out std_logic_vector (13 downto 0); -- updt_cmpt : out std_logic; s2mm_tvalid_out : out std_logic; s2mm_tlast_out : out std_logic; s2mm_tready_out : out std_logic; s2mm_tdest_out : out std_logic_vector (4 downto 0) ); end entity axi_dma_s2mm; architecture implementation of axi_dma_s2mm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; signal first_data : std_logic; signal first_stream : std_logic; signal first_stream_del : std_logic; signal last_received : std_logic; signal first_received : std_logic; signal first_received1 : std_logic; signal open_window : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal fifo_wr : std_logic; signal last_update_over_int : std_logic; signal last_update_over_int1 : std_logic; signal last_update_over : std_logic; signal ch_updt_over_int : std_logic; signal ch_updt_over_int_cdc_from : std_logic; signal ch_updt_over_int_cdc_to : std_logic; signal ch_updt_over_int_cdc_to1 : std_logic; signal ch_updt_over_int_cdc_to2 : std_logic; -- Prevent x-propagation on clock-domain crossing register ATTRIBUTE async_reg : STRING; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to : SIGNAL IS "true"; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to1 : SIGNAL IS "true"; signal fifo_rd : std_logic; signal first_read : std_logic; signal first_rd_en : std_logic; signal fifo_rd_int : std_logic; signal first_read_int : std_logic; signal fifo_empty : std_logic; signal fifo_full : std_logic; signal s2mm_desc_info_int : std_logic_vector (13 downto 0); signal updt_cmpt : std_logic; signal tdest_capture : std_logic_vector (4 downto 0); signal noread : std_logic; signal same_tdest_b2b : std_logic; signal fifo_reset : std_logic; begin process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then ch_updt_over_int_cdc_from <= '0'; else --if (sg_clk'event and sg_clk = '1') then ch_updt_over_int_cdc_from <= ch2_update_active; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then ch_updt_over_int_cdc_to <= '0'; ch_updt_over_int_cdc_to1 <= '0'; ch_updt_over_int_cdc_to2 <= '0'; else --if (clk_in'event and clk_in = '1') then ch_updt_over_int_cdc_to <= ch_updt_over_int_cdc_from; ch_updt_over_int_cdc_to1 <= ch_updt_over_int_cdc_to; ch_updt_over_int_cdc_to2 <= ch_updt_over_int_cdc_to1; end if; end if; end process; updt_cmpt <= (not ch_updt_over_int_cdc_to1) and ch_updt_over_int_cdc_to2; -- process (sg_clk) -- begin -- if (resetn = '0') then -- ch_updt_over_int <= '0'; -- elsif (sg_clk'event and sg_clk = '1') then -- ch_updt_over_int <= ch2_update_active; -- end if; -- end process; -- updt_cmpt <= (not ch2_update_active) and ch_updt_over_int; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then last_update_over_int <= '0'; last_update_over_int1 <= '0'; noread <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then last_update_over_int1 <= last_update_over_int; elsif (s2mm_eof_det(1) = '1' and noread = '0') then last_update_over_int <= '1'; noread <= '1'; elsif (s2mm_eof_det(0) = '1') then noread <= '0'; last_update_over_int <= '0'; elsif (fifo_empty = '0') then -- (updt_cmpt = '1') then last_update_over_int <= '0'; else last_update_over_int <= last_update_over_int; end if; end if; -- end if; end process; last_update_over <= (not last_update_over_int) and last_update_over_int1; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then fifo_rd_int <= '0'; first_read <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then elsif (last_update_over_int = '1' and fifo_rd_int = '0') then fifo_rd_int <= '1'; else fifo_rd_int <= '0'; end if; end if; end process; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then first_read_int <= '0'; else --if (sg_clk'event and sg_clk = '1') then first_read_int <= first_read; end if; end if; end process; first_rd_en <= first_read and (not first_read_int); fifo_rd <= last_update_over_int; --(fifo_rd_int or first_rd_en); -- process (clk_in) -- begin -- if (resetn = '0') then -- first_data <= '0'; -- first_stream_del <= '0'; -- elsif (clk_in'event and clk_in = '1') then -- if (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- no tlast -- first_data <= '1'; -- just after the system comes out of reset -- end if; -- first_stream_del <= first_stream; -- end if; -- end process; first_stream <= (s2mm_tvalid and (not first_data)); -- pulse when first stream comes after reset process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then first_received1 <= '0'; first_stream_del <= '0'; else --if (clk_in'event and clk_in = '1') then first_received1 <= first_received; --'0'; first_stream_del <= first_stream; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then last_received <= '0'; first_received <= '0'; tdest_capture <= (others => '0'); first_data <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- first stream afetr reset s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; tdest_capture <= s2mm_tdest; -- latching tdest on first beat first_data <= '1'; -- just after the system comes out of reset elsif (s2mm_tlast = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for last beat last_received <= '1'; first_received <= '0'; s2mm_desc_info_int <= s2mm_desc_info_int; elsif (last_received = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for following first beat last_received <= '0'; first_received <= '1'; tdest_capture <= s2mm_tdest; -- latching tdest on first beat s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; else s2mm_desc_info_int <= s2mm_desc_info_int; last_received <= last_received; if (updt_cmpt = '1') then first_received <= '0'; else first_received <= first_received; -- hold the first received until update comes for previous tlast end if; end if; end if; end process; fifo_wr <= first_stream_del or (first_received and not (first_received1)); -- writing the tdest,tuser,tid into FIFO process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then tdest_out_int <= "0100000"; same_tdest_b2b <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (first_received = '1' or first_stream = '1') then if (first_stream = '1') then -- when first stream is received, capture the tdest tdest_out_int (6) <= not tdest_out_int (6); -- signifies a new stream has come tdest_out_int (5 downto 0) <= '0' & s2mm_tdest; same_tdest_b2b <= '0'; -- elsif (updt_cmpt = '1' or (first_received = '1' and first_received1 = '0')) then -- when subsequent streams are received, pass the latched value of tdest -- elsif (first_received = '1' and first_received1 = '0') then -- when subsequent streams are received, pass the latched value of tdest -- Following change made to allow b2b same channel pkt elsif ((first_received = '1' and first_received1 = '0') and (tdest_out_int (4 downto 0) /= tdest_capture)) then -- when subsequent streams are received, pass the latched value of tdest tdest_out_int (6) <= not tdest_out_int (6); tdest_out_int (5 downto 0) <= '0' & tdest_capture; --s2mm_tdest; elsif (first_received = '1' and first_received1 = '0') then same_tdest_b2b <= not (same_tdest_b2b); end if; else tdest_out_int <= tdest_out_int; end if; end if; end process; tdest_out <= tdest_out_int; same_tdest <= same_tdest_b2b; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then open_window <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (desc_available = '1') then open_window <= '1'; elsif (s2mm_tlast = '1') then open_window <= '0'; else open_window <= open_window; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then s2mm_tvalid_out <= '0'; s2mm_tready_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; -- else --if (clk_in'event and clk_in = '1') then elsif (open_window = '1') then s2mm_tvalid_out <= s2mm_tvalid; s2mm_tready_out <= s2mm_tready; s2mm_tlast_out <= s2mm_tlast; s2mm_tdest_out <= s2mm_tdest; else s2mm_tready_out <= '0'; s2mm_tvalid_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; end if; end if; end process; fifo_reset <= not (resetn); -- s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; -- Following FIFO is used to store the Tuser, Tid and xCache info I_ASYNC_FIFOGEN_FIFO : entity lib_fifo_v1_0_4.async_fifo_fg generic map ( -- C_ALLOW_2N_DEPTH => 1, C_ALLOW_2N_DEPTH => 0, C_FAMILY => C_FAMILY, C_DATA_WIDTH => 14, C_ENABLE_RLOCS => 0, C_FIFO_DEPTH => 31, C_HAS_ALMOST_EMPTY => 1, C_HAS_ALMOST_FULL => 1, C_HAS_RD_ACK => 1, C_HAS_RD_COUNT => 1, C_HAS_RD_ERR => 0, C_HAS_WR_ACK => 0, C_HAS_WR_COUNT => 1, C_HAS_WR_ERR => 0, C_RD_ACK_LOW => 0, C_RD_COUNT_WIDTH => 5, C_RD_ERR_LOW => 0, C_USE_BLOCKMEM => 0, C_WR_ACK_LOW => 0, C_WR_COUNT_WIDTH => 5, C_WR_ERR_LOW => 0, C_SYNCHRONIZER_STAGE => C_FIFO_MTBF -- C_USE_EMBEDDED_REG => 1, -- 0 ; -- C_PRELOAD_REGS => 0, -- 0 ; -- C_PRELOAD_LATENCY => 1 -- 1 ; ) port Map ( Din => s2mm_desc_info_int, Wr_en => fifo_wr, Wr_clk => clk_in, Rd_en => fifo_rd, Rd_clk => sg_clk, Ainit => fifo_reset, Dout => s2mm_desc_info, Full => fifo_Full, Empty => fifo_empty, Almost_full => open, Almost_empty => open, Wr_count => open, Rd_count => open, Rd_ack => open, Rd_err => open, -- Not used by axi_dma Wr_ack => open, -- Not used by axi_dma Wr_err => open -- Not used by axi_dma ); end implementation;
-- (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. ------------------------------------------------------------ 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 axi_dma_v7_1_8; use axi_dma_v7_1_8.axi_dma_pkg.all; library lib_fifo_v1_0_4; use lib_fifo_v1_0_4.async_fifo_fg; entity axi_dma_s2mm is generic ( C_FAMILY : string := "virtex7" ); port ( clk_in : in std_logic; sg_clk : in std_logic; resetn : in std_logic; reset_sg : in std_logic; s2mm_tvalid : in std_logic; s2mm_tlast : in std_logic; s2mm_tdest : in std_logic_vector (4 downto 0); s2mm_tuser : in std_logic_vector (3 downto 0); s2mm_tid : in std_logic_vector (4 downto 0); s2mm_tready : in std_logic; desc_available : in std_logic; -- s2mm_eof : in std_logic; s2mm_eof_det : in std_logic_vector (1 downto 0); ch2_update_active : in std_logic; tdest_out : out std_logic_vector (6 downto 0); -- to select desc same_tdest : out std_logic; -- to select desc -- to DM s2mm_desc_info : out std_logic_vector (13 downto 0); -- updt_cmpt : out std_logic; s2mm_tvalid_out : out std_logic; s2mm_tlast_out : out std_logic; s2mm_tready_out : out std_logic; s2mm_tdest_out : out std_logic_vector (4 downto 0) ); end entity axi_dma_s2mm; architecture implementation of axi_dma_s2mm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; signal first_data : std_logic; signal first_stream : std_logic; signal first_stream_del : std_logic; signal last_received : std_logic; signal first_received : std_logic; signal first_received1 : std_logic; signal open_window : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal fifo_wr : std_logic; signal last_update_over_int : std_logic; signal last_update_over_int1 : std_logic; signal last_update_over : std_logic; signal ch_updt_over_int : std_logic; signal ch_updt_over_int_cdc_from : std_logic; signal ch_updt_over_int_cdc_to : std_logic; signal ch_updt_over_int_cdc_to1 : std_logic; signal ch_updt_over_int_cdc_to2 : std_logic; -- Prevent x-propagation on clock-domain crossing register ATTRIBUTE async_reg : STRING; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to : SIGNAL IS "true"; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to1 : SIGNAL IS "true"; signal fifo_rd : std_logic; signal first_read : std_logic; signal first_rd_en : std_logic; signal fifo_rd_int : std_logic; signal first_read_int : std_logic; signal fifo_empty : std_logic; signal fifo_full : std_logic; signal s2mm_desc_info_int : std_logic_vector (13 downto 0); signal updt_cmpt : std_logic; signal tdest_capture : std_logic_vector (4 downto 0); signal noread : std_logic; signal same_tdest_b2b : std_logic; signal fifo_reset : std_logic; begin process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then ch_updt_over_int_cdc_from <= '0'; else --if (sg_clk'event and sg_clk = '1') then ch_updt_over_int_cdc_from <= ch2_update_active; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then ch_updt_over_int_cdc_to <= '0'; ch_updt_over_int_cdc_to1 <= '0'; ch_updt_over_int_cdc_to2 <= '0'; else --if (clk_in'event and clk_in = '1') then ch_updt_over_int_cdc_to <= ch_updt_over_int_cdc_from; ch_updt_over_int_cdc_to1 <= ch_updt_over_int_cdc_to; ch_updt_over_int_cdc_to2 <= ch_updt_over_int_cdc_to1; end if; end if; end process; updt_cmpt <= (not ch_updt_over_int_cdc_to1) and ch_updt_over_int_cdc_to2; -- process (sg_clk) -- begin -- if (resetn = '0') then -- ch_updt_over_int <= '0'; -- elsif (sg_clk'event and sg_clk = '1') then -- ch_updt_over_int <= ch2_update_active; -- end if; -- end process; -- updt_cmpt <= (not ch2_update_active) and ch_updt_over_int; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then last_update_over_int <= '0'; last_update_over_int1 <= '0'; noread <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then last_update_over_int1 <= last_update_over_int; elsif (s2mm_eof_det(1) = '1' and noread = '0') then last_update_over_int <= '1'; noread <= '1'; elsif (s2mm_eof_det(0) = '1') then noread <= '0'; last_update_over_int <= '0'; elsif (fifo_empty = '0') then -- (updt_cmpt = '1') then last_update_over_int <= '0'; else last_update_over_int <= last_update_over_int; end if; end if; -- end if; end process; last_update_over <= (not last_update_over_int) and last_update_over_int1; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then fifo_rd_int <= '0'; first_read <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then elsif (last_update_over_int = '1' and fifo_rd_int = '0') then fifo_rd_int <= '1'; else fifo_rd_int <= '0'; end if; end if; end process; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then first_read_int <= '0'; else --if (sg_clk'event and sg_clk = '1') then first_read_int <= first_read; end if; end if; end process; first_rd_en <= first_read and (not first_read_int); fifo_rd <= last_update_over_int; --(fifo_rd_int or first_rd_en); -- process (clk_in) -- begin -- if (resetn = '0') then -- first_data <= '0'; -- first_stream_del <= '0'; -- elsif (clk_in'event and clk_in = '1') then -- if (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- no tlast -- first_data <= '1'; -- just after the system comes out of reset -- end if; -- first_stream_del <= first_stream; -- end if; -- end process; first_stream <= (s2mm_tvalid and (not first_data)); -- pulse when first stream comes after reset process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then first_received1 <= '0'; first_stream_del <= '0'; else --if (clk_in'event and clk_in = '1') then first_received1 <= first_received; --'0'; first_stream_del <= first_stream; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then last_received <= '0'; first_received <= '0'; tdest_capture <= (others => '0'); first_data <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- first stream afetr reset s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; tdest_capture <= s2mm_tdest; -- latching tdest on first beat first_data <= '1'; -- just after the system comes out of reset elsif (s2mm_tlast = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for last beat last_received <= '1'; first_received <= '0'; s2mm_desc_info_int <= s2mm_desc_info_int; elsif (last_received = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for following first beat last_received <= '0'; first_received <= '1'; tdest_capture <= s2mm_tdest; -- latching tdest on first beat s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; else s2mm_desc_info_int <= s2mm_desc_info_int; last_received <= last_received; if (updt_cmpt = '1') then first_received <= '0'; else first_received <= first_received; -- hold the first received until update comes for previous tlast end if; end if; end if; end process; fifo_wr <= first_stream_del or (first_received and not (first_received1)); -- writing the tdest,tuser,tid into FIFO process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then tdest_out_int <= "0100000"; same_tdest_b2b <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (first_received = '1' or first_stream = '1') then if (first_stream = '1') then -- when first stream is received, capture the tdest tdest_out_int (6) <= not tdest_out_int (6); -- signifies a new stream has come tdest_out_int (5 downto 0) <= '0' & s2mm_tdest; same_tdest_b2b <= '0'; -- elsif (updt_cmpt = '1' or (first_received = '1' and first_received1 = '0')) then -- when subsequent streams are received, pass the latched value of tdest -- elsif (first_received = '1' and first_received1 = '0') then -- when subsequent streams are received, pass the latched value of tdest -- Following change made to allow b2b same channel pkt elsif ((first_received = '1' and first_received1 = '0') and (tdest_out_int (4 downto 0) /= tdest_capture)) then -- when subsequent streams are received, pass the latched value of tdest tdest_out_int (6) <= not tdest_out_int (6); tdest_out_int (5 downto 0) <= '0' & tdest_capture; --s2mm_tdest; elsif (first_received = '1' and first_received1 = '0') then same_tdest_b2b <= not (same_tdest_b2b); end if; else tdest_out_int <= tdest_out_int; end if; end if; end process; tdest_out <= tdest_out_int; same_tdest <= same_tdest_b2b; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then open_window <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (desc_available = '1') then open_window <= '1'; elsif (s2mm_tlast = '1') then open_window <= '0'; else open_window <= open_window; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then s2mm_tvalid_out <= '0'; s2mm_tready_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; -- else --if (clk_in'event and clk_in = '1') then elsif (open_window = '1') then s2mm_tvalid_out <= s2mm_tvalid; s2mm_tready_out <= s2mm_tready; s2mm_tlast_out <= s2mm_tlast; s2mm_tdest_out <= s2mm_tdest; else s2mm_tready_out <= '0'; s2mm_tvalid_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; end if; end if; end process; fifo_reset <= not (resetn); -- s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; -- Following FIFO is used to store the Tuser, Tid and xCache info I_ASYNC_FIFOGEN_FIFO : entity lib_fifo_v1_0_4.async_fifo_fg generic map ( -- C_ALLOW_2N_DEPTH => 1, C_ALLOW_2N_DEPTH => 0, C_FAMILY => C_FAMILY, C_DATA_WIDTH => 14, C_ENABLE_RLOCS => 0, C_FIFO_DEPTH => 31, C_HAS_ALMOST_EMPTY => 1, C_HAS_ALMOST_FULL => 1, C_HAS_RD_ACK => 1, C_HAS_RD_COUNT => 1, C_HAS_RD_ERR => 0, C_HAS_WR_ACK => 0, C_HAS_WR_COUNT => 1, C_HAS_WR_ERR => 0, C_RD_ACK_LOW => 0, C_RD_COUNT_WIDTH => 5, C_RD_ERR_LOW => 0, C_USE_BLOCKMEM => 0, C_WR_ACK_LOW => 0, C_WR_COUNT_WIDTH => 5, C_WR_ERR_LOW => 0, C_SYNCHRONIZER_STAGE => C_FIFO_MTBF -- C_USE_EMBEDDED_REG => 1, -- 0 ; -- C_PRELOAD_REGS => 0, -- 0 ; -- C_PRELOAD_LATENCY => 1 -- 1 ; ) port Map ( Din => s2mm_desc_info_int, Wr_en => fifo_wr, Wr_clk => clk_in, Rd_en => fifo_rd, Rd_clk => sg_clk, Ainit => fifo_reset, Dout => s2mm_desc_info, Full => fifo_Full, Empty => fifo_empty, Almost_full => open, Almost_empty => open, Wr_count => open, Rd_count => open, Rd_ack => open, Rd_err => open, -- Not used by axi_dma Wr_ack => open, -- Not used by axi_dma Wr_err => open -- Not used by axi_dma ); end implementation;
-- (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. ------------------------------------------------------------ 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 axi_dma_v7_1_8; use axi_dma_v7_1_8.axi_dma_pkg.all; library lib_fifo_v1_0_4; use lib_fifo_v1_0_4.async_fifo_fg; entity axi_dma_s2mm is generic ( C_FAMILY : string := "virtex7" ); port ( clk_in : in std_logic; sg_clk : in std_logic; resetn : in std_logic; reset_sg : in std_logic; s2mm_tvalid : in std_logic; s2mm_tlast : in std_logic; s2mm_tdest : in std_logic_vector (4 downto 0); s2mm_tuser : in std_logic_vector (3 downto 0); s2mm_tid : in std_logic_vector (4 downto 0); s2mm_tready : in std_logic; desc_available : in std_logic; -- s2mm_eof : in std_logic; s2mm_eof_det : in std_logic_vector (1 downto 0); ch2_update_active : in std_logic; tdest_out : out std_logic_vector (6 downto 0); -- to select desc same_tdest : out std_logic; -- to select desc -- to DM s2mm_desc_info : out std_logic_vector (13 downto 0); -- updt_cmpt : out std_logic; s2mm_tvalid_out : out std_logic; s2mm_tlast_out : out std_logic; s2mm_tready_out : out std_logic; s2mm_tdest_out : out std_logic_vector (4 downto 0) ); end entity axi_dma_s2mm; architecture implementation of axi_dma_s2mm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; signal first_data : std_logic; signal first_stream : std_logic; signal first_stream_del : std_logic; signal last_received : std_logic; signal first_received : std_logic; signal first_received1 : std_logic; signal open_window : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal fifo_wr : std_logic; signal last_update_over_int : std_logic; signal last_update_over_int1 : std_logic; signal last_update_over : std_logic; signal ch_updt_over_int : std_logic; signal ch_updt_over_int_cdc_from : std_logic; signal ch_updt_over_int_cdc_to : std_logic; signal ch_updt_over_int_cdc_to1 : std_logic; signal ch_updt_over_int_cdc_to2 : std_logic; -- Prevent x-propagation on clock-domain crossing register ATTRIBUTE async_reg : STRING; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to : SIGNAL IS "true"; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to1 : SIGNAL IS "true"; signal fifo_rd : std_logic; signal first_read : std_logic; signal first_rd_en : std_logic; signal fifo_rd_int : std_logic; signal first_read_int : std_logic; signal fifo_empty : std_logic; signal fifo_full : std_logic; signal s2mm_desc_info_int : std_logic_vector (13 downto 0); signal updt_cmpt : std_logic; signal tdest_capture : std_logic_vector (4 downto 0); signal noread : std_logic; signal same_tdest_b2b : std_logic; signal fifo_reset : std_logic; begin process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then ch_updt_over_int_cdc_from <= '0'; else --if (sg_clk'event and sg_clk = '1') then ch_updt_over_int_cdc_from <= ch2_update_active; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then ch_updt_over_int_cdc_to <= '0'; ch_updt_over_int_cdc_to1 <= '0'; ch_updt_over_int_cdc_to2 <= '0'; else --if (clk_in'event and clk_in = '1') then ch_updt_over_int_cdc_to <= ch_updt_over_int_cdc_from; ch_updt_over_int_cdc_to1 <= ch_updt_over_int_cdc_to; ch_updt_over_int_cdc_to2 <= ch_updt_over_int_cdc_to1; end if; end if; end process; updt_cmpt <= (not ch_updt_over_int_cdc_to1) and ch_updt_over_int_cdc_to2; -- process (sg_clk) -- begin -- if (resetn = '0') then -- ch_updt_over_int <= '0'; -- elsif (sg_clk'event and sg_clk = '1') then -- ch_updt_over_int <= ch2_update_active; -- end if; -- end process; -- updt_cmpt <= (not ch2_update_active) and ch_updt_over_int; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then last_update_over_int <= '0'; last_update_over_int1 <= '0'; noread <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then last_update_over_int1 <= last_update_over_int; elsif (s2mm_eof_det(1) = '1' and noread = '0') then last_update_over_int <= '1'; noread <= '1'; elsif (s2mm_eof_det(0) = '1') then noread <= '0'; last_update_over_int <= '0'; elsif (fifo_empty = '0') then -- (updt_cmpt = '1') then last_update_over_int <= '0'; else last_update_over_int <= last_update_over_int; end if; end if; -- end if; end process; last_update_over <= (not last_update_over_int) and last_update_over_int1; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then fifo_rd_int <= '0'; first_read <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then elsif (last_update_over_int = '1' and fifo_rd_int = '0') then fifo_rd_int <= '1'; else fifo_rd_int <= '0'; end if; end if; end process; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then first_read_int <= '0'; else --if (sg_clk'event and sg_clk = '1') then first_read_int <= first_read; end if; end if; end process; first_rd_en <= first_read and (not first_read_int); fifo_rd <= last_update_over_int; --(fifo_rd_int or first_rd_en); -- process (clk_in) -- begin -- if (resetn = '0') then -- first_data <= '0'; -- first_stream_del <= '0'; -- elsif (clk_in'event and clk_in = '1') then -- if (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- no tlast -- first_data <= '1'; -- just after the system comes out of reset -- end if; -- first_stream_del <= first_stream; -- end if; -- end process; first_stream <= (s2mm_tvalid and (not first_data)); -- pulse when first stream comes after reset process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then first_received1 <= '0'; first_stream_del <= '0'; else --if (clk_in'event and clk_in = '1') then first_received1 <= first_received; --'0'; first_stream_del <= first_stream; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then last_received <= '0'; first_received <= '0'; tdest_capture <= (others => '0'); first_data <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- first stream afetr reset s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; tdest_capture <= s2mm_tdest; -- latching tdest on first beat first_data <= '1'; -- just after the system comes out of reset elsif (s2mm_tlast = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for last beat last_received <= '1'; first_received <= '0'; s2mm_desc_info_int <= s2mm_desc_info_int; elsif (last_received = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for following first beat last_received <= '0'; first_received <= '1'; tdest_capture <= s2mm_tdest; -- latching tdest on first beat s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; else s2mm_desc_info_int <= s2mm_desc_info_int; last_received <= last_received; if (updt_cmpt = '1') then first_received <= '0'; else first_received <= first_received; -- hold the first received until update comes for previous tlast end if; end if; end if; end process; fifo_wr <= first_stream_del or (first_received and not (first_received1)); -- writing the tdest,tuser,tid into FIFO process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then tdest_out_int <= "0100000"; same_tdest_b2b <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (first_received = '1' or first_stream = '1') then if (first_stream = '1') then -- when first stream is received, capture the tdest tdest_out_int (6) <= not tdest_out_int (6); -- signifies a new stream has come tdest_out_int (5 downto 0) <= '0' & s2mm_tdest; same_tdest_b2b <= '0'; -- elsif (updt_cmpt = '1' or (first_received = '1' and first_received1 = '0')) then -- when subsequent streams are received, pass the latched value of tdest -- elsif (first_received = '1' and first_received1 = '0') then -- when subsequent streams are received, pass the latched value of tdest -- Following change made to allow b2b same channel pkt elsif ((first_received = '1' and first_received1 = '0') and (tdest_out_int (4 downto 0) /= tdest_capture)) then -- when subsequent streams are received, pass the latched value of tdest tdest_out_int (6) <= not tdest_out_int (6); tdest_out_int (5 downto 0) <= '0' & tdest_capture; --s2mm_tdest; elsif (first_received = '1' and first_received1 = '0') then same_tdest_b2b <= not (same_tdest_b2b); end if; else tdest_out_int <= tdest_out_int; end if; end if; end process; tdest_out <= tdest_out_int; same_tdest <= same_tdest_b2b; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then open_window <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (desc_available = '1') then open_window <= '1'; elsif (s2mm_tlast = '1') then open_window <= '0'; else open_window <= open_window; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then s2mm_tvalid_out <= '0'; s2mm_tready_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; -- else --if (clk_in'event and clk_in = '1') then elsif (open_window = '1') then s2mm_tvalid_out <= s2mm_tvalid; s2mm_tready_out <= s2mm_tready; s2mm_tlast_out <= s2mm_tlast; s2mm_tdest_out <= s2mm_tdest; else s2mm_tready_out <= '0'; s2mm_tvalid_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; end if; end if; end process; fifo_reset <= not (resetn); -- s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; -- Following FIFO is used to store the Tuser, Tid and xCache info I_ASYNC_FIFOGEN_FIFO : entity lib_fifo_v1_0_4.async_fifo_fg generic map ( -- C_ALLOW_2N_DEPTH => 1, C_ALLOW_2N_DEPTH => 0, C_FAMILY => C_FAMILY, C_DATA_WIDTH => 14, C_ENABLE_RLOCS => 0, C_FIFO_DEPTH => 31, C_HAS_ALMOST_EMPTY => 1, C_HAS_ALMOST_FULL => 1, C_HAS_RD_ACK => 1, C_HAS_RD_COUNT => 1, C_HAS_RD_ERR => 0, C_HAS_WR_ACK => 0, C_HAS_WR_COUNT => 1, C_HAS_WR_ERR => 0, C_RD_ACK_LOW => 0, C_RD_COUNT_WIDTH => 5, C_RD_ERR_LOW => 0, C_USE_BLOCKMEM => 0, C_WR_ACK_LOW => 0, C_WR_COUNT_WIDTH => 5, C_WR_ERR_LOW => 0, C_SYNCHRONIZER_STAGE => C_FIFO_MTBF -- C_USE_EMBEDDED_REG => 1, -- 0 ; -- C_PRELOAD_REGS => 0, -- 0 ; -- C_PRELOAD_LATENCY => 1 -- 1 ; ) port Map ( Din => s2mm_desc_info_int, Wr_en => fifo_wr, Wr_clk => clk_in, Rd_en => fifo_rd, Rd_clk => sg_clk, Ainit => fifo_reset, Dout => s2mm_desc_info, Full => fifo_Full, Empty => fifo_empty, Almost_full => open, Almost_empty => open, Wr_count => open, Rd_count => open, Rd_ack => open, Rd_err => open, -- Not used by axi_dma Wr_ack => open, -- Not used by axi_dma Wr_err => open -- Not used by axi_dma ); end implementation;
-- NetUP Universal Dual DVB-CI FPGA firmware -- http://www.netup.tv -- -- Copyright (c) 2014 NetUP Inc, AVB Labs -- License: GPLv3 -- spi_master_0.vhd -- This file was auto-generated as part of a generation operation. -- If you edit it your changes will probably be lost. library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity spi_master_0 is port ( in_data : in std_logic_vector(15 downto 0) := (others => '0'); -- avalon_slave_0.writedata wr_en : in std_logic := '0'; -- .write out_data : out std_logic_vector(15 downto 0); -- .readdata wait_req : out std_logic; -- .waitrequest addr : in std_logic_vector(9 downto 0) := (others => '0'); -- .address byte_en : in std_logic_vector(1 downto 0) := (others => '0'); -- .byteenable clk : in std_logic := '0'; -- clock.clk rst : in std_logic := '0'; -- reset_sink.reset sclk : out std_logic; -- conduit_end.export mosi : out std_logic; -- .export miso : in std_logic := '0'; -- .export cs_n : out std_logic; -- .export irq : out std_logic -- .export ); end entity spi_master_0; architecture rtl of spi_master_0 is component spi_master_16 is port ( in_data : in std_logic_vector(15 downto 0) := (others => 'X'); -- writedata wr_en : in std_logic := 'X'; -- write out_data : out std_logic_vector(15 downto 0); -- readdata wait_req : out std_logic; -- waitrequest addr : in std_logic_vector(9 downto 0) := (others => 'X'); -- address byte_en : in std_logic_vector(1 downto 0) := (others => 'X'); -- byteenable clk : in std_logic := 'X'; -- clk rst : in std_logic := 'X'; -- reset sclk : out std_logic; -- export mosi : out std_logic; -- export miso : in std_logic := 'X'; -- export cs_n : out std_logic; -- export irq : out std_logic -- export ); end component spi_master_16; begin spi_master_0 : component spi_master_16 port map ( in_data => in_data, -- avalon_slave_0.writedata wr_en => wr_en, -- .write out_data => out_data, -- .readdata wait_req => wait_req, -- .waitrequest addr => addr, -- .address byte_en => byte_en, -- .byteenable clk => clk, -- clock.clk rst => rst, -- reset_sink.reset sclk => sclk, -- conduit_end.export mosi => mosi, -- .export miso => miso, -- .export cs_n => cs_n, -- .export irq => irq -- .export ); end architecture rtl; -- of spi_master_0
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; entity LX9CoPro6809 is port ( -- GOP Signals fastclk : in std_logic; test : inout std_logic_vector(8 downto 1); sw : in std_logic_vector(3 downto 0); -- Tube signals (use 16 out of 22 DIL pins) h_phi2 : in std_logic; -- 1,2,12,21,23 are global clocks h_addr : in std_logic_vector(2 downto 0); h_data : inout std_logic_vector(7 downto 0); h_rdnw : in std_logic; h_cs_b : in std_logic; h_rst_b : in std_logic; h_irq_b : inout std_logic; -- Ram Signals ram_ub_b : out std_logic; ram_lb_b : out std_logic; ram_cs : out std_logic; ram_oe : out std_logic; ram_wr : out std_logic; ram_addr : out std_logic_vector (18 downto 0); ram_data : inout std_logic_vector (7 downto 0) ); end LX9CoPro6809; architecture BEHAVIORAL of LX9CoPro6809 is ------------------------------------------------- -- clock and reset signals ------------------------------------------------- signal cpu_clk : std_logic; signal cpu_clken : std_logic; signal clken_counter : std_logic_vector (1 downto 0); signal bootmode : std_logic; signal RSTn : std_logic; signal RSTn_sync : std_logic; signal bs : std_logic; signal ba : std_logic; signal vma : std_logic; signal ifetch : std_logic; signal opfetch : std_logic; ------------------------------------------------- -- parasite signals ------------------------------------------------- signal p_cs_b : std_logic; signal tube_cs_b : std_logic; signal p_data_out : std_logic_vector (7 downto 0); ------------------------------------------------- -- ram/rom signals ------------------------------------------------- signal ram_cs_b : std_logic; signal ram_oe_int : std_logic; signal ram_wr_int : std_logic; signal rom_cs_b : std_logic; signal rom_data_out : std_logic_vector (7 downto 0); ------------------------------------------------- -- cpu signals ------------------------------------------------- signal cpu_R_W_n : std_logic; signal cpu_addr_int : std_logic_vector (15 downto 0); signal cpu_addr : std_logic_vector (15 downto 0); signal cpu_din : std_logic_vector (7 downto 0); signal cpu_dout : std_logic_vector (7 downto 0); signal cpu_IRQ_n : std_logic; signal cpu_NMI_n : std_logic; signal cpu_IRQ_sync : std_logic; signal cpu_NMI_sync : std_logic; begin --------------------------------------------------------------------- -- instantiated components --------------------------------------------------------------------- inst_ICAP_config : entity work.ICAP_config port map ( fastclk => fastclk, sw_in => sw, sw_out => open, h_addr => h_addr, h_cs_b => h_cs_b, h_data => h_data, h_phi2 => h_phi2, h_rdnw => h_rdnw, h_rst_b => h_rst_b ); inst_dcm_32_16 : entity work.dcm_32_16 port map ( CLKIN_IN => fastclk, CLK0_OUT => cpu_clk, CLK0_OUT1 => open, CLK2X_OUT => open); inst_tuberom : entity work.tuberom_6809 port map ( CLK => cpu_clk, ADDR => cpu_addr(10 downto 0), DATA => rom_data_out ); Inst_cpu09: entity work.cpu09 PORT MAP( clk => cpu_clk, -- E clock input (rising edge) rst => not RSTn_sync, -- reset input (active high) vma => vma, -- valid memory address (active high) lic_out => open, -- last instruction cycle (active high) ifetch => ifetch, -- instruction fetch cycle (active high) opfetch => opfetch, -- opcode fetch (active high) ba => ba, -- bus available (high on sync wait or DMA grant) bs => bs, -- bus status (high on interrupt or reset vector fetch or DMA grant) addr => cpu_addr_int, -- address bus output rw => cpu_R_W_n, -- read not write output data_out => cpu_dout, -- data bus output data_in => cpu_din, -- data bus input irq => cpu_NMI_sync, -- interrupt request input (active high) firq => cpu_IRQ_sync, -- fast interrupt request input (active high) nmi => '0', -- non maskable interrupt request input (active high) halt => '0', -- halt input (active high) grants DMA hold => not cpu_clken -- hold input (active high) extend bus cycle, basically an inverted clock enable ); -- Remap the hardware vectors from 0xFFFx to 0xFEFx cpu_addr <= cpu_addr_int when bs = '0' else cpu_addr_int(15 downto 9) & '0' & cpu_addr_int(7 downto 0); inst_tube: entity work.tube port map ( h_addr => h_addr, h_cs_b => h_cs_b, h_data => h_data, h_phi2 => h_phi2, h_rdnw => h_rdnw, h_rst_b => h_rst_b, h_irq_b => h_irq_b, p_addr => cpu_addr(2 downto 0), p_cs_b => tube_cs_b, p_data_in => cpu_dout, p_data_out => p_data_out, p_rdnw => cpu_R_W_n, p_phi2 => cpu_clk, p_rst_b => RSTn, p_nmi_b => cpu_NMI_n, p_irq_b => cpu_IRQ_n ); tube_cs_b <= not ((not p_cs_b) and cpu_clken); p_cs_b <= '0' when vma = '1' and cpu_addr(15 downto 4) = "111111101110" else '1'; rom_cs_b <= '0' when vma = '1' and cpu_addr(15 downto 11) = "11111" and cpu_R_W_n = '1' and bootmode = '1' else '1'; ram_cs_b <= '0' when vma = '1' and p_cs_b = '1' and rom_cs_b = '1' else '1'; cpu_din <= p_data_out when p_cs_b = '0' else rom_data_out when rom_cs_b = '0' else ram_data when ram_cs_b = '0' else x"f1"; ram_ub_b <= '0'; ram_lb_b <= '0'; ram_cs <= ram_cs_b; ram_oe_int <= not ((not ram_cs_b) and cpu_R_W_n); ram_oe <= ram_oe_int; ram_wr_int <= not ((not ram_cs_b) and (not cpu_R_W_n) and cpu_clken); ram_wr <= ram_wr_int; ram_addr <= "000" & cpu_addr(15 downto 0); ram_data <= cpu_dout when cpu_R_W_n = '0' else "ZZZZZZZZ"; -------------------------------------------------------- -- test signals -------------------------------------------------------- -- default to hi-impedence, to avoid conflicts with -- a Raspberry Pi connected to the test connector test <= (others => 'Z'); -------------------------------------------------------- -- boot mode generator -------------------------------------------------------- boot_gen : process(cpu_clk, RSTn_sync) begin if RSTn_sync = '0' then bootmode <= '1'; elsif rising_edge(cpu_clk) then if p_cs_b = '0' then bootmode <= '0'; end if; end if; end process; -------------------------------------------------------- -- synchronize interrupts etc into 6809 core -------------------------------------------------------- sync_gen : process(cpu_clk, RSTn_sync) begin if RSTn_sync = '0' then cpu_NMI_sync <= '0'; cpu_IRQ_sync <= '0'; elsif rising_edge(cpu_clk) then cpu_NMI_sync <= not cpu_NMI_n; cpu_IRQ_sync <= not cpu_IRQ_n; end if; end process; -------------------------------------------------------- -- clock enable generator -------------------------------------------------------- -- TODO If the clock speed is increased from 4MHz to 8MHz -- e.g. with cpu_clken <= not cpu_clken -- then *SAVE skips every other byte clk_gen : process(cpu_clk) begin if rising_edge(cpu_clk) then clken_counter <= clken_counter + 1; cpu_clken <= clken_counter(0) and clken_counter(1); RSTn_sync <= RSTn; end if; end process; end BEHAVIORAL;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc521.vhd,v 1.2 2001-10-26 16:29:56 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- PACKAGE c03s03b00x00p03n04i00521pkg IS -- -- Index types for array declarations -- SUBTYPE st_ind1 IS INTEGER RANGE 1 TO 8; -- index from 1 (POSITIVE) SUBTYPE st_ind2 IS INTEGER RANGE 0 TO 3; -- index from 0 (NATURAL) SUBTYPE st_ind3 IS CHARACTER RANGE 'a' TO 'd'; -- non-INTEGER index SUBTYPE st_ind4 IS INTEGER RANGE 0 DOWNTO -3; -- descending range -- -- Scalar type for subelements -- SUBTYPE st_scl1 IS CHARACTER ; SUBTYPE st_scl3 IS INTEGER RANGE 1 TO INTEGER'HIGH; SUBTYPE st_scl4 IS REAL RANGE 0.0 TO 1024.0; -- ----------------------------------------------------------------------------------------- -- Composite type declarations -- ----------------------------------------------------------------------------------------- -- -- Records of scalars -- TYPE t_scre_1 IS RECORD left : st_scl1; second : TIME; third : st_scl3; right : st_scl4; END RECORD; -- -- Unconstrained arrays of scalars -- TYPE t_usa1_1 IS ARRAY (st_ind1 RANGE <>) OF st_scl1; TYPE t_usa1_2 IS ARRAY (st_ind2 RANGE <>) OF TIME; TYPE t_usa1_3 IS ARRAY (st_ind3 RANGE <>) OF st_scl3; TYPE t_usa1_4 IS ARRAY (st_ind4 RANGE <>) OF st_scl4; TYPE t_usa2_1 IS ARRAY (st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa3_1 IS ARRAY (st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa4_1 IS ARRAY (st_ind4 RANGE <>, st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; -- -- -- Constrained arrays of scalars (make compatable with unconstrained types -- SUBTYPE t_csa1_1 IS t_usa1_1 (st_ind1 ); SUBTYPE t_csa1_2 IS t_usa1_2 (st_ind2 ); SUBTYPE t_csa1_3 IS t_usa1_3 (st_ind3 ); SUBTYPE t_csa1_4 IS t_usa1_4 (st_ind4 ); SUBTYPE t_csa2_1 IS t_usa2_1 (st_ind2 , -- ( i2, i1 ) of CHAR st_ind1 ); SUBTYPE t_csa3_1 IS t_usa3_1 (st_ind3 , -- ( i3, i2, i1) of CHAR st_ind2 , st_ind1 ); SUBTYPE t_csa4_1 IS t_usa4_1 (st_ind4 , -- ( i4, i3, i2, i1 ) of CHAR st_ind3 , st_ind2 , st_ind1 ); -- -- -- constrained arrays of composites -- TYPE t_cca1_1 IS ARRAY (st_ind1) OF t_scre_1; -- ( i1 ) is RECORD of scalar TYPE t_cca1_2 IS ARRAY (st_ind2) OF t_csa1_1; -- ( i2 )( i1 ) is CHAR TYPE t_cca1_3 IS ARRAY (st_ind3) OF t_cca1_2; -- ( i3 )( i2 )( i1 ) is CHAR TYPE t_cca1_4 IS ARRAY (st_ind4) OF t_cca1_3; -- ( i4 )( i3 )( i2 )( i1 ) is CHAR TYPE t_cca2_1 IS ARRAY (st_ind3) OF t_csa2_1; -- ( i3 )( i2, i1 ) is CHAR TYPE t_cca2_2 IS ARRAY (st_ind4, -- ( i4, i3 )( i2, i1 ) of CHAR st_ind3) OF t_csa2_1; TYPE t_cca3_1 IS ARRAY (st_ind4, -- ( i4, i3, i2 )( i1 ) of CHAR st_ind3, st_ind2) OF t_csa1_1; TYPE t_cca3_2 IS ARRAY (st_ind4) OF t_csa3_1; -- ( i4 )( i3, i2, i1 ) is CHAR -- -- Records of composites -- TYPE t_cmre_1 IS RECORD left : t_csa1_1; -- .fN(i1) is CHAR second : t_scre_1; -- .fN.fN END RECORD; TYPE t_cmre_2 IS RECORD left , second , third , right : t_csa1_1; -- .fN(i1) is CHAR END RECORD; -- -- Mixed Records/arrays -- TYPE t_cca1_7 IS ARRAY (st_ind3) OF t_cmre_2; -- (i3).fN(i1) is CHAR TYPE t_cmre_3 IS RECORD left , second , third , right : t_cca1_7; -- .fN(i3).fN(i1) is CHAR END RECORD; -- -- TYPE declarations for resolution function (Constrained types only) -- TYPE t_scre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_scre_1; TYPE t_csa1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_1; TYPE t_csa1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_2; TYPE t_csa1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_3; TYPE t_csa1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_4; TYPE t_csa2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa2_1; TYPE t_csa3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa3_1; TYPE t_csa4_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa4_1; TYPE t_cca1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_1; TYPE t_cca1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_2; TYPE t_cca1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_3; TYPE t_cca1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_4; TYPE t_cca2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_1; TYPE t_cca2_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_2; TYPE t_cca3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_1; TYPE t_cca3_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_2; TYPE t_cmre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_1; TYPE t_cmre_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_2; TYPE t_cca1_7_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_7; TYPE t_cmre_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_3; -- -- Declaration of Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3; -- -- Resolved SUBTYPE declaration -- SUBTYPE rst_scre_1 IS rf_scre_1 t_scre_1 ; SUBTYPE rst_csa1_1 IS rf_csa1_1 t_csa1_1 ; SUBTYPE rst_csa1_2 IS rf_csa1_2 t_csa1_2 ; SUBTYPE rst_csa1_3 IS rf_csa1_3 t_csa1_3 ; SUBTYPE rst_csa1_4 IS rf_csa1_4 t_csa1_4 ; SUBTYPE rst_csa2_1 IS rf_csa2_1 t_csa2_1 ; SUBTYPE rst_csa3_1 IS rf_csa3_1 t_csa3_1 ; SUBTYPE rst_csa4_1 IS rf_csa4_1 t_csa4_1 ; SUBTYPE rst_cca1_1 IS rf_cca1_1 t_cca1_1 ; SUBTYPE rst_cca1_2 IS rf_cca1_2 t_cca1_2 ; SUBTYPE rst_cca1_3 IS rf_cca1_3 t_cca1_3 ; SUBTYPE rst_cca1_4 IS rf_cca1_4 t_cca1_4 ; SUBTYPE rst_cca2_1 IS rf_cca2_1 t_cca2_1 ; SUBTYPE rst_cca2_2 IS rf_cca2_2 t_cca2_2 ; SUBTYPE rst_cca3_1 IS rf_cca3_1 t_cca3_1 ; SUBTYPE rst_cca3_2 IS rf_cca3_2 t_cca3_2 ; SUBTYPE rst_cmre_1 IS rf_cmre_1 t_cmre_1 ; SUBTYPE rst_cmre_2 IS rf_cmre_2 t_cmre_2 ; SUBTYPE rst_cca1_7 IS rf_cca1_7 t_cca1_7 ; SUBTYPE rst_cmre_3 IS rf_cmre_3 t_cmre_3 ; -- -- Functions declarations for multi-dimensional comosite values -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 ; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 ; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 ; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 ; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 ; -- ------------------------------------------------------------------------------------------- -- Data values for Composite Types -- ------------------------------------------------------------------------------------------- CONSTANT CX_scl1 : st_scl1 := 'X' ; CONSTANT C0_scl1 : st_scl1 := st_scl1'LEFT ; CONSTANT C1_scl1 : st_scl1 := 'A' ; CONSTANT C2_scl1 : st_scl1 := 'Z' ; CONSTANT CX_scl2 : TIME := 99 fs ; CONSTANT C0_scl2 : TIME := TIME'LEFT ; CONSTANT C1_scl2 : TIME := 0 fs; CONSTANT C2_scl2 : TIME := 2 ns; CONSTANT CX_scl3 : st_scl3 := 15 ; CONSTANT C0_scl3 : st_scl3 := st_scl3'LEFT ; CONSTANT C1_scl3 : st_scl3 := 6 ; CONSTANT C2_scl3 : st_scl3 := 8 ; CONSTANT CX_scl4 : st_scl4 := 99.9 ; CONSTANT C0_scl4 : st_scl4 := st_scl4'LEFT ; CONSTANT C1_scl4 : st_scl4 := 1.0 ; CONSTANT C2_scl4 : st_scl4 := 2.1 ; CONSTANT CX_scre_1 : t_scre_1 := ( CX_scl1, CX_scl2, CX_scl3, CX_scl4 ); CONSTANT C0_scre_1 : t_scre_1 := ( C0_scl1, C0_scl2, C0_scl3, C0_scl4 ); CONSTANT C1_scre_1 : t_scre_1 := ( C1_scl1, C1_scl2, C1_scl3, C1_scl4 ); CONSTANT C2_scre_1 : t_scre_1 := ( C2_scl1, C0_scl2, C0_scl3, C2_scl4 ); CONSTANT CX_csa1_1 : t_csa1_1 := ( OTHERS=>CX_scl1); CONSTANT C0_csa1_1 : t_csa1_1 := ( OTHERS=>C0_scl1); CONSTANT C1_csa1_1 : t_csa1_1 := ( OTHERS=>C1_scl1); CONSTANT C2_csa1_1 : t_csa1_1 := ( t_csa1_1'LEFT|t_csa1_1'RIGHT=>C2_scl1, OTHERS =>C0_scl1); CONSTANT CX_csa1_2 : t_csa1_2 := ( OTHERS=>CX_scl2); CONSTANT C0_csa1_2 : t_csa1_2 := ( OTHERS=>C0_scl2); CONSTANT C1_csa1_2 : t_csa1_2 := ( OTHERS=>C1_scl2); CONSTANT C2_csa1_2 : t_csa1_2 := ( t_csa1_2'LEFT|t_csa1_2'RIGHT=>C2_scl2, OTHERS =>C0_scl2); CONSTANT CX_csa1_3 : t_csa1_3 := ( OTHERS=>CX_scl3); CONSTANT C0_csa1_3 : t_csa1_3 := ( OTHERS=>C0_scl3); CONSTANT C1_csa1_3 : t_csa1_3 := ( OTHERS=>C1_scl3); CONSTANT C2_csa1_3 : t_csa1_3 := ( t_csa1_3'LEFT|t_csa1_3'RIGHT=>C2_scl3, OTHERS =>C0_scl3); CONSTANT CX_csa1_4 : t_csa1_4 := ( OTHERS=>CX_scl4); CONSTANT C0_csa1_4 : t_csa1_4 := ( OTHERS=>C0_scl4); CONSTANT C1_csa1_4 : t_csa1_4 := ( OTHERS=>C1_scl4); CONSTANT C2_csa1_4 : t_csa1_4 := ( t_csa1_4'LEFT|t_csa1_4'RIGHT=>C2_scl4, OTHERS =>C0_scl4); -- CONSTANT CX_csa2_1 : t_csa2_1 ; CONSTANT C0_csa2_1 : t_csa2_1 ; CONSTANT C1_csa2_1 : t_csa2_1 ; CONSTANT C2_csa2_1 : t_csa2_1 ; CONSTANT CX_csa3_1 : t_csa3_1 ; CONSTANT C0_csa3_1 : t_csa3_1 ; CONSTANT C1_csa3_1 : t_csa3_1 ; CONSTANT C2_csa3_1 : t_csa3_1 ; CONSTANT CX_csa4_1 : t_csa4_1 ; CONSTANT C0_csa4_1 : t_csa4_1 ; CONSTANT C1_csa4_1 : t_csa4_1 ; CONSTANT C2_csa4_1 : t_csa4_1 ; -- CONSTANT CX_cca1_1 : t_cca1_1 := ( OTHERS=>CX_scre_1 ); CONSTANT C0_cca1_1 : t_cca1_1 := ( OTHERS=>C0_scre_1 ); CONSTANT C1_cca1_1 : t_cca1_1 := ( OTHERS=>C1_scre_1 ); CONSTANT C2_cca1_1 : t_cca1_1 := ( C2_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C2_scre_1 ); CONSTANT CX_cca1_2 : t_cca1_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cca1_2 : t_cca1_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cca1_2 : t_cca1_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cca1_2 : t_cca1_2 := ( C2_csa1_1, C0_csa1_1, C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca1_3 : t_cca1_3 := ( OTHERS=>CX_cca1_2 ); CONSTANT C0_cca1_3 : t_cca1_3 := ( OTHERS=>C0_cca1_2 ); CONSTANT C1_cca1_3 : t_cca1_3 := ( OTHERS=>C1_cca1_2 ); CONSTANT C2_cca1_3 : t_cca1_3 := ( C2_cca1_2, C0_cca1_2, C0_cca1_2, C2_cca1_2 ); CONSTANT CX_cca1_4 : t_cca1_4 := ( OTHERS=>CX_cca1_3 ); CONSTANT C0_cca1_4 : t_cca1_4 := ( OTHERS=>C0_cca1_3 ); CONSTANT C1_cca1_4 : t_cca1_4 := ( OTHERS=>C1_cca1_3 ); CONSTANT C2_cca1_4 : t_cca1_4 := ( C2_cca1_3, C0_cca1_3, C0_cca1_3, C2_cca1_3 ); CONSTANT CX_cca2_1 : t_cca2_1 ; CONSTANT C0_cca2_1 : t_cca2_1 ; CONSTANT C1_cca2_1 : t_cca2_1 ; CONSTANT C2_cca2_1 : t_cca2_1 ; -- CONSTANT CX_cca2_2 : t_cca2_2 ; CONSTANT C0_cca2_2 : t_cca2_2 ; CONSTANT C1_cca2_2 : t_cca2_2 ; CONSTANT C2_cca2_2 : t_cca2_2 ; CONSTANT CX_cca3_1 : t_cca3_1 ; CONSTANT C0_cca3_1 : t_cca3_1 ; CONSTANT C1_cca3_1 : t_cca3_1 ; CONSTANT C2_cca3_1 : t_cca3_1 ; -- CONSTANT CX_cca3_2 : t_cca3_2 ; CONSTANT C0_cca3_2 : t_cca3_2 ; CONSTANT C1_cca3_2 : t_cca3_2 ; CONSTANT C2_cca3_2 : t_cca3_2 ; CONSTANT CX_cmre_1 : t_cmre_1 := ( CX_csa1_1, CX_scre_1 ); CONSTANT C0_cmre_1 : t_cmre_1 := ( C0_csa1_1, C0_scre_1 ); CONSTANT C1_cmre_1 : t_cmre_1 := ( C1_csa1_1, C1_scre_1 ); CONSTANT C2_cmre_1 : t_cmre_1 := ( C2_csa1_1, C0_scre_1 ); CONSTANT CX_cmre_2 : t_cmre_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cmre_2 : t_cmre_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cmre_2 : t_cmre_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cmre_2 : t_cmre_2 := ( left|right=>C2_csa1_1, OTHERS=>C0_csa1_1 ); CONSTANT CX_cca1_7 : t_cca1_7 := ( OTHERS=>CX_cmre_2 ); CONSTANT C0_cca1_7 : t_cca1_7 := ( OTHERS=>C0_cmre_2 ); CONSTANT C1_cca1_7 : t_cca1_7 := ( OTHERS=>C1_cmre_2 ); CONSTANT C2_cca1_7 : t_cca1_7 := ( C2_cmre_2, C0_cmre_2, C0_cmre_2, C2_cmre_2 ); CONSTANT CX_cmre_3 : t_cmre_3 := ( OTHERS=>CX_cca1_7 ); CONSTANT C0_cmre_3 : t_cmre_3 := ( OTHERS=>C0_cca1_7 ); CONSTANT C1_cmre_3 : t_cmre_3 := ( OTHERS=>C1_cca1_7 ); CONSTANT C2_cmre_3 : t_cmre_3 := ( left|right=>C2_cca1_7, OTHERS=>C0_cca1_7 ); -- -------------------------------------------------------------------------------------------- -- Functions for mapping from integer test values to/from values of the Test types -- -------------------------------------------------------------------------------------------- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1; FUNCTION val_t ( i : INTEGER ) RETURN TIME; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3; FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER; FUNCTION val_i ( i : TIME ) RETURN INTEGER; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER; FUNCTION val_s ( i : st_scl1 ) RETURN STRING; FUNCTION val_s ( i : TIME ) RETURN STRING; FUNCTION val_s ( i : st_scl3 ) RETURN STRING; FUNCTION val_s ( i : st_scl4 ) RETURN STRING; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING; END; PACKAGE BODY c03s03b00x00p03n04i00521pkg IS CONSTANT CX_csa2_1 : t_csa2_1 := F_csa2_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa2_1 : t_csa2_1 := F_csa2_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa3_1 : t_csa3_1 := F_csa3_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa3_1 : t_csa3_1 := F_csa3_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa4_1 : t_csa4_1 := F_csa4_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa4_1 : t_csa4_1 := F_csa4_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_cca2_1 : t_cca2_1 := ( OTHERS=>CX_csa2_1 ); CONSTANT C0_cca2_1 : t_cca2_1 := ( OTHERS=>C0_csa2_1 ); CONSTANT C1_cca2_1 : t_cca2_1 := ( OTHERS=>C1_csa2_1 ); CONSTANT C2_cca2_1 : t_cca2_1 := ( C2_csa2_1, C0_csa2_1, C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca2_2 : t_cca2_2 := F_cca2_2 ( CX_csa2_1, CX_csa2_1 ); CONSTANT C0_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C0_csa2_1 ); CONSTANT C1_cca2_2 : t_cca2_2 := F_cca2_2 ( C1_csa2_1, C1_csa2_1 ); CONSTANT C2_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca3_1 : t_cca3_1 := F_cca3_1 ( CX_csa1_1, CX_csa1_1 ); CONSTANT C0_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C0_csa1_1 ); CONSTANT C1_cca3_1 : t_cca3_1 := F_cca3_1 ( C1_csa1_1, C1_csa1_1 ); CONSTANT C2_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca3_2 : t_cca3_2 := ( OTHERS=>CX_csa3_1 ); CONSTANT C0_cca3_2 : t_cca3_2 := ( OTHERS=>C0_csa3_1 ); CONSTANT C1_cca3_2 : t_cca3_2 := ( OTHERS=>C1_csa3_1 ); CONSTANT C2_cca3_2 : t_cca3_2 := ( C2_csa3_1, C0_csa3_1, C0_csa3_1, C2_csa3_1 ); -- -- Functions to provide values for multi-dimensional composites -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 IS VARIABLE res : t_csa2_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 IS VARIABLE res : t_csa3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 IS VARIABLE res : t_csa4_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP FOR l IN res'RANGE(4) LOOP res(i,j,k,l) := v0; END LOOP; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3),res'left (4)) := v2; res(res'right(1),res'left (2),res'left (3),res'left (4)) := v2; res(res'left (1),res'right(2),res'left (3),res'left (4)) := v2; res(res'right(1),res'right(2),res'left (3),res'left (4)) := v2; res(res'left (1),res'left (2),res'right(3),res'left (4)) := v2; res(res'right(1),res'left (2),res'right(3),res'left (4)) := v2; res(res'left (1),res'right(2),res'right(3),res'left (4)) := v2; res(res'right(1),res'right(2),res'right(3),res'left (4)) := v2; res(res'left (1),res'left (2),res'left (3),res'right(4)) := v2; res(res'right(1),res'left (2),res'left (3),res'right(4)) := v2; res(res'left (1),res'right(2),res'left (3),res'right(4)) := v2; res(res'right(1),res'right(2),res'left (3),res'right(4)) := v2; res(res'left (1),res'left (2),res'right(3),res'right(4)) := v2; res(res'right(1),res'left (2),res'right(3),res'right(4)) := v2; res(res'left (1),res'right(2),res'right(3),res'right(4)) := v2; res(res'right(1),res'right(2),res'right(3),res'right(4)) := v2; RETURN res; END; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 IS VARIABLE res : t_cca2_2; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 IS VARIABLE res : t_cca3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; -- -- Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_scre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa4_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_7; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_3; ELSE RETURN v(1); END IF; END; -- -- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1 IS BEGIN IF i = 0 THEN RETURN C0_scl1; END IF; IF i = 1 THEN RETURN C1_scl1; END IF; IF i = 2 THEN RETURN C2_scl1; END IF; RETURN CX_scl1; END; FUNCTION val_t ( i : INTEGER ) RETURN TIME IS BEGIN IF i = 0 THEN RETURN C0_scl2; END IF; IF i = 1 THEN RETURN C1_scl2; END IF; IF i = 2 THEN RETURN C2_scl2; END IF; RETURN CX_scl2; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3 IS BEGIN IF i = 0 THEN RETURN C0_scl3; END IF; IF i = 1 THEN RETURN C1_scl3; END IF; IF i = 2 THEN RETURN C2_scl3; END IF; RETURN CX_scl3; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4 IS BEGIN IF i = 0 THEN RETURN C0_scl4; END IF; IF i = 1 THEN RETURN C1_scl4; END IF; IF i = 2 THEN RETURN C2_scl4; END IF; RETURN CX_scl4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1 IS BEGIN IF i = 0 THEN RETURN C0_scre_1; END IF; IF i = 1 THEN RETURN C1_scre_1; END IF; IF i = 2 THEN RETURN C2_scre_1; END IF; RETURN CX_scre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1 IS BEGIN IF i = 0 THEN RETURN C0_csa1_1; END IF; IF i = 1 THEN RETURN C1_csa1_1; END IF; IF i = 2 THEN RETURN C2_csa1_1; END IF; RETURN CX_csa1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2 IS BEGIN IF i = 0 THEN RETURN C0_csa1_2; END IF; IF i = 1 THEN RETURN C1_csa1_2; END IF; IF i = 2 THEN RETURN C2_csa1_2; END IF; RETURN CX_csa1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3 IS BEGIN IF i = 0 THEN RETURN C0_csa1_3; END IF; IF i = 1 THEN RETURN C1_csa1_3; END IF; IF i = 2 THEN RETURN C2_csa1_3; END IF; RETURN CX_csa1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4 IS BEGIN IF i = 0 THEN RETURN C0_csa1_4; END IF; IF i = 1 THEN RETURN C1_csa1_4; END IF; IF i = 2 THEN RETURN C2_csa1_4; END IF; RETURN CX_csa1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1 IS BEGIN IF i = 0 THEN RETURN C0_csa2_1; END IF; IF i = 1 THEN RETURN C1_csa2_1; END IF; IF i = 2 THEN RETURN C2_csa2_1; END IF; RETURN CX_csa2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1 IS BEGIN IF i = 0 THEN RETURN C0_csa3_1; END IF; IF i = 1 THEN RETURN C1_csa3_1; END IF; IF i = 2 THEN RETURN C2_csa3_1; END IF; RETURN CX_csa3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1 IS BEGIN IF i = 0 THEN RETURN C0_csa4_1; END IF; IF i = 1 THEN RETURN C1_csa4_1; END IF; IF i = 2 THEN RETURN C2_csa4_1; END IF; RETURN CX_csa4_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1 IS BEGIN IF i = 0 THEN RETURN C0_cca1_1; END IF; IF i = 1 THEN RETURN C1_cca1_1; END IF; IF i = 2 THEN RETURN C2_cca1_1; END IF; RETURN CX_cca1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2 IS BEGIN IF i = 0 THEN RETURN C0_cca1_2; END IF; IF i = 1 THEN RETURN C1_cca1_2; END IF; IF i = 2 THEN RETURN C2_cca1_2; END IF; RETURN CX_cca1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3 IS BEGIN IF i = 0 THEN RETURN C0_cca1_3; END IF; IF i = 1 THEN RETURN C1_cca1_3; END IF; IF i = 2 THEN RETURN C2_cca1_3; END IF; RETURN CX_cca1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4 IS BEGIN IF i = 0 THEN RETURN C0_cca1_4; END IF; IF i = 1 THEN RETURN C1_cca1_4; END IF; IF i = 2 THEN RETURN C2_cca1_4; END IF; RETURN CX_cca1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1 IS BEGIN IF i = 0 THEN RETURN C0_cca2_1; END IF; IF i = 1 THEN RETURN C1_cca2_1; END IF; IF i = 2 THEN RETURN C2_cca2_1; END IF; RETURN CX_cca2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2 IS BEGIN IF i = 0 THEN RETURN C0_cca2_2; END IF; IF i = 1 THEN RETURN C1_cca2_2; END IF; IF i = 2 THEN RETURN C2_cca2_2; END IF; RETURN CX_cca2_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1 IS BEGIN IF i = 0 THEN RETURN C0_cca3_1; END IF; IF i = 1 THEN RETURN C1_cca3_1; END IF; IF i = 2 THEN RETURN C2_cca3_1; END IF; RETURN CX_cca3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2 IS BEGIN IF i = 0 THEN RETURN C0_cca3_2; END IF; IF i = 1 THEN RETURN C1_cca3_2; END IF; IF i = 2 THEN RETURN C2_cca3_2; END IF; RETURN CX_cca3_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1 IS BEGIN IF i = 0 THEN RETURN C0_cmre_1; END IF; IF i = 1 THEN RETURN C1_cmre_1; END IF; IF i = 2 THEN RETURN C2_cmre_1; END IF; RETURN CX_cmre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2 IS BEGIN IF i = 0 THEN RETURN C0_cmre_2; END IF; IF i = 1 THEN RETURN C1_cmre_2; END IF; IF i = 2 THEN RETURN C2_cmre_2; END IF; RETURN CX_cmre_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7 IS BEGIN IF i = 0 THEN RETURN C0_cca1_7; END IF; IF i = 1 THEN RETURN C1_cca1_7; END IF; IF i = 2 THEN RETURN C2_cca1_7; END IF; RETURN CX_cca1_7; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3 IS BEGIN IF i = 0 THEN RETURN C0_cmre_3; END IF; IF i = 1 THEN RETURN C1_cmre_3; END IF; IF i = 2 THEN RETURN C2_cmre_3; END IF; RETURN CX_cmre_3; END; -- -- FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER IS BEGIN IF i = C0_scl1 THEN RETURN 0; END IF; IF i = C1_scl1 THEN RETURN 1; END IF; IF i = C2_scl1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : TIME ) RETURN INTEGER IS BEGIN IF i = C0_scl2 THEN RETURN 0; END IF; IF i = C1_scl2 THEN RETURN 1; END IF; IF i = C2_scl2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER IS BEGIN IF i = C0_scl3 THEN RETURN 0; END IF; IF i = C1_scl3 THEN RETURN 1; END IF; IF i = C2_scl3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER IS BEGIN IF i = C0_scl4 THEN RETURN 0; END IF; IF i = C1_scl4 THEN RETURN 1; END IF; IF i = C2_scl4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER IS BEGIN IF i = C0_scre_1 THEN RETURN 0; END IF; IF i = C1_scre_1 THEN RETURN 1; END IF; IF i = C2_scre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_1 THEN RETURN 0; END IF; IF i = C1_csa1_1 THEN RETURN 1; END IF; IF i = C2_csa1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_2 THEN RETURN 0; END IF; IF i = C1_csa1_2 THEN RETURN 1; END IF; IF i = C2_csa1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_3 THEN RETURN 0; END IF; IF i = C1_csa1_3 THEN RETURN 1; END IF; IF i = C2_csa1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_4 THEN RETURN 0; END IF; IF i = C1_csa1_4 THEN RETURN 1; END IF; IF i = C2_csa1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa2_1 THEN RETURN 0; END IF; IF i = C1_csa2_1 THEN RETURN 1; END IF; IF i = C2_csa2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa3_1 THEN RETURN 0; END IF; IF i = C1_csa3_1 THEN RETURN 1; END IF; IF i = C2_csa3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa4_1 THEN RETURN 0; END IF; IF i = C1_csa4_1 THEN RETURN 1; END IF; IF i = C2_csa4_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_1 THEN RETURN 0; END IF; IF i = C1_cca1_1 THEN RETURN 1; END IF; IF i = C2_cca1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_2 THEN RETURN 0; END IF; IF i = C1_cca1_2 THEN RETURN 1; END IF; IF i = C2_cca1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_3 THEN RETURN 0; END IF; IF i = C1_cca1_3 THEN RETURN 1; END IF; IF i = C2_cca1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_4 THEN RETURN 0; END IF; IF i = C1_cca1_4 THEN RETURN 1; END IF; IF i = C2_cca1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_1 THEN RETURN 0; END IF; IF i = C1_cca2_1 THEN RETURN 1; END IF; IF i = C2_cca2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_2 THEN RETURN 0; END IF; IF i = C1_cca2_2 THEN RETURN 1; END IF; IF i = C2_cca2_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_1 THEN RETURN 0; END IF; IF i = C1_cca3_1 THEN RETURN 1; END IF; IF i = C2_cca3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_2 THEN RETURN 0; END IF; IF i = C1_cca3_2 THEN RETURN 1; END IF; IF i = C2_cca3_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_1 THEN RETURN 0; END IF; IF i = C1_cmre_1 THEN RETURN 1; END IF; IF i = C2_cmre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_2 THEN RETURN 0; END IF; IF i = C1_cmre_2 THEN RETURN 1; END IF; IF i = C2_cmre_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_7 THEN RETURN 0; END IF; IF i = C1_cca1_7 THEN RETURN 1; END IF; IF i = C2_cca1_7 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_3 THEN RETURN 0; END IF; IF i = C1_cmre_3 THEN RETURN 1; END IF; IF i = C2_cmre_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_s ( i : st_scl1 ) RETURN STRING IS BEGIN IF i = C0_scl1 THEN RETURN "C0_scl1"; END IF; IF i = C1_scl1 THEN RETURN "C1_scl1"; END IF; IF i = C2_scl1 THEN RETURN "C2_scl1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : TIME ) RETURN STRING IS BEGIN IF i = C0_scl2 THEN RETURN "C0_scl2"; END IF; IF i = C1_scl2 THEN RETURN "C1_scl2"; END IF; IF i = C2_scl2 THEN RETURN "C2_scl2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl3 ) RETURN STRING IS BEGIN IF i = C0_scl3 THEN RETURN "C0_scl3"; END IF; IF i = C1_scl3 THEN RETURN "C1_scl3"; END IF; IF i = C2_scl3 THEN RETURN "C2_scl3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl4 ) RETURN STRING IS BEGIN IF i = C0_scl4 THEN RETURN "C0_scl4"; END IF; IF i = C1_scl4 THEN RETURN "C1_scl4"; END IF; IF i = C2_scl4 THEN RETURN "C2_scl4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING IS BEGIN IF i = C0_scre_1 THEN RETURN "C0_scre_1"; END IF; IF i = C1_scre_1 THEN RETURN "C1_scre_1"; END IF; IF i = C2_scre_1 THEN RETURN "C2_scre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING IS BEGIN IF i = C0_csa1_1 THEN RETURN "C0_csa1_1"; END IF; IF i = C1_csa1_1 THEN RETURN "C1_csa1_1"; END IF; IF i = C2_csa1_1 THEN RETURN "C2_csa1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING IS BEGIN IF i = C0_csa1_2 THEN RETURN "C0_csa1_2"; END IF; IF i = C1_csa1_2 THEN RETURN "C1_csa1_2"; END IF; IF i = C2_csa1_2 THEN RETURN "C2_csa1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING IS BEGIN IF i = C0_csa1_3 THEN RETURN "C0_csa1_3"; END IF; IF i = C1_csa1_3 THEN RETURN "C1_csa1_3"; END IF; IF i = C2_csa1_3 THEN RETURN "C2_csa1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING IS BEGIN IF i = C0_csa1_4 THEN RETURN "C0_csa1_4"; END IF; IF i = C1_csa1_4 THEN RETURN "C1_csa1_4"; END IF; IF i = C2_csa1_4 THEN RETURN "C2_csa1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING IS BEGIN IF i = C0_csa2_1 THEN RETURN "C0_csa2_1"; END IF; IF i = C1_csa2_1 THEN RETURN "C1_csa2_1"; END IF; IF i = C2_csa2_1 THEN RETURN "C2_csa2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING IS BEGIN IF i = C0_csa3_1 THEN RETURN "C0_csa3_1"; END IF; IF i = C1_csa3_1 THEN RETURN "C1_csa3_1"; END IF; IF i = C2_csa3_1 THEN RETURN "C2_csa3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING IS BEGIN IF i = C0_csa4_1 THEN RETURN "C0_csa4_1"; END IF; IF i = C1_csa4_1 THEN RETURN "C1_csa4_1"; END IF; IF i = C2_csa4_1 THEN RETURN "C2_csa4_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING IS BEGIN IF i = C0_cca1_1 THEN RETURN "C0_cca1_1"; END IF; IF i = C1_cca1_1 THEN RETURN "C1_cca1_1"; END IF; IF i = C2_cca1_1 THEN RETURN "C2_cca1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING IS BEGIN IF i = C0_cca1_2 THEN RETURN "C0_cca1_2"; END IF; IF i = C1_cca1_2 THEN RETURN "C1_cca1_2"; END IF; IF i = C2_cca1_2 THEN RETURN "C2_cca1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING IS BEGIN IF i = C0_cca1_3 THEN RETURN "C0_cca1_3"; END IF; IF i = C1_cca1_3 THEN RETURN "C1_cca1_3"; END IF; IF i = C2_cca1_3 THEN RETURN "C2_cca1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING IS BEGIN IF i = C0_cca1_4 THEN RETURN "C0_cca1_4"; END IF; IF i = C1_cca1_4 THEN RETURN "C1_cca1_4"; END IF; IF i = C2_cca1_4 THEN RETURN "C2_cca1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING IS BEGIN IF i = C0_cca2_1 THEN RETURN "C0_cca2_1"; END IF; IF i = C1_cca2_1 THEN RETURN "C1_cca2_1"; END IF; IF i = C2_cca2_1 THEN RETURN "C2_cca2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING IS BEGIN IF i = C0_cca2_2 THEN RETURN "C0_cca2_2"; END IF; IF i = C1_cca2_2 THEN RETURN "C1_cca2_2"; END IF; IF i = C2_cca2_2 THEN RETURN "C2_cca2_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING IS BEGIN IF i = C0_cca3_1 THEN RETURN "C0_cca3_1"; END IF; IF i = C1_cca3_1 THEN RETURN "C1_cca3_1"; END IF; IF i = C2_cca3_1 THEN RETURN "C2_cca3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING IS BEGIN IF i = C0_cca3_2 THEN RETURN "C0_cca3_2"; END IF; IF i = C1_cca3_2 THEN RETURN "C1_cca3_2"; END IF; IF i = C2_cca3_2 THEN RETURN "C2_cca3_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING IS BEGIN IF i = C0_cmre_1 THEN RETURN "C0_cmre_1"; END IF; IF i = C1_cmre_1 THEN RETURN "C1_cmre_1"; END IF; IF i = C2_cmre_1 THEN RETURN "C2_cmre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING IS BEGIN IF i = C0_cmre_2 THEN RETURN "C0_cmre_2"; END IF; IF i = C1_cmre_2 THEN RETURN "C1_cmre_2"; END IF; IF i = C2_cmre_2 THEN RETURN "C2_cmre_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING IS BEGIN IF i = C0_cca1_7 THEN RETURN "C0_cca1_7"; END IF; IF i = C1_cca1_7 THEN RETURN "C1_cca1_7"; END IF; IF i = C2_cca1_7 THEN RETURN "C2_cca1_7"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING IS BEGIN IF i = C0_cmre_3 THEN RETURN "C0_cmre_3"; END IF; IF i = C1_cmre_3 THEN RETURN "C1_cmre_3"; END IF; IF i = C2_cmre_3 THEN RETURN "C2_cmre_3"; END IF; RETURN "UNKNOWN"; END; END c03s03b00x00p03n04i00521pkg; USE work.c03s03b00x00p03n04i00521pkg.ALL; ENTITY c03s03b00x00p03n04i00521ent IS END c03s03b00x00p03n04i00521ent; ARCHITECTURE c03s03b00x00p03n04i00521arch OF c03s03b00x00p03n04i00521ent IS -- -- Access type declarations -- TYPE at_usa2_1 IS ACCESS t_usa2_1 ; TYPE at_usa3_1 IS ACCESS t_usa3_1 ; TYPE at_usa4_1 IS ACCESS t_usa4_1 ; TYPE at_csa2_1 IS ACCESS t_csa2_1 ; TYPE at_csa3_1 IS ACCESS t_csa3_1 ; TYPE at_csa4_1 IS ACCESS t_csa4_1 ; TYPE at_cca2_1 IS ACCESS t_cca2_1 ; TYPE at_cca2_2 IS ACCESS t_cca2_2 ; TYPE at_cca3_1 IS ACCESS t_cca3_1 ; TYPE at_cca3_2 IS ACCESS t_cca3_2 ; -- -- BEGIN TESTING: PROCESS -- -- ACCESS VARIABLE declarations -- VARIABLE AV0_usa2_1 : at_usa2_1 ; VARIABLE AV2_usa2_1 : at_usa2_1 ; VARIABLE AV0_usa3_1 : at_usa3_1 ; VARIABLE AV2_usa3_1 : at_usa3_1 ; VARIABLE AV0_usa4_1 : at_usa4_1 ; VARIABLE AV2_usa4_1 : at_usa4_1 ; VARIABLE AV0_csa2_1 : at_csa2_1 ; VARIABLE AV2_csa2_1 : at_csa2_1 ; VARIABLE AV0_csa3_1 : at_csa3_1 ; VARIABLE AV2_csa3_1 : at_csa3_1 ; VARIABLE AV0_csa4_1 : at_csa4_1 ; VARIABLE AV2_csa4_1 : at_csa4_1 ; VARIABLE AV0_cca2_1 : at_cca2_1 ; VARIABLE AV2_cca2_1 : at_cca2_1 ; VARIABLE AV0_cca2_2 : at_cca2_2 ; VARIABLE AV2_cca2_2 : at_cca2_2 ; VARIABLE AV0_cca3_1 : at_cca3_1 ; VARIABLE AV2_cca3_1 : at_cca3_1 ; VARIABLE AV0_cca3_2 : at_cca3_2 ; VARIABLE AV2_cca3_2 : at_cca3_2 ; -- -- BEGIN -- -- Allocation of access values -- AV0_usa2_1 := NEW t_usa2_1 ( st_ind2, st_ind1 ) ; AV0_usa3_1 := NEW t_usa3_1 ( st_ind3, st_ind2, st_ind1 ) ; AV0_usa4_1 := NEW t_usa4_1 (st_ind4, st_ind3, st_ind2, st_ind1 ) ; AV0_csa2_1 := NEW t_csa2_1 ; AV0_csa3_1 := NEW t_csa3_1 ; AV0_csa4_1 := NEW t_csa4_1 ; AV0_cca2_1 := NEW t_cca2_1 ; AV0_cca2_2 := NEW t_cca2_2 ; AV0_cca3_1 := NEW t_cca3_1 ; AV0_cca3_2 := NEW t_cca3_2 ; --- AV2_usa2_1 := NEW t_usa2_1 ' ( C2_csa2_1 ) ; AV2_usa3_1 := NEW t_usa3_1 ' ( C2_csa3_1 ) ; AV2_usa4_1 := NEW t_usa4_1 ' ( C2_csa4_1 ) ; AV2_csa2_1 := NEW t_csa2_1 ' ( C2_csa2_1 ) ; AV2_csa3_1 := NEW t_csa3_1 ' ( C2_csa3_1 ) ; AV2_csa4_1 := NEW t_csa4_1 ' ( C2_csa4_1 ) ; AV2_cca2_1 := NEW t_cca2_1 ' ( C2_cca2_1 ) ; AV2_cca2_2 := NEW t_cca2_2 ' ( C2_cca2_2 ) ; AV2_cca3_1 := NEW t_cca3_1 ' ( C2_cca3_1 ) ; AV2_cca3_2 := NEW t_cca3_2 ' ( C2_cca3_2 ) ; -- -- ASSERT AV0_usa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_usa2_1" SEVERITY FAILURE; ASSERT AV2_usa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_usa2_1" SEVERITY FAILURE; ASSERT AV0_usa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_usa3_1" SEVERITY FAILURE; ASSERT AV2_usa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_usa3_1" SEVERITY FAILURE; ASSERT AV0_usa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_usa4_1" SEVERITY FAILURE; ASSERT AV2_usa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_usa4_1" SEVERITY FAILURE; ASSERT AV0_csa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_csa2_1" SEVERITY FAILURE; ASSERT AV2_csa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_csa2_1" SEVERITY FAILURE; ASSERT AV0_csa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_csa3_1" SEVERITY FAILURE; ASSERT AV2_csa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_csa3_1" SEVERITY FAILURE; ASSERT AV0_csa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_csa4_1" SEVERITY FAILURE; ASSERT AV2_csa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_csa4_1" SEVERITY FAILURE; ASSERT AV0_cca2_1.all = C0_cca2_1 REPORT "Improper initialization of AV0_cca2_1" SEVERITY FAILURE; ASSERT AV2_cca2_1.all = C2_cca2_1 REPORT "Improper initialization of AV2_cca2_1" SEVERITY FAILURE; ASSERT AV0_cca2_2.all = C0_cca2_2 REPORT "Improper initialization of AV0_cca2_2" SEVERITY FAILURE; ASSERT AV2_cca2_2.all = C2_cca2_2 REPORT "Improper initialization of AV2_cca2_2" SEVERITY FAILURE; ASSERT AV0_cca3_1.all = C0_cca3_1 REPORT "Improper initialization of AV0_cca3_1" SEVERITY FAILURE; ASSERT AV2_cca3_1.all = C2_cca3_1 REPORT "Improper initialization of AV2_cca3_1" SEVERITY FAILURE; ASSERT AV0_cca3_2.all = C0_cca3_2 REPORT "Improper initialization of AV0_cca3_2" SEVERITY FAILURE; ASSERT AV2_cca3_2.all = C2_cca3_2 REPORT "Improper initialization of AV2_cca3_2" SEVERITY FAILURE; -- -- assert NOT( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***PASSED TEST: c03s03b00x00p03n04i00521" severity NOTE; assert ( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***FAILED TEST: c03s03b00x00p03n04i00521 - Each access value designates an object of the subtype defined by the subtype indication of the access type definition." severity ERROR; wait; END PROCESS TESTING; END c03s03b00x00p03n04i00521arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc521.vhd,v 1.2 2001-10-26 16:29:56 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- PACKAGE c03s03b00x00p03n04i00521pkg IS -- -- Index types for array declarations -- SUBTYPE st_ind1 IS INTEGER RANGE 1 TO 8; -- index from 1 (POSITIVE) SUBTYPE st_ind2 IS INTEGER RANGE 0 TO 3; -- index from 0 (NATURAL) SUBTYPE st_ind3 IS CHARACTER RANGE 'a' TO 'd'; -- non-INTEGER index SUBTYPE st_ind4 IS INTEGER RANGE 0 DOWNTO -3; -- descending range -- -- Scalar type for subelements -- SUBTYPE st_scl1 IS CHARACTER ; SUBTYPE st_scl3 IS INTEGER RANGE 1 TO INTEGER'HIGH; SUBTYPE st_scl4 IS REAL RANGE 0.0 TO 1024.0; -- ----------------------------------------------------------------------------------------- -- Composite type declarations -- ----------------------------------------------------------------------------------------- -- -- Records of scalars -- TYPE t_scre_1 IS RECORD left : st_scl1; second : TIME; third : st_scl3; right : st_scl4; END RECORD; -- -- Unconstrained arrays of scalars -- TYPE t_usa1_1 IS ARRAY (st_ind1 RANGE <>) OF st_scl1; TYPE t_usa1_2 IS ARRAY (st_ind2 RANGE <>) OF TIME; TYPE t_usa1_3 IS ARRAY (st_ind3 RANGE <>) OF st_scl3; TYPE t_usa1_4 IS ARRAY (st_ind4 RANGE <>) OF st_scl4; TYPE t_usa2_1 IS ARRAY (st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa3_1 IS ARRAY (st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa4_1 IS ARRAY (st_ind4 RANGE <>, st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; -- -- -- Constrained arrays of scalars (make compatable with unconstrained types -- SUBTYPE t_csa1_1 IS t_usa1_1 (st_ind1 ); SUBTYPE t_csa1_2 IS t_usa1_2 (st_ind2 ); SUBTYPE t_csa1_3 IS t_usa1_3 (st_ind3 ); SUBTYPE t_csa1_4 IS t_usa1_4 (st_ind4 ); SUBTYPE t_csa2_1 IS t_usa2_1 (st_ind2 , -- ( i2, i1 ) of CHAR st_ind1 ); SUBTYPE t_csa3_1 IS t_usa3_1 (st_ind3 , -- ( i3, i2, i1) of CHAR st_ind2 , st_ind1 ); SUBTYPE t_csa4_1 IS t_usa4_1 (st_ind4 , -- ( i4, i3, i2, i1 ) of CHAR st_ind3 , st_ind2 , st_ind1 ); -- -- -- constrained arrays of composites -- TYPE t_cca1_1 IS ARRAY (st_ind1) OF t_scre_1; -- ( i1 ) is RECORD of scalar TYPE t_cca1_2 IS ARRAY (st_ind2) OF t_csa1_1; -- ( i2 )( i1 ) is CHAR TYPE t_cca1_3 IS ARRAY (st_ind3) OF t_cca1_2; -- ( i3 )( i2 )( i1 ) is CHAR TYPE t_cca1_4 IS ARRAY (st_ind4) OF t_cca1_3; -- ( i4 )( i3 )( i2 )( i1 ) is CHAR TYPE t_cca2_1 IS ARRAY (st_ind3) OF t_csa2_1; -- ( i3 )( i2, i1 ) is CHAR TYPE t_cca2_2 IS ARRAY (st_ind4, -- ( i4, i3 )( i2, i1 ) of CHAR st_ind3) OF t_csa2_1; TYPE t_cca3_1 IS ARRAY (st_ind4, -- ( i4, i3, i2 )( i1 ) of CHAR st_ind3, st_ind2) OF t_csa1_1; TYPE t_cca3_2 IS ARRAY (st_ind4) OF t_csa3_1; -- ( i4 )( i3, i2, i1 ) is CHAR -- -- Records of composites -- TYPE t_cmre_1 IS RECORD left : t_csa1_1; -- .fN(i1) is CHAR second : t_scre_1; -- .fN.fN END RECORD; TYPE t_cmre_2 IS RECORD left , second , third , right : t_csa1_1; -- .fN(i1) is CHAR END RECORD; -- -- Mixed Records/arrays -- TYPE t_cca1_7 IS ARRAY (st_ind3) OF t_cmre_2; -- (i3).fN(i1) is CHAR TYPE t_cmre_3 IS RECORD left , second , third , right : t_cca1_7; -- .fN(i3).fN(i1) is CHAR END RECORD; -- -- TYPE declarations for resolution function (Constrained types only) -- TYPE t_scre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_scre_1; TYPE t_csa1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_1; TYPE t_csa1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_2; TYPE t_csa1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_3; TYPE t_csa1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_4; TYPE t_csa2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa2_1; TYPE t_csa3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa3_1; TYPE t_csa4_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa4_1; TYPE t_cca1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_1; TYPE t_cca1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_2; TYPE t_cca1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_3; TYPE t_cca1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_4; TYPE t_cca2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_1; TYPE t_cca2_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_2; TYPE t_cca3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_1; TYPE t_cca3_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_2; TYPE t_cmre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_1; TYPE t_cmre_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_2; TYPE t_cca1_7_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_7; TYPE t_cmre_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_3; -- -- Declaration of Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3; -- -- Resolved SUBTYPE declaration -- SUBTYPE rst_scre_1 IS rf_scre_1 t_scre_1 ; SUBTYPE rst_csa1_1 IS rf_csa1_1 t_csa1_1 ; SUBTYPE rst_csa1_2 IS rf_csa1_2 t_csa1_2 ; SUBTYPE rst_csa1_3 IS rf_csa1_3 t_csa1_3 ; SUBTYPE rst_csa1_4 IS rf_csa1_4 t_csa1_4 ; SUBTYPE rst_csa2_1 IS rf_csa2_1 t_csa2_1 ; SUBTYPE rst_csa3_1 IS rf_csa3_1 t_csa3_1 ; SUBTYPE rst_csa4_1 IS rf_csa4_1 t_csa4_1 ; SUBTYPE rst_cca1_1 IS rf_cca1_1 t_cca1_1 ; SUBTYPE rst_cca1_2 IS rf_cca1_2 t_cca1_2 ; SUBTYPE rst_cca1_3 IS rf_cca1_3 t_cca1_3 ; SUBTYPE rst_cca1_4 IS rf_cca1_4 t_cca1_4 ; SUBTYPE rst_cca2_1 IS rf_cca2_1 t_cca2_1 ; SUBTYPE rst_cca2_2 IS rf_cca2_2 t_cca2_2 ; SUBTYPE rst_cca3_1 IS rf_cca3_1 t_cca3_1 ; SUBTYPE rst_cca3_2 IS rf_cca3_2 t_cca3_2 ; SUBTYPE rst_cmre_1 IS rf_cmre_1 t_cmre_1 ; SUBTYPE rst_cmre_2 IS rf_cmre_2 t_cmre_2 ; SUBTYPE rst_cca1_7 IS rf_cca1_7 t_cca1_7 ; SUBTYPE rst_cmre_3 IS rf_cmre_3 t_cmre_3 ; -- -- Functions declarations for multi-dimensional comosite values -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 ; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 ; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 ; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 ; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 ; -- ------------------------------------------------------------------------------------------- -- Data values for Composite Types -- ------------------------------------------------------------------------------------------- CONSTANT CX_scl1 : st_scl1 := 'X' ; CONSTANT C0_scl1 : st_scl1 := st_scl1'LEFT ; CONSTANT C1_scl1 : st_scl1 := 'A' ; CONSTANT C2_scl1 : st_scl1 := 'Z' ; CONSTANT CX_scl2 : TIME := 99 fs ; CONSTANT C0_scl2 : TIME := TIME'LEFT ; CONSTANT C1_scl2 : TIME := 0 fs; CONSTANT C2_scl2 : TIME := 2 ns; CONSTANT CX_scl3 : st_scl3 := 15 ; CONSTANT C0_scl3 : st_scl3 := st_scl3'LEFT ; CONSTANT C1_scl3 : st_scl3 := 6 ; CONSTANT C2_scl3 : st_scl3 := 8 ; CONSTANT CX_scl4 : st_scl4 := 99.9 ; CONSTANT C0_scl4 : st_scl4 := st_scl4'LEFT ; CONSTANT C1_scl4 : st_scl4 := 1.0 ; CONSTANT C2_scl4 : st_scl4 := 2.1 ; CONSTANT CX_scre_1 : t_scre_1 := ( CX_scl1, CX_scl2, CX_scl3, CX_scl4 ); CONSTANT C0_scre_1 : t_scre_1 := ( C0_scl1, C0_scl2, C0_scl3, C0_scl4 ); CONSTANT C1_scre_1 : t_scre_1 := ( C1_scl1, C1_scl2, C1_scl3, C1_scl4 ); CONSTANT C2_scre_1 : t_scre_1 := ( C2_scl1, C0_scl2, C0_scl3, C2_scl4 ); CONSTANT CX_csa1_1 : t_csa1_1 := ( OTHERS=>CX_scl1); CONSTANT C0_csa1_1 : t_csa1_1 := ( OTHERS=>C0_scl1); CONSTANT C1_csa1_1 : t_csa1_1 := ( OTHERS=>C1_scl1); CONSTANT C2_csa1_1 : t_csa1_1 := ( t_csa1_1'LEFT|t_csa1_1'RIGHT=>C2_scl1, OTHERS =>C0_scl1); CONSTANT CX_csa1_2 : t_csa1_2 := ( OTHERS=>CX_scl2); CONSTANT C0_csa1_2 : t_csa1_2 := ( OTHERS=>C0_scl2); CONSTANT C1_csa1_2 : t_csa1_2 := ( OTHERS=>C1_scl2); CONSTANT C2_csa1_2 : t_csa1_2 := ( t_csa1_2'LEFT|t_csa1_2'RIGHT=>C2_scl2, OTHERS =>C0_scl2); CONSTANT CX_csa1_3 : t_csa1_3 := ( OTHERS=>CX_scl3); CONSTANT C0_csa1_3 : t_csa1_3 := ( OTHERS=>C0_scl3); CONSTANT C1_csa1_3 : t_csa1_3 := ( OTHERS=>C1_scl3); CONSTANT C2_csa1_3 : t_csa1_3 := ( t_csa1_3'LEFT|t_csa1_3'RIGHT=>C2_scl3, OTHERS =>C0_scl3); CONSTANT CX_csa1_4 : t_csa1_4 := ( OTHERS=>CX_scl4); CONSTANT C0_csa1_4 : t_csa1_4 := ( OTHERS=>C0_scl4); CONSTANT C1_csa1_4 : t_csa1_4 := ( OTHERS=>C1_scl4); CONSTANT C2_csa1_4 : t_csa1_4 := ( t_csa1_4'LEFT|t_csa1_4'RIGHT=>C2_scl4, OTHERS =>C0_scl4); -- CONSTANT CX_csa2_1 : t_csa2_1 ; CONSTANT C0_csa2_1 : t_csa2_1 ; CONSTANT C1_csa2_1 : t_csa2_1 ; CONSTANT C2_csa2_1 : t_csa2_1 ; CONSTANT CX_csa3_1 : t_csa3_1 ; CONSTANT C0_csa3_1 : t_csa3_1 ; CONSTANT C1_csa3_1 : t_csa3_1 ; CONSTANT C2_csa3_1 : t_csa3_1 ; CONSTANT CX_csa4_1 : t_csa4_1 ; CONSTANT C0_csa4_1 : t_csa4_1 ; CONSTANT C1_csa4_1 : t_csa4_1 ; CONSTANT C2_csa4_1 : t_csa4_1 ; -- CONSTANT CX_cca1_1 : t_cca1_1 := ( OTHERS=>CX_scre_1 ); CONSTANT C0_cca1_1 : t_cca1_1 := ( OTHERS=>C0_scre_1 ); CONSTANT C1_cca1_1 : t_cca1_1 := ( OTHERS=>C1_scre_1 ); CONSTANT C2_cca1_1 : t_cca1_1 := ( C2_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C2_scre_1 ); CONSTANT CX_cca1_2 : t_cca1_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cca1_2 : t_cca1_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cca1_2 : t_cca1_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cca1_2 : t_cca1_2 := ( C2_csa1_1, C0_csa1_1, C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca1_3 : t_cca1_3 := ( OTHERS=>CX_cca1_2 ); CONSTANT C0_cca1_3 : t_cca1_3 := ( OTHERS=>C0_cca1_2 ); CONSTANT C1_cca1_3 : t_cca1_3 := ( OTHERS=>C1_cca1_2 ); CONSTANT C2_cca1_3 : t_cca1_3 := ( C2_cca1_2, C0_cca1_2, C0_cca1_2, C2_cca1_2 ); CONSTANT CX_cca1_4 : t_cca1_4 := ( OTHERS=>CX_cca1_3 ); CONSTANT C0_cca1_4 : t_cca1_4 := ( OTHERS=>C0_cca1_3 ); CONSTANT C1_cca1_4 : t_cca1_4 := ( OTHERS=>C1_cca1_3 ); CONSTANT C2_cca1_4 : t_cca1_4 := ( C2_cca1_3, C0_cca1_3, C0_cca1_3, C2_cca1_3 ); CONSTANT CX_cca2_1 : t_cca2_1 ; CONSTANT C0_cca2_1 : t_cca2_1 ; CONSTANT C1_cca2_1 : t_cca2_1 ; CONSTANT C2_cca2_1 : t_cca2_1 ; -- CONSTANT CX_cca2_2 : t_cca2_2 ; CONSTANT C0_cca2_2 : t_cca2_2 ; CONSTANT C1_cca2_2 : t_cca2_2 ; CONSTANT C2_cca2_2 : t_cca2_2 ; CONSTANT CX_cca3_1 : t_cca3_1 ; CONSTANT C0_cca3_1 : t_cca3_1 ; CONSTANT C1_cca3_1 : t_cca3_1 ; CONSTANT C2_cca3_1 : t_cca3_1 ; -- CONSTANT CX_cca3_2 : t_cca3_2 ; CONSTANT C0_cca3_2 : t_cca3_2 ; CONSTANT C1_cca3_2 : t_cca3_2 ; CONSTANT C2_cca3_2 : t_cca3_2 ; CONSTANT CX_cmre_1 : t_cmre_1 := ( CX_csa1_1, CX_scre_1 ); CONSTANT C0_cmre_1 : t_cmre_1 := ( C0_csa1_1, C0_scre_1 ); CONSTANT C1_cmre_1 : t_cmre_1 := ( C1_csa1_1, C1_scre_1 ); CONSTANT C2_cmre_1 : t_cmre_1 := ( C2_csa1_1, C0_scre_1 ); CONSTANT CX_cmre_2 : t_cmre_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cmre_2 : t_cmre_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cmre_2 : t_cmre_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cmre_2 : t_cmre_2 := ( left|right=>C2_csa1_1, OTHERS=>C0_csa1_1 ); CONSTANT CX_cca1_7 : t_cca1_7 := ( OTHERS=>CX_cmre_2 ); CONSTANT C0_cca1_7 : t_cca1_7 := ( OTHERS=>C0_cmre_2 ); CONSTANT C1_cca1_7 : t_cca1_7 := ( OTHERS=>C1_cmre_2 ); CONSTANT C2_cca1_7 : t_cca1_7 := ( C2_cmre_2, C0_cmre_2, C0_cmre_2, C2_cmre_2 ); CONSTANT CX_cmre_3 : t_cmre_3 := ( OTHERS=>CX_cca1_7 ); CONSTANT C0_cmre_3 : t_cmre_3 := ( OTHERS=>C0_cca1_7 ); CONSTANT C1_cmre_3 : t_cmre_3 := ( OTHERS=>C1_cca1_7 ); CONSTANT C2_cmre_3 : t_cmre_3 := ( left|right=>C2_cca1_7, OTHERS=>C0_cca1_7 ); -- -------------------------------------------------------------------------------------------- -- Functions for mapping from integer test values to/from values of the Test types -- -------------------------------------------------------------------------------------------- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1; FUNCTION val_t ( i : INTEGER ) RETURN TIME; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3; FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER; FUNCTION val_i ( i : TIME ) RETURN INTEGER; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER; FUNCTION val_s ( i : st_scl1 ) RETURN STRING; FUNCTION val_s ( i : TIME ) RETURN STRING; FUNCTION val_s ( i : st_scl3 ) RETURN STRING; FUNCTION val_s ( i : st_scl4 ) RETURN STRING; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING; END; PACKAGE BODY c03s03b00x00p03n04i00521pkg IS CONSTANT CX_csa2_1 : t_csa2_1 := F_csa2_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa2_1 : t_csa2_1 := F_csa2_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa3_1 : t_csa3_1 := F_csa3_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa3_1 : t_csa3_1 := F_csa3_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa4_1 : t_csa4_1 := F_csa4_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa4_1 : t_csa4_1 := F_csa4_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_cca2_1 : t_cca2_1 := ( OTHERS=>CX_csa2_1 ); CONSTANT C0_cca2_1 : t_cca2_1 := ( OTHERS=>C0_csa2_1 ); CONSTANT C1_cca2_1 : t_cca2_1 := ( OTHERS=>C1_csa2_1 ); CONSTANT C2_cca2_1 : t_cca2_1 := ( C2_csa2_1, C0_csa2_1, C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca2_2 : t_cca2_2 := F_cca2_2 ( CX_csa2_1, CX_csa2_1 ); CONSTANT C0_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C0_csa2_1 ); CONSTANT C1_cca2_2 : t_cca2_2 := F_cca2_2 ( C1_csa2_1, C1_csa2_1 ); CONSTANT C2_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca3_1 : t_cca3_1 := F_cca3_1 ( CX_csa1_1, CX_csa1_1 ); CONSTANT C0_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C0_csa1_1 ); CONSTANT C1_cca3_1 : t_cca3_1 := F_cca3_1 ( C1_csa1_1, C1_csa1_1 ); CONSTANT C2_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca3_2 : t_cca3_2 := ( OTHERS=>CX_csa3_1 ); CONSTANT C0_cca3_2 : t_cca3_2 := ( OTHERS=>C0_csa3_1 ); CONSTANT C1_cca3_2 : t_cca3_2 := ( OTHERS=>C1_csa3_1 ); CONSTANT C2_cca3_2 : t_cca3_2 := ( C2_csa3_1, C0_csa3_1, C0_csa3_1, C2_csa3_1 ); -- -- Functions to provide values for multi-dimensional composites -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 IS VARIABLE res : t_csa2_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 IS VARIABLE res : t_csa3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 IS VARIABLE res : t_csa4_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP FOR l IN res'RANGE(4) LOOP res(i,j,k,l) := v0; END LOOP; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3),res'left (4)) := v2; res(res'right(1),res'left (2),res'left (3),res'left (4)) := v2; res(res'left (1),res'right(2),res'left (3),res'left (4)) := v2; res(res'right(1),res'right(2),res'left (3),res'left (4)) := v2; res(res'left (1),res'left (2),res'right(3),res'left (4)) := v2; res(res'right(1),res'left (2),res'right(3),res'left (4)) := v2; res(res'left (1),res'right(2),res'right(3),res'left (4)) := v2; res(res'right(1),res'right(2),res'right(3),res'left (4)) := v2; res(res'left (1),res'left (2),res'left (3),res'right(4)) := v2; res(res'right(1),res'left (2),res'left (3),res'right(4)) := v2; res(res'left (1),res'right(2),res'left (3),res'right(4)) := v2; res(res'right(1),res'right(2),res'left (3),res'right(4)) := v2; res(res'left (1),res'left (2),res'right(3),res'right(4)) := v2; res(res'right(1),res'left (2),res'right(3),res'right(4)) := v2; res(res'left (1),res'right(2),res'right(3),res'right(4)) := v2; res(res'right(1),res'right(2),res'right(3),res'right(4)) := v2; RETURN res; END; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 IS VARIABLE res : t_cca2_2; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 IS VARIABLE res : t_cca3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; -- -- Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_scre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa4_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_7; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_3; ELSE RETURN v(1); END IF; END; -- -- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1 IS BEGIN IF i = 0 THEN RETURN C0_scl1; END IF; IF i = 1 THEN RETURN C1_scl1; END IF; IF i = 2 THEN RETURN C2_scl1; END IF; RETURN CX_scl1; END; FUNCTION val_t ( i : INTEGER ) RETURN TIME IS BEGIN IF i = 0 THEN RETURN C0_scl2; END IF; IF i = 1 THEN RETURN C1_scl2; END IF; IF i = 2 THEN RETURN C2_scl2; END IF; RETURN CX_scl2; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3 IS BEGIN IF i = 0 THEN RETURN C0_scl3; END IF; IF i = 1 THEN RETURN C1_scl3; END IF; IF i = 2 THEN RETURN C2_scl3; END IF; RETURN CX_scl3; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4 IS BEGIN IF i = 0 THEN RETURN C0_scl4; END IF; IF i = 1 THEN RETURN C1_scl4; END IF; IF i = 2 THEN RETURN C2_scl4; END IF; RETURN CX_scl4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1 IS BEGIN IF i = 0 THEN RETURN C0_scre_1; END IF; IF i = 1 THEN RETURN C1_scre_1; END IF; IF i = 2 THEN RETURN C2_scre_1; END IF; RETURN CX_scre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1 IS BEGIN IF i = 0 THEN RETURN C0_csa1_1; END IF; IF i = 1 THEN RETURN C1_csa1_1; END IF; IF i = 2 THEN RETURN C2_csa1_1; END IF; RETURN CX_csa1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2 IS BEGIN IF i = 0 THEN RETURN C0_csa1_2; END IF; IF i = 1 THEN RETURN C1_csa1_2; END IF; IF i = 2 THEN RETURN C2_csa1_2; END IF; RETURN CX_csa1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3 IS BEGIN IF i = 0 THEN RETURN C0_csa1_3; END IF; IF i = 1 THEN RETURN C1_csa1_3; END IF; IF i = 2 THEN RETURN C2_csa1_3; END IF; RETURN CX_csa1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4 IS BEGIN IF i = 0 THEN RETURN C0_csa1_4; END IF; IF i = 1 THEN RETURN C1_csa1_4; END IF; IF i = 2 THEN RETURN C2_csa1_4; END IF; RETURN CX_csa1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1 IS BEGIN IF i = 0 THEN RETURN C0_csa2_1; END IF; IF i = 1 THEN RETURN C1_csa2_1; END IF; IF i = 2 THEN RETURN C2_csa2_1; END IF; RETURN CX_csa2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1 IS BEGIN IF i = 0 THEN RETURN C0_csa3_1; END IF; IF i = 1 THEN RETURN C1_csa3_1; END IF; IF i = 2 THEN RETURN C2_csa3_1; END IF; RETURN CX_csa3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1 IS BEGIN IF i = 0 THEN RETURN C0_csa4_1; END IF; IF i = 1 THEN RETURN C1_csa4_1; END IF; IF i = 2 THEN RETURN C2_csa4_1; END IF; RETURN CX_csa4_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1 IS BEGIN IF i = 0 THEN RETURN C0_cca1_1; END IF; IF i = 1 THEN RETURN C1_cca1_1; END IF; IF i = 2 THEN RETURN C2_cca1_1; END IF; RETURN CX_cca1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2 IS BEGIN IF i = 0 THEN RETURN C0_cca1_2; END IF; IF i = 1 THEN RETURN C1_cca1_2; END IF; IF i = 2 THEN RETURN C2_cca1_2; END IF; RETURN CX_cca1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3 IS BEGIN IF i = 0 THEN RETURN C0_cca1_3; END IF; IF i = 1 THEN RETURN C1_cca1_3; END IF; IF i = 2 THEN RETURN C2_cca1_3; END IF; RETURN CX_cca1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4 IS BEGIN IF i = 0 THEN RETURN C0_cca1_4; END IF; IF i = 1 THEN RETURN C1_cca1_4; END IF; IF i = 2 THEN RETURN C2_cca1_4; END IF; RETURN CX_cca1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1 IS BEGIN IF i = 0 THEN RETURN C0_cca2_1; END IF; IF i = 1 THEN RETURN C1_cca2_1; END IF; IF i = 2 THEN RETURN C2_cca2_1; END IF; RETURN CX_cca2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2 IS BEGIN IF i = 0 THEN RETURN C0_cca2_2; END IF; IF i = 1 THEN RETURN C1_cca2_2; END IF; IF i = 2 THEN RETURN C2_cca2_2; END IF; RETURN CX_cca2_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1 IS BEGIN IF i = 0 THEN RETURN C0_cca3_1; END IF; IF i = 1 THEN RETURN C1_cca3_1; END IF; IF i = 2 THEN RETURN C2_cca3_1; END IF; RETURN CX_cca3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2 IS BEGIN IF i = 0 THEN RETURN C0_cca3_2; END IF; IF i = 1 THEN RETURN C1_cca3_2; END IF; IF i = 2 THEN RETURN C2_cca3_2; END IF; RETURN CX_cca3_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1 IS BEGIN IF i = 0 THEN RETURN C0_cmre_1; END IF; IF i = 1 THEN RETURN C1_cmre_1; END IF; IF i = 2 THEN RETURN C2_cmre_1; END IF; RETURN CX_cmre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2 IS BEGIN IF i = 0 THEN RETURN C0_cmre_2; END IF; IF i = 1 THEN RETURN C1_cmre_2; END IF; IF i = 2 THEN RETURN C2_cmre_2; END IF; RETURN CX_cmre_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7 IS BEGIN IF i = 0 THEN RETURN C0_cca1_7; END IF; IF i = 1 THEN RETURN C1_cca1_7; END IF; IF i = 2 THEN RETURN C2_cca1_7; END IF; RETURN CX_cca1_7; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3 IS BEGIN IF i = 0 THEN RETURN C0_cmre_3; END IF; IF i = 1 THEN RETURN C1_cmre_3; END IF; IF i = 2 THEN RETURN C2_cmre_3; END IF; RETURN CX_cmre_3; END; -- -- FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER IS BEGIN IF i = C0_scl1 THEN RETURN 0; END IF; IF i = C1_scl1 THEN RETURN 1; END IF; IF i = C2_scl1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : TIME ) RETURN INTEGER IS BEGIN IF i = C0_scl2 THEN RETURN 0; END IF; IF i = C1_scl2 THEN RETURN 1; END IF; IF i = C2_scl2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER IS BEGIN IF i = C0_scl3 THEN RETURN 0; END IF; IF i = C1_scl3 THEN RETURN 1; END IF; IF i = C2_scl3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER IS BEGIN IF i = C0_scl4 THEN RETURN 0; END IF; IF i = C1_scl4 THEN RETURN 1; END IF; IF i = C2_scl4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER IS BEGIN IF i = C0_scre_1 THEN RETURN 0; END IF; IF i = C1_scre_1 THEN RETURN 1; END IF; IF i = C2_scre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_1 THEN RETURN 0; END IF; IF i = C1_csa1_1 THEN RETURN 1; END IF; IF i = C2_csa1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_2 THEN RETURN 0; END IF; IF i = C1_csa1_2 THEN RETURN 1; END IF; IF i = C2_csa1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_3 THEN RETURN 0; END IF; IF i = C1_csa1_3 THEN RETURN 1; END IF; IF i = C2_csa1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_4 THEN RETURN 0; END IF; IF i = C1_csa1_4 THEN RETURN 1; END IF; IF i = C2_csa1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa2_1 THEN RETURN 0; END IF; IF i = C1_csa2_1 THEN RETURN 1; END IF; IF i = C2_csa2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa3_1 THEN RETURN 0; END IF; IF i = C1_csa3_1 THEN RETURN 1; END IF; IF i = C2_csa3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa4_1 THEN RETURN 0; END IF; IF i = C1_csa4_1 THEN RETURN 1; END IF; IF i = C2_csa4_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_1 THEN RETURN 0; END IF; IF i = C1_cca1_1 THEN RETURN 1; END IF; IF i = C2_cca1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_2 THEN RETURN 0; END IF; IF i = C1_cca1_2 THEN RETURN 1; END IF; IF i = C2_cca1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_3 THEN RETURN 0; END IF; IF i = C1_cca1_3 THEN RETURN 1; END IF; IF i = C2_cca1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_4 THEN RETURN 0; END IF; IF i = C1_cca1_4 THEN RETURN 1; END IF; IF i = C2_cca1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_1 THEN RETURN 0; END IF; IF i = C1_cca2_1 THEN RETURN 1; END IF; IF i = C2_cca2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_2 THEN RETURN 0; END IF; IF i = C1_cca2_2 THEN RETURN 1; END IF; IF i = C2_cca2_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_1 THEN RETURN 0; END IF; IF i = C1_cca3_1 THEN RETURN 1; END IF; IF i = C2_cca3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_2 THEN RETURN 0; END IF; IF i = C1_cca3_2 THEN RETURN 1; END IF; IF i = C2_cca3_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_1 THEN RETURN 0; END IF; IF i = C1_cmre_1 THEN RETURN 1; END IF; IF i = C2_cmre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_2 THEN RETURN 0; END IF; IF i = C1_cmre_2 THEN RETURN 1; END IF; IF i = C2_cmre_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_7 THEN RETURN 0; END IF; IF i = C1_cca1_7 THEN RETURN 1; END IF; IF i = C2_cca1_7 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_3 THEN RETURN 0; END IF; IF i = C1_cmre_3 THEN RETURN 1; END IF; IF i = C2_cmre_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_s ( i : st_scl1 ) RETURN STRING IS BEGIN IF i = C0_scl1 THEN RETURN "C0_scl1"; END IF; IF i = C1_scl1 THEN RETURN "C1_scl1"; END IF; IF i = C2_scl1 THEN RETURN "C2_scl1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : TIME ) RETURN STRING IS BEGIN IF i = C0_scl2 THEN RETURN "C0_scl2"; END IF; IF i = C1_scl2 THEN RETURN "C1_scl2"; END IF; IF i = C2_scl2 THEN RETURN "C2_scl2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl3 ) RETURN STRING IS BEGIN IF i = C0_scl3 THEN RETURN "C0_scl3"; END IF; IF i = C1_scl3 THEN RETURN "C1_scl3"; END IF; IF i = C2_scl3 THEN RETURN "C2_scl3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl4 ) RETURN STRING IS BEGIN IF i = C0_scl4 THEN RETURN "C0_scl4"; END IF; IF i = C1_scl4 THEN RETURN "C1_scl4"; END IF; IF i = C2_scl4 THEN RETURN "C2_scl4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING IS BEGIN IF i = C0_scre_1 THEN RETURN "C0_scre_1"; END IF; IF i = C1_scre_1 THEN RETURN "C1_scre_1"; END IF; IF i = C2_scre_1 THEN RETURN "C2_scre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING IS BEGIN IF i = C0_csa1_1 THEN RETURN "C0_csa1_1"; END IF; IF i = C1_csa1_1 THEN RETURN "C1_csa1_1"; END IF; IF i = C2_csa1_1 THEN RETURN "C2_csa1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING IS BEGIN IF i = C0_csa1_2 THEN RETURN "C0_csa1_2"; END IF; IF i = C1_csa1_2 THEN RETURN "C1_csa1_2"; END IF; IF i = C2_csa1_2 THEN RETURN "C2_csa1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING IS BEGIN IF i = C0_csa1_3 THEN RETURN "C0_csa1_3"; END IF; IF i = C1_csa1_3 THEN RETURN "C1_csa1_3"; END IF; IF i = C2_csa1_3 THEN RETURN "C2_csa1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING IS BEGIN IF i = C0_csa1_4 THEN RETURN "C0_csa1_4"; END IF; IF i = C1_csa1_4 THEN RETURN "C1_csa1_4"; END IF; IF i = C2_csa1_4 THEN RETURN "C2_csa1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING IS BEGIN IF i = C0_csa2_1 THEN RETURN "C0_csa2_1"; END IF; IF i = C1_csa2_1 THEN RETURN "C1_csa2_1"; END IF; IF i = C2_csa2_1 THEN RETURN "C2_csa2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING IS BEGIN IF i = C0_csa3_1 THEN RETURN "C0_csa3_1"; END IF; IF i = C1_csa3_1 THEN RETURN "C1_csa3_1"; END IF; IF i = C2_csa3_1 THEN RETURN "C2_csa3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING IS BEGIN IF i = C0_csa4_1 THEN RETURN "C0_csa4_1"; END IF; IF i = C1_csa4_1 THEN RETURN "C1_csa4_1"; END IF; IF i = C2_csa4_1 THEN RETURN "C2_csa4_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING IS BEGIN IF i = C0_cca1_1 THEN RETURN "C0_cca1_1"; END IF; IF i = C1_cca1_1 THEN RETURN "C1_cca1_1"; END IF; IF i = C2_cca1_1 THEN RETURN "C2_cca1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING IS BEGIN IF i = C0_cca1_2 THEN RETURN "C0_cca1_2"; END IF; IF i = C1_cca1_2 THEN RETURN "C1_cca1_2"; END IF; IF i = C2_cca1_2 THEN RETURN "C2_cca1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING IS BEGIN IF i = C0_cca1_3 THEN RETURN "C0_cca1_3"; END IF; IF i = C1_cca1_3 THEN RETURN "C1_cca1_3"; END IF; IF i = C2_cca1_3 THEN RETURN "C2_cca1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING IS BEGIN IF i = C0_cca1_4 THEN RETURN "C0_cca1_4"; END IF; IF i = C1_cca1_4 THEN RETURN "C1_cca1_4"; END IF; IF i = C2_cca1_4 THEN RETURN "C2_cca1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING IS BEGIN IF i = C0_cca2_1 THEN RETURN "C0_cca2_1"; END IF; IF i = C1_cca2_1 THEN RETURN "C1_cca2_1"; END IF; IF i = C2_cca2_1 THEN RETURN "C2_cca2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING IS BEGIN IF i = C0_cca2_2 THEN RETURN "C0_cca2_2"; END IF; IF i = C1_cca2_2 THEN RETURN "C1_cca2_2"; END IF; IF i = C2_cca2_2 THEN RETURN "C2_cca2_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING IS BEGIN IF i = C0_cca3_1 THEN RETURN "C0_cca3_1"; END IF; IF i = C1_cca3_1 THEN RETURN "C1_cca3_1"; END IF; IF i = C2_cca3_1 THEN RETURN "C2_cca3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING IS BEGIN IF i = C0_cca3_2 THEN RETURN "C0_cca3_2"; END IF; IF i = C1_cca3_2 THEN RETURN "C1_cca3_2"; END IF; IF i = C2_cca3_2 THEN RETURN "C2_cca3_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING IS BEGIN IF i = C0_cmre_1 THEN RETURN "C0_cmre_1"; END IF; IF i = C1_cmre_1 THEN RETURN "C1_cmre_1"; END IF; IF i = C2_cmre_1 THEN RETURN "C2_cmre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING IS BEGIN IF i = C0_cmre_2 THEN RETURN "C0_cmre_2"; END IF; IF i = C1_cmre_2 THEN RETURN "C1_cmre_2"; END IF; IF i = C2_cmre_2 THEN RETURN "C2_cmre_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING IS BEGIN IF i = C0_cca1_7 THEN RETURN "C0_cca1_7"; END IF; IF i = C1_cca1_7 THEN RETURN "C1_cca1_7"; END IF; IF i = C2_cca1_7 THEN RETURN "C2_cca1_7"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING IS BEGIN IF i = C0_cmre_3 THEN RETURN "C0_cmre_3"; END IF; IF i = C1_cmre_3 THEN RETURN "C1_cmre_3"; END IF; IF i = C2_cmre_3 THEN RETURN "C2_cmre_3"; END IF; RETURN "UNKNOWN"; END; END c03s03b00x00p03n04i00521pkg; USE work.c03s03b00x00p03n04i00521pkg.ALL; ENTITY c03s03b00x00p03n04i00521ent IS END c03s03b00x00p03n04i00521ent; ARCHITECTURE c03s03b00x00p03n04i00521arch OF c03s03b00x00p03n04i00521ent IS -- -- Access type declarations -- TYPE at_usa2_1 IS ACCESS t_usa2_1 ; TYPE at_usa3_1 IS ACCESS t_usa3_1 ; TYPE at_usa4_1 IS ACCESS t_usa4_1 ; TYPE at_csa2_1 IS ACCESS t_csa2_1 ; TYPE at_csa3_1 IS ACCESS t_csa3_1 ; TYPE at_csa4_1 IS ACCESS t_csa4_1 ; TYPE at_cca2_1 IS ACCESS t_cca2_1 ; TYPE at_cca2_2 IS ACCESS t_cca2_2 ; TYPE at_cca3_1 IS ACCESS t_cca3_1 ; TYPE at_cca3_2 IS ACCESS t_cca3_2 ; -- -- BEGIN TESTING: PROCESS -- -- ACCESS VARIABLE declarations -- VARIABLE AV0_usa2_1 : at_usa2_1 ; VARIABLE AV2_usa2_1 : at_usa2_1 ; VARIABLE AV0_usa3_1 : at_usa3_1 ; VARIABLE AV2_usa3_1 : at_usa3_1 ; VARIABLE AV0_usa4_1 : at_usa4_1 ; VARIABLE AV2_usa4_1 : at_usa4_1 ; VARIABLE AV0_csa2_1 : at_csa2_1 ; VARIABLE AV2_csa2_1 : at_csa2_1 ; VARIABLE AV0_csa3_1 : at_csa3_1 ; VARIABLE AV2_csa3_1 : at_csa3_1 ; VARIABLE AV0_csa4_1 : at_csa4_1 ; VARIABLE AV2_csa4_1 : at_csa4_1 ; VARIABLE AV0_cca2_1 : at_cca2_1 ; VARIABLE AV2_cca2_1 : at_cca2_1 ; VARIABLE AV0_cca2_2 : at_cca2_2 ; VARIABLE AV2_cca2_2 : at_cca2_2 ; VARIABLE AV0_cca3_1 : at_cca3_1 ; VARIABLE AV2_cca3_1 : at_cca3_1 ; VARIABLE AV0_cca3_2 : at_cca3_2 ; VARIABLE AV2_cca3_2 : at_cca3_2 ; -- -- BEGIN -- -- Allocation of access values -- AV0_usa2_1 := NEW t_usa2_1 ( st_ind2, st_ind1 ) ; AV0_usa3_1 := NEW t_usa3_1 ( st_ind3, st_ind2, st_ind1 ) ; AV0_usa4_1 := NEW t_usa4_1 (st_ind4, st_ind3, st_ind2, st_ind1 ) ; AV0_csa2_1 := NEW t_csa2_1 ; AV0_csa3_1 := NEW t_csa3_1 ; AV0_csa4_1 := NEW t_csa4_1 ; AV0_cca2_1 := NEW t_cca2_1 ; AV0_cca2_2 := NEW t_cca2_2 ; AV0_cca3_1 := NEW t_cca3_1 ; AV0_cca3_2 := NEW t_cca3_2 ; --- AV2_usa2_1 := NEW t_usa2_1 ' ( C2_csa2_1 ) ; AV2_usa3_1 := NEW t_usa3_1 ' ( C2_csa3_1 ) ; AV2_usa4_1 := NEW t_usa4_1 ' ( C2_csa4_1 ) ; AV2_csa2_1 := NEW t_csa2_1 ' ( C2_csa2_1 ) ; AV2_csa3_1 := NEW t_csa3_1 ' ( C2_csa3_1 ) ; AV2_csa4_1 := NEW t_csa4_1 ' ( C2_csa4_1 ) ; AV2_cca2_1 := NEW t_cca2_1 ' ( C2_cca2_1 ) ; AV2_cca2_2 := NEW t_cca2_2 ' ( C2_cca2_2 ) ; AV2_cca3_1 := NEW t_cca3_1 ' ( C2_cca3_1 ) ; AV2_cca3_2 := NEW t_cca3_2 ' ( C2_cca3_2 ) ; -- -- ASSERT AV0_usa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_usa2_1" SEVERITY FAILURE; ASSERT AV2_usa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_usa2_1" SEVERITY FAILURE; ASSERT AV0_usa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_usa3_1" SEVERITY FAILURE; ASSERT AV2_usa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_usa3_1" SEVERITY FAILURE; ASSERT AV0_usa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_usa4_1" SEVERITY FAILURE; ASSERT AV2_usa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_usa4_1" SEVERITY FAILURE; ASSERT AV0_csa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_csa2_1" SEVERITY FAILURE; ASSERT AV2_csa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_csa2_1" SEVERITY FAILURE; ASSERT AV0_csa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_csa3_1" SEVERITY FAILURE; ASSERT AV2_csa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_csa3_1" SEVERITY FAILURE; ASSERT AV0_csa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_csa4_1" SEVERITY FAILURE; ASSERT AV2_csa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_csa4_1" SEVERITY FAILURE; ASSERT AV0_cca2_1.all = C0_cca2_1 REPORT "Improper initialization of AV0_cca2_1" SEVERITY FAILURE; ASSERT AV2_cca2_1.all = C2_cca2_1 REPORT "Improper initialization of AV2_cca2_1" SEVERITY FAILURE; ASSERT AV0_cca2_2.all = C0_cca2_2 REPORT "Improper initialization of AV0_cca2_2" SEVERITY FAILURE; ASSERT AV2_cca2_2.all = C2_cca2_2 REPORT "Improper initialization of AV2_cca2_2" SEVERITY FAILURE; ASSERT AV0_cca3_1.all = C0_cca3_1 REPORT "Improper initialization of AV0_cca3_1" SEVERITY FAILURE; ASSERT AV2_cca3_1.all = C2_cca3_1 REPORT "Improper initialization of AV2_cca3_1" SEVERITY FAILURE; ASSERT AV0_cca3_2.all = C0_cca3_2 REPORT "Improper initialization of AV0_cca3_2" SEVERITY FAILURE; ASSERT AV2_cca3_2.all = C2_cca3_2 REPORT "Improper initialization of AV2_cca3_2" SEVERITY FAILURE; -- -- assert NOT( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***PASSED TEST: c03s03b00x00p03n04i00521" severity NOTE; assert ( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***FAILED TEST: c03s03b00x00p03n04i00521 - Each access value designates an object of the subtype defined by the subtype indication of the access type definition." severity ERROR; wait; END PROCESS TESTING; END c03s03b00x00p03n04i00521arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc521.vhd,v 1.2 2001-10-26 16:29:56 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- PACKAGE c03s03b00x00p03n04i00521pkg IS -- -- Index types for array declarations -- SUBTYPE st_ind1 IS INTEGER RANGE 1 TO 8; -- index from 1 (POSITIVE) SUBTYPE st_ind2 IS INTEGER RANGE 0 TO 3; -- index from 0 (NATURAL) SUBTYPE st_ind3 IS CHARACTER RANGE 'a' TO 'd'; -- non-INTEGER index SUBTYPE st_ind4 IS INTEGER RANGE 0 DOWNTO -3; -- descending range -- -- Scalar type for subelements -- SUBTYPE st_scl1 IS CHARACTER ; SUBTYPE st_scl3 IS INTEGER RANGE 1 TO INTEGER'HIGH; SUBTYPE st_scl4 IS REAL RANGE 0.0 TO 1024.0; -- ----------------------------------------------------------------------------------------- -- Composite type declarations -- ----------------------------------------------------------------------------------------- -- -- Records of scalars -- TYPE t_scre_1 IS RECORD left : st_scl1; second : TIME; third : st_scl3; right : st_scl4; END RECORD; -- -- Unconstrained arrays of scalars -- TYPE t_usa1_1 IS ARRAY (st_ind1 RANGE <>) OF st_scl1; TYPE t_usa1_2 IS ARRAY (st_ind2 RANGE <>) OF TIME; TYPE t_usa1_3 IS ARRAY (st_ind3 RANGE <>) OF st_scl3; TYPE t_usa1_4 IS ARRAY (st_ind4 RANGE <>) OF st_scl4; TYPE t_usa2_1 IS ARRAY (st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa3_1 IS ARRAY (st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; TYPE t_usa4_1 IS ARRAY (st_ind4 RANGE <>, st_ind3 RANGE <>, st_ind2 RANGE <>, st_ind1 RANGE <>) OF st_scl1; -- -- -- Constrained arrays of scalars (make compatable with unconstrained types -- SUBTYPE t_csa1_1 IS t_usa1_1 (st_ind1 ); SUBTYPE t_csa1_2 IS t_usa1_2 (st_ind2 ); SUBTYPE t_csa1_3 IS t_usa1_3 (st_ind3 ); SUBTYPE t_csa1_4 IS t_usa1_4 (st_ind4 ); SUBTYPE t_csa2_1 IS t_usa2_1 (st_ind2 , -- ( i2, i1 ) of CHAR st_ind1 ); SUBTYPE t_csa3_1 IS t_usa3_1 (st_ind3 , -- ( i3, i2, i1) of CHAR st_ind2 , st_ind1 ); SUBTYPE t_csa4_1 IS t_usa4_1 (st_ind4 , -- ( i4, i3, i2, i1 ) of CHAR st_ind3 , st_ind2 , st_ind1 ); -- -- -- constrained arrays of composites -- TYPE t_cca1_1 IS ARRAY (st_ind1) OF t_scre_1; -- ( i1 ) is RECORD of scalar TYPE t_cca1_2 IS ARRAY (st_ind2) OF t_csa1_1; -- ( i2 )( i1 ) is CHAR TYPE t_cca1_3 IS ARRAY (st_ind3) OF t_cca1_2; -- ( i3 )( i2 )( i1 ) is CHAR TYPE t_cca1_4 IS ARRAY (st_ind4) OF t_cca1_3; -- ( i4 )( i3 )( i2 )( i1 ) is CHAR TYPE t_cca2_1 IS ARRAY (st_ind3) OF t_csa2_1; -- ( i3 )( i2, i1 ) is CHAR TYPE t_cca2_2 IS ARRAY (st_ind4, -- ( i4, i3 )( i2, i1 ) of CHAR st_ind3) OF t_csa2_1; TYPE t_cca3_1 IS ARRAY (st_ind4, -- ( i4, i3, i2 )( i1 ) of CHAR st_ind3, st_ind2) OF t_csa1_1; TYPE t_cca3_2 IS ARRAY (st_ind4) OF t_csa3_1; -- ( i4 )( i3, i2, i1 ) is CHAR -- -- Records of composites -- TYPE t_cmre_1 IS RECORD left : t_csa1_1; -- .fN(i1) is CHAR second : t_scre_1; -- .fN.fN END RECORD; TYPE t_cmre_2 IS RECORD left , second , third , right : t_csa1_1; -- .fN(i1) is CHAR END RECORD; -- -- Mixed Records/arrays -- TYPE t_cca1_7 IS ARRAY (st_ind3) OF t_cmre_2; -- (i3).fN(i1) is CHAR TYPE t_cmre_3 IS RECORD left , second , third , right : t_cca1_7; -- .fN(i3).fN(i1) is CHAR END RECORD; -- -- TYPE declarations for resolution function (Constrained types only) -- TYPE t_scre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_scre_1; TYPE t_csa1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_1; TYPE t_csa1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_2; TYPE t_csa1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_3; TYPE t_csa1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa1_4; TYPE t_csa2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa2_1; TYPE t_csa3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa3_1; TYPE t_csa4_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_csa4_1; TYPE t_cca1_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_1; TYPE t_cca1_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_2; TYPE t_cca1_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_3; TYPE t_cca1_4_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_4; TYPE t_cca2_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_1; TYPE t_cca2_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca2_2; TYPE t_cca3_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_1; TYPE t_cca3_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca3_2; TYPE t_cmre_1_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_1; TYPE t_cmre_2_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_2; TYPE t_cca1_7_vct IS ARRAY (POSITIVE RANGE <>) OF t_cca1_7; TYPE t_cmre_3_vct IS ARRAY (POSITIVE RANGE <>) OF t_cmre_3; -- -- Declaration of Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3; -- -- Resolved SUBTYPE declaration -- SUBTYPE rst_scre_1 IS rf_scre_1 t_scre_1 ; SUBTYPE rst_csa1_1 IS rf_csa1_1 t_csa1_1 ; SUBTYPE rst_csa1_2 IS rf_csa1_2 t_csa1_2 ; SUBTYPE rst_csa1_3 IS rf_csa1_3 t_csa1_3 ; SUBTYPE rst_csa1_4 IS rf_csa1_4 t_csa1_4 ; SUBTYPE rst_csa2_1 IS rf_csa2_1 t_csa2_1 ; SUBTYPE rst_csa3_1 IS rf_csa3_1 t_csa3_1 ; SUBTYPE rst_csa4_1 IS rf_csa4_1 t_csa4_1 ; SUBTYPE rst_cca1_1 IS rf_cca1_1 t_cca1_1 ; SUBTYPE rst_cca1_2 IS rf_cca1_2 t_cca1_2 ; SUBTYPE rst_cca1_3 IS rf_cca1_3 t_cca1_3 ; SUBTYPE rst_cca1_4 IS rf_cca1_4 t_cca1_4 ; SUBTYPE rst_cca2_1 IS rf_cca2_1 t_cca2_1 ; SUBTYPE rst_cca2_2 IS rf_cca2_2 t_cca2_2 ; SUBTYPE rst_cca3_1 IS rf_cca3_1 t_cca3_1 ; SUBTYPE rst_cca3_2 IS rf_cca3_2 t_cca3_2 ; SUBTYPE rst_cmre_1 IS rf_cmre_1 t_cmre_1 ; SUBTYPE rst_cmre_2 IS rf_cmre_2 t_cmre_2 ; SUBTYPE rst_cca1_7 IS rf_cca1_7 t_cca1_7 ; SUBTYPE rst_cmre_3 IS rf_cmre_3 t_cmre_3 ; -- -- Functions declarations for multi-dimensional comosite values -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 ; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 ; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 ; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 ; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 ; -- ------------------------------------------------------------------------------------------- -- Data values for Composite Types -- ------------------------------------------------------------------------------------------- CONSTANT CX_scl1 : st_scl1 := 'X' ; CONSTANT C0_scl1 : st_scl1 := st_scl1'LEFT ; CONSTANT C1_scl1 : st_scl1 := 'A' ; CONSTANT C2_scl1 : st_scl1 := 'Z' ; CONSTANT CX_scl2 : TIME := 99 fs ; CONSTANT C0_scl2 : TIME := TIME'LEFT ; CONSTANT C1_scl2 : TIME := 0 fs; CONSTANT C2_scl2 : TIME := 2 ns; CONSTANT CX_scl3 : st_scl3 := 15 ; CONSTANT C0_scl3 : st_scl3 := st_scl3'LEFT ; CONSTANT C1_scl3 : st_scl3 := 6 ; CONSTANT C2_scl3 : st_scl3 := 8 ; CONSTANT CX_scl4 : st_scl4 := 99.9 ; CONSTANT C0_scl4 : st_scl4 := st_scl4'LEFT ; CONSTANT C1_scl4 : st_scl4 := 1.0 ; CONSTANT C2_scl4 : st_scl4 := 2.1 ; CONSTANT CX_scre_1 : t_scre_1 := ( CX_scl1, CX_scl2, CX_scl3, CX_scl4 ); CONSTANT C0_scre_1 : t_scre_1 := ( C0_scl1, C0_scl2, C0_scl3, C0_scl4 ); CONSTANT C1_scre_1 : t_scre_1 := ( C1_scl1, C1_scl2, C1_scl3, C1_scl4 ); CONSTANT C2_scre_1 : t_scre_1 := ( C2_scl1, C0_scl2, C0_scl3, C2_scl4 ); CONSTANT CX_csa1_1 : t_csa1_1 := ( OTHERS=>CX_scl1); CONSTANT C0_csa1_1 : t_csa1_1 := ( OTHERS=>C0_scl1); CONSTANT C1_csa1_1 : t_csa1_1 := ( OTHERS=>C1_scl1); CONSTANT C2_csa1_1 : t_csa1_1 := ( t_csa1_1'LEFT|t_csa1_1'RIGHT=>C2_scl1, OTHERS =>C0_scl1); CONSTANT CX_csa1_2 : t_csa1_2 := ( OTHERS=>CX_scl2); CONSTANT C0_csa1_2 : t_csa1_2 := ( OTHERS=>C0_scl2); CONSTANT C1_csa1_2 : t_csa1_2 := ( OTHERS=>C1_scl2); CONSTANT C2_csa1_2 : t_csa1_2 := ( t_csa1_2'LEFT|t_csa1_2'RIGHT=>C2_scl2, OTHERS =>C0_scl2); CONSTANT CX_csa1_3 : t_csa1_3 := ( OTHERS=>CX_scl3); CONSTANT C0_csa1_3 : t_csa1_3 := ( OTHERS=>C0_scl3); CONSTANT C1_csa1_3 : t_csa1_3 := ( OTHERS=>C1_scl3); CONSTANT C2_csa1_3 : t_csa1_3 := ( t_csa1_3'LEFT|t_csa1_3'RIGHT=>C2_scl3, OTHERS =>C0_scl3); CONSTANT CX_csa1_4 : t_csa1_4 := ( OTHERS=>CX_scl4); CONSTANT C0_csa1_4 : t_csa1_4 := ( OTHERS=>C0_scl4); CONSTANT C1_csa1_4 : t_csa1_4 := ( OTHERS=>C1_scl4); CONSTANT C2_csa1_4 : t_csa1_4 := ( t_csa1_4'LEFT|t_csa1_4'RIGHT=>C2_scl4, OTHERS =>C0_scl4); -- CONSTANT CX_csa2_1 : t_csa2_1 ; CONSTANT C0_csa2_1 : t_csa2_1 ; CONSTANT C1_csa2_1 : t_csa2_1 ; CONSTANT C2_csa2_1 : t_csa2_1 ; CONSTANT CX_csa3_1 : t_csa3_1 ; CONSTANT C0_csa3_1 : t_csa3_1 ; CONSTANT C1_csa3_1 : t_csa3_1 ; CONSTANT C2_csa3_1 : t_csa3_1 ; CONSTANT CX_csa4_1 : t_csa4_1 ; CONSTANT C0_csa4_1 : t_csa4_1 ; CONSTANT C1_csa4_1 : t_csa4_1 ; CONSTANT C2_csa4_1 : t_csa4_1 ; -- CONSTANT CX_cca1_1 : t_cca1_1 := ( OTHERS=>CX_scre_1 ); CONSTANT C0_cca1_1 : t_cca1_1 := ( OTHERS=>C0_scre_1 ); CONSTANT C1_cca1_1 : t_cca1_1 := ( OTHERS=>C1_scre_1 ); CONSTANT C2_cca1_1 : t_cca1_1 := ( C2_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C0_scre_1, C2_scre_1 ); CONSTANT CX_cca1_2 : t_cca1_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cca1_2 : t_cca1_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cca1_2 : t_cca1_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cca1_2 : t_cca1_2 := ( C2_csa1_1, C0_csa1_1, C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca1_3 : t_cca1_3 := ( OTHERS=>CX_cca1_2 ); CONSTANT C0_cca1_3 : t_cca1_3 := ( OTHERS=>C0_cca1_2 ); CONSTANT C1_cca1_3 : t_cca1_3 := ( OTHERS=>C1_cca1_2 ); CONSTANT C2_cca1_3 : t_cca1_3 := ( C2_cca1_2, C0_cca1_2, C0_cca1_2, C2_cca1_2 ); CONSTANT CX_cca1_4 : t_cca1_4 := ( OTHERS=>CX_cca1_3 ); CONSTANT C0_cca1_4 : t_cca1_4 := ( OTHERS=>C0_cca1_3 ); CONSTANT C1_cca1_4 : t_cca1_4 := ( OTHERS=>C1_cca1_3 ); CONSTANT C2_cca1_4 : t_cca1_4 := ( C2_cca1_3, C0_cca1_3, C0_cca1_3, C2_cca1_3 ); CONSTANT CX_cca2_1 : t_cca2_1 ; CONSTANT C0_cca2_1 : t_cca2_1 ; CONSTANT C1_cca2_1 : t_cca2_1 ; CONSTANT C2_cca2_1 : t_cca2_1 ; -- CONSTANT CX_cca2_2 : t_cca2_2 ; CONSTANT C0_cca2_2 : t_cca2_2 ; CONSTANT C1_cca2_2 : t_cca2_2 ; CONSTANT C2_cca2_2 : t_cca2_2 ; CONSTANT CX_cca3_1 : t_cca3_1 ; CONSTANT C0_cca3_1 : t_cca3_1 ; CONSTANT C1_cca3_1 : t_cca3_1 ; CONSTANT C2_cca3_1 : t_cca3_1 ; -- CONSTANT CX_cca3_2 : t_cca3_2 ; CONSTANT C0_cca3_2 : t_cca3_2 ; CONSTANT C1_cca3_2 : t_cca3_2 ; CONSTANT C2_cca3_2 : t_cca3_2 ; CONSTANT CX_cmre_1 : t_cmre_1 := ( CX_csa1_1, CX_scre_1 ); CONSTANT C0_cmre_1 : t_cmre_1 := ( C0_csa1_1, C0_scre_1 ); CONSTANT C1_cmre_1 : t_cmre_1 := ( C1_csa1_1, C1_scre_1 ); CONSTANT C2_cmre_1 : t_cmre_1 := ( C2_csa1_1, C0_scre_1 ); CONSTANT CX_cmre_2 : t_cmre_2 := ( OTHERS=>CX_csa1_1 ); CONSTANT C0_cmre_2 : t_cmre_2 := ( OTHERS=>C0_csa1_1 ); CONSTANT C1_cmre_2 : t_cmre_2 := ( OTHERS=>C1_csa1_1 ); CONSTANT C2_cmre_2 : t_cmre_2 := ( left|right=>C2_csa1_1, OTHERS=>C0_csa1_1 ); CONSTANT CX_cca1_7 : t_cca1_7 := ( OTHERS=>CX_cmre_2 ); CONSTANT C0_cca1_7 : t_cca1_7 := ( OTHERS=>C0_cmre_2 ); CONSTANT C1_cca1_7 : t_cca1_7 := ( OTHERS=>C1_cmre_2 ); CONSTANT C2_cca1_7 : t_cca1_7 := ( C2_cmre_2, C0_cmre_2, C0_cmre_2, C2_cmre_2 ); CONSTANT CX_cmre_3 : t_cmre_3 := ( OTHERS=>CX_cca1_7 ); CONSTANT C0_cmre_3 : t_cmre_3 := ( OTHERS=>C0_cca1_7 ); CONSTANT C1_cmre_3 : t_cmre_3 := ( OTHERS=>C1_cca1_7 ); CONSTANT C2_cmre_3 : t_cmre_3 := ( left|right=>C2_cca1_7, OTHERS=>C0_cca1_7 ); -- -------------------------------------------------------------------------------------------- -- Functions for mapping from integer test values to/from values of the Test types -- -------------------------------------------------------------------------------------------- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1; FUNCTION val_t ( i : INTEGER ) RETURN TIME; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3; FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER; FUNCTION val_i ( i : TIME ) RETURN INTEGER; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER; FUNCTION val_s ( i : st_scl1 ) RETURN STRING; FUNCTION val_s ( i : TIME ) RETURN STRING; FUNCTION val_s ( i : st_scl3 ) RETURN STRING; FUNCTION val_s ( i : st_scl4 ) RETURN STRING; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING; END; PACKAGE BODY c03s03b00x00p03n04i00521pkg IS CONSTANT CX_csa2_1 : t_csa2_1 := F_csa2_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa2_1 : t_csa2_1 := F_csa2_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa2_1 : t_csa2_1 := F_csa2_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa3_1 : t_csa3_1 := F_csa3_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa3_1 : t_csa3_1 := F_csa3_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa3_1 : t_csa3_1 := F_csa3_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_csa4_1 : t_csa4_1 := F_csa4_1 ( CX_scl1, CX_scl1 ); CONSTANT C0_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C0_scl1 ); CONSTANT C1_csa4_1 : t_csa4_1 := F_csa4_1 ( C1_scl1, C1_scl1 ); CONSTANT C2_csa4_1 : t_csa4_1 := F_csa4_1 ( C0_scl1, C2_scl1 ); CONSTANT CX_cca2_1 : t_cca2_1 := ( OTHERS=>CX_csa2_1 ); CONSTANT C0_cca2_1 : t_cca2_1 := ( OTHERS=>C0_csa2_1 ); CONSTANT C1_cca2_1 : t_cca2_1 := ( OTHERS=>C1_csa2_1 ); CONSTANT C2_cca2_1 : t_cca2_1 := ( C2_csa2_1, C0_csa2_1, C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca2_2 : t_cca2_2 := F_cca2_2 ( CX_csa2_1, CX_csa2_1 ); CONSTANT C0_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C0_csa2_1 ); CONSTANT C1_cca2_2 : t_cca2_2 := F_cca2_2 ( C1_csa2_1, C1_csa2_1 ); CONSTANT C2_cca2_2 : t_cca2_2 := F_cca2_2 ( C0_csa2_1, C2_csa2_1 ); CONSTANT CX_cca3_1 : t_cca3_1 := F_cca3_1 ( CX_csa1_1, CX_csa1_1 ); CONSTANT C0_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C0_csa1_1 ); CONSTANT C1_cca3_1 : t_cca3_1 := F_cca3_1 ( C1_csa1_1, C1_csa1_1 ); CONSTANT C2_cca3_1 : t_cca3_1 := F_cca3_1 ( C0_csa1_1, C2_csa1_1 ); CONSTANT CX_cca3_2 : t_cca3_2 := ( OTHERS=>CX_csa3_1 ); CONSTANT C0_cca3_2 : t_cca3_2 := ( OTHERS=>C0_csa3_1 ); CONSTANT C1_cca3_2 : t_cca3_2 := ( OTHERS=>C1_csa3_1 ); CONSTANT C2_cca3_2 : t_cca3_2 := ( C2_csa3_1, C0_csa3_1, C0_csa3_1, C2_csa3_1 ); -- -- Functions to provide values for multi-dimensional composites -- FUNCTION F_csa2_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa2_1 IS VARIABLE res : t_csa2_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_csa3_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa3_1 IS VARIABLE res : t_csa3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; FUNCTION F_csa4_1 ( v0,v2 : IN st_scl1 ) RETURN t_csa4_1 IS VARIABLE res : t_csa4_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP FOR l IN res'RANGE(4) LOOP res(i,j,k,l) := v0; END LOOP; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3),res'left (4)) := v2; res(res'right(1),res'left (2),res'left (3),res'left (4)) := v2; res(res'left (1),res'right(2),res'left (3),res'left (4)) := v2; res(res'right(1),res'right(2),res'left (3),res'left (4)) := v2; res(res'left (1),res'left (2),res'right(3),res'left (4)) := v2; res(res'right(1),res'left (2),res'right(3),res'left (4)) := v2; res(res'left (1),res'right(2),res'right(3),res'left (4)) := v2; res(res'right(1),res'right(2),res'right(3),res'left (4)) := v2; res(res'left (1),res'left (2),res'left (3),res'right(4)) := v2; res(res'right(1),res'left (2),res'left (3),res'right(4)) := v2; res(res'left (1),res'right(2),res'left (3),res'right(4)) := v2; res(res'right(1),res'right(2),res'left (3),res'right(4)) := v2; res(res'left (1),res'left (2),res'right(3),res'right(4)) := v2; res(res'right(1),res'left (2),res'right(3),res'right(4)) := v2; res(res'left (1),res'right(2),res'right(3),res'right(4)) := v2; res(res'right(1),res'right(2),res'right(3),res'right(4)) := v2; RETURN res; END; FUNCTION F_cca2_2 ( v0,v2 : IN t_csa2_1 ) RETURN t_cca2_2 IS VARIABLE res : t_cca2_2; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP res(i,j) := v0; END LOOP; END LOOP; res(res'left (1),res'left (2)) := v2; res(res'left (1),res'right(2)) := v2; res(res'right(1),res'left (2)) := v2; res(res'right(1),res'right(2)) := v2; RETURN res; END; FUNCTION F_cca3_1 ( v0,v2 : IN t_csa1_1 ) RETURN t_cca3_1 IS VARIABLE res : t_cca3_1; BEGIN FOR i IN res'RANGE(1) LOOP FOR j IN res'RANGE(2) LOOP FOR k IN res'RANGE(3) LOOP res(i,j,k) := v0; END LOOP; END LOOP; END LOOP; res(res'left (1),res'left (2),res'left (3)) := v2; res(res'right(1),res'left (2),res'left (3)) := v2; res(res'left (1),res'right(2),res'left (3)) := v2; res(res'right(1),res'right(2),res'left (3)) := v2; res(res'left (1),res'left (2),res'right(3)) := v2; res(res'right(1),res'left (2),res'right(3)) := v2; res(res'left (1),res'right(2),res'right(3)) := v2; res(res'right(1),res'right(2),res'right(3)) := v2; RETURN res; END; -- -- Resolution Functions -- FUNCTION rf_scre_1 ( v: t_scre_1_vct ) RETURN t_scre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_scre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_1 ( v: t_csa1_1_vct ) RETURN t_csa1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_2 ( v: t_csa1_2_vct ) RETURN t_csa1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_3 ( v: t_csa1_3_vct ) RETURN t_csa1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa1_4 ( v: t_csa1_4_vct ) RETURN t_csa1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa2_1 ( v: t_csa2_1_vct ) RETURN t_csa2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa3_1 ( v: t_csa3_1_vct ) RETURN t_csa3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_csa4_1 ( v: t_csa4_1_vct ) RETURN t_csa4_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_csa4_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_1 ( v: t_cca1_1_vct ) RETURN t_cca1_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_2 ( v: t_cca1_2_vct ) RETURN t_cca1_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_3 ( v: t_cca1_3_vct ) RETURN t_cca1_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_3; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_4 ( v: t_cca1_4_vct ) RETURN t_cca1_4 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_4; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_1 ( v: t_cca2_1_vct ) RETURN t_cca2_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca2_2 ( v: t_cca2_2_vct ) RETURN t_cca2_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca2_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_1 ( v: t_cca3_1_vct ) RETURN t_cca3_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca3_2 ( v: t_cca3_2_vct ) RETURN t_cca3_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca3_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_1 ( v: t_cmre_1_vct ) RETURN t_cmre_1 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_1; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_2 ( v: t_cmre_2_vct ) RETURN t_cmre_2 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_2; ELSE RETURN v(1); END IF; END; FUNCTION rf_cca1_7 ( v: t_cca1_7_vct ) RETURN t_cca1_7 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cca1_7; ELSE RETURN v(1); END IF; END; FUNCTION rf_cmre_3 ( v: t_cmre_3_vct ) RETURN t_cmre_3 IS BEGIN IF v'LENGTH=0 THEN RETURN CX_cmre_3; ELSE RETURN v(1); END IF; END; -- -- FUNCTION val_t ( i : INTEGER ) RETURN st_scl1 IS BEGIN IF i = 0 THEN RETURN C0_scl1; END IF; IF i = 1 THEN RETURN C1_scl1; END IF; IF i = 2 THEN RETURN C2_scl1; END IF; RETURN CX_scl1; END; FUNCTION val_t ( i : INTEGER ) RETURN TIME IS BEGIN IF i = 0 THEN RETURN C0_scl2; END IF; IF i = 1 THEN RETURN C1_scl2; END IF; IF i = 2 THEN RETURN C2_scl2; END IF; RETURN CX_scl2; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl3 IS BEGIN IF i = 0 THEN RETURN C0_scl3; END IF; IF i = 1 THEN RETURN C1_scl3; END IF; IF i = 2 THEN RETURN C2_scl3; END IF; RETURN CX_scl3; END; FUNCTION val_t ( i : INTEGER ) RETURN st_scl4 IS BEGIN IF i = 0 THEN RETURN C0_scl4; END IF; IF i = 1 THEN RETURN C1_scl4; END IF; IF i = 2 THEN RETURN C2_scl4; END IF; RETURN CX_scl4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_scre_1 IS BEGIN IF i = 0 THEN RETURN C0_scre_1; END IF; IF i = 1 THEN RETURN C1_scre_1; END IF; IF i = 2 THEN RETURN C2_scre_1; END IF; RETURN CX_scre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_1 IS BEGIN IF i = 0 THEN RETURN C0_csa1_1; END IF; IF i = 1 THEN RETURN C1_csa1_1; END IF; IF i = 2 THEN RETURN C2_csa1_1; END IF; RETURN CX_csa1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_2 IS BEGIN IF i = 0 THEN RETURN C0_csa1_2; END IF; IF i = 1 THEN RETURN C1_csa1_2; END IF; IF i = 2 THEN RETURN C2_csa1_2; END IF; RETURN CX_csa1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_3 IS BEGIN IF i = 0 THEN RETURN C0_csa1_3; END IF; IF i = 1 THEN RETURN C1_csa1_3; END IF; IF i = 2 THEN RETURN C2_csa1_3; END IF; RETURN CX_csa1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa1_4 IS BEGIN IF i = 0 THEN RETURN C0_csa1_4; END IF; IF i = 1 THEN RETURN C1_csa1_4; END IF; IF i = 2 THEN RETURN C2_csa1_4; END IF; RETURN CX_csa1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa2_1 IS BEGIN IF i = 0 THEN RETURN C0_csa2_1; END IF; IF i = 1 THEN RETURN C1_csa2_1; END IF; IF i = 2 THEN RETURN C2_csa2_1; END IF; RETURN CX_csa2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa3_1 IS BEGIN IF i = 0 THEN RETURN C0_csa3_1; END IF; IF i = 1 THEN RETURN C1_csa3_1; END IF; IF i = 2 THEN RETURN C2_csa3_1; END IF; RETURN CX_csa3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_csa4_1 IS BEGIN IF i = 0 THEN RETURN C0_csa4_1; END IF; IF i = 1 THEN RETURN C1_csa4_1; END IF; IF i = 2 THEN RETURN C2_csa4_1; END IF; RETURN CX_csa4_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_1 IS BEGIN IF i = 0 THEN RETURN C0_cca1_1; END IF; IF i = 1 THEN RETURN C1_cca1_1; END IF; IF i = 2 THEN RETURN C2_cca1_1; END IF; RETURN CX_cca1_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_2 IS BEGIN IF i = 0 THEN RETURN C0_cca1_2; END IF; IF i = 1 THEN RETURN C1_cca1_2; END IF; IF i = 2 THEN RETURN C2_cca1_2; END IF; RETURN CX_cca1_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_3 IS BEGIN IF i = 0 THEN RETURN C0_cca1_3; END IF; IF i = 1 THEN RETURN C1_cca1_3; END IF; IF i = 2 THEN RETURN C2_cca1_3; END IF; RETURN CX_cca1_3; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_4 IS BEGIN IF i = 0 THEN RETURN C0_cca1_4; END IF; IF i = 1 THEN RETURN C1_cca1_4; END IF; IF i = 2 THEN RETURN C2_cca1_4; END IF; RETURN CX_cca1_4; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_1 IS BEGIN IF i = 0 THEN RETURN C0_cca2_1; END IF; IF i = 1 THEN RETURN C1_cca2_1; END IF; IF i = 2 THEN RETURN C2_cca2_1; END IF; RETURN CX_cca2_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca2_2 IS BEGIN IF i = 0 THEN RETURN C0_cca2_2; END IF; IF i = 1 THEN RETURN C1_cca2_2; END IF; IF i = 2 THEN RETURN C2_cca2_2; END IF; RETURN CX_cca2_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_1 IS BEGIN IF i = 0 THEN RETURN C0_cca3_1; END IF; IF i = 1 THEN RETURN C1_cca3_1; END IF; IF i = 2 THEN RETURN C2_cca3_1; END IF; RETURN CX_cca3_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca3_2 IS BEGIN IF i = 0 THEN RETURN C0_cca3_2; END IF; IF i = 1 THEN RETURN C1_cca3_2; END IF; IF i = 2 THEN RETURN C2_cca3_2; END IF; RETURN CX_cca3_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_1 IS BEGIN IF i = 0 THEN RETURN C0_cmre_1; END IF; IF i = 1 THEN RETURN C1_cmre_1; END IF; IF i = 2 THEN RETURN C2_cmre_1; END IF; RETURN CX_cmre_1; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_2 IS BEGIN IF i = 0 THEN RETURN C0_cmre_2; END IF; IF i = 1 THEN RETURN C1_cmre_2; END IF; IF i = 2 THEN RETURN C2_cmre_2; END IF; RETURN CX_cmre_2; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cca1_7 IS BEGIN IF i = 0 THEN RETURN C0_cca1_7; END IF; IF i = 1 THEN RETURN C1_cca1_7; END IF; IF i = 2 THEN RETURN C2_cca1_7; END IF; RETURN CX_cca1_7; END; FUNCTION val_t ( i : INTEGER ) RETURN t_cmre_3 IS BEGIN IF i = 0 THEN RETURN C0_cmre_3; END IF; IF i = 1 THEN RETURN C1_cmre_3; END IF; IF i = 2 THEN RETURN C2_cmre_3; END IF; RETURN CX_cmre_3; END; -- -- FUNCTION val_i ( i : st_scl1 ) RETURN INTEGER IS BEGIN IF i = C0_scl1 THEN RETURN 0; END IF; IF i = C1_scl1 THEN RETURN 1; END IF; IF i = C2_scl1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : TIME ) RETURN INTEGER IS BEGIN IF i = C0_scl2 THEN RETURN 0; END IF; IF i = C1_scl2 THEN RETURN 1; END IF; IF i = C2_scl2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl3 ) RETURN INTEGER IS BEGIN IF i = C0_scl3 THEN RETURN 0; END IF; IF i = C1_scl3 THEN RETURN 1; END IF; IF i = C2_scl3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : st_scl4 ) RETURN INTEGER IS BEGIN IF i = C0_scl4 THEN RETURN 0; END IF; IF i = C1_scl4 THEN RETURN 1; END IF; IF i = C2_scl4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_scre_1 ) RETURN INTEGER IS BEGIN IF i = C0_scre_1 THEN RETURN 0; END IF; IF i = C1_scre_1 THEN RETURN 1; END IF; IF i = C2_scre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_1 THEN RETURN 0; END IF; IF i = C1_csa1_1 THEN RETURN 1; END IF; IF i = C2_csa1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_2 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_2 THEN RETURN 0; END IF; IF i = C1_csa1_2 THEN RETURN 1; END IF; IF i = C2_csa1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_3 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_3 THEN RETURN 0; END IF; IF i = C1_csa1_3 THEN RETURN 1; END IF; IF i = C2_csa1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa1_4 ) RETURN INTEGER IS BEGIN IF i = C0_csa1_4 THEN RETURN 0; END IF; IF i = C1_csa1_4 THEN RETURN 1; END IF; IF i = C2_csa1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa2_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa2_1 THEN RETURN 0; END IF; IF i = C1_csa2_1 THEN RETURN 1; END IF; IF i = C2_csa2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa3_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa3_1 THEN RETURN 0; END IF; IF i = C1_csa3_1 THEN RETURN 1; END IF; IF i = C2_csa3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_csa4_1 ) RETURN INTEGER IS BEGIN IF i = C0_csa4_1 THEN RETURN 0; END IF; IF i = C1_csa4_1 THEN RETURN 1; END IF; IF i = C2_csa4_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_1 THEN RETURN 0; END IF; IF i = C1_cca1_1 THEN RETURN 1; END IF; IF i = C2_cca1_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_2 THEN RETURN 0; END IF; IF i = C1_cca1_2 THEN RETURN 1; END IF; IF i = C2_cca1_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_3 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_3 THEN RETURN 0; END IF; IF i = C1_cca1_3 THEN RETURN 1; END IF; IF i = C2_cca1_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_4 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_4 THEN RETURN 0; END IF; IF i = C1_cca1_4 THEN RETURN 1; END IF; IF i = C2_cca1_4 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_1 THEN RETURN 0; END IF; IF i = C1_cca2_1 THEN RETURN 1; END IF; IF i = C2_cca2_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca2_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca2_2 THEN RETURN 0; END IF; IF i = C1_cca2_2 THEN RETURN 1; END IF; IF i = C2_cca2_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_1 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_1 THEN RETURN 0; END IF; IF i = C1_cca3_1 THEN RETURN 1; END IF; IF i = C2_cca3_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca3_2 ) RETURN INTEGER IS BEGIN IF i = C0_cca3_2 THEN RETURN 0; END IF; IF i = C1_cca3_2 THEN RETURN 1; END IF; IF i = C2_cca3_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_1 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_1 THEN RETURN 0; END IF; IF i = C1_cmre_1 THEN RETURN 1; END IF; IF i = C2_cmre_1 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_2 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_2 THEN RETURN 0; END IF; IF i = C1_cmre_2 THEN RETURN 1; END IF; IF i = C2_cmre_2 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cca1_7 ) RETURN INTEGER IS BEGIN IF i = C0_cca1_7 THEN RETURN 0; END IF; IF i = C1_cca1_7 THEN RETURN 1; END IF; IF i = C2_cca1_7 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_i ( i : t_cmre_3 ) RETURN INTEGER IS BEGIN IF i = C0_cmre_3 THEN RETURN 0; END IF; IF i = C1_cmre_3 THEN RETURN 1; END IF; IF i = C2_cmre_3 THEN RETURN 2; END IF; RETURN -1; END; FUNCTION val_s ( i : st_scl1 ) RETURN STRING IS BEGIN IF i = C0_scl1 THEN RETURN "C0_scl1"; END IF; IF i = C1_scl1 THEN RETURN "C1_scl1"; END IF; IF i = C2_scl1 THEN RETURN "C2_scl1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : TIME ) RETURN STRING IS BEGIN IF i = C0_scl2 THEN RETURN "C0_scl2"; END IF; IF i = C1_scl2 THEN RETURN "C1_scl2"; END IF; IF i = C2_scl2 THEN RETURN "C2_scl2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl3 ) RETURN STRING IS BEGIN IF i = C0_scl3 THEN RETURN "C0_scl3"; END IF; IF i = C1_scl3 THEN RETURN "C1_scl3"; END IF; IF i = C2_scl3 THEN RETURN "C2_scl3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : st_scl4 ) RETURN STRING IS BEGIN IF i = C0_scl4 THEN RETURN "C0_scl4"; END IF; IF i = C1_scl4 THEN RETURN "C1_scl4"; END IF; IF i = C2_scl4 THEN RETURN "C2_scl4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_scre_1 ) RETURN STRING IS BEGIN IF i = C0_scre_1 THEN RETURN "C0_scre_1"; END IF; IF i = C1_scre_1 THEN RETURN "C1_scre_1"; END IF; IF i = C2_scre_1 THEN RETURN "C2_scre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_1 ) RETURN STRING IS BEGIN IF i = C0_csa1_1 THEN RETURN "C0_csa1_1"; END IF; IF i = C1_csa1_1 THEN RETURN "C1_csa1_1"; END IF; IF i = C2_csa1_1 THEN RETURN "C2_csa1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_2 ) RETURN STRING IS BEGIN IF i = C0_csa1_2 THEN RETURN "C0_csa1_2"; END IF; IF i = C1_csa1_2 THEN RETURN "C1_csa1_2"; END IF; IF i = C2_csa1_2 THEN RETURN "C2_csa1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_3 ) RETURN STRING IS BEGIN IF i = C0_csa1_3 THEN RETURN "C0_csa1_3"; END IF; IF i = C1_csa1_3 THEN RETURN "C1_csa1_3"; END IF; IF i = C2_csa1_3 THEN RETURN "C2_csa1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa1_4 ) RETURN STRING IS BEGIN IF i = C0_csa1_4 THEN RETURN "C0_csa1_4"; END IF; IF i = C1_csa1_4 THEN RETURN "C1_csa1_4"; END IF; IF i = C2_csa1_4 THEN RETURN "C2_csa1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa2_1 ) RETURN STRING IS BEGIN IF i = C0_csa2_1 THEN RETURN "C0_csa2_1"; END IF; IF i = C1_csa2_1 THEN RETURN "C1_csa2_1"; END IF; IF i = C2_csa2_1 THEN RETURN "C2_csa2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa3_1 ) RETURN STRING IS BEGIN IF i = C0_csa3_1 THEN RETURN "C0_csa3_1"; END IF; IF i = C1_csa3_1 THEN RETURN "C1_csa3_1"; END IF; IF i = C2_csa3_1 THEN RETURN "C2_csa3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_csa4_1 ) RETURN STRING IS BEGIN IF i = C0_csa4_1 THEN RETURN "C0_csa4_1"; END IF; IF i = C1_csa4_1 THEN RETURN "C1_csa4_1"; END IF; IF i = C2_csa4_1 THEN RETURN "C2_csa4_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_1 ) RETURN STRING IS BEGIN IF i = C0_cca1_1 THEN RETURN "C0_cca1_1"; END IF; IF i = C1_cca1_1 THEN RETURN "C1_cca1_1"; END IF; IF i = C2_cca1_1 THEN RETURN "C2_cca1_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_2 ) RETURN STRING IS BEGIN IF i = C0_cca1_2 THEN RETURN "C0_cca1_2"; END IF; IF i = C1_cca1_2 THEN RETURN "C1_cca1_2"; END IF; IF i = C2_cca1_2 THEN RETURN "C2_cca1_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_3 ) RETURN STRING IS BEGIN IF i = C0_cca1_3 THEN RETURN "C0_cca1_3"; END IF; IF i = C1_cca1_3 THEN RETURN "C1_cca1_3"; END IF; IF i = C2_cca1_3 THEN RETURN "C2_cca1_3"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_4 ) RETURN STRING IS BEGIN IF i = C0_cca1_4 THEN RETURN "C0_cca1_4"; END IF; IF i = C1_cca1_4 THEN RETURN "C1_cca1_4"; END IF; IF i = C2_cca1_4 THEN RETURN "C2_cca1_4"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_1 ) RETURN STRING IS BEGIN IF i = C0_cca2_1 THEN RETURN "C0_cca2_1"; END IF; IF i = C1_cca2_1 THEN RETURN "C1_cca2_1"; END IF; IF i = C2_cca2_1 THEN RETURN "C2_cca2_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca2_2 ) RETURN STRING IS BEGIN IF i = C0_cca2_2 THEN RETURN "C0_cca2_2"; END IF; IF i = C1_cca2_2 THEN RETURN "C1_cca2_2"; END IF; IF i = C2_cca2_2 THEN RETURN "C2_cca2_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_1 ) RETURN STRING IS BEGIN IF i = C0_cca3_1 THEN RETURN "C0_cca3_1"; END IF; IF i = C1_cca3_1 THEN RETURN "C1_cca3_1"; END IF; IF i = C2_cca3_1 THEN RETURN "C2_cca3_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca3_2 ) RETURN STRING IS BEGIN IF i = C0_cca3_2 THEN RETURN "C0_cca3_2"; END IF; IF i = C1_cca3_2 THEN RETURN "C1_cca3_2"; END IF; IF i = C2_cca3_2 THEN RETURN "C2_cca3_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_1 ) RETURN STRING IS BEGIN IF i = C0_cmre_1 THEN RETURN "C0_cmre_1"; END IF; IF i = C1_cmre_1 THEN RETURN "C1_cmre_1"; END IF; IF i = C2_cmre_1 THEN RETURN "C2_cmre_1"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_2 ) RETURN STRING IS BEGIN IF i = C0_cmre_2 THEN RETURN "C0_cmre_2"; END IF; IF i = C1_cmre_2 THEN RETURN "C1_cmre_2"; END IF; IF i = C2_cmre_2 THEN RETURN "C2_cmre_2"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cca1_7 ) RETURN STRING IS BEGIN IF i = C0_cca1_7 THEN RETURN "C0_cca1_7"; END IF; IF i = C1_cca1_7 THEN RETURN "C1_cca1_7"; END IF; IF i = C2_cca1_7 THEN RETURN "C2_cca1_7"; END IF; RETURN "UNKNOWN"; END; FUNCTION val_s ( i : t_cmre_3 ) RETURN STRING IS BEGIN IF i = C0_cmre_3 THEN RETURN "C0_cmre_3"; END IF; IF i = C1_cmre_3 THEN RETURN "C1_cmre_3"; END IF; IF i = C2_cmre_3 THEN RETURN "C2_cmre_3"; END IF; RETURN "UNKNOWN"; END; END c03s03b00x00p03n04i00521pkg; USE work.c03s03b00x00p03n04i00521pkg.ALL; ENTITY c03s03b00x00p03n04i00521ent IS END c03s03b00x00p03n04i00521ent; ARCHITECTURE c03s03b00x00p03n04i00521arch OF c03s03b00x00p03n04i00521ent IS -- -- Access type declarations -- TYPE at_usa2_1 IS ACCESS t_usa2_1 ; TYPE at_usa3_1 IS ACCESS t_usa3_1 ; TYPE at_usa4_1 IS ACCESS t_usa4_1 ; TYPE at_csa2_1 IS ACCESS t_csa2_1 ; TYPE at_csa3_1 IS ACCESS t_csa3_1 ; TYPE at_csa4_1 IS ACCESS t_csa4_1 ; TYPE at_cca2_1 IS ACCESS t_cca2_1 ; TYPE at_cca2_2 IS ACCESS t_cca2_2 ; TYPE at_cca3_1 IS ACCESS t_cca3_1 ; TYPE at_cca3_2 IS ACCESS t_cca3_2 ; -- -- BEGIN TESTING: PROCESS -- -- ACCESS VARIABLE declarations -- VARIABLE AV0_usa2_1 : at_usa2_1 ; VARIABLE AV2_usa2_1 : at_usa2_1 ; VARIABLE AV0_usa3_1 : at_usa3_1 ; VARIABLE AV2_usa3_1 : at_usa3_1 ; VARIABLE AV0_usa4_1 : at_usa4_1 ; VARIABLE AV2_usa4_1 : at_usa4_1 ; VARIABLE AV0_csa2_1 : at_csa2_1 ; VARIABLE AV2_csa2_1 : at_csa2_1 ; VARIABLE AV0_csa3_1 : at_csa3_1 ; VARIABLE AV2_csa3_1 : at_csa3_1 ; VARIABLE AV0_csa4_1 : at_csa4_1 ; VARIABLE AV2_csa4_1 : at_csa4_1 ; VARIABLE AV0_cca2_1 : at_cca2_1 ; VARIABLE AV2_cca2_1 : at_cca2_1 ; VARIABLE AV0_cca2_2 : at_cca2_2 ; VARIABLE AV2_cca2_2 : at_cca2_2 ; VARIABLE AV0_cca3_1 : at_cca3_1 ; VARIABLE AV2_cca3_1 : at_cca3_1 ; VARIABLE AV0_cca3_2 : at_cca3_2 ; VARIABLE AV2_cca3_2 : at_cca3_2 ; -- -- BEGIN -- -- Allocation of access values -- AV0_usa2_1 := NEW t_usa2_1 ( st_ind2, st_ind1 ) ; AV0_usa3_1 := NEW t_usa3_1 ( st_ind3, st_ind2, st_ind1 ) ; AV0_usa4_1 := NEW t_usa4_1 (st_ind4, st_ind3, st_ind2, st_ind1 ) ; AV0_csa2_1 := NEW t_csa2_1 ; AV0_csa3_1 := NEW t_csa3_1 ; AV0_csa4_1 := NEW t_csa4_1 ; AV0_cca2_1 := NEW t_cca2_1 ; AV0_cca2_2 := NEW t_cca2_2 ; AV0_cca3_1 := NEW t_cca3_1 ; AV0_cca3_2 := NEW t_cca3_2 ; --- AV2_usa2_1 := NEW t_usa2_1 ' ( C2_csa2_1 ) ; AV2_usa3_1 := NEW t_usa3_1 ' ( C2_csa3_1 ) ; AV2_usa4_1 := NEW t_usa4_1 ' ( C2_csa4_1 ) ; AV2_csa2_1 := NEW t_csa2_1 ' ( C2_csa2_1 ) ; AV2_csa3_1 := NEW t_csa3_1 ' ( C2_csa3_1 ) ; AV2_csa4_1 := NEW t_csa4_1 ' ( C2_csa4_1 ) ; AV2_cca2_1 := NEW t_cca2_1 ' ( C2_cca2_1 ) ; AV2_cca2_2 := NEW t_cca2_2 ' ( C2_cca2_2 ) ; AV2_cca3_1 := NEW t_cca3_1 ' ( C2_cca3_1 ) ; AV2_cca3_2 := NEW t_cca3_2 ' ( C2_cca3_2 ) ; -- -- ASSERT AV0_usa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_usa2_1" SEVERITY FAILURE; ASSERT AV2_usa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_usa2_1" SEVERITY FAILURE; ASSERT AV0_usa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_usa3_1" SEVERITY FAILURE; ASSERT AV2_usa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_usa3_1" SEVERITY FAILURE; ASSERT AV0_usa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_usa4_1" SEVERITY FAILURE; ASSERT AV2_usa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_usa4_1" SEVERITY FAILURE; ASSERT AV0_csa2_1.all = C0_csa2_1 REPORT "Improper initialization of AV0_csa2_1" SEVERITY FAILURE; ASSERT AV2_csa2_1.all = C2_csa2_1 REPORT "Improper initialization of AV2_csa2_1" SEVERITY FAILURE; ASSERT AV0_csa3_1.all = C0_csa3_1 REPORT "Improper initialization of AV0_csa3_1" SEVERITY FAILURE; ASSERT AV2_csa3_1.all = C2_csa3_1 REPORT "Improper initialization of AV2_csa3_1" SEVERITY FAILURE; ASSERT AV0_csa4_1.all = C0_csa4_1 REPORT "Improper initialization of AV0_csa4_1" SEVERITY FAILURE; ASSERT AV2_csa4_1.all = C2_csa4_1 REPORT "Improper initialization of AV2_csa4_1" SEVERITY FAILURE; ASSERT AV0_cca2_1.all = C0_cca2_1 REPORT "Improper initialization of AV0_cca2_1" SEVERITY FAILURE; ASSERT AV2_cca2_1.all = C2_cca2_1 REPORT "Improper initialization of AV2_cca2_1" SEVERITY FAILURE; ASSERT AV0_cca2_2.all = C0_cca2_2 REPORT "Improper initialization of AV0_cca2_2" SEVERITY FAILURE; ASSERT AV2_cca2_2.all = C2_cca2_2 REPORT "Improper initialization of AV2_cca2_2" SEVERITY FAILURE; ASSERT AV0_cca3_1.all = C0_cca3_1 REPORT "Improper initialization of AV0_cca3_1" SEVERITY FAILURE; ASSERT AV2_cca3_1.all = C2_cca3_1 REPORT "Improper initialization of AV2_cca3_1" SEVERITY FAILURE; ASSERT AV0_cca3_2.all = C0_cca3_2 REPORT "Improper initialization of AV0_cca3_2" SEVERITY FAILURE; ASSERT AV2_cca3_2.all = C2_cca3_2 REPORT "Improper initialization of AV2_cca3_2" SEVERITY FAILURE; -- -- assert NOT( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***PASSED TEST: c03s03b00x00p03n04i00521" severity NOTE; assert ( ( AV0_usa2_1.all = C0_csa2_1 ) and ( AV2_usa2_1.all = C2_csa2_1 ) and ( AV0_usa3_1.all = C0_csa3_1 ) and ( AV2_usa3_1.all = C2_csa3_1 ) and ( AV0_usa4_1.all = C0_csa4_1 ) and ( AV2_usa4_1.all = C2_csa4_1 ) and ( AV0_csa2_1.all = C0_csa2_1 ) and ( AV2_csa2_1.all = C2_csa2_1 ) and ( AV0_csa3_1.all = C0_csa3_1 ) and ( AV2_csa3_1.all = C2_csa3_1 )) report "***FAILED TEST: c03s03b00x00p03n04i00521 - Each access value designates an object of the subtype defined by the subtype indication of the access type definition." severity ERROR; wait; END PROCESS TESTING; END c03s03b00x00p03n04i00521arch;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.slot_bus_pkg.all; entity all_carts_v4 is generic ( g_kernal_base : std_logic_vector(27 downto 0) := X"0ECC000"; -- multiple of 16K g_rom_base : std_logic_vector(27 downto 0) := X"0F00000"; -- multiple of 1M g_ram_base : std_logic_vector(27 downto 0) := X"0EF0000" ); -- multiple of 64K port ( clock : in std_logic; reset : in std_logic; RST_in : in std_logic; c64_reset : in std_logic; ethernet_enable : in std_logic := '1'; kernal_enable : in std_logic; kernal_area : in std_logic; freeze_trig : in std_logic; -- goes '1' when the button has been pressed and we're waiting to enter the freezer freeze_act : in std_logic; -- goes '1' when we need to switch in the cartridge for freeze mode unfreeze : out std_logic; -- indicates the freeze logic to switch back to non-freeze mode. cart_active : out std_logic; -- indicates that the cartridge is active cart_kill : in std_logic; cart_logic : in std_logic_vector(3 downto 0); -- 1 out of 16 logic emulations slot_req : in t_slot_req; slot_resp : out t_slot_resp; epyx_timeout : in std_logic; serve_enable : out std_logic; -- enables fetching bus address PHI2=1 serve_vic : out std_logic; -- enables doing so for PHI2=0 serve_rom : out std_logic; -- ROML or ROMH serve_io1 : out std_logic; -- IO1n serve_io2 : out std_logic; -- IO2n allow_write : out std_logic; mem_addr : out unsigned(25 downto 0); irq_n : out std_logic; nmi_n : out std_logic; exrom_n : out std_logic; game_n : out std_logic; CART_LEDn : out std_logic ); end all_carts_v4; architecture gideon of all_carts_v4 is signal reset_in : std_logic; signal ext_bank : std_logic_vector(18 downto 16); signal bank_bits : std_logic_vector(15 downto 13); signal mode_bits : std_logic_vector(2 downto 0); signal ram_select : std_logic; -- signal rom_enable : std_logic; signal freeze_act_d : std_logic; signal cart_en : std_logic; signal do_io2 : std_logic; signal allow_bank : std_logic; signal hold_nmi : std_logic; signal eth_addr : boolean; signal cart_logic_d : std_logic_vector(cart_logic'range) := (others => '0'); signal mem_addr_i : std_logic_vector(27 downto 0); constant c_none : std_logic_vector(3 downto 0) := "0000"; constant c_8k : std_logic_vector(3 downto 0) := "0001"; constant c_16k : std_logic_vector(3 downto 0) := "0010"; constant c_16k_umax : std_logic_vector(3 downto 0) := "0011"; constant c_fc3 : std_logic_vector(3 downto 0) := "0100"; constant c_ss5 : std_logic_vector(3 downto 0) := "0101"; constant c_retro : std_logic_vector(3 downto 0) := "0110"; constant c_action : std_logic_vector(3 downto 0) := "0111"; constant c_system3 : std_logic_vector(3 downto 0) := "1000"; constant c_domark : std_logic_vector(3 downto 0) := "1001"; constant c_ocean128 : std_logic_vector(3 downto 0) := "1010"; constant c_ocean256 : std_logic_vector(3 downto 0) := "1011"; constant c_easy_flash : std_logic_vector(3 downto 0) := "1100"; constant c_epyx : std_logic_vector(3 downto 0) := "1110"; constant c_serve_rom_rr : std_logic_vector(0 to 7) := "11011111"; constant c_serve_io_rr : std_logic_vector(0 to 7) := "10101111"; -- alias signal slot_addr : std_logic_vector(15 downto 0); signal io_read : std_logic; signal io_write : std_logic; signal io_addr : std_logic_vector(8 downto 0); signal io_wdata : std_logic_vector(7 downto 0); begin serve_enable <= cart_en or kernal_enable; cart_active <= cart_en; slot_addr <= std_logic_vector(slot_req.bus_address); io_write <= slot_req.io_write; io_read <= slot_req.io_read; io_addr <= std_logic_vector(slot_req.io_address(8 downto 0)); io_wdata <= slot_req.data; process(clock) begin if rising_edge(clock) then reset_in <= reset or RST_in or c64_reset; freeze_act_d <= freeze_act; unfreeze <= '0'; -- control register if reset_in='1' then cart_logic_d <= cart_logic; -- activate change of mode! mode_bits <= (others => '0'); bank_bits <= (others => '0'); ext_bank <= (others => '0'); allow_bank <= '0'; ram_select <= '0'; do_io2 <= '1'; cart_en <= '1'; -- unfreeze <= '0'; hold_nmi <= '0'; elsif freeze_act='1' and freeze_act_d='0' then bank_bits <= (others => '0'); mode_bits <= (others => '0'); --allow_bank <= '0'; ram_select <= '0'; cart_en <= '1'; -- unfreeze <= '0'; hold_nmi <= '1'; elsif cart_en = '0' then cart_logic_d <= cart_logic; -- activate change of mode! end if; serve_vic <= '0'; case cart_logic_d is when c_fc3 => -- unfreeze <= '0'; if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF bank_bits <= io_wdata(1 downto 0) & '0'; mode_bits <= '0' & io_wdata(4) & io_wdata(5); unfreeze <= '1'; cart_en <= not io_wdata(7); hold_nmi <= not io_wdata(6); end if; if freeze_act='1' then game_n <= '0'; exrom_n <= '1'; else game_n <= mode_bits(0); exrom_n <= mode_bits(1); end if; if mode_bits(1 downto 0)="10" then serve_vic <= '1'; end if; serve_rom <= '1'; serve_io1 <= '1'; serve_io2 <= '1'; irq_n <= '1'; nmi_n <= not(freeze_trig or freeze_act or hold_nmi); when c_retro | c_action => if io_write='1' and io_addr(8 downto 1) = X"00" and cart_en='1' then -- DE00/DE01 if io_addr(0)='0' then bank_bits <= io_wdata(7) & io_wdata(4 downto 3); mode_bits <= io_wdata(5) & io_wdata(1 downto 0); unfreeze <= io_wdata(6); cart_en <= not io_wdata(2); else if io_wdata(6)='1' then do_io2 <= '0'; end if; if io_wdata(1)='1' then allow_bank <= '1'; end if; end if; end if; if freeze_act='1' then game_n <= '0'; exrom_n <= '1'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; else game_n <= not mode_bits(0); exrom_n <= mode_bits(1); serve_io1 <= c_serve_io_rr(to_integer(unsigned(mode_bits))); serve_io2 <= c_serve_io_rr(to_integer(unsigned(mode_bits))) and do_io2; serve_rom <= c_serve_rom_rr(to_integer(unsigned(mode_bits))); end if; irq_n <= not(freeze_trig or freeze_act); nmi_n <= not(freeze_trig or freeze_act); when c_easy_flash => if io_write='1' and io_addr(8)='0' and cart_en='1' then -- DExx if io_addr(1)='0' then -- DE00 ext_bank <= io_wdata(5 downto 3); bank_bits <= io_wdata(2 downto 0); else -- DE02 mode_bits <= io_wdata(2 downto 0); -- LED not implemented end if; end if; game_n <= not (mode_bits(0) or not mode_bits(2)); exrom_n <= not mode_bits(1); serve_rom <= '1'; serve_io1 <= '0'; -- write registers only, no reads serve_io2 <= '1'; -- RAM irq_n <= '1'; nmi_n <= '1'; when c_ss5 => if io_write='1' and io_addr(8) = '0' and cart_en='1' then -- DE00-DEFF bank_bits <= io_wdata(4) & io_wdata(2) & '0'; mode_bits <= io_wdata(3) & io_wdata(1) & io_wdata(0); unfreeze <= not io_wdata(0); cart_en <= not io_wdata(3); end if; game_n <= mode_bits(0); exrom_n <= not mode_bits(1); serve_io1 <= cart_en; serve_io2 <= '0'; serve_rom <= cart_en; irq_n <= not(freeze_trig or freeze_act); nmi_n <= not(freeze_trig or freeze_act); when c_8k => if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF cart_en <= '0'; -- permanent off end if; game_n <= '1'; exrom_n <= '0'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '1'; -- for EPYX test irq_n <= '1'; nmi_n <= '1'; when c_16k => -- if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF -- cart_en <= '0'; -- permanent off -- end if; game_n <= '0'; exrom_n <= '0'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_16k_umax => if io_write='1' and io_addr(8 downto 0) = "111111111" and cart_en='1' then -- DFFF cart_en <= '0'; -- permanent off end if; game_n <= '0'; exrom_n <= '1'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_ocean128 => if io_write='1' and io_addr(8)='0' then -- DE00 range bank_bits <= io_wdata(2 downto 0); ext_bank <= io_wdata(5 downto 3); end if; game_n <= '1'; exrom_n <= '0'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_domark => if io_write='1' and io_addr(8)='0' then -- DE00 range bank_bits <= io_wdata(2 downto 0); ext_bank <= '0' & io_wdata(4 downto 3); mode_bits(0) <= io_wdata(7); -- if io_wdata(7 downto 5) /= "000" then -- permanent off -- cart_en <= '0'; -- end if; cart_en <= not (io_wdata(7) or io_wdata(6) or io_wdata(5)); end if; game_n <= '1'; exrom_n <= mode_bits(0); serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_ocean256 => if io_write='1' and io_addr(8)='0' then -- DE00 range bank_bits <= io_wdata(2 downto 0); ext_bank <= "00" & io_wdata(3); end if; game_n <= '0'; exrom_n <= '0'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_system3 => -- 16K, only 8K used? if (io_write='1' or io_read='1') and io_addr(8)='0' then -- DE00 range bank_bits <= io_addr(2 downto 0); ext_bank <= io_addr(5 downto 3); end if; game_n <= '1'; exrom_n <= '0'; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; when c_epyx => game_n <= '1'; exrom_n <= epyx_timeout; serve_rom <= '1'; serve_io1 <= '0'; serve_io2 <= '1'; -- rom visible df00-dfff irq_n <= '1'; nmi_n <= '1'; when others => game_n <= '1'; exrom_n <= '1'; serve_rom <= '0'; serve_io1 <= '0'; serve_io2 <= '0'; irq_n <= '1'; nmi_n <= '1'; end case; if cart_kill='1' then cart_en <= '0'; hold_nmi <= '0'; end if; end if; end process; CART_LEDn <= not cart_en; -- decode address DE02-DE0F eth_addr <= slot_addr(15 downto 4) = X"DE0" and slot_addr(3 downto 1) /= "000" and ethernet_enable='1'; -- determine address -- process(cart_logic_d, cart_base_d, slot_addr, mode_bits, bank_bits, do_io2, allow_bank, eth_addr) process(cart_logic_d, slot_addr, mode_bits, bank_bits, ext_bank, do_io2, allow_bank, eth_addr, kernal_area) begin mem_addr_i <= g_rom_base; -- defaults -- 64K, 8K banks, no writes mem_addr_i(15 downto 0) <= bank_bits(15 downto 13) & slot_addr(12 downto 0); allow_write <= '0'; case cart_logic_d is when c_retro => -- 64K RAM if mode_bits(2)='1' then if slot_addr(13)='0' then mem_addr_i <= g_ram_base(27 downto 16) & bank_bits(15 downto 13) & slot_addr(12 downto 0); if allow_bank='0' and slot_addr(15 downto 13)="110" then -- io range exceptions mem_addr_i <= g_ram_base(27 downto 16) & "000" & slot_addr(12 downto 0); end if; end if; if slot_addr(15 downto 13)="100" then--and mode_bits(1 downto 0)/="10" then allow_write <= '1'; end if; if slot_addr(15 downto 8)=X"DE" and slot_addr(7 downto 1)/="0000000" then allow_write <= '1'; end if; if slot_addr(15 downto 8)=X"DF" and do_io2='1' then allow_write <= '1'; end if; end if; when c_action => -- 32K RAM if mode_bits(2)='1' then if slot_addr(13)='0' then mem_addr_i <= g_ram_base(27 downto 15) & bank_bits(14 downto 13) & slot_addr(12 downto 0); if allow_bank='0' and slot_addr(15 downto 13)="110" then -- io range exceptions mem_addr_i <= g_ram_base(27 downto 15) & "00" & slot_addr(12 downto 0); end if; end if; if slot_addr(15 downto 13)="100" then -- and mode_bits(1 downto 0)="11" then allow_write <= '1'; end if; if slot_addr(15 downto 8)=X"DE" and slot_addr(7 downto 1)/="0000000" then allow_write <= '1'; end if; if slot_addr(15 downto 8)=X"DF" and do_io2='1' then allow_write <= '1'; end if; end if; when c_easy_flash => -- Little RAM if slot_addr(15 downto 8)=X"DF" then mem_addr_i <= g_ram_base(27 downto 8) & slot_addr(7 downto 0); allow_write <= '1'; else mem_addr_i <= g_rom_base(27 downto 20) & slot_addr(13) & ext_bank & bank_bits & slot_addr(12 downto 0); end if; when c_fc3 => mem_addr_i(15 downto 0) <= bank_bits(15 downto 14) & slot_addr(13 downto 0); -- 16K banks when c_ss5 => if mode_bits(1 downto 0)="00" then if slot_addr(15 downto 13)="100" then allow_write <= '1'; mem_addr_i <= g_ram_base(27 downto 15) & bank_bits(15 downto 14) & slot_addr(12 downto 0); else mem_addr_i <= g_rom_base(27 downto 16) & bank_bits(15 downto 14) & slot_addr(13 downto 0); end if; else mem_addr_i <= g_rom_base(27 downto 16) & bank_bits(15 downto 14) & slot_addr(13 downto 0); end if; when c_8k | c_epyx => mem_addr_i(27 downto 13) <= g_rom_base(27 downto 13); mem_addr_i(12 downto 0) <= slot_addr(12 downto 0); when c_16k | c_16k_umax => mem_addr_i(27 downto 14) <= g_rom_base(27 downto 14); mem_addr_i(13 downto 0) <= slot_addr(13 downto 0); when c_ocean128 | c_system3 | c_domark | c_ocean256 => mem_addr_i <= g_rom_base(27 downto 20) & slot_addr(13) & ext_bank & bank_bits & slot_addr(12 downto 0); -- when c_ocean256 => -- mem_addr_i(18 downto 0) <= ext_bank & bank_bits & slot_addr(12 downto 0); -- mem_addr_i(19) <= slot_addr(13); -- map banks 16-31 to $A000. (second 128K) when others => null; end case; if kernal_area='1' then mem_addr_i <= g_kernal_base(27 downto 14) & slot_addr(12 downto 0) & '0'; end if; -- if eth_addr then -- mem_addr_i(25 downto 21) <= eth_base(25 downto 21); -- mem_addr_i(20) <= '1'; -- indicate it is a slot access -- allow_write <= '1'; -- we should also be able to write to the ethernet chip -- -- invert bit 3 -- mem_addr_i(3) <= not slot_addr(3); -- -- leave other bits in tact -- end if; end process; mem_addr <= unsigned(mem_addr_i(mem_addr'range)); slot_resp.data(7) <= bank_bits(15); slot_resp.data(6) <= '1'; slot_resp.data(5) <= '0'; slot_resp.data(4) <= bank_bits(14); slot_resp.data(3) <= bank_bits(13); slot_resp.data(2) <= '0'; -- freeze button pressed slot_resp.data(1) <= allow_bank; -- '1'; -- allow bank bit stuck at '1' for 1541U slot_resp.data(0) <= '0'; slot_resp.reg_output <= '1' when (slot_addr(8 downto 1)="00000000") and (cart_logic_d = c_retro) else '0'; end gideon;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; package pico_cpu is constant CPU_Bitwidth : integer := 32; constant CPU_Instwidth : integer := 6 + CPU_Bitwidth; constant InstMem_depth : integer := 1024; constant DataMem_depth : integer := 1024; constant clock_period : time := 1 ns; component ALU is generic (BitWidth: integer); port ( A: in std_logic_vector (BitWidth-1 downto 0); B: in std_logic_vector (BitWidth-1 downto 0); Command: in std_logic_vector (3 downto 0); Cflag_in: in std_logic; Cflag_out: out std_logic; Result: out std_logic_vector (BitWidth-1 downto 0) ); end component; component RegisterFile is generic (BitWidth: integer); port ( clk : in std_logic; rst: in std_logic; Data_in_mem: in std_logic_vector (BitWidth-1 downto 0); Data_in_CU: in std_logic_vector (BitWidth-1 downto 0); Data_in_ACC: in std_logic_vector (BitWidth-1 downto 0); Data_in_sel: in std_logic_vector (1 downto 0); Register_in_sel: in std_logic_vector (7 downto 0); Register_out_sel: in std_logic_vector (2 downto 0); Data_out: out std_logic_vector (BitWidth-1 downto 0) ); end component; component PicoCPU is port( rst: in std_logic; clk: in std_logic; FlagOut: out std_logic_vector ( 3 downto 0); output: out std_logic_vector ( CPU_Bitwidth-1 downto 0) ); end component; component ControlUnit is generic (BitWidth: integer; InstructionWidth:integer); port( rst: in std_logic; clk: in std_logic; Instr_In: in std_logic_vector (InstructionWidth-1 downto 0); Instr_Add: out std_logic_vector (BitWidth-1 downto 0); MemRdAddress: out std_logic_vector (BitWidth-1 downto 0); MemWrtAddress: out std_logic_vector (BitWidth-1 downto 0); Mem_RW: out std_logic; DPU_Flags: in std_logic_vector (3 downto 0); DataToDPU: out std_logic_vector (BitWidth-1 downto 0); CommandToDPU: out std_logic_vector (10 downto 0); Reg_in_sel: out std_logic_vector (7 downto 0); Reg_out_sel: out std_logic_vector (2 downto 0); DataFromDPU: in std_logic_vector (BitWidth-1 downto 0) ); end component; ---------------------------------------- component InstMem is generic (BitWidth : integer; InstructionWidth:integer); port ( address : in std_logic_vector(BitWidth-1 downto 0); data : out std_logic_vector(InstructionWidth-1 downto 0) ); end component; ---------------------------------------- component DPU is generic (BitWidth: integer); port ( Data_in_mem: in std_logic_vector (BitWidth-1 downto 0); Data_in: in std_logic_vector (BitWidth-1 downto 0); clk: in std_logic; Command: in std_logic_vector (10 downto 0); Reg_in_sel: in std_logic_vector (7 downto 0); Reg_out_sel: in std_logic_vector (2 downto 0); rst: in std_logic; DPU_Flags: out std_logic_vector (3 downto 0); Result: out std_logic_vector (BitWidth-1 downto 0) ); end component; ---------------------------------------- component Mem is generic (BitWidth: integer); port ( RdAddress: in std_logic_vector (BitWidth-1 downto 0); Data_in: in std_logic_vector (BitWidth-1 downto 0); WrtAddress: in std_logic_vector (BitWidth-1 downto 0); clk: in std_logic; RW: in std_logic; rst: in std_logic; Data_Out: out std_logic_vector (BitWidth-1 downto 0) ); end component; component Adder_Sub is generic (BitWidth: integer); port ( A: in std_logic_vector (BitWidth-1 downto 0); B: in std_logic_vector (BitWidth-1 downto 0); Add_Sub: in std_logic; result: out std_logic_vector (BitWidth-1 downto 0); Cout: out std_logic ); end component; component FullAdderSub is Port ( C_in : in STD_LOGIC; A : in STD_LOGIC; B : in STD_LOGIC; Add_Sub: in STD_LOGIC; C_out : out STD_LOGIC; Sum : out STD_LOGIC); end component; end; --package body
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity Rx is Port ( Dato_entrada : in STD_LOGIC; CLK : in STD_LOGIC; Dato_salida : out STD_LOGIC_VECTOR (7 downto 0); Campana : out STD_LOGIC); end Rx; architecture Behavioral of Rx is COMPONENT Divisor PORT( clk : IN std_logic; newC : OUT std_logic ); END COMPONENT; signal reloj_baudios : std_logic := '0'; signal estado : std_logic_vector(1 downto 0) := "00"; -- 00 -> Recepcion de Idle -- 01 -> Recepcion de dato -- 10 -> bit de paridad -- 11 -> bits de parada signal contador_de_bits : std_logic_vector(3 downto 0) := "0000"; signal Paridad : std_logic := '0'; signal aux : std_logic_vector(7 downto 0) := "00000000"; begin Inst_Divisor: Divisor PORT MAP( clk => CLK, newC => reloj_baudios ); Dato_salida <= aux; process (CLK) variable Dato_temporal : std_logic_vector(7 downto 0) := (others => '0'); begin if (rising_edge(CLK) and reloj_baudios = '1') then Campana <= '0'; if (estado = "00" and Dato_entrada = '0') then estado <= "01"; elsif (estado = "01") then if (Dato_entrada = '1') then Paridad <= not Paridad; end if; Dato_temporal(6 downto 0) := Dato_temporal(7 downto 1); Dato_temporal(7) := Dato_entrada; contador_de_bits <= contador_de_bits + 1; if (contador_de_bits >= "0111") then contador_de_bits <= (others => '0'); estado <= "10"; end if; elsif (estado = "10") then if (Paridad = Dato_entrada) then estado <= "11"; else estado <= "00"; Paridad <= '0'; end if; elsif (estado = "11") then if (contador_de_bits = "0001") then estado <= "00"; contador_de_bits <= (others => '0'); aux <= Dato_temporal; Campana <= '1'; elsif (Dato_entrada = '1') then contador_de_bits <= contador_de_bits + 1; else estado <= "00"; Paridad <= '0'; end if; end if; end if; end process; end Behavioral;
------------------------------------------------------------------------------- -- Date $Date: 2005/04/12 19:09:27 $ -- Author $Author: Gideon $ -- Revision $Revision: 1.1 $ -- Log $Log: oscillator.vhd,v $ ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.tl_flat_memory_model_pkg.all; use work.wave_pkg.all; entity tb_sid_from_file is end tb_sid_from_file; architecture tb of tb_sid_from_file is signal clock : std_logic := '0'; signal reset : std_logic; signal addr : unsigned(6 downto 0) := (others => '0'); signal wren : std_logic := '0'; signal wdata : std_logic_vector(7 downto 0) := (others => '0'); signal rdata : std_logic_vector(7 downto 0) := (others => '0'); signal start_iter : std_logic := '0'; signal sid_pwm : std_logic := '0'; signal sample_out : signed(17 downto 0); signal stop_clock : boolean := false; signal vc : real := 0.0; constant R : real := 2200.0; constant C : real := 0.000000022; constant c_cpu_period : time := 1014973 ps; constant c_half_clock : time := c_cpu_period / 8; constant c_clock : time := c_half_clock * 2; begin clock <= not clock after c_half_clock when not stop_clock; -- 5 MHz reset <= '1', '0' after 1 us; sid: entity work.sid_top generic map ( g_filter_div => 20, -- 194 for 50 MHz; g_num_voices => 3 ) port map ( clock => clock, reset => reset, addr => addr, wren => wren, wdata => wdata, rdata => rdata, start_iter => start_iter, sample_out => sample_out ); -- i_pdm_sid: entity work.sigma_delta_dac -- generic map ( -- g_left_shift => 0, -- g_width => sample_out'length ) -- port map ( -- clock => clock, -- reset => reset, -- -- dac_in => sample_out, -- -- dac_out => sid_pwm ); -- -- filter: process(clock) -- variable v_dac : real; -- variable i_r : real; -- variable q_c : real; -- begin -- if rising_edge(clock) then -- if sid_pwm='0' then -- v_dac := -1.2; -- else -- v_dac := 1.2; -- end if; -- i_r := (v_dac - vc) / R; -- q_c := i_r * 200.0e-9; -- 200 ns; -- vc <= vc + (q_c / C); -- end if; -- end process; -- test: process variable trace_in : h_mem_object; variable addr_i : integer := 0; variable delay : time := 1 ns; variable t : unsigned(23 downto 0); variable b : std_logic_vector(7 downto 0); begin register_mem_model(tb_sid_from_file'path_name, "trace", trace_in); load_memory("sidtrace.555", trace_in, X"00000000"); wait until reset='0'; wait until clock='1'; L1: while now < 5000 ms loop b := read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i, 32))); addr <= unsigned(b(6 downto 0)); wdata <= read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+1, 32))); t(23 downto 16) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+2, 32)))); t(15 downto 8) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+3, 32)))); t( 7 downto 0) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+4, 32)))); addr_i := addr_i + 5; if t = 0 then exit L1; end if; delay := (1 us) * (to_integer(t)-1); wait for delay; wren <= '1'; wait for 1 * c_clock; wren <= '0'; wait for 3 * c_clock; end loop; stop_clock <= true; wait; end process test; process begin wait for 3 * c_clock; start_iter <= '1'; wait for 1 * c_clock; start_iter <= '0'; if stop_clock then wait; end if; end process; -- this clock is a little faster (1 Mhz instead of 985250 Hz, thus we need to adjust our sample rate by the same amount -- which means we need to sample at 48718 Hz instead of 48kHz. Sample period = process variable chan : t_wave_channel; begin open_channel(chan); while not stop_clock loop wait for 20833 ns; -- 20526 ns; push_sample(chan, to_integer(sample_out(17 downto 2))); end loop; write_wave("sid_wave.wav", 48000, (0 => chan)); wait; end process; end tb;
------------------------------------------------------------------------------- -- Date $Date: 2005/04/12 19:09:27 $ -- Author $Author: Gideon $ -- Revision $Revision: 1.1 $ -- Log $Log: oscillator.vhd,v $ ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.tl_flat_memory_model_pkg.all; use work.wave_pkg.all; entity tb_sid_from_file is end tb_sid_from_file; architecture tb of tb_sid_from_file is signal clock : std_logic := '0'; signal reset : std_logic; signal addr : unsigned(6 downto 0) := (others => '0'); signal wren : std_logic := '0'; signal wdata : std_logic_vector(7 downto 0) := (others => '0'); signal rdata : std_logic_vector(7 downto 0) := (others => '0'); signal start_iter : std_logic := '0'; signal sid_pwm : std_logic := '0'; signal sample_out : signed(17 downto 0); signal stop_clock : boolean := false; signal vc : real := 0.0; constant R : real := 2200.0; constant C : real := 0.000000022; constant c_cpu_period : time := 1014973 ps; constant c_half_clock : time := c_cpu_period / 8; constant c_clock : time := c_half_clock * 2; begin clock <= not clock after c_half_clock when not stop_clock; -- 5 MHz reset <= '1', '0' after 1 us; sid: entity work.sid_top generic map ( g_filter_div => 20, -- 194 for 50 MHz; g_num_voices => 3 ) port map ( clock => clock, reset => reset, addr => addr, wren => wren, wdata => wdata, rdata => rdata, start_iter => start_iter, sample_out => sample_out ); -- i_pdm_sid: entity work.sigma_delta_dac -- generic map ( -- g_left_shift => 0, -- g_width => sample_out'length ) -- port map ( -- clock => clock, -- reset => reset, -- -- dac_in => sample_out, -- -- dac_out => sid_pwm ); -- -- filter: process(clock) -- variable v_dac : real; -- variable i_r : real; -- variable q_c : real; -- begin -- if rising_edge(clock) then -- if sid_pwm='0' then -- v_dac := -1.2; -- else -- v_dac := 1.2; -- end if; -- i_r := (v_dac - vc) / R; -- q_c := i_r * 200.0e-9; -- 200 ns; -- vc <= vc + (q_c / C); -- end if; -- end process; -- test: process variable trace_in : h_mem_object; variable addr_i : integer := 0; variable delay : time := 1 ns; variable t : unsigned(23 downto 0); variable b : std_logic_vector(7 downto 0); begin register_mem_model(tb_sid_from_file'path_name, "trace", trace_in); load_memory("sidtrace.555", trace_in, X"00000000"); wait until reset='0'; wait until clock='1'; L1: while now < 5000 ms loop b := read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i, 32))); addr <= unsigned(b(6 downto 0)); wdata <= read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+1, 32))); t(23 downto 16) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+2, 32)))); t(15 downto 8) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+3, 32)))); t( 7 downto 0) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+4, 32)))); addr_i := addr_i + 5; if t = 0 then exit L1; end if; delay := (1 us) * (to_integer(t)-1); wait for delay; wren <= '1'; wait for 1 * c_clock; wren <= '0'; wait for 3 * c_clock; end loop; stop_clock <= true; wait; end process test; process begin wait for 3 * c_clock; start_iter <= '1'; wait for 1 * c_clock; start_iter <= '0'; if stop_clock then wait; end if; end process; -- this clock is a little faster (1 Mhz instead of 985250 Hz, thus we need to adjust our sample rate by the same amount -- which means we need to sample at 48718 Hz instead of 48kHz. Sample period = process variable chan : t_wave_channel; begin open_channel(chan); while not stop_clock loop wait for 20833 ns; -- 20526 ns; push_sample(chan, to_integer(sample_out(17 downto 2))); end loop; write_wave("sid_wave.wav", 48000, (0 => chan)); wait; end process; end tb;
------------------------------------------------------------------------------- -- Date $Date: 2005/04/12 19:09:27 $ -- Author $Author: Gideon $ -- Revision $Revision: 1.1 $ -- Log $Log: oscillator.vhd,v $ ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.tl_flat_memory_model_pkg.all; use work.wave_pkg.all; entity tb_sid_from_file is end tb_sid_from_file; architecture tb of tb_sid_from_file is signal clock : std_logic := '0'; signal reset : std_logic; signal addr : unsigned(6 downto 0) := (others => '0'); signal wren : std_logic := '0'; signal wdata : std_logic_vector(7 downto 0) := (others => '0'); signal rdata : std_logic_vector(7 downto 0) := (others => '0'); signal start_iter : std_logic := '0'; signal sid_pwm : std_logic := '0'; signal sample_out : signed(17 downto 0); signal stop_clock : boolean := false; signal vc : real := 0.0; constant R : real := 2200.0; constant C : real := 0.000000022; constant c_cpu_period : time := 1014973 ps; constant c_half_clock : time := c_cpu_period / 8; constant c_clock : time := c_half_clock * 2; begin clock <= not clock after c_half_clock when not stop_clock; -- 5 MHz reset <= '1', '0' after 1 us; sid: entity work.sid_top generic map ( g_filter_div => 20, -- 194 for 50 MHz; g_num_voices => 3 ) port map ( clock => clock, reset => reset, addr => addr, wren => wren, wdata => wdata, rdata => rdata, start_iter => start_iter, sample_out => sample_out ); -- i_pdm_sid: entity work.sigma_delta_dac -- generic map ( -- g_left_shift => 0, -- g_width => sample_out'length ) -- port map ( -- clock => clock, -- reset => reset, -- -- dac_in => sample_out, -- -- dac_out => sid_pwm ); -- -- filter: process(clock) -- variable v_dac : real; -- variable i_r : real; -- variable q_c : real; -- begin -- if rising_edge(clock) then -- if sid_pwm='0' then -- v_dac := -1.2; -- else -- v_dac := 1.2; -- end if; -- i_r := (v_dac - vc) / R; -- q_c := i_r * 200.0e-9; -- 200 ns; -- vc <= vc + (q_c / C); -- end if; -- end process; -- test: process variable trace_in : h_mem_object; variable addr_i : integer := 0; variable delay : time := 1 ns; variable t : unsigned(23 downto 0); variable b : std_logic_vector(7 downto 0); begin register_mem_model(tb_sid_from_file'path_name, "trace", trace_in); load_memory("sidtrace.555", trace_in, X"00000000"); wait until reset='0'; wait until clock='1'; L1: while now < 5000 ms loop b := read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i, 32))); addr <= unsigned(b(6 downto 0)); wdata <= read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+1, 32))); t(23 downto 16) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+2, 32)))); t(15 downto 8) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+3, 32)))); t( 7 downto 0) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+4, 32)))); addr_i := addr_i + 5; if t = 0 then exit L1; end if; delay := (1 us) * (to_integer(t)-1); wait for delay; wren <= '1'; wait for 1 * c_clock; wren <= '0'; wait for 3 * c_clock; end loop; stop_clock <= true; wait; end process test; process begin wait for 3 * c_clock; start_iter <= '1'; wait for 1 * c_clock; start_iter <= '0'; if stop_clock then wait; end if; end process; -- this clock is a little faster (1 Mhz instead of 985250 Hz, thus we need to adjust our sample rate by the same amount -- which means we need to sample at 48718 Hz instead of 48kHz. Sample period = process variable chan : t_wave_channel; begin open_channel(chan); while not stop_clock loop wait for 20833 ns; -- 20526 ns; push_sample(chan, to_integer(sample_out(17 downto 2))); end loop; write_wave("sid_wave.wav", 48000, (0 => chan)); wait; end process; end tb;
------------------------------------------------------------------------------- -- Date $Date: 2005/04/12 19:09:27 $ -- Author $Author: Gideon $ -- Revision $Revision: 1.1 $ -- Log $Log: oscillator.vhd,v $ ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.tl_flat_memory_model_pkg.all; use work.wave_pkg.all; entity tb_sid_from_file is end tb_sid_from_file; architecture tb of tb_sid_from_file is signal clock : std_logic := '0'; signal reset : std_logic; signal addr : unsigned(6 downto 0) := (others => '0'); signal wren : std_logic := '0'; signal wdata : std_logic_vector(7 downto 0) := (others => '0'); signal rdata : std_logic_vector(7 downto 0) := (others => '0'); signal start_iter : std_logic := '0'; signal sid_pwm : std_logic := '0'; signal sample_out : signed(17 downto 0); signal stop_clock : boolean := false; signal vc : real := 0.0; constant R : real := 2200.0; constant C : real := 0.000000022; constant c_cpu_period : time := 1014973 ps; constant c_half_clock : time := c_cpu_period / 8; constant c_clock : time := c_half_clock * 2; begin clock <= not clock after c_half_clock when not stop_clock; -- 5 MHz reset <= '1', '0' after 1 us; sid: entity work.sid_top generic map ( g_filter_div => 20, -- 194 for 50 MHz; g_num_voices => 3 ) port map ( clock => clock, reset => reset, addr => addr, wren => wren, wdata => wdata, rdata => rdata, start_iter => start_iter, sample_out => sample_out ); -- i_pdm_sid: entity work.sigma_delta_dac -- generic map ( -- g_left_shift => 0, -- g_width => sample_out'length ) -- port map ( -- clock => clock, -- reset => reset, -- -- dac_in => sample_out, -- -- dac_out => sid_pwm ); -- -- filter: process(clock) -- variable v_dac : real; -- variable i_r : real; -- variable q_c : real; -- begin -- if rising_edge(clock) then -- if sid_pwm='0' then -- v_dac := -1.2; -- else -- v_dac := 1.2; -- end if; -- i_r := (v_dac - vc) / R; -- q_c := i_r * 200.0e-9; -- 200 ns; -- vc <= vc + (q_c / C); -- end if; -- end process; -- test: process variable trace_in : h_mem_object; variable addr_i : integer := 0; variable delay : time := 1 ns; variable t : unsigned(23 downto 0); variable b : std_logic_vector(7 downto 0); begin register_mem_model(tb_sid_from_file'path_name, "trace", trace_in); load_memory("sidtrace.555", trace_in, X"00000000"); wait until reset='0'; wait until clock='1'; L1: while now < 5000 ms loop b := read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i, 32))); addr <= unsigned(b(6 downto 0)); wdata <= read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+1, 32))); t(23 downto 16) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+2, 32)))); t(15 downto 8) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+3, 32)))); t( 7 downto 0) := unsigned(read_memory_8(trace_in, std_logic_vector(to_unsigned(addr_i+4, 32)))); addr_i := addr_i + 5; if t = 0 then exit L1; end if; delay := (1 us) * (to_integer(t)-1); wait for delay; wren <= '1'; wait for 1 * c_clock; wren <= '0'; wait for 3 * c_clock; end loop; stop_clock <= true; wait; end process test; process begin wait for 3 * c_clock; start_iter <= '1'; wait for 1 * c_clock; start_iter <= '0'; if stop_clock then wait; end if; end process; -- this clock is a little faster (1 Mhz instead of 985250 Hz, thus we need to adjust our sample rate by the same amount -- which means we need to sample at 48718 Hz instead of 48kHz. Sample period = process variable chan : t_wave_channel; begin open_channel(chan); while not stop_clock loop wait for 20833 ns; -- 20526 ns; push_sample(chan, to_integer(sample_out(17 downto 2))); end loop; write_wave("sid_wave.wav", 48000, (0 => chan)); wait; end process; end tb;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity top_tb_qp is end entity top_tb_qp; architecture top_tb_qp_behav of top_tb_qp is alias slv is std_logic_vector; subtype slv512 is slv(511 downto 0); subtype slv256 is slv(255 downto 0); subtype slv32 is slv(31 downto 0); subtype word is unsigned(31 downto 0); component pll is port ( inclk0 : in std_logic := '0'; c0 : out std_logic ); end component pll; component sha256_pc is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_pc; component sha256_qp is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_qp; constant NUM_CORES : natural := 4; -- SHA256_SEL = 0 => sha256_pc, uses precalculated H + K + W technique -- SHA256_SEL = 1 => sha256_qp, uses quasi-pipelining technique constant SHA256_SEL : natural := 1; constant tclk_40 : time := 25 ns; type data_array is array(NUM_CORES-1 downto 0) of slv512; type digest_array is array(NUM_CORES-1 downto 0) of slv256; type nonce_array is array(NUM_CORES-1 downto 0) of word; signal OSC_CLK : std_logic := '0'; signal clk : std_logic; signal reset : std_logic := '0'; signal data_1 : data_array; signal digest_1 : digest_array; signal data_2 : data_array; signal digest_2 : digest_array; signal data_in : slv256; signal h_in : slv256; signal q_data_in : slv256 := (others => '0'); signal q_h_in : slv256 := (others => '0'); signal q_nonce : nonce_array; signal q_golden_nonce : slv32 := (others => '0'); begin reset <= '1','0' after 2.5 * tclk_40; data_in <= X"00000000000000000000000080000000000000002194261a9395e64dbed17115"; h_in <= X"228ea4732a3c9ba860c009cda7252b9161a5e75ec8c582a5f106abb3af41f790"; clk_gen: process is begin OSC_CLK <= not OSC_CLK; wait for tclk_40/2; end process clk_gen; pll_inst: pll port map ( inclk0 => OSC_CLK, c0 => clk ); sha256_gen: for i in NUM_CORES-1 downto 0 generate data_1(i) <= X"000002800000000000000000000000000000000000000000000000000000000000000000000000000000000080000000" & slv(q_nonce(i)) & q_data_in(95 downto 0); data_2(i) <= X"0000010000000000000000000000000000000000000000000000000080000000" & digest_1(i); sha256_pc_gen: if SHA256_SEL = 0 generate sha256_1: sha256_pc generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_pc generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_pc_gen; sha256_qp_gen: if SHA256_SEL = 1 generate sha256_1: sha256_qp generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_qp generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_qp_gen; end generate sha256_gen; registers: process(clk, reset) begin if reset = '1' then q_data_in <= (others => '0'); q_h_in <= (others => '0'); q_nonce(0) <= X"0e33337a" - 256; for i in NUM_CORES-1 downto 1 loop q_nonce(i) <= q_nonce(0) + i; end loop; q_golden_nonce <= (others => '0'); elsif rising_edge(clk) then q_data_in <= data_in; q_h_in <= h_in; for i in NUM_CORES-1 downto 0 loop q_nonce(i) <= q_nonce(0) + i + NUM_CORES; if digest_2(i)(255 downto 224) = X"00000000" then if SHA256_SEL = 0 then q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*131); else q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*134); end if; end if; end loop; end if; end process registers; end architecture top_tb_qp_behav;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity top_tb_qp is end entity top_tb_qp; architecture top_tb_qp_behav of top_tb_qp is alias slv is std_logic_vector; subtype slv512 is slv(511 downto 0); subtype slv256 is slv(255 downto 0); subtype slv32 is slv(31 downto 0); subtype word is unsigned(31 downto 0); component pll is port ( inclk0 : in std_logic := '0'; c0 : out std_logic ); end component pll; component sha256_pc is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_pc; component sha256_qp is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_qp; constant NUM_CORES : natural := 4; -- SHA256_SEL = 0 => sha256_pc, uses precalculated H + K + W technique -- SHA256_SEL = 1 => sha256_qp, uses quasi-pipelining technique constant SHA256_SEL : natural := 1; constant tclk_40 : time := 25 ns; type data_array is array(NUM_CORES-1 downto 0) of slv512; type digest_array is array(NUM_CORES-1 downto 0) of slv256; type nonce_array is array(NUM_CORES-1 downto 0) of word; signal OSC_CLK : std_logic := '0'; signal clk : std_logic; signal reset : std_logic := '0'; signal data_1 : data_array; signal digest_1 : digest_array; signal data_2 : data_array; signal digest_2 : digest_array; signal data_in : slv256; signal h_in : slv256; signal q_data_in : slv256 := (others => '0'); signal q_h_in : slv256 := (others => '0'); signal q_nonce : nonce_array; signal q_golden_nonce : slv32 := (others => '0'); begin reset <= '1','0' after 2.5 * tclk_40; data_in <= X"00000000000000000000000080000000000000002194261a9395e64dbed17115"; h_in <= X"228ea4732a3c9ba860c009cda7252b9161a5e75ec8c582a5f106abb3af41f790"; clk_gen: process is begin OSC_CLK <= not OSC_CLK; wait for tclk_40/2; end process clk_gen; pll_inst: pll port map ( inclk0 => OSC_CLK, c0 => clk ); sha256_gen: for i in NUM_CORES-1 downto 0 generate data_1(i) <= X"000002800000000000000000000000000000000000000000000000000000000000000000000000000000000080000000" & slv(q_nonce(i)) & q_data_in(95 downto 0); data_2(i) <= X"0000010000000000000000000000000000000000000000000000000080000000" & digest_1(i); sha256_pc_gen: if SHA256_SEL = 0 generate sha256_1: sha256_pc generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_pc generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_pc_gen; sha256_qp_gen: if SHA256_SEL = 1 generate sha256_1: sha256_qp generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_qp generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_qp_gen; end generate sha256_gen; registers: process(clk, reset) begin if reset = '1' then q_data_in <= (others => '0'); q_h_in <= (others => '0'); q_nonce(0) <= X"0e33337a" - 256; for i in NUM_CORES-1 downto 1 loop q_nonce(i) <= q_nonce(0) + i; end loop; q_golden_nonce <= (others => '0'); elsif rising_edge(clk) then q_data_in <= data_in; q_h_in <= h_in; for i in NUM_CORES-1 downto 0 loop q_nonce(i) <= q_nonce(0) + i + NUM_CORES; if digest_2(i)(255 downto 224) = X"00000000" then if SHA256_SEL = 0 then q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*131); else q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*134); end if; end if; end loop; end if; end process registers; end architecture top_tb_qp_behav;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity top_tb_qp is end entity top_tb_qp; architecture top_tb_qp_behav of top_tb_qp is alias slv is std_logic_vector; subtype slv512 is slv(511 downto 0); subtype slv256 is slv(255 downto 0); subtype slv32 is slv(31 downto 0); subtype word is unsigned(31 downto 0); component pll is port ( inclk0 : in std_logic := '0'; c0 : out std_logic ); end component pll; component sha256_pc is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_pc; component sha256_qp is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_qp; constant NUM_CORES : natural := 4; -- SHA256_SEL = 0 => sha256_pc, uses precalculated H + K + W technique -- SHA256_SEL = 1 => sha256_qp, uses quasi-pipelining technique constant SHA256_SEL : natural := 1; constant tclk_40 : time := 25 ns; type data_array is array(NUM_CORES-1 downto 0) of slv512; type digest_array is array(NUM_CORES-1 downto 0) of slv256; type nonce_array is array(NUM_CORES-1 downto 0) of word; signal OSC_CLK : std_logic := '0'; signal clk : std_logic; signal reset : std_logic := '0'; signal data_1 : data_array; signal digest_1 : digest_array; signal data_2 : data_array; signal digest_2 : digest_array; signal data_in : slv256; signal h_in : slv256; signal q_data_in : slv256 := (others => '0'); signal q_h_in : slv256 := (others => '0'); signal q_nonce : nonce_array; signal q_golden_nonce : slv32 := (others => '0'); begin reset <= '1','0' after 2.5 * tclk_40; data_in <= X"00000000000000000000000080000000000000002194261a9395e64dbed17115"; h_in <= X"228ea4732a3c9ba860c009cda7252b9161a5e75ec8c582a5f106abb3af41f790"; clk_gen: process is begin OSC_CLK <= not OSC_CLK; wait for tclk_40/2; end process clk_gen; pll_inst: pll port map ( inclk0 => OSC_CLK, c0 => clk ); sha256_gen: for i in NUM_CORES-1 downto 0 generate data_1(i) <= X"000002800000000000000000000000000000000000000000000000000000000000000000000000000000000080000000" & slv(q_nonce(i)) & q_data_in(95 downto 0); data_2(i) <= X"0000010000000000000000000000000000000000000000000000000080000000" & digest_1(i); sha256_pc_gen: if SHA256_SEL = 0 generate sha256_1: sha256_pc generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_pc generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_pc_gen; sha256_qp_gen: if SHA256_SEL = 1 generate sha256_1: sha256_qp generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_qp generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_qp_gen; end generate sha256_gen; registers: process(clk, reset) begin if reset = '1' then q_data_in <= (others => '0'); q_h_in <= (others => '0'); q_nonce(0) <= X"0e33337a" - 256; for i in NUM_CORES-1 downto 1 loop q_nonce(i) <= q_nonce(0) + i; end loop; q_golden_nonce <= (others => '0'); elsif rising_edge(clk) then q_data_in <= data_in; q_h_in <= h_in; for i in NUM_CORES-1 downto 0 loop q_nonce(i) <= q_nonce(0) + i + NUM_CORES; if digest_2(i)(255 downto 224) = X"00000000" then if SHA256_SEL = 0 then q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*131); else q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*134); end if; end if; end loop; end if; end process registers; end architecture top_tb_qp_behav;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity top_tb_qp is end entity top_tb_qp; architecture top_tb_qp_behav of top_tb_qp is alias slv is std_logic_vector; subtype slv512 is slv(511 downto 0); subtype slv256 is slv(255 downto 0); subtype slv32 is slv(31 downto 0); subtype word is unsigned(31 downto 0); component pll is port ( inclk0 : in std_logic := '0'; c0 : out std_logic ); end component pll; component sha256_pc is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_pc; component sha256_qp is generic ( default_h : boolean := true ); port ( clk : in std_logic; reset : in std_logic; msg_in : in std_logic_vector(511 downto 0); h_in : in std_logic_vector(255 downto 0) := (others => '0'); digest : out std_logic_vector(255 downto 0) ); end component sha256_qp; constant NUM_CORES : natural := 4; -- SHA256_SEL = 0 => sha256_pc, uses precalculated H + K + W technique -- SHA256_SEL = 1 => sha256_qp, uses quasi-pipelining technique constant SHA256_SEL : natural := 1; constant tclk_40 : time := 25 ns; type data_array is array(NUM_CORES-1 downto 0) of slv512; type digest_array is array(NUM_CORES-1 downto 0) of slv256; type nonce_array is array(NUM_CORES-1 downto 0) of word; signal OSC_CLK : std_logic := '0'; signal clk : std_logic; signal reset : std_logic := '0'; signal data_1 : data_array; signal digest_1 : digest_array; signal data_2 : data_array; signal digest_2 : digest_array; signal data_in : slv256; signal h_in : slv256; signal q_data_in : slv256 := (others => '0'); signal q_h_in : slv256 := (others => '0'); signal q_nonce : nonce_array; signal q_golden_nonce : slv32 := (others => '0'); begin reset <= '1','0' after 2.5 * tclk_40; data_in <= X"00000000000000000000000080000000000000002194261a9395e64dbed17115"; h_in <= X"228ea4732a3c9ba860c009cda7252b9161a5e75ec8c582a5f106abb3af41f790"; clk_gen: process is begin OSC_CLK <= not OSC_CLK; wait for tclk_40/2; end process clk_gen; pll_inst: pll port map ( inclk0 => OSC_CLK, c0 => clk ); sha256_gen: for i in NUM_CORES-1 downto 0 generate data_1(i) <= X"000002800000000000000000000000000000000000000000000000000000000000000000000000000000000080000000" & slv(q_nonce(i)) & q_data_in(95 downto 0); data_2(i) <= X"0000010000000000000000000000000000000000000000000000000080000000" & digest_1(i); sha256_pc_gen: if SHA256_SEL = 0 generate sha256_1: sha256_pc generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_pc generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_pc_gen; sha256_qp_gen: if SHA256_SEL = 1 generate sha256_1: sha256_qp generic map ( default_h => false ) port map ( clk => clk, reset => reset, msg_in => data_1(i), h_in => q_h_in, digest => digest_1(i) ); sha256_2: sha256_qp generic map ( default_h => true ) port map ( clk => clk, reset => reset, msg_in => data_2(i), digest => digest_2(i) ); end generate sha256_qp_gen; end generate sha256_gen; registers: process(clk, reset) begin if reset = '1' then q_data_in <= (others => '0'); q_h_in <= (others => '0'); q_nonce(0) <= X"0e33337a" - 256; for i in NUM_CORES-1 downto 1 loop q_nonce(i) <= q_nonce(0) + i; end loop; q_golden_nonce <= (others => '0'); elsif rising_edge(clk) then q_data_in <= data_in; q_h_in <= h_in; for i in NUM_CORES-1 downto 0 loop q_nonce(i) <= q_nonce(0) + i + NUM_CORES; if digest_2(i)(255 downto 224) = X"00000000" then if SHA256_SEL = 0 then q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*131); else q_golden_nonce <= slv(q_nonce(i) - NUM_CORES*134); end if; end if; end loop; end if; end process registers; end architecture top_tb_qp_behav;
-------------------------------------------------------------------------------- -- Author: Parham Alvani ([email protected]) -- -- Create Date: 03-03-2016 -- Module Name: p4-3.vhd -------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; entity decoder_2_4 is port (i0, i1 : in std_logic; o0, o1, o2, o3 : out std_logic); end entity decoder_2_4; architecture structural of decoder_2_4 is begin out0 <= (not i0) and (not i1); out1 <= i0 and (not i1); out2 <= (not i0) and i1; out3 <= i0 and i1; end architecture structural;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc1345.vhd,v 1.2 2001-10-26 16:30:09 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c08s04b01x00p06n05i01345ent IS END c08s04b01x00p06n05i01345ent; ARCHITECTURE c08s04b01x00p06n05i01345arch OF c08s04b01x00p06n05i01345ent IS signal k : integer; BEGIN TESTING: PROCESS BEGIN k <= 1 after 10 ns, 2 after 20 ns, 3 after 30 ns, 2 after 20 ns, 4 after 40 ns, 5 after 50 ns; wait for 80 ns; assert FALSE report "***FAILED TEST: c08s04b01x00p06n05i01345 - The sequence of new transactions must be in ascending order with respect to time." severity ERROR; wait; END PROCESS TESTING; END c08s04b01x00p06n05i01345arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc1345.vhd,v 1.2 2001-10-26 16:30:09 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c08s04b01x00p06n05i01345ent IS END c08s04b01x00p06n05i01345ent; ARCHITECTURE c08s04b01x00p06n05i01345arch OF c08s04b01x00p06n05i01345ent IS signal k : integer; BEGIN TESTING: PROCESS BEGIN k <= 1 after 10 ns, 2 after 20 ns, 3 after 30 ns, 2 after 20 ns, 4 after 40 ns, 5 after 50 ns; wait for 80 ns; assert FALSE report "***FAILED TEST: c08s04b01x00p06n05i01345 - The sequence of new transactions must be in ascending order with respect to time." severity ERROR; wait; END PROCESS TESTING; END c08s04b01x00p06n05i01345arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc1345.vhd,v 1.2 2001-10-26 16:30:09 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c08s04b01x00p06n05i01345ent IS END c08s04b01x00p06n05i01345ent; ARCHITECTURE c08s04b01x00p06n05i01345arch OF c08s04b01x00p06n05i01345ent IS signal k : integer; BEGIN TESTING: PROCESS BEGIN k <= 1 after 10 ns, 2 after 20 ns, 3 after 30 ns, 2 after 20 ns, 4 after 40 ns, 5 after 50 ns; wait for 80 ns; assert FALSE report "***FAILED TEST: c08s04b01x00p06n05i01345 - The sequence of new transactions must be in ascending order with respect to time." severity ERROR; wait; END PROCESS TESTING; END c08s04b01x00p06n05i01345arch;
-- (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_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;
--------------------------------------------------------------------------------------------------- -- -- Title : rx_dma_ctrl -- Design : eth_new -- Author : dove -- Company : google -- --------------------------------------------------------------------------------------------------- -- -- File : rx_dma_ctrl.vhd -- Generated : Sun Sep 10 22:46:39 2006 -- From : interface description file -- By : Itf2Vhdl ver. 1.20 -- --------------------------------------------------------------------------------------------------- -- -- Description : -- --------------------------------------------------------------------------------------------------- --{{ Section below this comment is automatically maintained -- and may be overwritten --{entity {rx_dma_ctrl} architecture {arch_rx_dma_ctrl}} library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity rx_dma_ctrl is generic( DWIDTH : natural; -- 8 RD_CYCLE : natural; -- 1 RD_DELAY : natural; -- 1 RAM_AWIDTH : natural ); port( clk : in std_logic; reset : in std_logic; ena : in std_logic; start : in std_logic; length : in std_logic_vector(15 downto 0); start_waddr : in std_logic_vector(RAM_AWIDTH - 1 downto 0); -- start_raddr : in std_logic_vector(23 downto 0); start_raddr : in std_logic_vector(RAM_AWIDTH - 1 downto 0); wstep : in std_logic_vector(7 downto 0); rstep : in std_logic_vector(7 downto 0); busy : out std_logic; -- raddr : out std_logic_vector(23 downto 0); raddr : out std_logic_vector(RAM_AWIDTH - 1 downto 0); rdata : in std_logic_vector(DWIDTH - 1 downto 0); wren : out std_logic; waddr : out std_logic_vector(RAM_AWIDTH - 1 downto 0); wdata : out std_logic_vector(2*DWIDTH - 1 downto 0) ); end rx_dma_ctrl; --}} End of automatically maintained section architecture arch_rx_dma_ctrl of rx_dma_ctrl is component shiftreg generic( width : INTEGER; depth : INTEGER); port( clk : in std_logic; ce : in std_logic; D : in std_logic_vector((width-1) downto 0); Q : out std_logic_vector((width-1) downto 0); S : out std_logic_vector((width-1) downto 0)); end component; signal length_reg : std_logic_vector(15 downto 0); signal start_waddr_reg : std_logic_vector(RAM_AWIDTH - 1 downto 0); -- signal start_raddr_reg : std_logic_vector(23 downto 0); signal start_raddr_reg : std_logic_vector(RAM_AWIDTH - 1 downto 0); signal wstep_reg : std_logic_vector(7 downto 0); signal rstep_reg : std_logic_vector(7 downto 0); signal busy_buf : std_logic; signal cycle_cnt : std_logic_vector(7 downto 0); signal cnt : std_logic_vector(15 downto 0); signal rden_buf : std_logic; -- signal raddr_buf : std_logic_vector(23 downto 0); signal raddr_buf : std_logic_vector(RAM_AWIDTH - 1 downto 0); signal wren_buf : std_logic; signal waddr_buf : std_logic_vector(RAM_AWIDTH - 1 downto 0); signal rd_start : std_logic; signal wr_start : std_logic; signal rd_ctrl : std_logic_vector(1 downto 0); signal wr_ctrl : std_logic_vector(1 downto 0); signal flag : std_logic; begin -- DMA Status process(clk, reset) begin if reset = '1' then length_reg <= (others => '0'); start_waddr_reg <= (others => '0'); start_raddr_reg <= (others => '0'); wstep_reg <= (others => '0'); rstep_reg <= (others => '0'); elsif rising_edge(clk) then if start = '1' then length_reg <= length; start_waddr_reg <= start_waddr; start_raddr_reg <= start_raddr; wstep_reg <= wstep; rstep_reg <= rstep; end if; end if; end process; process(clk, reset) begin if reset = '1' then busy_buf <= '0'; elsif rising_edge(clk) then if start = '1' then busy_buf <= '1'; -- elsif cnt = length_reg and cycle_cnt = RD_CYCLE - 1 then elsif cnt = length_reg then busy_buf <= '0'; end if; end if; end process; busy <= busy_buf; process(clk, reset) begin if reset = '1' then cycle_cnt <= (others => '0'); elsif rising_edge(clk) then if busy_buf = '1' and ena = '1' then if cycle_cnt = RD_CYCLE - 1 then cycle_cnt <= (others => '0'); else cycle_cnt <= cycle_cnt + 1; end if; else cycle_cnt <= (others => '0'); end if; end if; end process; process(clk, reset) begin if reset = '1' then cnt <= X"0000"; elsif rising_edge(clk) then if start = '1' then cnt <= X"0000"; elsif busy_buf = '1' and ena = '1' and (cycle_cnt = 0 or cycle_cnt = 1) then cnt <= cnt + 1; end if; end if; end process; -- Read Ctrl process(clk, reset) begin if reset = '1' then rden_buf <= '0'; elsif rising_edge(clk) then -- if busy_buf = '1' and ena = '1' and cycle_cnt = RD_CYCLE - 1 and cnt < length_reg then if busy_buf = '1' and ena = '1' and (cycle_cnt = 0 or cycle_cnt = 1) and cnt < length_reg then rden_buf <= '1'; else rden_buf <= '0'; end if; end if; end process; process(clk, reset) begin if reset = '1' then raddr_buf <= (others => '0'); elsif rising_edge(clk) then if rd_start = '1' then raddr_buf <= start_raddr_reg; elsif rden_buf = '1' then raddr_buf <= raddr_buf + rstep_reg; end if; end if; end process; raddr <= raddr_buf; -- Write Ctrl u_wr_ctrl : shiftreg generic map( width => 2, depth => RD_DELAY ) port map( clk => clk, ce => '1', D => rd_ctrl, Q => wr_ctrl, S => open ); rd_ctrl(0) <= rden_buf; rd_ctrl(1) <= rd_start; wren_buf <= wr_ctrl(0); wr_start <= wr_ctrl(1); process(clk, reset) begin if reset = '1' then waddr_buf <= (others => '0'); elsif rising_edge(clk) then if wr_start = '1' then waddr_buf <= start_waddr_reg; elsif wren_buf = '1' and flag = '1' then waddr_buf <= waddr_buf + wstep_reg; end if; end if; end process; process(clk) begin if rising_edge(clk) then rd_start <= start; -- wren <= wr_start or wren_buf; end if; end process; process(reset, clk) begin if reset = '1' then flag <= '0'; elsif rising_edge(clk) then if wren_buf = '1' and flag = '0' then flag <= '1'; elsif flag <= '1' then flag <= '0'; end if; end if; end process; process(reset, clk) begin if reset = '1' then wren <= '0'; elsif rising_edge(clk) then wren <= flag; waddr <= waddr_buf; if wren_buf = '1' and flag = '0'then wdata(7 downto 0) <= rdata; elsif flag = '1' then wdata(15 downto 8) <= rdata; end if; end if; end process; -- wren <= flag; -- waddr <= waddr_buf; -- wdata <= rdata; end arch_rx_dma_ctrl;
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2014" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block bhp6iTEHy6Wxjqv34Jeqc9v2WcfIAaJ2xwjY+6vlNOTmLCpBWO3EFdu2AiL3umXdEi43Pq22Wzal ijBx3qWOqw== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block YGtKIlEAs8qtfGeC9yYI5YUMMaRL8WOioJb/GIhKHfuJ+7G7N6UVGfoYjIawSs4yNJmV9KOs0dKH p8WR+sUHRl10zWIy+lRcFtGKPkm/tehqSkWu4zv5kf40EDkqXxAA/f46N928Ecef/fENYYTTE5LY tz6cWOq/FMBncpkq6tY= `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2014_03", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block jENJ82TVeP+YR7xtjDvA7gkpdHwrJkKuktPSN53KOqg8z4RNUyFFuqZqLq+F67no4KFx9ZVyBrcG 1TKOnwCminxvbpZcYCynzojie7pk8MDbSEehV301cGQ2ACzZe1NCXAkl7t29jfB4ej4NFpfzZt0Q m/pxebD9enSgAF30Pujk0H0wn+EBfFIA1S2H4O2AtDleK67ysKpG9VwTt72uunHtI+jp+nvjilpB IUVq/nSPGWIVJGskI73yA87bOY8w3B0yZgKR+z1zm9gfjaxkGS16l7izlkwEVgvy+Zi85CrFTSvd gxmhLfBTRePKsT4Z2Tg5GsGIpjPhrUmhhdS7/w== `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block hHpg1z3vk95yVRWn+VQ7GJbGeLymjmiecnC+jHvPsoOD1r9kDJ6ti2wQjEzQerMovibQSB281zS1 2tPIww+WhyE1Ci2B0qCQaErPpmraZvKeMVIm9WiMMwGwGuBBKHXxwQWbDMi81MDsN3wRem9ZMgCG 3V4EJhsWMkn5bcMzTYU= `protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block VFFip6IhD66Uj9IlBpJ6wGRSNaXMp7bS6Kf0ql04NCh4SdTNxzv8MH7PJVYaDZvQw+I41wrEjdOa m05amIgidLBU1M8BcSwneqrVxO1GskHyvqutAR9vQ3OhHdpkGZyE5uEehBCqb7f8URHTmFhakwpU 3npeF/TtF4labILRAz2CAZmR2h41qszCc6dCYwgc9SB5sCup0RtMWXKgImxXn4xXvU20rKGUJe0g TTbaDlRoMZxPhL88BvhY+cie1u/iZhse+k3Je/4s8cgzFqvMwnTg6ihczrJsgN+qEg1smYlqE6RJ TBa5frOG6C5qt2DMP3p2tpO+d5CTBRbcMSRCWg== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 6592) `protect data_block TVKwsuoeR8RChLqmNMeAGFMulK/EmzLts9Hcw1qLETsA19ewxL9uG4WK/3YWjdRfR8EU/W368cvh KFeNqLDgnwKEhEUPNwdgUX5JkMl04Zzqt2RHOy0vImQsl4djtFxmmE/Sk36jWuwMhjaZ1Bd9YTAS lNZgery0tshp2EOo2zK2o0kBu9kfXZAT+FoHHZCGsOS3ptlKG44kANvTRBCxjt0EAi82YBxYfsm1 8AcV+lmoCDxmOQP0ByIUINpMG+55L5kbzi4IgNGEjxJgtLb1teJgnmJ0HuhjUyOLe/V3njWwSNAC qUeE8nnvdZ2Ga+L3VT0JWCy+OPp3bbzCCsHRD6Bcb53y30xkfi88sge6kdUzmzqCulTCaGMPMUFR SWpebjs1U0gfhjd/b4YBmiEP9Rzw1lTKiSPGhq5Rc9rkhfGX6JjgJwQW0WD5CZOn6di4pAqiUHXa 8sv9GvZr5rej6PVmLyZZVjONmmfa/B0nNHqMbnLkyGtXRgxE0vDW+lnkO7TKcN7k2sdrHNYepev+ /lyOS7IHb+q6DhJnjr3NRFbyL7gbNTQY3dQ0czz4anHfA6b4cYNdfXjd0WAols7rO4ZUNoJOd2EJ CmF46wr1ZZGHdEdY/4YQDfGFJ+P/nzhgQTBN8ojiLoXNhDU4qmw6gFLLEQV3WtKlcIlN0UhXjhdk YjVpXFRLt0aGa6EuRO6KDUgDdubnw1Qh/GKZi/chtldR6boNy9xkdHgG0FRlg4DkHM1uMctjQ9QS R6rkNpQf/sdQaGOSncBiooWxkUY3HIlN2L98JWvQTSpYyZmia2xbPPuaEXS+M3TajJ/n89y3clNE 28fkY4AmI5l0l96r/zYC+t6Rde0U6Ea/1RUndaSl6MZ9IuSvVMZbp82yEyNbd7+e0vJKZ9L3ED2k FwZhn5gdP6yB6CPMN0wz47cPqo82ChcdkisE77bW9WSTmEU3m/jhmGjM/b9Rbj1dvEScqQ7r3NfM Sb2xXbfOn/Rf/aBzwY/KTShKtdtttN4hVIT5cjT9FS2hRgz7PQmgDaDoPdljir+bE5TW2em+fpgN Aeq13dqaM1zkmXxmxVLv0vMQAVDJpbdl/NhAH89HXdSMBCHKmi5sllUWUaqTDHWDYBZ+LGO5Ryui Icsip+Sv4jmBw5LW4uonrxaGsM7ndwrYNT3AHpM1bWawyXCNRbTj0/tceQ7OIBj8fmwqL3Wat+jb /KECowFq21SrETSDGXq98FQppPsn+wm7aaqWsQHbClaf5gQdLab4c9g/OBx5YYA3ulZTSaH28WNG fdjlotGF4R9EH+e49n5hJbPO/TfnF65hdh1gxO9FMP4al1xuPF8H6hZWenJQ91d0UsRsK0mZsEZS Vvn0AifIW8+hef2q/NecUYXmANfEUrjm5X50VPpFg21X/iINmQ8UBIkOgVfzIdsezao3D6a48pgS QLzz+MrruK95uAa415ZYd0xRaGZgpWujamsO1RXTmh3flUChmYTOKmntqsnCGVAd6Xtf2Xb0LYzF UUU+0If/HBWvrXAnD+Zt95uz0yyIa+EG80EIeAekmA2rXSQWizSfuwxOBca5+aCVdgj3lpIWFjj2 4REW6AHY2Vodui37lAlqQJjHF9rYyDWxwRC2RuIOAMbU5zmWPW6TFyJxlTKUvYlB0l4eUSVLkZH+ oNPpGbmje34k6M43RRcfsUN4lZL/ZfbvyEAS0Wk+SPDebRgYnPWvb64n1e9chJCSHhx/7TgqG0S1 8u9tFdea5D0rfoGwOJkFI+4R4BKYQLVLoIp4fb4HZhnAVkkM9DsAr2nDnooBmoZFFhYPeJHTdrxD OVJF+cGB82SH1VbHrAr+vlN4j4QHW5zs7VH+N39kXps225ewHXWdgUUWmFUWYpGHIDBuIMIT408z MJjeaIhktA6azPKWmR6ODcDceC+lWOsUpnbhnKYp400bldRROJDJgJZVQbz8JKr0XSWJbzLFUG1U 1KEAvKmr5g1VD8pvYOvTj6ryr4M2gXao6rfcDDDlQjzCZYREH5ReuTLOOwVSyl8D0NSVkM8Eqq3N oPQwTyrML6BBGLw/FGUJjfINup3gmbMt+UyRHKPwY1sEQze1oLz4GtOTOireab0QeW5bfcUkz0TG B7syK30wDnlK91AWyQm5TXDxNZmTINVI43qzzMxa5gTqMqQ2/x7cv+wr0iRdmyQjTR82GnBUv0Yx GaluKqXZsoSa4UP+EW1tjO2GxvPkuOctg9b8wnGzURAcCCpJxQF7B1ztHZjrRlkCrZqe9DjJ6O5/ o8OwnTCz0iSAZsfqspnf4pKxFv/rozPfx1mgVFr7jtwb5oOB1cdXnnZcpJ4LkSa+9hT8H7cJUI4L 8a3thEzllgnStCgQQfZSqiWBoVu1ge063quTBuaJ4IYGHoDIiXM/DDngDLjP26hMRQVVNIzIVU0c 3GlWTFUVqPEtbD3LXPSxyrR5MAnhWzbhT/2bj2c0NL3xSpP0Vw5dXFIYMkCanDC1UunlT71LI1xc gmnxiSlIcx5SaZeabPvsaqYJCpVWxFN2CCbFwutHuiZu+aZSR/7HZJkBZNBSVNUc8LvCGplAuXI9 Dd/J4xyum0dZ1N/WzeX2nVNZUnWRY5c+WHj07Ldgmbb1Fj0sxlP5IonR5zl2MgsBFCH3d90kI1lL exlDWKWBskWrdCB9RM/WpwfvXhMVOEE0hCtTFtd5xcYbmJuFgc+NVB2jpdhKD2YBTuJvonQWr5MW cLE8S8vUE6Tb+xNJtYpOE5OpnIPH27VGiARPa8n9C7lynyQxc6/ND+yG/lh6XBiW2b6oSfkFMYsc UOgQRMzyZV2rkCRQ+Z8r4AHDHlC90YmAhZdnsfW33PQbYdJX3MTbXQFwCNh70E1645M+6YFrMziI 4d8iSx8mN/9oC7cSJ/I85PBUoHvdusVw9MeDNeML2NoIoPjPNo/mJRmSc9P2YYU8JRDGpWVH3AIE YnjYirmUhoD/YDGKMprAk/VmDhvLFXbGa7O8eCs37Bk8s/64oATSfVndgzSuHHmwy8y/TgkaEGSM HrhFw+lu2i3ce5/D3uglzslKtHGn6JhOCsFplPLVQ0IJapoUQ7ra6wiYQKceEwX3VbXEmNTJcTEB cduO560133BoB2j0RcoqtQojoX2CTKignzCFq31gzA4qhx0R5qb0UE8330dvyW3y9r5f/YaUnXz+ fbyed1FN87AYlq6awKPNOYy3uhhCx6h1QKWvxyhLB+oJsN8YqhH9M+rmGI/+pJYz6MzSnR/pT6cG Wnwi28cjwJ+xMZ8bRdKjHYOEo8O8zu0o9lJlB6XaOgPifSmWjlfbJzbH88fmK4gNjOfwsQhy17YZ xHJsXTLAqNPgKA5Xy8vtSaoe9Xhphafy5F+iXlhErrNPpw66lDcLDYtdy3DaqZvZUrc/McghCmWU i6gnXF0BYZZzpR3wygUIZ0xsBATCXLvXU6wwcqPLenYP7N90jIxnUlVGajPSRwUVQa+hWjw0p2b/ xycKVKZ65JVXEyVfj8KYhEzg14hOU0Zvl6PHHkKjRjAv8Rf5klYOoeH1sgR3BCM1H24N3sm+NPqP gmnwbZEJR0E54w9Bv0grZdXXFhP9gLlwKFVQGT2cKLX89pfI5YRs/CNrYcCLBJVZA+Zgh+HMh84U sZZhdMNuQbYUv/xY+QtiWn1fFGUkPmTshYIZqIShlwTRV1gaAtknts1rkBA+UzLSFLlynBxuQqrd z7Nh0zmG3NlEhC+QDF49PdTHlbxA8XgvCcJ85BxZfxDBeWhRyUtXQjobn3kk+WC5hgYFyZy+xX36 bRRzMe58WjRCj08E4PRP39qhpfBUoJ1BqDRMMXIxsMFrlLosvGoA6fVhFAM7GC0Bxc4F0JmGMHWq st/cV/boIjEXOAUdfUyfNzbheCFWivO2K2JPxH+r7UWHw4Gq8GhhbG58dbTpTgdGZckhdwjVfQHf 3lRsnz8w4Ud3bpF9oEPDoiyWqFP9aVHITGzUrapMpro0gZq+fUoHFgG57PpU4+/82qPU6VX384Oi WZbAM/yk3A6M5kxIPMdm96c1JtrfNmeTVmqgNRKyHi+ZYK4yYT45Wjer1zO1jrjQ6/bqnX61qoxA m1WG/Bglmg7KHWjwv+80iOoSdUzw7+1gyUUtLpH7T2u4kh1ymJcPCRqiDrh0TSprniZo9do9o1sD AfbI69GMH+zghmHnP3WcSq4ngYgwijXi+DuZM7JHCGP3WxRulTEiDkVrP2sRbflGdk5REV9jeJ9/ yGDbRi1qvOi9urpP9BcMFd81ibbzz6rr8dg33iFC8C1xbyozvN2fjXGVbEL8WuF3y/T32eRK3JaW 0jY+67Su5jntfzs2/jX81DCFfJcPcPdVN0AHixeZ9cEWDQOMPZtcs8PyUkzb2TbM2eOzJFJe8XPY zyRJfV1nr7AKVJzyldwADFdo62JvDLAWIKx38gO8vTh+ecEiGCUrvK3rBpV4URXRWpvc7s78WGxa 9kkTSielpexXAPNFCueTV3n7zBUB2P9uzQpjuGTHlQUFZrCANnQcvLDoIlO+G/en8MA8Cy/ixGHJ KLe/UNr+ZPRB8X2+CsWpdotL6yn0KdA49MKRSndoB03/lv3ERLdoEdYVkVlb77hJ6CtiudQxky4N HVx3oI4/Q3sQbo+HSr4K8fSv9YIDHofL4KTVqaKMBfMkEC6Hs4N0mmULatAjX93RK+evIxzf+lHS by8YBTVL9NNOiY2iXm2FheVqzR9avVXEU0n7vVMpuo75pAV+xccnne8WUsotd3ehZdFn5Z88lSaB wvmapwBNZRK+GdBgAJ4ihUDKizH1V0g7wmTwFknfZxnM7c8yG5I9b9+ZdL44YQAeuHZiz14IS8Ce UggluthctB/bnPsQOoS0k7K+YW89jO8grpkcRp/gEH5j3dPWpHObq7cr1cvlsnsjI+CzHXo1C1Hx 1/9f4i8PslkXir2aracOhT0YppN5ohJR0C9BufIlGvMacVoPIJUO9WM9T0fguBqAQh1cwDjULv84 SLsBThidLOrA9iR/0q7OGLaVQCFr7aqb49YHIImeBf4To2EcDaCZWqxZDeEmMDUBQJn2HtWAds/8 V+bdeK/Dhic4O8Ul5w+S7yXo1y+M4hF5P1GGKaLrUW0YbRTaP2/pt6Q18XWn3ok2mSuN9Zd6p6lh u0mduv7uuuK1VZQsm4WQhWVE3phIRLMgB7BXO2PwZiuVY4kxXCaIaIwJvmPkXryoOJJ79qstfFVF JUR0Bowq4CByjeid9YmZOImkZzndOUaul4WeLy8o4Z+AsdrRwr9yJuJEqfdWXNuXvlrrNZYDOV9n Xo/+TA3zsse6qfUHU0piuLnxLkRO4VaSzcaoYb+jF02nVVpWYs84iGXVtolvC7TkWxY1aj4v5dNX fUpupJenh0GoFAUpp69ioPjWJidhLsuMMNMEqWE6/t54a2uCdvJOQQWRkbrcaREntNxHVwz85Qzw KXBlRCjOJ297v0j7Ym7NPcsLYaTnd+6eC8br8LkVFtHR5eKRrWjArCa9bJAip/giRlG1hF3UBI9+ c27Gwe/g++YCXlF64C7D9rud3ayvmq/9w3xWYMgpuvgkvrWmBiF0arLE79a37wttqnZYzRcvEpuf jeReOX54duivpiqsjw4cuJQa7YOxJgLtW3ZyypOgiWEXLkw8Do5FSrRsFQH42aVsWysj4akOpvua 1ZRaN2wy6/3dl5cWpqZJUd0O9MS9C+jNnTMBxqGlzR74rGcwmRhei8Am5VIFI5CcMG2CvT7cAHdQ 4iBfxBVL5QzxxImLQB+zHh+TBgya4/I7iNRje8JDLLkv2ZVfbAjr0fQ4KHx/s0JkLhalg/p/++s2 NcsAxbxiTA+kyYe8mWGCq13pSG5ldwvbNdm3EoqbsZlzW09/EDXW0A7E2jMQGHJc8sv8cRXMYHgB jx2fpEIwiV/EXfUpwWgY4CyHx2kSFP9Rbo9KCH583vSblKGP56wI0jYXzDL8bWH3y6NbifITfXrp sPJ6mUO9AzdEElGEpYczCupoGvOP+g8HnN5HO6jL4Y362Jz2nEjxdpfCJey7q75pwxRlvl06XGFS NfAw1X8hwPQnS/1AlWvjN8aGyD3fG7Kg4Ok4EGRrtCkPfuh3DJPjooD7d96VUkK4hWlI9SAHdvcU bPF2q12/mdRZDdPjvXvEshmwTzVAk/ODXptwuf7zbVU5dXK/GRQ/PhpjvyTzklAac/9vHa4x5sb2 y9SBOwGrsip7lw9bWofMIpzGkHtbWoKf4NTnqjafKwrR+0cnfvf5lwaYBH0ZzHSH+68NOMo/c8iB Xc4TadD5jbSwU7XfzzW1oT0qTcrCrgh/ggRNt2iYnZ4jbBTUYFgvMvIQegLe3agMyGUirAJUACdf rGuEQHpx+0+UKvpoERs93fmKx9RigXSu8UXaCAoURIwlQmLFAGG2vdazOvgKRu64OhE0MmTDejcR 9TLavVAlEpDmyl1LjvFDVxTT91lrD6OC1jhXJtnsI5sF1bLriBc7zEQqIHc3MNICrCWH9rULMQue /ZEFIUqA6CSUNDXx/JtibtmN+I6GJs4oN2THnGwC8kA3DUL9RxyHO1Bjdw2/CRla1fHRJHg5M6BN 6Et0LcCKhxaG6fLWKjlIjmYOzzg7K6fUDVTc/D7HACNnU9/1eGnmymyLbrdKYL2ajHHOk8dAIB5M kcsy67b1hDOKdzEw+kX4vRHI9d1ZghgQc4JEJTI+lrYlMm4xSx/OST2v5qTV8iPaxn5IlFq0gQGj kZT9ydnlbJhHVWrbpPgiCLmpCn67J+F+/6NHi8WE52XR+oxyeVTSBKNbAaqmGmBapkplBCkTS7nh ufed5HONoMaLjTQWS66dmgHP2ujh0OA/3p3wqPrn5rqjnGnsJEjVMfKGymNTgKCNyvHAp72cAGnJ cQO/CXTAl9nyGXlk06ci18s/GkXFp9ACClTe262MA7srQq5hOe+Oj5DBZ6oeF/rjNKCmJ4PxBMaG mnyS02lQdK5bwbN//BM3BiHnByDiK2lsItTKneQWT5BzKYhYrY/9AHmIyq2GOVimXXeXor+cQoe7 MymfmkYBT6P+aUudiO8B6guh2x3lxi681tbaMoqwoMcBYn61sGP9fHzwSPXlMsfME40QA3sbv2U0 ofQ+Jde0JM+CH2JcBFlIEnFe5M304b41nlMOnmH7ZY4EDRl0TXGSTjA1ro9lgfHQK3MlIdaE88Vw 16uSWQAUbryG3WXZthsaCgagDnQ2PSpBsck1CrAqS9+CqM0aCxq/IXmQ/GrLsuz+STfAeMmkr9m9 5kTRzt3qy0kM049I3Z4jQBXJ0g8OK4RwBijTERbR3H+yY3LaGTLTbsm1vJwV/cCYoR0mOi7cRTr+ zh41iymA2hRy+Zs6z46zXNYyrCoY0ox2ah8dgUuoW2WX4B3zSrD3Fze5slPYfpkNf9yPzeOzBonJ M+WjgeaoWTxqKtHxhOAMAOlkoePAVbNqN3K4vJleaMFNe+esbXF72PoEQEXx0/3AqGu+3oxYxgPB YgQ37kgSo6J2eyLbJdC8O5nnQmuPuxF2RZHZ7WudohIIV2qJzy2p5I/qYm4bg3XkH2Ouhy8e080q ixE9NfpYhWeHnH1E6vyvaMiy3UblJLer38wCYqfjfggzqI4cCU6RaTMmpivnc2Rj1g3JerOzTXSd m91BWBOC1cDdZV6YaJzCVWiuHQOp5DBwKp5IzYK87Wi2MGs4T0YX4Ik31BvqioKyPGBqIC9aTu4h 8xNL4heWJybkjLYCUKjBwt8EYL3ko/u5fPshbHpjxMxe5Rnr8qtFbJGNHl5eCYtFUmv/8xtERuOX jIizVCRFloB1cKh8X6ZpAc3j7TjcJQ/8RlcqRrTgAEYS59fhgAf+ZUoM5vx58iHdmd+zXoJDU5IR 0Gr9BPtMycPTeu4C1UGqgRPO9KM1RSE5mPuycJjfI8xrpZ3QXihCj+KCS6wsE9mFcMcsL0qs7Cm2 +7nM5H5tcg5uy4heEE4wTE5sK9vxnl5SN1O6tsZB7sIp7WMwCTb6/KvNQN/oSE/waMg/cyYIXBFv yuuDF4tVAa0er9aviacCDvOq+ltJwfjkmL6CvVcQgnx1jgRc1j83ilV7UM1w46F+Dj69GHhMjK7i FHwGzhNHRc9iRkcCEmZ5IAmbtiRI6cMVPhoj8O086P+DOIQFaK9wkZ2l20kHsUjBtLaKNoppRGNP cZloIUjwLZqjRtviOxXSO07KEOZrVYuqQr3be6sObCpC/y7wBUjI3sDYJsQpQCue5Oi4befLLXrT ApOBfhxv3QUvLazFTLyJt3RG7WAy3l8s/++n7kIooJqBDCbFbVzAu+oGPY9RdmvZmGeEFGR1s6Ad L3ObFdSVvKQuJnuGD1M3TwEFQzocAT/R/AJcNXH54wESyumV8FEWhcDCXUoWEoKY17VUQu6DNCM2 iw1xYk7PJ7jB17JuTMAZu6QXLFNrxJVWqaxprpDvKaMIfxiqYeJXg1qcSiYEhuL8KD0xiTttoH/4 R8Pgo9R7iAf/dCzfTlrtORuXWx7bBttQHTBy8lCvVUFAn+bfQulLgz3w34K9LkpBw+1ltYXE8sYM vlx7GxNyaD5goRPgFOh6zdoluJ4vOlBTMJoSq9aIR3lNy9Jdt5ucX0DmLVUpJY4oXiqVUV6j/RYA tnzsNFaoz2mjFC+4DjDnDK6TaRQXniFPRTeACC7kA+bAFK8CVoShWNs04kkTxSA9OUb2oTWWOo6o YeevH5sxINy33UMIADk4jS5PbZJNx6SqPcMKPQCqofkgP8Z1Wg== `protect end_protected
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2014" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block bhp6iTEHy6Wxjqv34Jeqc9v2WcfIAaJ2xwjY+6vlNOTmLCpBWO3EFdu2AiL3umXdEi43Pq22Wzal ijBx3qWOqw== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block YGtKIlEAs8qtfGeC9yYI5YUMMaRL8WOioJb/GIhKHfuJ+7G7N6UVGfoYjIawSs4yNJmV9KOs0dKH p8WR+sUHRl10zWIy+lRcFtGKPkm/tehqSkWu4zv5kf40EDkqXxAA/f46N928Ecef/fENYYTTE5LY tz6cWOq/FMBncpkq6tY= `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2014_03", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block jENJ82TVeP+YR7xtjDvA7gkpdHwrJkKuktPSN53KOqg8z4RNUyFFuqZqLq+F67no4KFx9ZVyBrcG 1TKOnwCminxvbpZcYCynzojie7pk8MDbSEehV301cGQ2ACzZe1NCXAkl7t29jfB4ej4NFpfzZt0Q m/pxebD9enSgAF30Pujk0H0wn+EBfFIA1S2H4O2AtDleK67ysKpG9VwTt72uunHtI+jp+nvjilpB IUVq/nSPGWIVJGskI73yA87bOY8w3B0yZgKR+z1zm9gfjaxkGS16l7izlkwEVgvy+Zi85CrFTSvd gxmhLfBTRePKsT4Z2Tg5GsGIpjPhrUmhhdS7/w== `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block hHpg1z3vk95yVRWn+VQ7GJbGeLymjmiecnC+jHvPsoOD1r9kDJ6ti2wQjEzQerMovibQSB281zS1 2tPIww+WhyE1Ci2B0qCQaErPpmraZvKeMVIm9WiMMwGwGuBBKHXxwQWbDMi81MDsN3wRem9ZMgCG 3V4EJhsWMkn5bcMzTYU= `protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block VFFip6IhD66Uj9IlBpJ6wGRSNaXMp7bS6Kf0ql04NCh4SdTNxzv8MH7PJVYaDZvQw+I41wrEjdOa m05amIgidLBU1M8BcSwneqrVxO1GskHyvqutAR9vQ3OhHdpkGZyE5uEehBCqb7f8URHTmFhakwpU 3npeF/TtF4labILRAz2CAZmR2h41qszCc6dCYwgc9SB5sCup0RtMWXKgImxXn4xXvU20rKGUJe0g TTbaDlRoMZxPhL88BvhY+cie1u/iZhse+k3Je/4s8cgzFqvMwnTg6ihczrJsgN+qEg1smYlqE6RJ TBa5frOG6C5qt2DMP3p2tpO+d5CTBRbcMSRCWg== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 6592) `protect data_block TVKwsuoeR8RChLqmNMeAGFMulK/EmzLts9Hcw1qLETsA19ewxL9uG4WK/3YWjdRfR8EU/W368cvh KFeNqLDgnwKEhEUPNwdgUX5JkMl04Zzqt2RHOy0vImQsl4djtFxmmE/Sk36jWuwMhjaZ1Bd9YTAS lNZgery0tshp2EOo2zK2o0kBu9kfXZAT+FoHHZCGsOS3ptlKG44kANvTRBCxjt0EAi82YBxYfsm1 8AcV+lmoCDxmOQP0ByIUINpMG+55L5kbzi4IgNGEjxJgtLb1teJgnmJ0HuhjUyOLe/V3njWwSNAC qUeE8nnvdZ2Ga+L3VT0JWCy+OPp3bbzCCsHRD6Bcb53y30xkfi88sge6kdUzmzqCulTCaGMPMUFR SWpebjs1U0gfhjd/b4YBmiEP9Rzw1lTKiSPGhq5Rc9rkhfGX6JjgJwQW0WD5CZOn6di4pAqiUHXa 8sv9GvZr5rej6PVmLyZZVjONmmfa/B0nNHqMbnLkyGtXRgxE0vDW+lnkO7TKcN7k2sdrHNYepev+ /lyOS7IHb+q6DhJnjr3NRFbyL7gbNTQY3dQ0czz4anHfA6b4cYNdfXjd0WAols7rO4ZUNoJOd2EJ CmF46wr1ZZGHdEdY/4YQDfGFJ+P/nzhgQTBN8ojiLoXNhDU4qmw6gFLLEQV3WtKlcIlN0UhXjhdk YjVpXFRLt0aGa6EuRO6KDUgDdubnw1Qh/GKZi/chtldR6boNy9xkdHgG0FRlg4DkHM1uMctjQ9QS R6rkNpQf/sdQaGOSncBiooWxkUY3HIlN2L98JWvQTSpYyZmia2xbPPuaEXS+M3TajJ/n89y3clNE 28fkY4AmI5l0l96r/zYC+t6Rde0U6Ea/1RUndaSl6MZ9IuSvVMZbp82yEyNbd7+e0vJKZ9L3ED2k FwZhn5gdP6yB6CPMN0wz47cPqo82ChcdkisE77bW9WSTmEU3m/jhmGjM/b9Rbj1dvEScqQ7r3NfM Sb2xXbfOn/Rf/aBzwY/KTShKtdtttN4hVIT5cjT9FS2hRgz7PQmgDaDoPdljir+bE5TW2em+fpgN Aeq13dqaM1zkmXxmxVLv0vMQAVDJpbdl/NhAH89HXdSMBCHKmi5sllUWUaqTDHWDYBZ+LGO5Ryui Icsip+Sv4jmBw5LW4uonrxaGsM7ndwrYNT3AHpM1bWawyXCNRbTj0/tceQ7OIBj8fmwqL3Wat+jb /KECowFq21SrETSDGXq98FQppPsn+wm7aaqWsQHbClaf5gQdLab4c9g/OBx5YYA3ulZTSaH28WNG fdjlotGF4R9EH+e49n5hJbPO/TfnF65hdh1gxO9FMP4al1xuPF8H6hZWenJQ91d0UsRsK0mZsEZS Vvn0AifIW8+hef2q/NecUYXmANfEUrjm5X50VPpFg21X/iINmQ8UBIkOgVfzIdsezao3D6a48pgS QLzz+MrruK95uAa415ZYd0xRaGZgpWujamsO1RXTmh3flUChmYTOKmntqsnCGVAd6Xtf2Xb0LYzF UUU+0If/HBWvrXAnD+Zt95uz0yyIa+EG80EIeAekmA2rXSQWizSfuwxOBca5+aCVdgj3lpIWFjj2 4REW6AHY2Vodui37lAlqQJjHF9rYyDWxwRC2RuIOAMbU5zmWPW6TFyJxlTKUvYlB0l4eUSVLkZH+ oNPpGbmje34k6M43RRcfsUN4lZL/ZfbvyEAS0Wk+SPDebRgYnPWvb64n1e9chJCSHhx/7TgqG0S1 8u9tFdea5D0rfoGwOJkFI+4R4BKYQLVLoIp4fb4HZhnAVkkM9DsAr2nDnooBmoZFFhYPeJHTdrxD OVJF+cGB82SH1VbHrAr+vlN4j4QHW5zs7VH+N39kXps225ewHXWdgUUWmFUWYpGHIDBuIMIT408z MJjeaIhktA6azPKWmR6ODcDceC+lWOsUpnbhnKYp400bldRROJDJgJZVQbz8JKr0XSWJbzLFUG1U 1KEAvKmr5g1VD8pvYOvTj6ryr4M2gXao6rfcDDDlQjzCZYREH5ReuTLOOwVSyl8D0NSVkM8Eqq3N oPQwTyrML6BBGLw/FGUJjfINup3gmbMt+UyRHKPwY1sEQze1oLz4GtOTOireab0QeW5bfcUkz0TG B7syK30wDnlK91AWyQm5TXDxNZmTINVI43qzzMxa5gTqMqQ2/x7cv+wr0iRdmyQjTR82GnBUv0Yx GaluKqXZsoSa4UP+EW1tjO2GxvPkuOctg9b8wnGzURAcCCpJxQF7B1ztHZjrRlkCrZqe9DjJ6O5/ o8OwnTCz0iSAZsfqspnf4pKxFv/rozPfx1mgVFr7jtwb5oOB1cdXnnZcpJ4LkSa+9hT8H7cJUI4L 8a3thEzllgnStCgQQfZSqiWBoVu1ge063quTBuaJ4IYGHoDIiXM/DDngDLjP26hMRQVVNIzIVU0c 3GlWTFUVqPEtbD3LXPSxyrR5MAnhWzbhT/2bj2c0NL3xSpP0Vw5dXFIYMkCanDC1UunlT71LI1xc gmnxiSlIcx5SaZeabPvsaqYJCpVWxFN2CCbFwutHuiZu+aZSR/7HZJkBZNBSVNUc8LvCGplAuXI9 Dd/J4xyum0dZ1N/WzeX2nVNZUnWRY5c+WHj07Ldgmbb1Fj0sxlP5IonR5zl2MgsBFCH3d90kI1lL exlDWKWBskWrdCB9RM/WpwfvXhMVOEE0hCtTFtd5xcYbmJuFgc+NVB2jpdhKD2YBTuJvonQWr5MW cLE8S8vUE6Tb+xNJtYpOE5OpnIPH27VGiARPa8n9C7lynyQxc6/ND+yG/lh6XBiW2b6oSfkFMYsc UOgQRMzyZV2rkCRQ+Z8r4AHDHlC90YmAhZdnsfW33PQbYdJX3MTbXQFwCNh70E1645M+6YFrMziI 4d8iSx8mN/9oC7cSJ/I85PBUoHvdusVw9MeDNeML2NoIoPjPNo/mJRmSc9P2YYU8JRDGpWVH3AIE YnjYirmUhoD/YDGKMprAk/VmDhvLFXbGa7O8eCs37Bk8s/64oATSfVndgzSuHHmwy8y/TgkaEGSM HrhFw+lu2i3ce5/D3uglzslKtHGn6JhOCsFplPLVQ0IJapoUQ7ra6wiYQKceEwX3VbXEmNTJcTEB cduO560133BoB2j0RcoqtQojoX2CTKignzCFq31gzA4qhx0R5qb0UE8330dvyW3y9r5f/YaUnXz+ fbyed1FN87AYlq6awKPNOYy3uhhCx6h1QKWvxyhLB+oJsN8YqhH9M+rmGI/+pJYz6MzSnR/pT6cG Wnwi28cjwJ+xMZ8bRdKjHYOEo8O8zu0o9lJlB6XaOgPifSmWjlfbJzbH88fmK4gNjOfwsQhy17YZ xHJsXTLAqNPgKA5Xy8vtSaoe9Xhphafy5F+iXlhErrNPpw66lDcLDYtdy3DaqZvZUrc/McghCmWU i6gnXF0BYZZzpR3wygUIZ0xsBATCXLvXU6wwcqPLenYP7N90jIxnUlVGajPSRwUVQa+hWjw0p2b/ xycKVKZ65JVXEyVfj8KYhEzg14hOU0Zvl6PHHkKjRjAv8Rf5klYOoeH1sgR3BCM1H24N3sm+NPqP gmnwbZEJR0E54w9Bv0grZdXXFhP9gLlwKFVQGT2cKLX89pfI5YRs/CNrYcCLBJVZA+Zgh+HMh84U sZZhdMNuQbYUv/xY+QtiWn1fFGUkPmTshYIZqIShlwTRV1gaAtknts1rkBA+UzLSFLlynBxuQqrd z7Nh0zmG3NlEhC+QDF49PdTHlbxA8XgvCcJ85BxZfxDBeWhRyUtXQjobn3kk+WC5hgYFyZy+xX36 bRRzMe58WjRCj08E4PRP39qhpfBUoJ1BqDRMMXIxsMFrlLosvGoA6fVhFAM7GC0Bxc4F0JmGMHWq st/cV/boIjEXOAUdfUyfNzbheCFWivO2K2JPxH+r7UWHw4Gq8GhhbG58dbTpTgdGZckhdwjVfQHf 3lRsnz8w4Ud3bpF9oEPDoiyWqFP9aVHITGzUrapMpro0gZq+fUoHFgG57PpU4+/82qPU6VX384Oi WZbAM/yk3A6M5kxIPMdm96c1JtrfNmeTVmqgNRKyHi+ZYK4yYT45Wjer1zO1jrjQ6/bqnX61qoxA m1WG/Bglmg7KHWjwv+80iOoSdUzw7+1gyUUtLpH7T2u4kh1ymJcPCRqiDrh0TSprniZo9do9o1sD AfbI69GMH+zghmHnP3WcSq4ngYgwijXi+DuZM7JHCGP3WxRulTEiDkVrP2sRbflGdk5REV9jeJ9/ yGDbRi1qvOi9urpP9BcMFd81ibbzz6rr8dg33iFC8C1xbyozvN2fjXGVbEL8WuF3y/T32eRK3JaW 0jY+67Su5jntfzs2/jX81DCFfJcPcPdVN0AHixeZ9cEWDQOMPZtcs8PyUkzb2TbM2eOzJFJe8XPY zyRJfV1nr7AKVJzyldwADFdo62JvDLAWIKx38gO8vTh+ecEiGCUrvK3rBpV4URXRWpvc7s78WGxa 9kkTSielpexXAPNFCueTV3n7zBUB2P9uzQpjuGTHlQUFZrCANnQcvLDoIlO+G/en8MA8Cy/ixGHJ KLe/UNr+ZPRB8X2+CsWpdotL6yn0KdA49MKRSndoB03/lv3ERLdoEdYVkVlb77hJ6CtiudQxky4N HVx3oI4/Q3sQbo+HSr4K8fSv9YIDHofL4KTVqaKMBfMkEC6Hs4N0mmULatAjX93RK+evIxzf+lHS by8YBTVL9NNOiY2iXm2FheVqzR9avVXEU0n7vVMpuo75pAV+xccnne8WUsotd3ehZdFn5Z88lSaB wvmapwBNZRK+GdBgAJ4ihUDKizH1V0g7wmTwFknfZxnM7c8yG5I9b9+ZdL44YQAeuHZiz14IS8Ce UggluthctB/bnPsQOoS0k7K+YW89jO8grpkcRp/gEH5j3dPWpHObq7cr1cvlsnsjI+CzHXo1C1Hx 1/9f4i8PslkXir2aracOhT0YppN5ohJR0C9BufIlGvMacVoPIJUO9WM9T0fguBqAQh1cwDjULv84 SLsBThidLOrA9iR/0q7OGLaVQCFr7aqb49YHIImeBf4To2EcDaCZWqxZDeEmMDUBQJn2HtWAds/8 V+bdeK/Dhic4O8Ul5w+S7yXo1y+M4hF5P1GGKaLrUW0YbRTaP2/pt6Q18XWn3ok2mSuN9Zd6p6lh u0mduv7uuuK1VZQsm4WQhWVE3phIRLMgB7BXO2PwZiuVY4kxXCaIaIwJvmPkXryoOJJ79qstfFVF JUR0Bowq4CByjeid9YmZOImkZzndOUaul4WeLy8o4Z+AsdrRwr9yJuJEqfdWXNuXvlrrNZYDOV9n Xo/+TA3zsse6qfUHU0piuLnxLkRO4VaSzcaoYb+jF02nVVpWYs84iGXVtolvC7TkWxY1aj4v5dNX fUpupJenh0GoFAUpp69ioPjWJidhLsuMMNMEqWE6/t54a2uCdvJOQQWRkbrcaREntNxHVwz85Qzw KXBlRCjOJ297v0j7Ym7NPcsLYaTnd+6eC8br8LkVFtHR5eKRrWjArCa9bJAip/giRlG1hF3UBI9+ c27Gwe/g++YCXlF64C7D9rud3ayvmq/9w3xWYMgpuvgkvrWmBiF0arLE79a37wttqnZYzRcvEpuf jeReOX54duivpiqsjw4cuJQa7YOxJgLtW3ZyypOgiWEXLkw8Do5FSrRsFQH42aVsWysj4akOpvua 1ZRaN2wy6/3dl5cWpqZJUd0O9MS9C+jNnTMBxqGlzR74rGcwmRhei8Am5VIFI5CcMG2CvT7cAHdQ 4iBfxBVL5QzxxImLQB+zHh+TBgya4/I7iNRje8JDLLkv2ZVfbAjr0fQ4KHx/s0JkLhalg/p/++s2 NcsAxbxiTA+kyYe8mWGCq13pSG5ldwvbNdm3EoqbsZlzW09/EDXW0A7E2jMQGHJc8sv8cRXMYHgB jx2fpEIwiV/EXfUpwWgY4CyHx2kSFP9Rbo9KCH583vSblKGP56wI0jYXzDL8bWH3y6NbifITfXrp sPJ6mUO9AzdEElGEpYczCupoGvOP+g8HnN5HO6jL4Y362Jz2nEjxdpfCJey7q75pwxRlvl06XGFS NfAw1X8hwPQnS/1AlWvjN8aGyD3fG7Kg4Ok4EGRrtCkPfuh3DJPjooD7d96VUkK4hWlI9SAHdvcU bPF2q12/mdRZDdPjvXvEshmwTzVAk/ODXptwuf7zbVU5dXK/GRQ/PhpjvyTzklAac/9vHa4x5sb2 y9SBOwGrsip7lw9bWofMIpzGkHtbWoKf4NTnqjafKwrR+0cnfvf5lwaYBH0ZzHSH+68NOMo/c8iB Xc4TadD5jbSwU7XfzzW1oT0qTcrCrgh/ggRNt2iYnZ4jbBTUYFgvMvIQegLe3agMyGUirAJUACdf rGuEQHpx+0+UKvpoERs93fmKx9RigXSu8UXaCAoURIwlQmLFAGG2vdazOvgKRu64OhE0MmTDejcR 9TLavVAlEpDmyl1LjvFDVxTT91lrD6OC1jhXJtnsI5sF1bLriBc7zEQqIHc3MNICrCWH9rULMQue /ZEFIUqA6CSUNDXx/JtibtmN+I6GJs4oN2THnGwC8kA3DUL9RxyHO1Bjdw2/CRla1fHRJHg5M6BN 6Et0LcCKhxaG6fLWKjlIjmYOzzg7K6fUDVTc/D7HACNnU9/1eGnmymyLbrdKYL2ajHHOk8dAIB5M kcsy67b1hDOKdzEw+kX4vRHI9d1ZghgQc4JEJTI+lrYlMm4xSx/OST2v5qTV8iPaxn5IlFq0gQGj kZT9ydnlbJhHVWrbpPgiCLmpCn67J+F+/6NHi8WE52XR+oxyeVTSBKNbAaqmGmBapkplBCkTS7nh ufed5HONoMaLjTQWS66dmgHP2ujh0OA/3p3wqPrn5rqjnGnsJEjVMfKGymNTgKCNyvHAp72cAGnJ cQO/CXTAl9nyGXlk06ci18s/GkXFp9ACClTe262MA7srQq5hOe+Oj5DBZ6oeF/rjNKCmJ4PxBMaG mnyS02lQdK5bwbN//BM3BiHnByDiK2lsItTKneQWT5BzKYhYrY/9AHmIyq2GOVimXXeXor+cQoe7 MymfmkYBT6P+aUudiO8B6guh2x3lxi681tbaMoqwoMcBYn61sGP9fHzwSPXlMsfME40QA3sbv2U0 ofQ+Jde0JM+CH2JcBFlIEnFe5M304b41nlMOnmH7ZY4EDRl0TXGSTjA1ro9lgfHQK3MlIdaE88Vw 16uSWQAUbryG3WXZthsaCgagDnQ2PSpBsck1CrAqS9+CqM0aCxq/IXmQ/GrLsuz+STfAeMmkr9m9 5kTRzt3qy0kM049I3Z4jQBXJ0g8OK4RwBijTERbR3H+yY3LaGTLTbsm1vJwV/cCYoR0mOi7cRTr+ zh41iymA2hRy+Zs6z46zXNYyrCoY0ox2ah8dgUuoW2WX4B3zSrD3Fze5slPYfpkNf9yPzeOzBonJ M+WjgeaoWTxqKtHxhOAMAOlkoePAVbNqN3K4vJleaMFNe+esbXF72PoEQEXx0/3AqGu+3oxYxgPB YgQ37kgSo6J2eyLbJdC8O5nnQmuPuxF2RZHZ7WudohIIV2qJzy2p5I/qYm4bg3XkH2Ouhy8e080q ixE9NfpYhWeHnH1E6vyvaMiy3UblJLer38wCYqfjfggzqI4cCU6RaTMmpivnc2Rj1g3JerOzTXSd m91BWBOC1cDdZV6YaJzCVWiuHQOp5DBwKp5IzYK87Wi2MGs4T0YX4Ik31BvqioKyPGBqIC9aTu4h 8xNL4heWJybkjLYCUKjBwt8EYL3ko/u5fPshbHpjxMxe5Rnr8qtFbJGNHl5eCYtFUmv/8xtERuOX jIizVCRFloB1cKh8X6ZpAc3j7TjcJQ/8RlcqRrTgAEYS59fhgAf+ZUoM5vx58iHdmd+zXoJDU5IR 0Gr9BPtMycPTeu4C1UGqgRPO9KM1RSE5mPuycJjfI8xrpZ3QXihCj+KCS6wsE9mFcMcsL0qs7Cm2 +7nM5H5tcg5uy4heEE4wTE5sK9vxnl5SN1O6tsZB7sIp7WMwCTb6/KvNQN/oSE/waMg/cyYIXBFv yuuDF4tVAa0er9aviacCDvOq+ltJwfjkmL6CvVcQgnx1jgRc1j83ilV7UM1w46F+Dj69GHhMjK7i FHwGzhNHRc9iRkcCEmZ5IAmbtiRI6cMVPhoj8O086P+DOIQFaK9wkZ2l20kHsUjBtLaKNoppRGNP cZloIUjwLZqjRtviOxXSO07KEOZrVYuqQr3be6sObCpC/y7wBUjI3sDYJsQpQCue5Oi4befLLXrT ApOBfhxv3QUvLazFTLyJt3RG7WAy3l8s/++n7kIooJqBDCbFbVzAu+oGPY9RdmvZmGeEFGR1s6Ad L3ObFdSVvKQuJnuGD1M3TwEFQzocAT/R/AJcNXH54wESyumV8FEWhcDCXUoWEoKY17VUQu6DNCM2 iw1xYk7PJ7jB17JuTMAZu6QXLFNrxJVWqaxprpDvKaMIfxiqYeJXg1qcSiYEhuL8KD0xiTttoH/4 R8Pgo9R7iAf/dCzfTlrtORuXWx7bBttQHTBy8lCvVUFAn+bfQulLgz3w34K9LkpBw+1ltYXE8sYM vlx7GxNyaD5goRPgFOh6zdoluJ4vOlBTMJoSq9aIR3lNy9Jdt5ucX0DmLVUpJY4oXiqVUV6j/RYA tnzsNFaoz2mjFC+4DjDnDK6TaRQXniFPRTeACC7kA+bAFK8CVoShWNs04kkTxSA9OUb2oTWWOo6o YeevH5sxINy33UMIADk4jS5PbZJNx6SqPcMKPQCqofkgP8Z1Wg== `protect end_protected
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2014" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block bhp6iTEHy6Wxjqv34Jeqc9v2WcfIAaJ2xwjY+6vlNOTmLCpBWO3EFdu2AiL3umXdEi43Pq22Wzal ijBx3qWOqw== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block YGtKIlEAs8qtfGeC9yYI5YUMMaRL8WOioJb/GIhKHfuJ+7G7N6UVGfoYjIawSs4yNJmV9KOs0dKH p8WR+sUHRl10zWIy+lRcFtGKPkm/tehqSkWu4zv5kf40EDkqXxAA/f46N928Ecef/fENYYTTE5LY tz6cWOq/FMBncpkq6tY= `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2014_03", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block jENJ82TVeP+YR7xtjDvA7gkpdHwrJkKuktPSN53KOqg8z4RNUyFFuqZqLq+F67no4KFx9ZVyBrcG 1TKOnwCminxvbpZcYCynzojie7pk8MDbSEehV301cGQ2ACzZe1NCXAkl7t29jfB4ej4NFpfzZt0Q m/pxebD9enSgAF30Pujk0H0wn+EBfFIA1S2H4O2AtDleK67ysKpG9VwTt72uunHtI+jp+nvjilpB IUVq/nSPGWIVJGskI73yA87bOY8w3B0yZgKR+z1zm9gfjaxkGS16l7izlkwEVgvy+Zi85CrFTSvd gxmhLfBTRePKsT4Z2Tg5GsGIpjPhrUmhhdS7/w== `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block hHpg1z3vk95yVRWn+VQ7GJbGeLymjmiecnC+jHvPsoOD1r9kDJ6ti2wQjEzQerMovibQSB281zS1 2tPIww+WhyE1Ci2B0qCQaErPpmraZvKeMVIm9WiMMwGwGuBBKHXxwQWbDMi81MDsN3wRem9ZMgCG 3V4EJhsWMkn5bcMzTYU= `protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block VFFip6IhD66Uj9IlBpJ6wGRSNaXMp7bS6Kf0ql04NCh4SdTNxzv8MH7PJVYaDZvQw+I41wrEjdOa m05amIgidLBU1M8BcSwneqrVxO1GskHyvqutAR9vQ3OhHdpkGZyE5uEehBCqb7f8URHTmFhakwpU 3npeF/TtF4labILRAz2CAZmR2h41qszCc6dCYwgc9SB5sCup0RtMWXKgImxXn4xXvU20rKGUJe0g TTbaDlRoMZxPhL88BvhY+cie1u/iZhse+k3Je/4s8cgzFqvMwnTg6ihczrJsgN+qEg1smYlqE6RJ TBa5frOG6C5qt2DMP3p2tpO+d5CTBRbcMSRCWg== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 6592) `protect data_block TVKwsuoeR8RChLqmNMeAGFMulK/EmzLts9Hcw1qLETsA19ewxL9uG4WK/3YWjdRfR8EU/W368cvh KFeNqLDgnwKEhEUPNwdgUX5JkMl04Zzqt2RHOy0vImQsl4djtFxmmE/Sk36jWuwMhjaZ1Bd9YTAS lNZgery0tshp2EOo2zK2o0kBu9kfXZAT+FoHHZCGsOS3ptlKG44kANvTRBCxjt0EAi82YBxYfsm1 8AcV+lmoCDxmOQP0ByIUINpMG+55L5kbzi4IgNGEjxJgtLb1teJgnmJ0HuhjUyOLe/V3njWwSNAC qUeE8nnvdZ2Ga+L3VT0JWCy+OPp3bbzCCsHRD6Bcb53y30xkfi88sge6kdUzmzqCulTCaGMPMUFR SWpebjs1U0gfhjd/b4YBmiEP9Rzw1lTKiSPGhq5Rc9rkhfGX6JjgJwQW0WD5CZOn6di4pAqiUHXa 8sv9GvZr5rej6PVmLyZZVjONmmfa/B0nNHqMbnLkyGtXRgxE0vDW+lnkO7TKcN7k2sdrHNYepev+ /lyOS7IHb+q6DhJnjr3NRFbyL7gbNTQY3dQ0czz4anHfA6b4cYNdfXjd0WAols7rO4ZUNoJOd2EJ CmF46wr1ZZGHdEdY/4YQDfGFJ+P/nzhgQTBN8ojiLoXNhDU4qmw6gFLLEQV3WtKlcIlN0UhXjhdk YjVpXFRLt0aGa6EuRO6KDUgDdubnw1Qh/GKZi/chtldR6boNy9xkdHgG0FRlg4DkHM1uMctjQ9QS R6rkNpQf/sdQaGOSncBiooWxkUY3HIlN2L98JWvQTSpYyZmia2xbPPuaEXS+M3TajJ/n89y3clNE 28fkY4AmI5l0l96r/zYC+t6Rde0U6Ea/1RUndaSl6MZ9IuSvVMZbp82yEyNbd7+e0vJKZ9L3ED2k FwZhn5gdP6yB6CPMN0wz47cPqo82ChcdkisE77bW9WSTmEU3m/jhmGjM/b9Rbj1dvEScqQ7r3NfM Sb2xXbfOn/Rf/aBzwY/KTShKtdtttN4hVIT5cjT9FS2hRgz7PQmgDaDoPdljir+bE5TW2em+fpgN Aeq13dqaM1zkmXxmxVLv0vMQAVDJpbdl/NhAH89HXdSMBCHKmi5sllUWUaqTDHWDYBZ+LGO5Ryui Icsip+Sv4jmBw5LW4uonrxaGsM7ndwrYNT3AHpM1bWawyXCNRbTj0/tceQ7OIBj8fmwqL3Wat+jb /KECowFq21SrETSDGXq98FQppPsn+wm7aaqWsQHbClaf5gQdLab4c9g/OBx5YYA3ulZTSaH28WNG fdjlotGF4R9EH+e49n5hJbPO/TfnF65hdh1gxO9FMP4al1xuPF8H6hZWenJQ91d0UsRsK0mZsEZS Vvn0AifIW8+hef2q/NecUYXmANfEUrjm5X50VPpFg21X/iINmQ8UBIkOgVfzIdsezao3D6a48pgS QLzz+MrruK95uAa415ZYd0xRaGZgpWujamsO1RXTmh3flUChmYTOKmntqsnCGVAd6Xtf2Xb0LYzF UUU+0If/HBWvrXAnD+Zt95uz0yyIa+EG80EIeAekmA2rXSQWizSfuwxOBca5+aCVdgj3lpIWFjj2 4REW6AHY2Vodui37lAlqQJjHF9rYyDWxwRC2RuIOAMbU5zmWPW6TFyJxlTKUvYlB0l4eUSVLkZH+ oNPpGbmje34k6M43RRcfsUN4lZL/ZfbvyEAS0Wk+SPDebRgYnPWvb64n1e9chJCSHhx/7TgqG0S1 8u9tFdea5D0rfoGwOJkFI+4R4BKYQLVLoIp4fb4HZhnAVkkM9DsAr2nDnooBmoZFFhYPeJHTdrxD OVJF+cGB82SH1VbHrAr+vlN4j4QHW5zs7VH+N39kXps225ewHXWdgUUWmFUWYpGHIDBuIMIT408z MJjeaIhktA6azPKWmR6ODcDceC+lWOsUpnbhnKYp400bldRROJDJgJZVQbz8JKr0XSWJbzLFUG1U 1KEAvKmr5g1VD8pvYOvTj6ryr4M2gXao6rfcDDDlQjzCZYREH5ReuTLOOwVSyl8D0NSVkM8Eqq3N oPQwTyrML6BBGLw/FGUJjfINup3gmbMt+UyRHKPwY1sEQze1oLz4GtOTOireab0QeW5bfcUkz0TG B7syK30wDnlK91AWyQm5TXDxNZmTINVI43qzzMxa5gTqMqQ2/x7cv+wr0iRdmyQjTR82GnBUv0Yx GaluKqXZsoSa4UP+EW1tjO2GxvPkuOctg9b8wnGzURAcCCpJxQF7B1ztHZjrRlkCrZqe9DjJ6O5/ o8OwnTCz0iSAZsfqspnf4pKxFv/rozPfx1mgVFr7jtwb5oOB1cdXnnZcpJ4LkSa+9hT8H7cJUI4L 8a3thEzllgnStCgQQfZSqiWBoVu1ge063quTBuaJ4IYGHoDIiXM/DDngDLjP26hMRQVVNIzIVU0c 3GlWTFUVqPEtbD3LXPSxyrR5MAnhWzbhT/2bj2c0NL3xSpP0Vw5dXFIYMkCanDC1UunlT71LI1xc gmnxiSlIcx5SaZeabPvsaqYJCpVWxFN2CCbFwutHuiZu+aZSR/7HZJkBZNBSVNUc8LvCGplAuXI9 Dd/J4xyum0dZ1N/WzeX2nVNZUnWRY5c+WHj07Ldgmbb1Fj0sxlP5IonR5zl2MgsBFCH3d90kI1lL exlDWKWBskWrdCB9RM/WpwfvXhMVOEE0hCtTFtd5xcYbmJuFgc+NVB2jpdhKD2YBTuJvonQWr5MW cLE8S8vUE6Tb+xNJtYpOE5OpnIPH27VGiARPa8n9C7lynyQxc6/ND+yG/lh6XBiW2b6oSfkFMYsc UOgQRMzyZV2rkCRQ+Z8r4AHDHlC90YmAhZdnsfW33PQbYdJX3MTbXQFwCNh70E1645M+6YFrMziI 4d8iSx8mN/9oC7cSJ/I85PBUoHvdusVw9MeDNeML2NoIoPjPNo/mJRmSc9P2YYU8JRDGpWVH3AIE YnjYirmUhoD/YDGKMprAk/VmDhvLFXbGa7O8eCs37Bk8s/64oATSfVndgzSuHHmwy8y/TgkaEGSM HrhFw+lu2i3ce5/D3uglzslKtHGn6JhOCsFplPLVQ0IJapoUQ7ra6wiYQKceEwX3VbXEmNTJcTEB cduO560133BoB2j0RcoqtQojoX2CTKignzCFq31gzA4qhx0R5qb0UE8330dvyW3y9r5f/YaUnXz+ fbyed1FN87AYlq6awKPNOYy3uhhCx6h1QKWvxyhLB+oJsN8YqhH9M+rmGI/+pJYz6MzSnR/pT6cG Wnwi28cjwJ+xMZ8bRdKjHYOEo8O8zu0o9lJlB6XaOgPifSmWjlfbJzbH88fmK4gNjOfwsQhy17YZ xHJsXTLAqNPgKA5Xy8vtSaoe9Xhphafy5F+iXlhErrNPpw66lDcLDYtdy3DaqZvZUrc/McghCmWU i6gnXF0BYZZzpR3wygUIZ0xsBATCXLvXU6wwcqPLenYP7N90jIxnUlVGajPSRwUVQa+hWjw0p2b/ xycKVKZ65JVXEyVfj8KYhEzg14hOU0Zvl6PHHkKjRjAv8Rf5klYOoeH1sgR3BCM1H24N3sm+NPqP gmnwbZEJR0E54w9Bv0grZdXXFhP9gLlwKFVQGT2cKLX89pfI5YRs/CNrYcCLBJVZA+Zgh+HMh84U sZZhdMNuQbYUv/xY+QtiWn1fFGUkPmTshYIZqIShlwTRV1gaAtknts1rkBA+UzLSFLlynBxuQqrd z7Nh0zmG3NlEhC+QDF49PdTHlbxA8XgvCcJ85BxZfxDBeWhRyUtXQjobn3kk+WC5hgYFyZy+xX36 bRRzMe58WjRCj08E4PRP39qhpfBUoJ1BqDRMMXIxsMFrlLosvGoA6fVhFAM7GC0Bxc4F0JmGMHWq st/cV/boIjEXOAUdfUyfNzbheCFWivO2K2JPxH+r7UWHw4Gq8GhhbG58dbTpTgdGZckhdwjVfQHf 3lRsnz8w4Ud3bpF9oEPDoiyWqFP9aVHITGzUrapMpro0gZq+fUoHFgG57PpU4+/82qPU6VX384Oi WZbAM/yk3A6M5kxIPMdm96c1JtrfNmeTVmqgNRKyHi+ZYK4yYT45Wjer1zO1jrjQ6/bqnX61qoxA m1WG/Bglmg7KHWjwv+80iOoSdUzw7+1gyUUtLpH7T2u4kh1ymJcPCRqiDrh0TSprniZo9do9o1sD AfbI69GMH+zghmHnP3WcSq4ngYgwijXi+DuZM7JHCGP3WxRulTEiDkVrP2sRbflGdk5REV9jeJ9/ yGDbRi1qvOi9urpP9BcMFd81ibbzz6rr8dg33iFC8C1xbyozvN2fjXGVbEL8WuF3y/T32eRK3JaW 0jY+67Su5jntfzs2/jX81DCFfJcPcPdVN0AHixeZ9cEWDQOMPZtcs8PyUkzb2TbM2eOzJFJe8XPY zyRJfV1nr7AKVJzyldwADFdo62JvDLAWIKx38gO8vTh+ecEiGCUrvK3rBpV4URXRWpvc7s78WGxa 9kkTSielpexXAPNFCueTV3n7zBUB2P9uzQpjuGTHlQUFZrCANnQcvLDoIlO+G/en8MA8Cy/ixGHJ KLe/UNr+ZPRB8X2+CsWpdotL6yn0KdA49MKRSndoB03/lv3ERLdoEdYVkVlb77hJ6CtiudQxky4N HVx3oI4/Q3sQbo+HSr4K8fSv9YIDHofL4KTVqaKMBfMkEC6Hs4N0mmULatAjX93RK+evIxzf+lHS by8YBTVL9NNOiY2iXm2FheVqzR9avVXEU0n7vVMpuo75pAV+xccnne8WUsotd3ehZdFn5Z88lSaB wvmapwBNZRK+GdBgAJ4ihUDKizH1V0g7wmTwFknfZxnM7c8yG5I9b9+ZdL44YQAeuHZiz14IS8Ce UggluthctB/bnPsQOoS0k7K+YW89jO8grpkcRp/gEH5j3dPWpHObq7cr1cvlsnsjI+CzHXo1C1Hx 1/9f4i8PslkXir2aracOhT0YppN5ohJR0C9BufIlGvMacVoPIJUO9WM9T0fguBqAQh1cwDjULv84 SLsBThidLOrA9iR/0q7OGLaVQCFr7aqb49YHIImeBf4To2EcDaCZWqxZDeEmMDUBQJn2HtWAds/8 V+bdeK/Dhic4O8Ul5w+S7yXo1y+M4hF5P1GGKaLrUW0YbRTaP2/pt6Q18XWn3ok2mSuN9Zd6p6lh u0mduv7uuuK1VZQsm4WQhWVE3phIRLMgB7BXO2PwZiuVY4kxXCaIaIwJvmPkXryoOJJ79qstfFVF JUR0Bowq4CByjeid9YmZOImkZzndOUaul4WeLy8o4Z+AsdrRwr9yJuJEqfdWXNuXvlrrNZYDOV9n Xo/+TA3zsse6qfUHU0piuLnxLkRO4VaSzcaoYb+jF02nVVpWYs84iGXVtolvC7TkWxY1aj4v5dNX fUpupJenh0GoFAUpp69ioPjWJidhLsuMMNMEqWE6/t54a2uCdvJOQQWRkbrcaREntNxHVwz85Qzw KXBlRCjOJ297v0j7Ym7NPcsLYaTnd+6eC8br8LkVFtHR5eKRrWjArCa9bJAip/giRlG1hF3UBI9+ c27Gwe/g++YCXlF64C7D9rud3ayvmq/9w3xWYMgpuvgkvrWmBiF0arLE79a37wttqnZYzRcvEpuf jeReOX54duivpiqsjw4cuJQa7YOxJgLtW3ZyypOgiWEXLkw8Do5FSrRsFQH42aVsWysj4akOpvua 1ZRaN2wy6/3dl5cWpqZJUd0O9MS9C+jNnTMBxqGlzR74rGcwmRhei8Am5VIFI5CcMG2CvT7cAHdQ 4iBfxBVL5QzxxImLQB+zHh+TBgya4/I7iNRje8JDLLkv2ZVfbAjr0fQ4KHx/s0JkLhalg/p/++s2 NcsAxbxiTA+kyYe8mWGCq13pSG5ldwvbNdm3EoqbsZlzW09/EDXW0A7E2jMQGHJc8sv8cRXMYHgB jx2fpEIwiV/EXfUpwWgY4CyHx2kSFP9Rbo9KCH583vSblKGP56wI0jYXzDL8bWH3y6NbifITfXrp sPJ6mUO9AzdEElGEpYczCupoGvOP+g8HnN5HO6jL4Y362Jz2nEjxdpfCJey7q75pwxRlvl06XGFS NfAw1X8hwPQnS/1AlWvjN8aGyD3fG7Kg4Ok4EGRrtCkPfuh3DJPjooD7d96VUkK4hWlI9SAHdvcU bPF2q12/mdRZDdPjvXvEshmwTzVAk/ODXptwuf7zbVU5dXK/GRQ/PhpjvyTzklAac/9vHa4x5sb2 y9SBOwGrsip7lw9bWofMIpzGkHtbWoKf4NTnqjafKwrR+0cnfvf5lwaYBH0ZzHSH+68NOMo/c8iB Xc4TadD5jbSwU7XfzzW1oT0qTcrCrgh/ggRNt2iYnZ4jbBTUYFgvMvIQegLe3agMyGUirAJUACdf rGuEQHpx+0+UKvpoERs93fmKx9RigXSu8UXaCAoURIwlQmLFAGG2vdazOvgKRu64OhE0MmTDejcR 9TLavVAlEpDmyl1LjvFDVxTT91lrD6OC1jhXJtnsI5sF1bLriBc7zEQqIHc3MNICrCWH9rULMQue /ZEFIUqA6CSUNDXx/JtibtmN+I6GJs4oN2THnGwC8kA3DUL9RxyHO1Bjdw2/CRla1fHRJHg5M6BN 6Et0LcCKhxaG6fLWKjlIjmYOzzg7K6fUDVTc/D7HACNnU9/1eGnmymyLbrdKYL2ajHHOk8dAIB5M kcsy67b1hDOKdzEw+kX4vRHI9d1ZghgQc4JEJTI+lrYlMm4xSx/OST2v5qTV8iPaxn5IlFq0gQGj kZT9ydnlbJhHVWrbpPgiCLmpCn67J+F+/6NHi8WE52XR+oxyeVTSBKNbAaqmGmBapkplBCkTS7nh ufed5HONoMaLjTQWS66dmgHP2ujh0OA/3p3wqPrn5rqjnGnsJEjVMfKGymNTgKCNyvHAp72cAGnJ cQO/CXTAl9nyGXlk06ci18s/GkXFp9ACClTe262MA7srQq5hOe+Oj5DBZ6oeF/rjNKCmJ4PxBMaG mnyS02lQdK5bwbN//BM3BiHnByDiK2lsItTKneQWT5BzKYhYrY/9AHmIyq2GOVimXXeXor+cQoe7 MymfmkYBT6P+aUudiO8B6guh2x3lxi681tbaMoqwoMcBYn61sGP9fHzwSPXlMsfME40QA3sbv2U0 ofQ+Jde0JM+CH2JcBFlIEnFe5M304b41nlMOnmH7ZY4EDRl0TXGSTjA1ro9lgfHQK3MlIdaE88Vw 16uSWQAUbryG3WXZthsaCgagDnQ2PSpBsck1CrAqS9+CqM0aCxq/IXmQ/GrLsuz+STfAeMmkr9m9 5kTRzt3qy0kM049I3Z4jQBXJ0g8OK4RwBijTERbR3H+yY3LaGTLTbsm1vJwV/cCYoR0mOi7cRTr+ zh41iymA2hRy+Zs6z46zXNYyrCoY0ox2ah8dgUuoW2WX4B3zSrD3Fze5slPYfpkNf9yPzeOzBonJ M+WjgeaoWTxqKtHxhOAMAOlkoePAVbNqN3K4vJleaMFNe+esbXF72PoEQEXx0/3AqGu+3oxYxgPB YgQ37kgSo6J2eyLbJdC8O5nnQmuPuxF2RZHZ7WudohIIV2qJzy2p5I/qYm4bg3XkH2Ouhy8e080q ixE9NfpYhWeHnH1E6vyvaMiy3UblJLer38wCYqfjfggzqI4cCU6RaTMmpivnc2Rj1g3JerOzTXSd m91BWBOC1cDdZV6YaJzCVWiuHQOp5DBwKp5IzYK87Wi2MGs4T0YX4Ik31BvqioKyPGBqIC9aTu4h 8xNL4heWJybkjLYCUKjBwt8EYL3ko/u5fPshbHpjxMxe5Rnr8qtFbJGNHl5eCYtFUmv/8xtERuOX jIizVCRFloB1cKh8X6ZpAc3j7TjcJQ/8RlcqRrTgAEYS59fhgAf+ZUoM5vx58iHdmd+zXoJDU5IR 0Gr9BPtMycPTeu4C1UGqgRPO9KM1RSE5mPuycJjfI8xrpZ3QXihCj+KCS6wsE9mFcMcsL0qs7Cm2 +7nM5H5tcg5uy4heEE4wTE5sK9vxnl5SN1O6tsZB7sIp7WMwCTb6/KvNQN/oSE/waMg/cyYIXBFv yuuDF4tVAa0er9aviacCDvOq+ltJwfjkmL6CvVcQgnx1jgRc1j83ilV7UM1w46F+Dj69GHhMjK7i FHwGzhNHRc9iRkcCEmZ5IAmbtiRI6cMVPhoj8O086P+DOIQFaK9wkZ2l20kHsUjBtLaKNoppRGNP cZloIUjwLZqjRtviOxXSO07KEOZrVYuqQr3be6sObCpC/y7wBUjI3sDYJsQpQCue5Oi4befLLXrT ApOBfhxv3QUvLazFTLyJt3RG7WAy3l8s/++n7kIooJqBDCbFbVzAu+oGPY9RdmvZmGeEFGR1s6Ad L3ObFdSVvKQuJnuGD1M3TwEFQzocAT/R/AJcNXH54wESyumV8FEWhcDCXUoWEoKY17VUQu6DNCM2 iw1xYk7PJ7jB17JuTMAZu6QXLFNrxJVWqaxprpDvKaMIfxiqYeJXg1qcSiYEhuL8KD0xiTttoH/4 R8Pgo9R7iAf/dCzfTlrtORuXWx7bBttQHTBy8lCvVUFAn+bfQulLgz3w34K9LkpBw+1ltYXE8sYM vlx7GxNyaD5goRPgFOh6zdoluJ4vOlBTMJoSq9aIR3lNy9Jdt5ucX0DmLVUpJY4oXiqVUV6j/RYA tnzsNFaoz2mjFC+4DjDnDK6TaRQXniFPRTeACC7kA+bAFK8CVoShWNs04kkTxSA9OUb2oTWWOo6o YeevH5sxINy33UMIADk4jS5PbZJNx6SqPcMKPQCqofkgP8Z1Wg== `protect end_protected
architecture RTL of FIFO is begin FOR_LABEL : for i in 0 to 7 generate end generate FOR_LABEL; IF_LABEL : if a = '1' generate end generate IF_LABEL; CASE_LABEL : case data generate end generate CASE_LABEL; -- Violations below FOR_LABEL : for i in 0 to 7 generate end generate FOR_LABEL; IF_LABEL : if a = '1' generate end generate IF_LABEL; CASE_LABEL : case data generate end generate CASE_LABEL; end;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_arith.all;
LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.numeric_std.all; USE ieee.std_logic_unsigned.all; ENTITY GreenDroidDIVUCore IS PORT ( i00 : IN std_logic_vector(31 DOWNTO 0); i01 : IN std_logic_vector(31 DOWNTO 0); i02 : IN std_logic_vector(31 DOWNTO 0); r00 : OUT std_logic_vector(31 DOWNTO 0); r01 : OUT std_logic_vector(31 DOWNTO 0); r02 : OUT std_logic_vector(31 DOWNTO 0); FP : IN std_logic_vector(31 DOWNTO 0); FPout : OUT std_logic_vector(31 DOWNTO 0); M_ADDR : OUT std_logic_vector(31 DOWNTO 0); M_DATA : INOUT std_logic_vector(31 DOWNTO 0); M_RD : INOUT std_logic; M_WR : INOUT std_logic; M_RDY : IN std_logic; reset : IN std_logic; CLK : IN std_logic ); END ENTITY; ARCHITECTURE Behavioural OF GreenDroidDIVUCore IS TYPE States IS (ST_INIT,WS_INIT,ST_RESET,ST00,WS00,ST_END); SIGNAL Mstate : States; BEGIN -- CONTROL PROCESS -------- PROCESS(clk,reset) BEGIN IF reset='1' THEN Mstate <= ST_RESET; ELSIF(rising_edge(clk)) THEN CASE Mstate IS WHEN ST_RESET => Mstate <= ST_INIT; WHEN ST_INIT => IF M_RDY='1' THEN Mstate <= ST00; ELSE Mstate <= WS_INIT; END IF; WHEN WS_INIT => IF M_RDY='1' THEN Mstate <= ST00; END IF; WHEN ST00 | WS00| ST_END => WHEN OTHERS => END CASE; END IF; END PROCESS; -- EXECUTE PROCESS -------- PROCESS(clk,reset) VARIABLE T,s0,s1,s2,s3,s4,s5,s6,s7,fpi :std_logic_vector(31 DOWNTO 0); BEGIN IF(reset='1') THEN -- reset any internal states -- s0 := (OTHERS=>'0'); s1 := (OTHERS=>'0'); s2 := (OTHERS=>'0'); s3 := (OTHERS=>'0'); s4 := (OTHERS=>'0'); s5 := (OTHERS=>'0'); s6 := (OTHERS=>'0'); s7 := (OTHERS=>'0'); fpi:=(OTHERS=>'0'); M_ADDR <= (OTHERS=>'Z'); M_DATA <= (OTHERS=>'Z'); M_RD <= 'Z'; M_WR <= 'Z'; ELSIF(rising_edge(clk)) THEN M_DATA <="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; CASE Mstate IS WHEN ST_INIT => -- connect 3 input params here -- s0 := i00; s1 := i01; s2 := i02; fpi := FP; --copy1 ; s7 := s6; s6 := s5; s5 := s4; s4 := s3; s3 := s2; s2 := s1; s1 := s0; --lit ; s7 := s6; s6 := s5; s5 := s4; s4 := s3; s3 := s2; s2 := s1; s1 := s0; s0:= "11111111111111111111111111111111"; --tos-- ; s0:=s0-"0000000000000000000000000000001" ; --rsd2 ; T:=s0 ; s0:=s1 ; s1:=T ; --rsu3 ; T:=s0 ; s0:=s1 ; s1:=s2 ; s2:=T ; -- bzp ### ignored ### ; -- recover 3 results here -- r00 <= s0; r01 <= s1; r02 <= s2; FPout <= fpi; WHEN OTHERS => END CASE; END IF; END PROCESS; END ARCHITECTURE;
-- Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. -- -------------------------------------------------------------------------------- -- Tool Version: Vivado v.2016.4 (win64) Build 1756540 Mon Jan 23 19:11:23 MST 2017 -- Date : Wed May 03 18:20:15 2017 -- Host : LAPTOP-IQ9G3D1I running 64-bit major release (build 9200) -- Command : write_vhdl -force -mode synth_stub -- C:/Users/andrewandre/Documents/GitHub/kernel-on-chip/hdl/projects/Nexys4/bd/ip/bd_clk_wiz_0_0/bd_clk_wiz_0_0_stub.vhdl -- Design : bd_clk_wiz_0_0 -- Purpose : Stub declaration of top-level module interface -- Device : xc7a100tcsg324-1 -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity bd_clk_wiz_0_0 is Port ( clk_ref_i : out STD_LOGIC; aclk : out STD_LOGIC; sys_clk_i : out STD_LOGIC; resetn : in STD_LOGIC; clk_in1 : in STD_LOGIC ); end bd_clk_wiz_0_0; architecture stub of bd_clk_wiz_0_0 is attribute syn_black_box : boolean; attribute black_box_pad_pin : string; attribute syn_black_box of stub : architecture is true; attribute black_box_pad_pin of stub : architecture is "clk_ref_i,aclk,sys_clk_i,resetn,clk_in1"; begin end;
--------------------------------------------------------------------- -- TITLE: Program Counter Next -- AUTHOR: Steve Rhoads ([email protected]) -- DATE CREATED: 2/8/01 -- FILENAME: pc_next.vhd -- PROJECT: Plasma CPU core -- COPYRIGHT: Software placed into the public domain by the author. -- Software 'as is' without warranty. Author liable for nothing. -- DESCRIPTION: -- Implements the Program Counter logic. --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use work.mlite_pack.all; entity pc_next is port(clk : in std_logic; reset_in : in std_logic; pc_new : in std_logic_vector(31 downto 2); take_branch : in std_logic; pause_in : in std_logic; opcode25_0 : in std_logic_vector(25 downto 0); pc_source : in pc_source_type; pc_future : out std_logic_vector(31 downto 2); pc_future_test : out std_logic_vector(31 downto 2); pc_current : out std_logic_vector(31 downto 2); pc_plus4 : out std_logic_vector(31 downto 2)); end; --pc_next architecture logic of pc_next is signal pc_reg : std_logic_vector(31 downto 2); begin pc_select: process(clk, reset_in, pc_new, take_branch, pause_in, opcode25_0, pc_source, pc_reg) variable pc_inc : std_logic_vector(31 downto 2); variable pc_next : std_logic_vector(31 downto 2); begin pc_inc := bv_increment(pc_reg); --pc_reg+1 case pc_source is when FROM_INC4 => pc_next := pc_inc; when FROM_OPCODE25_0 => pc_next := pc_reg(31 downto 28) & opcode25_0; when FROM_BRANCH | FROM_LBRANCH => if take_branch = '1' then pc_next := pc_new; else pc_next := pc_inc; end if; when others => pc_next := pc_inc; end case; if pause_in = '1' then pc_next := pc_reg; end if; if reset_in = '1' then pc_reg <= ZERO(31 downto 2); pc_next := pc_reg; elsif rising_edge(clk) then pc_reg <= pc_next; end if; pc_future <= pc_next; pc_future_test <= pc_next; pc_current <= pc_reg; pc_plus4 <= pc_inc; end process; end; --logic
--------------------------------------------------------------------- -- TITLE: Program Counter Next -- AUTHOR: Steve Rhoads ([email protected]) -- DATE CREATED: 2/8/01 -- FILENAME: pc_next.vhd -- PROJECT: Plasma CPU core -- COPYRIGHT: Software placed into the public domain by the author. -- Software 'as is' without warranty. Author liable for nothing. -- DESCRIPTION: -- Implements the Program Counter logic. --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use work.mlite_pack.all; entity pc_next is port(clk : in std_logic; reset_in : in std_logic; pc_new : in std_logic_vector(31 downto 2); take_branch : in std_logic; pause_in : in std_logic; opcode25_0 : in std_logic_vector(25 downto 0); pc_source : in pc_source_type; pc_future : out std_logic_vector(31 downto 2); pc_future_test : out std_logic_vector(31 downto 2); pc_current : out std_logic_vector(31 downto 2); pc_plus4 : out std_logic_vector(31 downto 2)); end; --pc_next architecture logic of pc_next is signal pc_reg : std_logic_vector(31 downto 2); begin pc_select: process(clk, reset_in, pc_new, take_branch, pause_in, opcode25_0, pc_source, pc_reg) variable pc_inc : std_logic_vector(31 downto 2); variable pc_next : std_logic_vector(31 downto 2); begin pc_inc := bv_increment(pc_reg); --pc_reg+1 case pc_source is when FROM_INC4 => pc_next := pc_inc; when FROM_OPCODE25_0 => pc_next := pc_reg(31 downto 28) & opcode25_0; when FROM_BRANCH | FROM_LBRANCH => if take_branch = '1' then pc_next := pc_new; else pc_next := pc_inc; end if; when others => pc_next := pc_inc; end case; if pause_in = '1' then pc_next := pc_reg; end if; if reset_in = '1' then pc_reg <= ZERO(31 downto 2); pc_next := pc_reg; elsif rising_edge(clk) then pc_reg <= pc_next; end if; pc_future <= pc_next; pc_future_test <= pc_next; pc_current <= pc_reg; pc_plus4 <= pc_inc; end process; end; --logic
--cpu_4004.vhd --- -- --Filename: cpu_4004.vhd --Description: --Author: Oddbjørn Norstrand <[email protected] --Maintainer: Oddbjørn Norstrand <[email protected]> --Created: Sat Dec 15 21:38:10 2012 (+0100) --Version: 0.1 --Last-Updated: Mon Dec 31 16:24:20 2012 (+0100) -- By: oddbjorn -- Update #: 132 --URL: --Keywords: --Compatibility: -- -- --Commentary: -- -- -- -- --Change Log: -- -- -- --This program is free software; you can redistribute it and/or --modify it under the terms of the GNU General Public License as --published by the Free Software Foundation; either version 3, 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; see the file COPYING. If not, write to --the Free Software Foundation, Inc., 51 Franklin Street, Fifth --Floor, Boston, MA 02110-1301, USA. -- -- --Code: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.sim_pkg.all; use work.cpu_4004_pkg.all; entity cpu_4004 is generic ( READ_LATENCY : natural := 2); port ( clk : in std_logic; reset_n : in std_logic; cpu_input : in cpu_4004_input_type; cpu_output : out cpu_4004_output_type); end entity cpu_4004; architecture twoproc of cpu_4004 is type state_type is (halted, fetch_addr, fetch_read, decode, decode_two, ex_halt, ex_inc_r0, ex_dec_r0, ex_inc_r1, ex_dec_r1, ex_add_r0_r1, ex_sub_r0_r1, ex_print_r0, ex_jp_if_r0_nz, ex_jp_if_r0_z, ex_load_r0, ex_load_r1, ex_store_r0, ex_store_r1, ex_swap_r0_addr_0, ex_swap_r0_addr_1, ex_swap_r1_addr_0, ex_swap_r1_addr_1, paused); type reg_type is record cpu_input : cpu_4004_input_type; cpu_output : cpu_4004_output_type; state : state_type; cnt : byte; second_ins_byte : boolean; data_not_ins : boolean; data : byte; addr : byte; end record reg_type; signal r, rin : reg_type; begin -- architecture twoproc -- purpose: Main logic -- type : combinational p_comb : process (cpu_input, r) is variable v : reg_type; begin -- process p_comb v := r; --Read inputs v.cpu_input := cpu_input; --Default values v.cpu_output.beep := '0'; v.cpu_output.digit_latch := '0'; v.cpu_output.led_fetch := '0'; v.cpu_output.led_dec := '0'; v.cpu_output.led_exec := '0'; v.cpu_output.mem_wr := '0'; v.cpu_output.mem_rd := '0'; v.cpu_output.halted := '0'; v.cpu_output.running := '1'; v.cpu_output.paused := '0'; --The CPU state machine case r.state is when halted => --Wait for the CPU to be started v.cpu_output.halted := '1'; v.cpu_output.running := '0'; v.cpu_output.paused := '0'; v.second_ins_byte := false; v.data_not_ins := false; v.addr := 0; v.data := 0; v.cpu_output.digit_value := 0; v.cpu_output.mem_wdata := 0; v.cpu_output.mem_addr := 0; if r.cpu_input.run = '1' then v.state := fetch_addr; v.cpu_output.reg_ip := 0; v.cpu_output.reg_is := 0; v.cpu_output.reg_r0 := 0; v.cpu_output.reg_r1 := 0; end if; when fetch_addr => --Address the instruction pointed to by the instruction pointer v.cpu_output.led_fetch := '1'; v.cpu_output.mem_rd := '1'; if r.data_not_ins then v.cpu_output.mem_addr := r.addr; else v.cpu_output.mem_addr := r.cpu_output.reg_ip; v.cpu_output.reg_ip := (r.cpu_output.reg_ip + 1) mod byte_values; end if; v.state := fetch_read; v.cnt := READ_LATENCY; when fetch_read => --Wait for data and read the instruction addressed in fetch_addr v.cpu_output.led_fetch := '1'; if r.cnt = 0 then if r.data_not_ins then v.data_not_ins := false; v.data := r.cpu_input.mem_rdata; if r.cpu_output.reg_is = SWAP_R0_ADDR then v.state := ex_swap_r0_addr_1; elsif r.cpu_output.reg_is = SWAP_R1_ADDR then v.state := ex_swap_r1_addr_1; else v.state := halted; end if; elsif r.second_ins_byte then v.second_ins_byte := false; v.data := r.cpu_input.mem_rdata; v.state := decode_two; else v.cpu_output.reg_is := r.cpu_input.mem_rdata; v.state := decode; end if; else v.cnt := r.cnt - 1; end if; when decode => --Decode the fetched instruction v.cpu_output.led_dec := '1'; case r.cpu_output.reg_is is when HALT => v.state := ex_halt; when INC_R0 => v.state := ex_inc_r0; when DEC_R0 => v.state := ex_dec_r0; when INC_R1 => v.state := ex_inc_r1; when DEC_R1 => v.state := ex_dec_r1; when ADD_R0_R1 => v.state := ex_add_r0_r1; when SUB_R0_R1 => v.state := ex_sub_r0_r1; when PRINT_R0 => v.state := ex_print_r0; when JP_IF_R0_NZ | JP_IF_R0_Z | LOAD_R0 | LOAD_R1 | STORE_R0 | STORE_R1 | SWAP_R0_ADDR | SWAP_R1_ADDR => --Fetch second byte for all two byte instructions v.second_ins_byte := true; v.state := fetch_addr; when others => v.state := ex_halt; end case; when decode_two => --Second decode stage for two byte instructions v.cpu_output.led_dec := '1'; case r.cpu_output.reg_is is when JP_IF_R0_NZ => v.state := ex_jp_if_r0_nz; when JP_IF_R0_Z => v.state := ex_jp_if_r0_z; when LOAD_R0 => v.state := ex_load_r0; when LOAD_R1 => v.state := ex_load_r1; when STORE_R0 => v.state := ex_store_r0; when STORE_R1 => v.state := ex_store_r1; when SWAP_R0_ADDR => v.state := ex_swap_r0_addr_0; when SWAP_R1_ADDR => v.state := ex_swap_r1_addr_0; when others => v.state := ex_halt; end case; when ex_halt => --Execute the halt instruction v.cpu_output.led_exec := '1'; v.state := halted; when ex_inc_r0 => --Increment the R0 register v.cpu_output.led_exec := '1'; v.cpu_output.reg_r0 := (r.cpu_output.reg_r0 + 1) mod byte_values; v.state := fetch_addr; when ex_dec_r0 => --Decrement the R0 register v.cpu_output.led_exec := '1'; v.cpu_output.reg_r0 := (r.cpu_output.reg_r0 - 1) mod byte_values; v.state := fetch_addr; when ex_inc_r1 => --Increment the R1 register v.cpu_output.led_exec := '1'; v.cpu_output.reg_r1 := (r.cpu_output.reg_r1 + 1) mod byte_values; v.state := fetch_addr; when ex_dec_r1 => --Decrement the R1 register v.cpu_output.led_exec := '1'; v.cpu_output.reg_r1 := (r.cpu_output.reg_r1 - 1) mod byte_values; v.state := fetch_addr; when ex_add_r0_r1 => --Add R0 and R1 and store the result in R0 v.cpu_output.led_exec := '1'; v.cpu_output.reg_r0 := (r.cpu_output.reg_r0 + r.cpu_output.reg_r1) mod byte_values; v.state := fetch_addr; when ex_sub_r0_r1 => --Subtract R1 from R0 and store the result in R0 v.cpu_output.led_exec := '1'; v.cpu_output.reg_r0 := (r.cpu_output.reg_r0 - r.cpu_output.reg_r1) mod byte_values; v.state := fetch_addr; when ex_print_r0 => --Printout the value of R0 v.cpu_output.led_exec := '1'; v.cpu_output.digit_value := r.cpu_output.reg_r0; v.cpu_output.digit_latch := '1'; v.state := fetch_addr; when ex_jp_if_r0_nz => --JUmp to address pointed to by data is R0 != 0 v.cpu_output.led_exec := '1'; if not (r.cpu_output.reg_r0 = 0) then v.cpu_output.reg_ip := r.data; end if; v.state := fetch_addr; when ex_jp_if_r0_z => --JUmp to address pointed to by data is R0 == 0 v.cpu_output.led_exec := '1'; if r.cpu_output.reg_r0 = 0 then v.cpu_output.reg_ip := r.data; end if; v.state := fetch_addr; when ex_load_r0 => --Load the fetched data into R0 v.cpu_output.led_exec := '1'; v.cpu_output.reg_r0 := r.data; v.state := fetch_addr; when ex_load_r1 => --Load the fetched data into R1 v.cpu_output.led_exec := '1'; v.cpu_output.reg_r1 := r.data; v.state := fetch_addr; when ex_store_r0 => --Store the content of R0 in memory v.cpu_output.led_exec := '1'; v.cpu_output.mem_wdata := r.cpu_output.reg_r0; v.cpu_output.mem_addr := r.data; v.cpu_output.mem_wr := '1'; v.state := fetch_addr; when ex_store_r1 => --Store the content of R0 in memory v.cpu_output.led_exec := '1'; v.cpu_output.mem_wdata := r.cpu_output.reg_r1; v.cpu_output.mem_addr := r.data; v.cpu_output.mem_wr := '1'; v.state := fetch_addr; when ex_swap_r0_addr_0 => --Swap the content of R0 with the contnet of a memory location --Part 0 read v.cpu_output.led_exec := '1'; v.data_not_ins := true; v.addr := r.data; v.state := fetch_addr; when ex_swap_r0_addr_1 => --Swap the content of R0 with the contnet of a memory location --Part 1 write v.cpu_output.reg_r0 := r.data; v.cpu_output.led_exec := '1'; v.cpu_output.mem_wdata := r.cpu_output.reg_r0; v.cpu_output.mem_addr := r.addr; v.cpu_output.mem_wr := '1'; v.state := fetch_addr; when ex_swap_r1_addr_0 => --Swap the content of R1 with the contnet of a memory location --Part 0 read v.cpu_output.led_exec := '1'; v.data_not_ins := true; v.addr := r.data; v.state := fetch_addr; when ex_swap_r1_addr_1 => --Swap the content of R1 with the contnet of a memory location --Part 1 write v.cpu_output.reg_r1 := r.data; v.cpu_output.led_exec := '1'; v.cpu_output.mem_wdata := r.cpu_output.reg_r1; v.cpu_output.mem_addr := r.addr; v.cpu_output.mem_wr := '1'; v.state := fetch_addr; when others => null; end case; --Drive outputs cpu_output <= r.cpu_output; --Drive register rin <= v; end process p_comb; -- purpose: Register -- type : sequential p_reg : process (clk, reset_n) is begin -- process p_reg if reset_n = '0' then r.cpu_output.halted <= '1'; r.cpu_output.running <= '0'; r.cpu_output.paused <= '0'; r.cpu_output.beep <= '0'; r.cpu_output.digit_latch <= '0'; r.cpu_output.led_fetch <= '0'; r.cpu_output.led_dec <= '0'; r.cpu_output.led_exec <= '0'; r.cpu_output.mem_wr <= '0'; r.cpu_output.mem_rd <= '0'; r.state <= halted; elsif rising_edge(clk) then r <= rin; end if; end process p_reg; end architecture twoproc; --cpu_4004.vhd ends here
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
-- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := CONFIG_KBD_ENABLE; constant CFG_VGA_ENABLE : integer := CONFIG_VGA_ENABLE; constant CFG_SVGA_ENABLE : integer := CONFIG_SVGA_ENABLE;
library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; library std; use work.ComFlow_pkg.all; entity eth_marvell_88e1111 is generic ( MASTER_ADDR_WIDTH : integer; IN0_NBWORDS : integer; IN1_NBWORDS : integer; IN2_NBWORDS : integer; IN3_NBWORDS : integer; OUT0_NBWORDS : integer; OUT1_NBWORDS : integer; CLK_PROC_FREQ : integer; IN0_SIZE : integer; IN1_SIZE : integer; IN2_SIZE : integer; IN3_SIZE : integer; OUT0_SIZE : integer; OUT1_SIZE : integer ); port ( clk_proc : in std_logic; clk_hal : out std_logic; reset_n : in std_logic; --------------------- external ports -------------------- gtx_clk : out std_logic; tx_en : out std_logic; tx_data : out std_logic_vector(3 downto 0); rx_clk : in std_logic; rx_dv : in std_logic; rx_data : in std_logic_vector(3 downto 0); phy_reset_l : out std_logic; phy_mdc : out std_logic; phy_mdio : inout std_logic; ------------------------ in0 flow ----------------------- in0_data : in std_logic_vector(IN0_SIZE-1 downto 0); in0_fv : in std_logic; in0_dv : in std_logic; ------------------------ in1 flow ----------------------- in1_data : in std_logic_vector(IN1_SIZE-1 downto 0); in1_fv : in std_logic; in1_dv : in std_logic; ------------------------ in2 flow ----------------------- in2_data : in std_logic_vector(IN2_SIZE-1 downto 0); in2_fv : in std_logic; in2_dv : in std_logic; ------------------------ in3 flow ----------------------- in3_data : in std_logic_vector(IN3_SIZE-1 downto 0); in3_fv : in std_logic; in3_dv : in std_logic; ------------------------ out0 flow ---------------------- out0_data : out std_logic_vector(OUT0_SIZE-1 downto 0); out0_fv : out std_logic; out0_dv : out std_logic; ------------------------ out1 flow ---------------------- out1_data : out std_logic_vector(OUT1_SIZE-1 downto 0); out1_fv : out std_logic; out1_dv : out std_logic; ---- ===== Masters ===== ------ bus_master ------ master_addr_o : out std_logic_vector(MASTER_ADDR_WIDTH-1 downto 0); master_wr_o : out std_logic; master_rd_o : out std_logic; master_datawr_o : out std_logic_vector(31 downto 0); master_datard_i : in std_logic_vector(31 downto 0); --======================= Slaves ======================== ------------------------- bus_sl ------------------------ addr_rel_i : in std_logic_vector(3 downto 0); wr_i : in std_logic; rd_i : in std_logic; datawr_i : in std_logic_vector(31 downto 0); datard_o : out std_logic_vector(31 downto 0) ); end eth_marvell_88e1111; architecture rtl of eth_marvell_88e1111 is constant DATA_HAL_SIZE : INTEGER := 8; constant CLK_HAL_FREQ : INTEGER := 125000000; component eth_marvell_88e1111_slave generic ( CLK_PROC_FREQ : integer ); port ( clk_proc : in std_logic; reset_n : in std_logic; ---------------- dynamic parameters ports --------------- status_enable : out std_logic; flow_in0_enable : out std_logic; flow_in1_enable : out std_logic; flow_in2_enable : out std_logic; flow_in3_enable : out std_logic; --======================= Slaves ======================== ------------------------- bus_sl ------------------------ addr_rel_i : in std_logic_vector(3 downto 0); wr_i : in std_logic; rd_i : in std_logic; datawr_i : in std_logic_vector(31 downto 0); datard_o : out std_logic_vector(31 downto 0) ); end component; component eth_marvell_88e1111_hal port ( clk_proc : in std_logic; clk_hal : out std_logic; reset_n : in std_logic; ---------------------- external ports -------------------- gtx_clk : out std_logic; tx_en : out std_logic; tx_data : out std_logic_vector(3 downto 0); rx_clk : in std_logic; rx_dv : in std_logic; rx_data : in std_logic_vector(3 downto 0); phy_reset_l : out std_logic; phy_mdc : out std_logic; phy_mdio : inout std_logic; ---------------------- hal com -------------------------- out_data_o : out std_logic_vector(7 downto 0); out_data_wr_o : out std_logic; out_data_full_i : in std_logic; out_data_end_o : out std_logic; in_data_i : in std_logic_vector(7 downto 0); in_data_rd_o : out std_logic; in_data_empty_i : in std_logic; in_data_rdy_i : in std_logic; in_data_size_packet : in std_logic_vector(15 downto 0) ); end component; signal clk_hal_s : std_logic; -- slave interface signal status_enable : std_logic; signal flow_in0_enable : std_logic; signal flow_in1_enable : std_logic; signal flow_in2_enable : std_logic; signal flow_in3_enable : std_logic; -- HAL OUT signal hal_out_data : std_logic_vector(DATA_HAL_SIZE-1 downto 0) := (others => '0'); signal hal_out_data_wr : std_logic := '0'; signal hal_out_data_full : std_logic := '0'; signal hal_out_data_end : std_logic := '0'; -- HAL IN signal hal_in_data : std_logic_vector(DATA_HAL_SIZE-1 downto 0) := (others => '0'); signal hal_in_empty : std_logic := '0'; signal hal_in_rd : std_logic := '0'; signal hal_in_rdy : std_logic := '0'; signal hal_in_size_packet : std_logic_vector(15 downto 0) := (others => '0'); begin eth_marvell_88e1111_slave_inst : eth_marvell_88e1111_slave generic map ( CLK_PROC_FREQ => CLK_PROC_FREQ ) port map ( clk_proc => clk_proc, reset_n => reset_n, status_enable => status_enable, flow_in0_enable => flow_in0_enable, flow_in1_enable => flow_in1_enable, flow_in2_enable => flow_in2_enable, flow_in3_enable => flow_in3_enable, addr_rel_i => addr_rel_i, wr_i => wr_i, rd_i => rd_i, datawr_i => datawr_i, datard_o => datard_o ); udp_hal_inst : eth_marvell_88e1111_hal port map ( clk_proc => clk_proc, clk_hal => clk_hal_s, reset_n => reset_n, --------------------------------------------------------------------------- -- RGMII Interface --------------------------------------------------------------------------- gtx_clk => gtx_clk, tx_en => tx_en, tx_data => tx_data, rx_clk => rx_clk, rx_dv => rx_dv, rx_data => rx_data, --phy phy_reset_l => phy_reset_l, phy_mdc => phy_mdc, phy_mdio => phy_mdio, -- generic interface out_data_o => hal_out_data, out_data_wr_o => hal_out_data_wr, out_data_full_i => hal_out_data_full, out_data_end_o => hal_out_data_end, in_data_i => hal_in_data, in_data_rd_o => hal_in_rd, in_data_empty_i => hal_in_empty, in_data_rdy_i => hal_in_rdy, in_data_size_packet => hal_in_size_packet ); -- com controler gp_com_inst : component gp_com generic map ( IN0_SIZE => IN0_SIZE, IN1_SIZE => IN1_SIZE, IN2_SIZE => IN2_SIZE, IN3_SIZE => IN3_SIZE, OUT0_SIZE => OUT0_SIZE, OUT1_SIZE => OUT1_SIZE, IN0_NBWORDS => IN0_NBWORDS, IN1_NBWORDS => IN1_NBWORDS, IN2_NBWORDS => IN2_NBWORDS, IN3_NBWORDS => IN3_NBWORDS, OUT0_NBWORDS => OUT0_NBWORDS, OUT1_NBWORDS => OUT1_NBWORDS, CLK_PROC_FREQ => CLK_PROC_FREQ, CLK_HAL_FREQ => CLK_HAL_FREQ, DATA_HAL_SIZE => DATA_HAL_SIZE, PACKET_HAL_SIZE => 733, MASTER_ADDR_WIDTH => MASTER_ADDR_WIDTH ) port map ( clk_proc => clk_proc, reset_n => reset_n, clk_hal => clk_hal_s, from_hal_data => hal_out_data, from_hal_wr => hal_out_data_wr, from_hal_full => hal_out_data_full, from_hal_pktend => hal_out_data_end, to_hal_data => hal_in_data, to_hal_rd => hal_in_rd, to_hal_empty => hal_in_empty, to_hal_rdy => hal_in_rdy, to_hal_size_packet => hal_in_size_packet, status_enable => status_enable, flow_in0_enable => flow_in0_enable, flow_in1_enable => flow_in1_enable, flow_in2_enable => flow_in2_enable, flow_in3_enable => flow_in3_enable, in0_data => in0_data, in0_fv => in0_fv, in0_dv => in0_dv, in1_data => in1_data, in1_fv => in1_fv, in1_dv => in1_dv, in2_data => in2_data, in2_fv => in2_fv, in2_dv => in2_dv, in3_data => in3_data, in3_fv => in3_fv, in3_dv => in3_dv, out0_data => out0_data, out0_fv => out0_fv, out0_dv => out0_dv, out1_data => out1_data, out1_fv => out1_fv, out1_dv => out1_dv, master_addr_o => master_addr_o, master_wr_o => master_wr_o, master_rd_o => master_rd_o, master_datawr_o => master_datawr_o, master_datard_i => master_datard_i ); clk_hal <= clk_hal_s; end rtl;
-- Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. -- -------------------------------------------------------------------------------- -- Tool Version: Vivado v.2016.4 (win64) Build 1733598 Wed Dec 14 22:35:39 MST 2016 -- Date : Wed May 31 20:12:37 2017 -- Host : GILAMONSTER running 64-bit major release (build 9200) -- Command : write_vhdl -force -mode synth_stub -- c:/ZyboIP/examples/dma_example/dma_example.srcs/sources_1/bd/system/ip/system_auto_pc_1/system_auto_pc_1_stub.vhdl -- Design : system_auto_pc_1 -- Purpose : Stub declaration of top-level module interface -- Device : xc7z020clg484-1 -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity system_auto_pc_1 is Port ( aclk : in STD_LOGIC; aresetn : in STD_LOGIC; s_axi_awid : in STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_awaddr : in STD_LOGIC_VECTOR ( 31 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_VECTOR ( 0 to 0 ); s_axi_awcache : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_awprot : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_awregion : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_awqos : 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 ( 63 downto 0 ); s_axi_wstrb : in STD_LOGIC_VECTOR ( 7 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 ( 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; s_axi_arid : in STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_araddr : in STD_LOGIC_VECTOR ( 31 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_VECTOR ( 0 to 0 ); s_axi_arcache : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_arprot : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_arregion : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_arqos : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_arvalid : in STD_LOGIC; s_axi_arready : out STD_LOGIC; s_axi_rid : out STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_rdata : out STD_LOGIC_VECTOR ( 63 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; m_axi_awid : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_awaddr : out STD_LOGIC_VECTOR ( 31 downto 0 ); m_axi_awlen : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_awsize : out STD_LOGIC_VECTOR ( 2 downto 0 ); m_axi_awburst : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_awlock : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_awcache : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_awprot : out STD_LOGIC_VECTOR ( 2 downto 0 ); m_axi_awqos : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_awvalid : out STD_LOGIC; m_axi_awready : in STD_LOGIC; m_axi_wid : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_wdata : out STD_LOGIC_VECTOR ( 63 downto 0 ); m_axi_wstrb : out STD_LOGIC_VECTOR ( 7 downto 0 ); m_axi_wlast : out STD_LOGIC; m_axi_wvalid : out STD_LOGIC; m_axi_wready : in STD_LOGIC; m_axi_bid : in STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_bresp : in STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_bvalid : in STD_LOGIC; m_axi_bready : out STD_LOGIC; m_axi_arid : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_araddr : out STD_LOGIC_VECTOR ( 31 downto 0 ); m_axi_arlen : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_arsize : out STD_LOGIC_VECTOR ( 2 downto 0 ); m_axi_arburst : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_arlock : out STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_arcache : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_arprot : out STD_LOGIC_VECTOR ( 2 downto 0 ); m_axi_arqos : out STD_LOGIC_VECTOR ( 3 downto 0 ); m_axi_arvalid : out STD_LOGIC; m_axi_arready : in STD_LOGIC; m_axi_rid : in STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_rdata : in STD_LOGIC_VECTOR ( 63 downto 0 ); m_axi_rresp : in STD_LOGIC_VECTOR ( 1 downto 0 ); m_axi_rlast : in STD_LOGIC; m_axi_rvalid : in STD_LOGIC; m_axi_rready : out STD_LOGIC ); end system_auto_pc_1; architecture stub of system_auto_pc_1 is attribute syn_black_box : boolean; attribute black_box_pad_pin : string; attribute syn_black_box of stub : architecture is true; attribute black_box_pad_pin of stub : architecture is "aclk,aresetn,s_axi_awid[1:0],s_axi_awaddr[31:0],s_axi_awlen[7:0],s_axi_awsize[2:0],s_axi_awburst[1:0],s_axi_awlock[0:0],s_axi_awcache[3:0],s_axi_awprot[2:0],s_axi_awregion[3:0],s_axi_awqos[3:0],s_axi_awvalid,s_axi_awready,s_axi_wdata[63:0],s_axi_wstrb[7:0],s_axi_wlast,s_axi_wvalid,s_axi_wready,s_axi_bid[1:0],s_axi_bresp[1:0],s_axi_bvalid,s_axi_bready,s_axi_arid[1:0],s_axi_araddr[31:0],s_axi_arlen[7:0],s_axi_arsize[2:0],s_axi_arburst[1:0],s_axi_arlock[0:0],s_axi_arcache[3:0],s_axi_arprot[2:0],s_axi_arregion[3:0],s_axi_arqos[3:0],s_axi_arvalid,s_axi_arready,s_axi_rid[1:0],s_axi_rdata[63:0],s_axi_rresp[1:0],s_axi_rlast,s_axi_rvalid,s_axi_rready,m_axi_awid[1:0],m_axi_awaddr[31:0],m_axi_awlen[3:0],m_axi_awsize[2:0],m_axi_awburst[1:0],m_axi_awlock[1:0],m_axi_awcache[3:0],m_axi_awprot[2:0],m_axi_awqos[3:0],m_axi_awvalid,m_axi_awready,m_axi_wid[1:0],m_axi_wdata[63:0],m_axi_wstrb[7:0],m_axi_wlast,m_axi_wvalid,m_axi_wready,m_axi_bid[1:0],m_axi_bresp[1:0],m_axi_bvalid,m_axi_bready,m_axi_arid[1:0],m_axi_araddr[31:0],m_axi_arlen[3:0],m_axi_arsize[2:0],m_axi_arburst[1:0],m_axi_arlock[1:0],m_axi_arcache[3:0],m_axi_arprot[2:0],m_axi_arqos[3:0],m_axi_arvalid,m_axi_arready,m_axi_rid[1:0],m_axi_rdata[63:0],m_axi_rresp[1:0],m_axi_rlast,m_axi_rvalid,m_axi_rready"; attribute X_CORE_INFO : string; attribute X_CORE_INFO of stub : architecture is "axi_protocol_converter_v2_1_11_axi_protocol_converter,Vivado 2016.4"; begin end;
-------------------------------------------------------------------------------- -- Gideon's Logic Architectures - Copyright 2014 -- Entity: usb_cmd_nano -- Date:2015-02-14 -- Author: Gideon -- Description: I/O registers for controlling commands directly, 16 bits for -- attachment to nano cpu. -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.usb_cmd_pkg.all; entity usb_cmd_nano is port ( clock : in std_logic; reset : in std_logic; io_addr : in unsigned(7 downto 0); io_write : in std_logic; io_read : in std_logic; io_wdata : in std_logic_vector(15 downto 0); io_rdata : out std_logic_vector(15 downto 0); cmd_req : out t_usb_cmd_req; cmd_resp : in t_usb_cmd_resp ); end entity; architecture arch of usb_cmd_nano is signal done_latch : std_logic; begin process(clock) begin if rising_edge(clock) then if cmd_resp.done = '1' then cmd_req.request <= '0'; done_latch <= '1'; end if; if io_write = '1' then case io_addr is when X"60" => -- command request cmd_req.request <= '1'; done_latch <= '0'; cmd_req.togglebit <= io_wdata(11); --cmd_req.do_split <= io_wdata(7); cmd_req.do_data <= io_wdata(6); cmd_req.command <= c_usb_commands_decoded(to_integer(unsigned(io_wdata(2 downto 0)))); when X"61" => -- data buffer control cmd_req.buffer_index <= unsigned(io_wdata(15 downto 14)); cmd_req.no_data <= io_wdata(13); cmd_req.data_length(9 downto 0) <= unsigned(io_wdata(9 downto 0)); when X"62" => -- device/endpoint cmd_req.device_addr <= unsigned(io_wdata(14 downto 8)); cmd_req.endp_addr <= unsigned(io_wdata(3 downto 0)); when X"63" => -- split info cmd_req.do_split <= io_wdata(15); cmd_req.split_hub_addr <= unsigned(io_wdata(14 downto 8)); cmd_req.split_port_addr <= unsigned(io_wdata(3 downto 0)); cmd_req.split_sc <= io_wdata(7); cmd_req.split_sp <= io_wdata(6); cmd_req.split_et <= io_wdata(5 downto 4); when others => null; end case; end if; if reset='1' then done_latch <= '0'; cmd_req.request <= '0'; end if; end if; end process; process(io_read, io_addr, cmd_resp, done_latch) begin io_rdata <= (others => '0'); if io_read = '1' then case io_addr is when X"64" => io_rdata(15) <= done_latch; io_rdata(14 downto 12) <= std_logic_vector(to_unsigned(t_usb_result'pos(cmd_resp.result), 3)); io_rdata(11) <= cmd_resp.togglebit; io_rdata(10) <= cmd_resp.no_data; io_rdata(9 downto 0) <= std_logic_vector(cmd_resp.data_length(9 downto 0)); when others => null; end case; end if; end process; end arch;
-- ------------------------------------------------------------- -- -- Entity Declaration for ent_ad -- -- Generated -- by: wig -- on: Mon Apr 10 13:27:22 2006 -- cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls -- -- !!! Do not edit this file! Autogenerated by MIX !!! -- $Author: wig $ -- $Id: ent_ad-e.vhd,v 1.1 2006/04/10 15:42:05 wig Exp $ -- $Date: 2006/04/10 15:42:05 $ -- $Log: ent_ad-e.vhd,v $ -- Revision 1.1 2006/04/10 15:42:05 wig -- Updated testcase (__TOP__) -- -- -- Based on Mix Entity Template built into RCSfile: MixWriter.pm,v -- Id: MixWriter.pm,v 1.79 2006/03/17 09:18:31 wig Exp -- -- Generator: mix_0.pl Version: Revision: 1.44 , [email protected] -- (C) 2003,2005 Micronas GmbH -- -- -------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; -- No project specific VHDL libraries/enty -- -- -- Start of Generated Entity ent_ad -- entity ent_ad is -- Generics: -- No Generated Generics for Entity ent_ad -- Generated Port Declaration: -- No Generated Port for Entity ent_ad end ent_ad; -- -- End of Generated Entity ent_ad -- -- --!End of Entity/ies -- --------------------------------------------------------------
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2984.vhd,v 1.2 2001-10-26 16:30:24 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package is --Failure here end; ENTITY c02s05b00x00p02n01i02984ent IS END c02s05b00x00p02n01i02984ent; ARCHITECTURE c02s05b00x00p02n01i02984arch OF c02s05b00x00p02n01i02984ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c02s05b00x00p02n01i02984 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c02s05b00x00p02n01i02984arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2984.vhd,v 1.2 2001-10-26 16:30:24 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package is --Failure here end; ENTITY c02s05b00x00p02n01i02984ent IS END c02s05b00x00p02n01i02984ent; ARCHITECTURE c02s05b00x00p02n01i02984arch OF c02s05b00x00p02n01i02984ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c02s05b00x00p02n01i02984 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c02s05b00x00p02n01i02984arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2984.vhd,v 1.2 2001-10-26 16:30:24 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package is --Failure here end; ENTITY c02s05b00x00p02n01i02984ent IS END c02s05b00x00p02n01i02984ent; ARCHITECTURE c02s05b00x00p02n01i02984arch OF c02s05b00x00p02n01i02984ent IS BEGIN TESTING: PROCESS BEGIN assert FALSE report "***FAILED TEST: c02s05b00x00p02n01i02984 - Missing identifier." severity ERROR; wait; END PROCESS TESTING; END c02s05b00x00p02n01i02984arch;
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity mul_561 is port ( result : out std_logic_vector(31 downto 0); in_a : in std_logic_vector(31 downto 0); in_b : in std_logic_vector(15 downto 0) ); end mul_561; architecture augh of mul_561 is signal tmp_res : signed(47 downto 0); begin -- The actual multiplication tmp_res <= signed(in_a) * signed(in_b); -- Set the output result <= std_logic_vector(tmp_res(31 downto 0)); end architecture;
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity mul_561 is port ( result : out std_logic_vector(31 downto 0); in_a : in std_logic_vector(31 downto 0); in_b : in std_logic_vector(15 downto 0) ); end mul_561; architecture augh of mul_561 is signal tmp_res : signed(47 downto 0); begin -- The actual multiplication tmp_res <= signed(in_a) * signed(in_b); -- Set the output result <= std_logic_vector(tmp_res(31 downto 0)); end architecture;
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2013" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block L/UpzzjJ2827HVIpKbSj31z/lW1So5alZ+ELgyzVf7NZltu1RMkL1kVmyQJY8BBg6LJKwRl1Vl0e k4xoRikwhQ== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block GhWpV9M5kfLniqfvvjbB0AJG2/rpd3Ds2b89wx5I0ybkFakKzEksGAqqpuGV7ObCBmr/MnS+CxiV sOyUSNiVMVjMo831GI+mCZDY4betCg2WEexQF7nq3kk5HuCajczZ1fyrF0Ewl1cX9UUeIRCJWnO4 FJdTjsMwHZRPiIIPF24= `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2013_09", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block 3kWgcGM2KDP42dldvcoMFI/e3ptvSdVKl8eMT3n+cVa0Aw95fjrojhZ3DyAL7GteMfR+HuaVNaCJ 8TulLQPV9zWthIA2QDyrhe6rqazGLh1YFupXtLLj6ZqYRcIKhD4gMM0gb1YQmAzK5PiiSbXbhVHs k4AEjZ/R2tJYiNhJuW4x/ggumb/RFuCbih/BkuZ0mS5YANTMAPEyoOdGmwbzu/anmsw4yivgm5Mn BfG6XwjYFVGMgGnp7xmpHPb84E2m8e46xU5N1+bpvx+3so19GtLEOywrExIvKYy3XDpsiZT1kLZf 9xe3TRsbFdN7jmP+Smy04moZrW+39+8Qq35nPw== `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block 3I/mDRGBTzMlN8LDQpBRJxNvlZyseXF3ZoebC0N5JiCFsUSg3JDXB6RfMiAGcLCbx71FcC3F8rIN bGwiGcFF1lNI2XhdBdoA5vp4Mgi2P18aBGBVnX9jBjjJNrz0cLPQt42u/uAwM/e26UxpbPOI93y0 9MPTv7DoJ7HrwnVHdz8= `protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block NfXjgqiEgUV2Zs+lo3LIEHyoucG6vO7rMhH+lbSSeX0v+JDkqX3j8+TitZXVXIpZSMsUkXOEQ/DJ ShQSsDHnxp5QiQz9sBO6P8DRqv72tRPKw+MeaX7RyYr+h86c6MbwWQonZ4aTlxqyLhScTQ64yym+ PsKQuESGDUy3xmR2syAcNnYGS8xTuMKkZ5On44qsGGCnbh7lK5A0DHRm14B2zkg6/SMOkAccyjXy pcz1daFk2zcgUYwil3T+0pHythFClQr+s6Znz3J6fntuVi2cZLbbUO2YWgqns/t3kS5DC9V7g78O I8pWAesE+q5ANrZLloFd2+xNY9c0PZPyeodLQA== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 4960) `protect data_block IsDPvfwJwsCByKJ+eOQxrkLl7auGua0c5t0OOJrjPP8ytx451y3xfA7YQlp2KY+pxR8U8bTiymN7 0Xl6SrBGkH7QnIlZY2ZF1fXeFQxh1nkHLfLm2LSATV2+q3/aDlVLsyflKjYLiiT7QMQi/aSJhPZ6 HzP6tDHoqqpw1ZbCb80lFR+7AR+lb9RLfL7GM9yzFT9W5ekDS8ZVLJaJir8HffH18yj8IW00P4ht U6MLvGQDnSO5Cv6GD8irv01zA1oprCmOkMAtBAGoGx+yCbREeSX8ONC46wPNETbgpJqcpJXpFxhA R9XaUfXWP/EOQAH8Rxqx5xeQ18tK4kGJM2wS6tslmQkxmU0FNJlDLYWbEnv4zJGCCgtxF/+9hYYH kyGdAfqOa+SQwyEmy6v3nDn3fy5Wwf9SR5Su+HbWHtRFrl4IeaPMjH0ICMGex5A047iXkXOwMNsD jEqoW4z6ayUDxP2kfAQfNiqbOXWoSSYt9b4+oBVbNCU9j2C110/XwOSnftLvgfz3EuDP1ibweESi bIfYNDfvyZNdUFXGNVR4E4m92x2y2t2ZuJ44afrVzxdJorgDJbU8rMRFMtl9DFm18qgUClKpgll/ zn2ptvBg4lm7N3fgvaFQuJ+JtKQmSvGq1cB+l52Vqr4WQ4gE5fbp3ReurKkMfIY6Tv9cESZBjGFF ESNuxb8O5XrukKAuBzi0JakRfQD2dcWNttM8Qx8i5WTRI4ZtXXa/mjgeak91KPctXEY2fGgjveDA rn8rgY3Cqdr6JLaKFE8Z3XXr6v2kRqy0DemFaN2JxQuVh+PowzFuBgZk+n5PF/vl34rxPg9v1ICB sTUezPgz4Cgt7gIJAGEQxc6bkq+iLbtN1jZzUy1v45WvkNkyhx/mMyUGEGsBbeqG0+IEPy9hxvdU Pjd9KvGVx+DYhYIW7kxgg8jb6PALDZZfI/zTWz1iPf1kjmp8wf3XvdA7NzD4kDfjtQDUZQJv/O+r Bbkt/KHUlhejhBlp8D2Cy3fRAp4DR7ggXw02zGnV6uFeERBrSdPPQRPFdjP7/awF9MNG/rvq/SDx FgTuzyN2kt/SlqTc3y9H0advGhMvOCC58iDDKImTsMYUFLILhhEqFcG//NbS93VHSSywH5NsscPm 36ctbsL68ABjAUVZRiHvq+ce5XkOfBq6OHiy5S6QRmOMGkXj5ZPDM/nQ+RXIP8vc/KjqTOncdr9b +Z6v4asU80aGEdaAIoHhf+L0rIAXB6qgF7Pgw2u0s46hLVmUeCuE7M7+Hb7w4s0+99PBrdWTdwn6 0l4dSrCjmEUSmaVPAEu0K+9G0ycL/93hJK+1KagRXVIN9tUzUoCfFIQunFmJpTbleQYYqDfx1xjB 3RJnVmaWBX+gad54JSyAxpIuDB/zVd46NuubWjdkqPy/bBXecCp31S0TGu3wJ9ul9YQPGh6LcKKg NgA3uQ9wAQMLhPhN1/a7aSwPfeh6Ns2fMyR3tKRtFIVF7Kny0MTiIwtSwucQ9Cx166BVzyaLD9Sv +iUK2OeiTon4SYMfgxGF+o4e8vlE2BTRXpqner/8MQ2cCdGbmBPP+GTQVcCpWRDAkXuB5agS+p8b ZrX6GuQeyAhglIv5xEo21ANFwM7p82h/Y2CW/svNn4gLv29hOA5giyCgCKQPYlRJz4FZI0HNFNPn nb9ePxQ3A+fSNTltVc3+FVxNS7Jt2x2e+kQz02thevYvoHXaWyFngKeVtqd0pVgYLUicZKqOPeez puQV+WIs3VYYmUaITNlNY0gCNdEqW69pbm7Sj0GLWsJcmgvN8PmLrAhUjRVnoUiLhjJJP2OC9MtM ublsF5mVHQ1ASOENY0PiVLNzIrSVNe0byny4z5HheMt3LY2c9sr+wOWscDwUma4j32GDEZiXaO19 R5z9eFa6CjHaNyoRyr0UipVS4tfmXtxsA2vHczJsLOl0PMR1Sys2rGNjJW7Xd43JvCV+4ctuiIQt dWVRwini4R5rbEnipgKjjYRnfuxQpoCs5Xv+OD1Nz/gF5lKznYSkuzSECku1skryXxAf3AhVvtWM gEaxVT39/8yX849teC4uOh3gxVC2o1jXa/26qIilX8IYleggcyjtVB31DXFrPzJWZYHbCVlep2Lu 8vt3DJQuQJIZJZlDgHqQr5b+dvKtO7g5bhsQTZcTgF3bwF/N8DonN+RSbR5HTedgw6mfrLipBZzv Yo4ao/PRE9x9SjVIkAHLmge3FPtnLP45Dlfyuc+XrFxmSBARLi0KKeirCX5bIrmeyqyIZH7+uMWn 60L+PZWH/pK59OIADuVdwNqUERhx7QJn2kQCe94K8919yUb7BGyRqiDIeMJUE20jcwju520HXfd7 r1uPr2DtLqjm/WokyDRPIPzXdlDNLvD5OGvDrlGnsHabTm8uy6MOITycpqG9mdbasUpSm+s6S3Cb OpwhHn+uDAl/MQxFvfvRETxFK6RZK0dchA4CwwyA69lLjq3cSdiO3pBhPocHuZtOkRya9M9MINtM ScOZLqdwAbB4BFPI8L9+qHEMOhPsK+z5i/HaPuYbF355Zkdz4hgP/0jUSrjcTiR7XjfdRUaK+Eaj WvWAsaOjd0jveJHjWwPlMln7fqn576jWa/OubfNOHgCpN2axXApBzWevPOZEcxf0JVNV25hCzET+ GJeghvfFR/72ETvRD0qNmMY7eUPlcdVtq/pu+9sUmH2JDbnIlJfMaZF5Xs69WJd+fSfByKaD9nQk jwtPj3CkHSuIGG1Xd8tcHAI7RE/76dntU+JbAvd+VrUd2LPRvdLr+vXZeQDa36/Gzd4MBnmK2RnU Msyk0t9NCvhcc3qvsIxQiMLyo9/eCkxslyar0PFk8FC+CwdDucehVL7Jyz2EKrEKrLUEcCk0Ru59 KeeHvdfAnVVIfL2oRoP4TBdnNOH3L+5aVj8W2U/RETg3pR4TuxpzO+ATV5TfOTajInH//A0BY33g iTwPqIzMRr6oLDjYJww+3HPfnhrrQPmHAI9EIS/a+jiLEgRSutISngvwWU1c+hSMF0rXu45Fg7sb hhKZ0ScWbSQdNqVJUquWZYYR0c3Oop4iOIl5MwmaNjwRb4YamM93FIZjOmsbyKwF63MU2gZJsDQ5 iVDrFtOeAGE43GaC1l8OBWhZDM68sqxSt/8M/C3CWSCOte45wcqk/WHGlJyGGLZSxf5uDnaozxmi A8CYsCJcj8j25+iiynZnIjCv/LSp4KX56NlPYfh+wc28PuS/br/umo1kuzqlsvwRGaEgqaNflLGp xWuDUqhaO1LGtiF8zSx4qkbwnGgeHX5NZszjN8tmCwvJ4fK62AaPi6KyO4B2baClxlbxNmlAlKkD igkzQeRJBrdS3M6OxMW9t4651Omb0AXmyE7Zx5GtDYzMazEc+A8Piosse7EL7NYUq4prY9XnKPQb YnNUBOwCrinouTz5aEWwJzrFkn9AkzJECaIkZ8+6TZ9+Z5aLcrE2xkZmNb5UTvNhRf0dz+1FrLKz i8P/Flg4gXS9D3Eda+W50RDqIMNSaNo698dLZhnkMkOAR41dpDHnRZcTb9kDHDn9zOLVnF0ksnGN LU0254ffzcjITXiyNNXdvweJPoVN0ldoTIlRTFyzVFHgrEKVW4l77JetU8LB0aBWAlvpApZLcruS TEG3Jj4zQk+XrfXornB75x3YT/3cZNI/IsA4XWO5KGVzmO2s8iPTBVxVgPfOP+q+0499pNPRUpIz 5p41dutHVOoEjpOVytVipq4MZiuE9Tex/mi8uD1Wp69LMCi5JVQTGhXUpY5AOTKTXapNQl9VNoY/ i4xmSf5TJud7eEakUGRotPJzR6XUgRFU7mVuHINCDFOv9o4WHqSDaOH4vfSLLEqQe1oUSDBU4n4t 5KPiTZn7lnaj0feQqVdLkSYLm50CqU8tSLtSBQr3EiEV1xCF73A1q9IS9BbggYus2Dm3V5nV4igK 6g2Ens2iuRbN+RsfXutm3PV6bjNhqHlvvYxdrUvHAGSISfUEfVs7Df/RppBlLWfzac6JQorvu/K5 WjOkf+rMvWLBwps7HHTVKVJSNpAPkllVNiwddf6H+eRhqT+dzQwTIjeYwmrDB8BWXhxEygqnF/Xg iGLxlaJyaEnG+VSL9+lSJ83u+mK27koNvLVvMuuwS1mz/YxqC+5AzL8WY8kqdkiaYij0e8p4a3OL B3j3Pfya+5Ad3bhi1rGAOJGWLTAGqLdAnLY+pw4iBHIiES6Bb16kaF214hnhMBALH9Xq5d4CIvXi sqhFjxLBMYwfuedvmByR51m9RJiHm83GBoSDiOJg0V6sodjumqlezESGUC61gFjMpXLjydZKhQjp JOaNTGXSw4gSi8bxNYUANHJAGVoi0NKRPAwZpGEBDjJ2rORj6IMwJaWcjSOXk26r7IBtiRCpa/c2 AsgT/QpGs6AZMuC6HJ/lo8CjtzA7ONFV4cjaAFLUCcGBuF8rWIL3BefWFuldzWrbMQsHBpiuhTtD Zfqs9SGJ8MMY04j99w+2CsJoDkL3ZIZej6qt75zhNJ8tn2g4IH75l/QrPu92ItrLcTQldlC5XO6w x7PE28ks/67y+G5n9IdSe+OWtmF4nVXC4SE162DszBsch+Ymv9EH9gnnPbjsH+t1rF38tyBE1A/J jAk1hA65W5/nG8g1CQeXDA0SKGLjbMVyMIIv9IMuRdFvECWYS5xpAzjdU97P7BJ0THHKSq7V0m4M AHSKM9EWf56RRMIGKyFc+u6r8oUn/SWAiEtqLAOOFnYQKHomPdF6KZgp8nGOlcjoSwh/e+xz2N38 KE4v0iRr08U8+q2TFAR613C3cnejj7tcS6xONFsLf5MOrbxy1RZR4Yd2VLOcxsMGBACbOf+I7WrB cpF340wrxX/oy58QGFe1dpR4nhFlajOhT9VKxyPGqwRqf14wgUEdFs8lCb812WEITNZycyzbvBLJ pciekFpjq31ejYA10Bsw4S+R7/uCTiIAsvzIDdhJkdKI+cBtwa3/otUFrMIMqHPkDt/zx0ugIO4a jmGYWT2MX5Qcp9RcgAEKBnWfXaZZXLR3ODiLsr3Hj2MnOIofDmhIHdkGA3VyWlmodXDEenCX1D4M ZcLjg/xxmy3bN3gNSkBru4G+TiQVIrYg7g3xFP88HmD+BhaRyJtFFg+kvu+FfI6CHinXa2Bghvd0 /uyvlaV37lJgWFlH2b8TxHqEOEg+TAXEcjN4dfjYTY6cxPAmulQVcJouqPNOGUNSD2AGctEdyW1m Yqo0GWfw6QB6yNagSspHEJljQpPzn4eMvkXyA7MFuy/ZP9+FgziUzbQJIt9avpMb7IG/kwrLpyM4 Ef/FMesQrjv2DOManIJ8WlU4kVl6FHyLaAadnzX0b9YbpLfnovy7zJUVsGQSlPwXmOxUU/rQoj1H 2lqifh7wLdesUmHBDceB0Uc5i2xvwZzNt4NtFT8goKuPqXcmPxjxvNfv44iB7+MCuTGifMtpq93b /6LooX9g/CwcUElqOjQgcQHMVJ7Oc8Oa53iEiAFm3AJ2/uimepWdpwY18+552ph7f/Zop9zAnKxU b0Kcc6mnaQiF5DzEed+5GqT7BtiLHl3gwydEX2ni1lxfKZX1jhG4rirKlI26yqMib2mnB8sQCSvg a+Pf1cEJUUyGMUCEiB68/Fkq8hI6HtN/u9f8tLhjxC/z3yWMNKxHsVJIYTbAC+9De0UaQP4ZkMv+ M+OiaACXbFwP2Tj1gAsIqiYmgE+tiainEv0Fvvg0y7nmdUqbLhbYEcZIhY93hs2GDl2E0NJ/cqdU C+NYOnQyuiFaS9JmFkkRP+m4NpOas6/VMhn8Y3e6NQfPIHif40iUfGIGI7kNndzrchU9ZBAVR1k3 k7I/vCNprAWE7T5HmM7hitZhJ8VCMWtvyszE4sCW6KrwWo0+OfxGnNvwZl2c43dEzaUGOX2MQd62 HFGLVjVkRlWu4IC8slLraQ5zTrVVXrMAPZaTkynefNyM0ZaJEGozGQfHIHH5FQkHDNPsz3cm2ALK GyRbQJ6u8TPvYoQfOAPIA9khxcRfXpCrSrFBKFRfTU6I6JZpQBTrW4iH2h/lfKQGNjcxe4+isKUg WouekBGRKLK6CH3SKjTGRRN7guifCa7IMBd+AE1mpGYE/LSbcy6R98c9aUCxPov1nUNEga3IZpJN izfcBJHvO4gTlglh1p5rPRaMN+mKKq1yf9a5ajA047mWgB2G7rpYhS1NuMIizJ4ddaXw/6wqew4g i85xXFCu1by7gCiDhGstctRKdDuFCz913sKnRqz8afD05hN0mrLCEcCkNTYYdrcWn84lhT1a/WGZ sffq4qH9AW5AGuiVLl+Daczzf4UNu0+q7/1S8f33V9WPTGb7Xkl8lrrs/QtOu4EoAUkxYfwYdU8n bbkgr4jWNTqW5IfU0LStAdYryvqI4gDkB4R5CUXUOYHzoahSFyYk8vw06HUhDi7XRmadFTXmAqAp UAeC5EanZx/2kUnaNYd7hG1QLo8zG9M0ZgORM2kNm+SIig6C4PSnVijFJFzjikvZbZixax2+aVvA U5vqOpp/96i7FZhPlFy8uHyyaYxFyjrHbiWuprllU5Tj+f1RFg20nhppbhrDGxxt+4Zq+1W8V3Vj /A== `protect end_protected
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2013" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block L/UpzzjJ2827HVIpKbSj31z/lW1So5alZ+ELgyzVf7NZltu1RMkL1kVmyQJY8BBg6LJKwRl1Vl0e k4xoRikwhQ== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block GhWpV9M5kfLniqfvvjbB0AJG2/rpd3Ds2b89wx5I0ybkFakKzEksGAqqpuGV7ObCBmr/MnS+CxiV sOyUSNiVMVjMo831GI+mCZDY4betCg2WEexQF7nq3kk5HuCajczZ1fyrF0Ewl1cX9UUeIRCJWnO4 FJdTjsMwHZRPiIIPF24= `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2013_09", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block 3kWgcGM2KDP42dldvcoMFI/e3ptvSdVKl8eMT3n+cVa0Aw95fjrojhZ3DyAL7GteMfR+HuaVNaCJ 8TulLQPV9zWthIA2QDyrhe6rqazGLh1YFupXtLLj6ZqYRcIKhD4gMM0gb1YQmAzK5PiiSbXbhVHs k4AEjZ/R2tJYiNhJuW4x/ggumb/RFuCbih/BkuZ0mS5YANTMAPEyoOdGmwbzu/anmsw4yivgm5Mn BfG6XwjYFVGMgGnp7xmpHPb84E2m8e46xU5N1+bpvx+3so19GtLEOywrExIvKYy3XDpsiZT1kLZf 9xe3TRsbFdN7jmP+Smy04moZrW+39+8Qq35nPw== `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block 3I/mDRGBTzMlN8LDQpBRJxNvlZyseXF3ZoebC0N5JiCFsUSg3JDXB6RfMiAGcLCbx71FcC3F8rIN bGwiGcFF1lNI2XhdBdoA5vp4Mgi2P18aBGBVnX9jBjjJNrz0cLPQt42u/uAwM/e26UxpbPOI93y0 9MPTv7DoJ7HrwnVHdz8= `protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block NfXjgqiEgUV2Zs+lo3LIEHyoucG6vO7rMhH+lbSSeX0v+JDkqX3j8+TitZXVXIpZSMsUkXOEQ/DJ ShQSsDHnxp5QiQz9sBO6P8DRqv72tRPKw+MeaX7RyYr+h86c6MbwWQonZ4aTlxqyLhScTQ64yym+ PsKQuESGDUy3xmR2syAcNnYGS8xTuMKkZ5On44qsGGCnbh7lK5A0DHRm14B2zkg6/SMOkAccyjXy pcz1daFk2zcgUYwil3T+0pHythFClQr+s6Znz3J6fntuVi2cZLbbUO2YWgqns/t3kS5DC9V7g78O I8pWAesE+q5ANrZLloFd2+xNY9c0PZPyeodLQA== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 4960) `protect data_block IsDPvfwJwsCByKJ+eOQxrkLl7auGua0c5t0OOJrjPP8ytx451y3xfA7YQlp2KY+pxR8U8bTiymN7 0Xl6SrBGkH7QnIlZY2ZF1fXeFQxh1nkHLfLm2LSATV2+q3/aDlVLsyflKjYLiiT7QMQi/aSJhPZ6 HzP6tDHoqqpw1ZbCb80lFR+7AR+lb9RLfL7GM9yzFT9W5ekDS8ZVLJaJir8HffH18yj8IW00P4ht U6MLvGQDnSO5Cv6GD8irv01zA1oprCmOkMAtBAGoGx+yCbREeSX8ONC46wPNETbgpJqcpJXpFxhA R9XaUfXWP/EOQAH8Rxqx5xeQ18tK4kGJM2wS6tslmQkxmU0FNJlDLYWbEnv4zJGCCgtxF/+9hYYH kyGdAfqOa+SQwyEmy6v3nDn3fy5Wwf9SR5Su+HbWHtRFrl4IeaPMjH0ICMGex5A047iXkXOwMNsD jEqoW4z6ayUDxP2kfAQfNiqbOXWoSSYt9b4+oBVbNCU9j2C110/XwOSnftLvgfz3EuDP1ibweESi bIfYNDfvyZNdUFXGNVR4E4m92x2y2t2ZuJ44afrVzxdJorgDJbU8rMRFMtl9DFm18qgUClKpgll/ zn2ptvBg4lm7N3fgvaFQuJ+JtKQmSvGq1cB+l52Vqr4WQ4gE5fbp3ReurKkMfIY6Tv9cESZBjGFF ESNuxb8O5XrukKAuBzi0JakRfQD2dcWNttM8Qx8i5WTRI4ZtXXa/mjgeak91KPctXEY2fGgjveDA rn8rgY3Cqdr6JLaKFE8Z3XXr6v2kRqy0DemFaN2JxQuVh+PowzFuBgZk+n5PF/vl34rxPg9v1ICB sTUezPgz4Cgt7gIJAGEQxc6bkq+iLbtN1jZzUy1v45WvkNkyhx/mMyUGEGsBbeqG0+IEPy9hxvdU Pjd9KvGVx+DYhYIW7kxgg8jb6PALDZZfI/zTWz1iPf1kjmp8wf3XvdA7NzD4kDfjtQDUZQJv/O+r Bbkt/KHUlhejhBlp8D2Cy3fRAp4DR7ggXw02zGnV6uFeERBrSdPPQRPFdjP7/awF9MNG/rvq/SDx FgTuzyN2kt/SlqTc3y9H0advGhMvOCC58iDDKImTsMYUFLILhhEqFcG//NbS93VHSSywH5NsscPm 36ctbsL68ABjAUVZRiHvq+ce5XkOfBq6OHiy5S6QRmOMGkXj5ZPDM/nQ+RXIP8vc/KjqTOncdr9b +Z6v4asU80aGEdaAIoHhf+L0rIAXB6qgF7Pgw2u0s46hLVmUeCuE7M7+Hb7w4s0+99PBrdWTdwn6 0l4dSrCjmEUSmaVPAEu0K+9G0ycL/93hJK+1KagRXVIN9tUzUoCfFIQunFmJpTbleQYYqDfx1xjB 3RJnVmaWBX+gad54JSyAxpIuDB/zVd46NuubWjdkqPy/bBXecCp31S0TGu3wJ9ul9YQPGh6LcKKg NgA3uQ9wAQMLhPhN1/a7aSwPfeh6Ns2fMyR3tKRtFIVF7Kny0MTiIwtSwucQ9Cx166BVzyaLD9Sv +iUK2OeiTon4SYMfgxGF+o4e8vlE2BTRXpqner/8MQ2cCdGbmBPP+GTQVcCpWRDAkXuB5agS+p8b ZrX6GuQeyAhglIv5xEo21ANFwM7p82h/Y2CW/svNn4gLv29hOA5giyCgCKQPYlRJz4FZI0HNFNPn nb9ePxQ3A+fSNTltVc3+FVxNS7Jt2x2e+kQz02thevYvoHXaWyFngKeVtqd0pVgYLUicZKqOPeez puQV+WIs3VYYmUaITNlNY0gCNdEqW69pbm7Sj0GLWsJcmgvN8PmLrAhUjRVnoUiLhjJJP2OC9MtM ublsF5mVHQ1ASOENY0PiVLNzIrSVNe0byny4z5HheMt3LY2c9sr+wOWscDwUma4j32GDEZiXaO19 R5z9eFa6CjHaNyoRyr0UipVS4tfmXtxsA2vHczJsLOl0PMR1Sys2rGNjJW7Xd43JvCV+4ctuiIQt dWVRwini4R5rbEnipgKjjYRnfuxQpoCs5Xv+OD1Nz/gF5lKznYSkuzSECku1skryXxAf3AhVvtWM gEaxVT39/8yX849teC4uOh3gxVC2o1jXa/26qIilX8IYleggcyjtVB31DXFrPzJWZYHbCVlep2Lu 8vt3DJQuQJIZJZlDgHqQr5b+dvKtO7g5bhsQTZcTgF3bwF/N8DonN+RSbR5HTedgw6mfrLipBZzv Yo4ao/PRE9x9SjVIkAHLmge3FPtnLP45Dlfyuc+XrFxmSBARLi0KKeirCX5bIrmeyqyIZH7+uMWn 60L+PZWH/pK59OIADuVdwNqUERhx7QJn2kQCe94K8919yUb7BGyRqiDIeMJUE20jcwju520HXfd7 r1uPr2DtLqjm/WokyDRPIPzXdlDNLvD5OGvDrlGnsHabTm8uy6MOITycpqG9mdbasUpSm+s6S3Cb OpwhHn+uDAl/MQxFvfvRETxFK6RZK0dchA4CwwyA69lLjq3cSdiO3pBhPocHuZtOkRya9M9MINtM ScOZLqdwAbB4BFPI8L9+qHEMOhPsK+z5i/HaPuYbF355Zkdz4hgP/0jUSrjcTiR7XjfdRUaK+Eaj WvWAsaOjd0jveJHjWwPlMln7fqn576jWa/OubfNOHgCpN2axXApBzWevPOZEcxf0JVNV25hCzET+ GJeghvfFR/72ETvRD0qNmMY7eUPlcdVtq/pu+9sUmH2JDbnIlJfMaZF5Xs69WJd+fSfByKaD9nQk jwtPj3CkHSuIGG1Xd8tcHAI7RE/76dntU+JbAvd+VrUd2LPRvdLr+vXZeQDa36/Gzd4MBnmK2RnU Msyk0t9NCvhcc3qvsIxQiMLyo9/eCkxslyar0PFk8FC+CwdDucehVL7Jyz2EKrEKrLUEcCk0Ru59 KeeHvdfAnVVIfL2oRoP4TBdnNOH3L+5aVj8W2U/RETg3pR4TuxpzO+ATV5TfOTajInH//A0BY33g iTwPqIzMRr6oLDjYJww+3HPfnhrrQPmHAI9EIS/a+jiLEgRSutISngvwWU1c+hSMF0rXu45Fg7sb hhKZ0ScWbSQdNqVJUquWZYYR0c3Oop4iOIl5MwmaNjwRb4YamM93FIZjOmsbyKwF63MU2gZJsDQ5 iVDrFtOeAGE43GaC1l8OBWhZDM68sqxSt/8M/C3CWSCOte45wcqk/WHGlJyGGLZSxf5uDnaozxmi A8CYsCJcj8j25+iiynZnIjCv/LSp4KX56NlPYfh+wc28PuS/br/umo1kuzqlsvwRGaEgqaNflLGp xWuDUqhaO1LGtiF8zSx4qkbwnGgeHX5NZszjN8tmCwvJ4fK62AaPi6KyO4B2baClxlbxNmlAlKkD igkzQeRJBrdS3M6OxMW9t4651Omb0AXmyE7Zx5GtDYzMazEc+A8Piosse7EL7NYUq4prY9XnKPQb YnNUBOwCrinouTz5aEWwJzrFkn9AkzJECaIkZ8+6TZ9+Z5aLcrE2xkZmNb5UTvNhRf0dz+1FrLKz i8P/Flg4gXS9D3Eda+W50RDqIMNSaNo698dLZhnkMkOAR41dpDHnRZcTb9kDHDn9zOLVnF0ksnGN LU0254ffzcjITXiyNNXdvweJPoVN0ldoTIlRTFyzVFHgrEKVW4l77JetU8LB0aBWAlvpApZLcruS TEG3Jj4zQk+XrfXornB75x3YT/3cZNI/IsA4XWO5KGVzmO2s8iPTBVxVgPfOP+q+0499pNPRUpIz 5p41dutHVOoEjpOVytVipq4MZiuE9Tex/mi8uD1Wp69LMCi5JVQTGhXUpY5AOTKTXapNQl9VNoY/ i4xmSf5TJud7eEakUGRotPJzR6XUgRFU7mVuHINCDFOv9o4WHqSDaOH4vfSLLEqQe1oUSDBU4n4t 5KPiTZn7lnaj0feQqVdLkSYLm50CqU8tSLtSBQr3EiEV1xCF73A1q9IS9BbggYus2Dm3V5nV4igK 6g2Ens2iuRbN+RsfXutm3PV6bjNhqHlvvYxdrUvHAGSISfUEfVs7Df/RppBlLWfzac6JQorvu/K5 WjOkf+rMvWLBwps7HHTVKVJSNpAPkllVNiwddf6H+eRhqT+dzQwTIjeYwmrDB8BWXhxEygqnF/Xg iGLxlaJyaEnG+VSL9+lSJ83u+mK27koNvLVvMuuwS1mz/YxqC+5AzL8WY8kqdkiaYij0e8p4a3OL B3j3Pfya+5Ad3bhi1rGAOJGWLTAGqLdAnLY+pw4iBHIiES6Bb16kaF214hnhMBALH9Xq5d4CIvXi sqhFjxLBMYwfuedvmByR51m9RJiHm83GBoSDiOJg0V6sodjumqlezESGUC61gFjMpXLjydZKhQjp JOaNTGXSw4gSi8bxNYUANHJAGVoi0NKRPAwZpGEBDjJ2rORj6IMwJaWcjSOXk26r7IBtiRCpa/c2 AsgT/QpGs6AZMuC6HJ/lo8CjtzA7ONFV4cjaAFLUCcGBuF8rWIL3BefWFuldzWrbMQsHBpiuhTtD Zfqs9SGJ8MMY04j99w+2CsJoDkL3ZIZej6qt75zhNJ8tn2g4IH75l/QrPu92ItrLcTQldlC5XO6w x7PE28ks/67y+G5n9IdSe+OWtmF4nVXC4SE162DszBsch+Ymv9EH9gnnPbjsH+t1rF38tyBE1A/J jAk1hA65W5/nG8g1CQeXDA0SKGLjbMVyMIIv9IMuRdFvECWYS5xpAzjdU97P7BJ0THHKSq7V0m4M AHSKM9EWf56RRMIGKyFc+u6r8oUn/SWAiEtqLAOOFnYQKHomPdF6KZgp8nGOlcjoSwh/e+xz2N38 KE4v0iRr08U8+q2TFAR613C3cnejj7tcS6xONFsLf5MOrbxy1RZR4Yd2VLOcxsMGBACbOf+I7WrB cpF340wrxX/oy58QGFe1dpR4nhFlajOhT9VKxyPGqwRqf14wgUEdFs8lCb812WEITNZycyzbvBLJ pciekFpjq31ejYA10Bsw4S+R7/uCTiIAsvzIDdhJkdKI+cBtwa3/otUFrMIMqHPkDt/zx0ugIO4a jmGYWT2MX5Qcp9RcgAEKBnWfXaZZXLR3ODiLsr3Hj2MnOIofDmhIHdkGA3VyWlmodXDEenCX1D4M ZcLjg/xxmy3bN3gNSkBru4G+TiQVIrYg7g3xFP88HmD+BhaRyJtFFg+kvu+FfI6CHinXa2Bghvd0 /uyvlaV37lJgWFlH2b8TxHqEOEg+TAXEcjN4dfjYTY6cxPAmulQVcJouqPNOGUNSD2AGctEdyW1m Yqo0GWfw6QB6yNagSspHEJljQpPzn4eMvkXyA7MFuy/ZP9+FgziUzbQJIt9avpMb7IG/kwrLpyM4 Ef/FMesQrjv2DOManIJ8WlU4kVl6FHyLaAadnzX0b9YbpLfnovy7zJUVsGQSlPwXmOxUU/rQoj1H 2lqifh7wLdesUmHBDceB0Uc5i2xvwZzNt4NtFT8goKuPqXcmPxjxvNfv44iB7+MCuTGifMtpq93b /6LooX9g/CwcUElqOjQgcQHMVJ7Oc8Oa53iEiAFm3AJ2/uimepWdpwY18+552ph7f/Zop9zAnKxU b0Kcc6mnaQiF5DzEed+5GqT7BtiLHl3gwydEX2ni1lxfKZX1jhG4rirKlI26yqMib2mnB8sQCSvg a+Pf1cEJUUyGMUCEiB68/Fkq8hI6HtN/u9f8tLhjxC/z3yWMNKxHsVJIYTbAC+9De0UaQP4ZkMv+ M+OiaACXbFwP2Tj1gAsIqiYmgE+tiainEv0Fvvg0y7nmdUqbLhbYEcZIhY93hs2GDl2E0NJ/cqdU C+NYOnQyuiFaS9JmFkkRP+m4NpOas6/VMhn8Y3e6NQfPIHif40iUfGIGI7kNndzrchU9ZBAVR1k3 k7I/vCNprAWE7T5HmM7hitZhJ8VCMWtvyszE4sCW6KrwWo0+OfxGnNvwZl2c43dEzaUGOX2MQd62 HFGLVjVkRlWu4IC8slLraQ5zTrVVXrMAPZaTkynefNyM0ZaJEGozGQfHIHH5FQkHDNPsz3cm2ALK GyRbQJ6u8TPvYoQfOAPIA9khxcRfXpCrSrFBKFRfTU6I6JZpQBTrW4iH2h/lfKQGNjcxe4+isKUg WouekBGRKLK6CH3SKjTGRRN7guifCa7IMBd+AE1mpGYE/LSbcy6R98c9aUCxPov1nUNEga3IZpJN izfcBJHvO4gTlglh1p5rPRaMN+mKKq1yf9a5ajA047mWgB2G7rpYhS1NuMIizJ4ddaXw/6wqew4g i85xXFCu1by7gCiDhGstctRKdDuFCz913sKnRqz8afD05hN0mrLCEcCkNTYYdrcWn84lhT1a/WGZ sffq4qH9AW5AGuiVLl+Daczzf4UNu0+q7/1S8f33V9WPTGb7Xkl8lrrs/QtOu4EoAUkxYfwYdU8n bbkgr4jWNTqW5IfU0LStAdYryvqI4gDkB4R5CUXUOYHzoahSFyYk8vw06HUhDi7XRmadFTXmAqAp UAeC5EanZx/2kUnaNYd7hG1QLo8zG9M0ZgORM2kNm+SIig6C4PSnVijFJFzjikvZbZixax2+aVvA U5vqOpp/96i7FZhPlFy8uHyyaYxFyjrHbiWuprllU5Tj+f1RFg20nhppbhrDGxxt+4Zq+1W8V3Vj /A== `protect end_protected
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity hello is port (clk, rst: std_logic; cnt : out unsigned(3 downto 0)); end hello; architecture behav of hello is signal val : unsigned (3 downto 0); begin process(clk) begin if rising_edge(clk) then if rst = '1' then val <= (others => '0'); else val <= val + 1; end if; end if; end process; cnt <= val; --psl default clock is rising_edge(clk); --psl restrict {rst; (not rst)[*]}; --psl assert always val /= 5 abort rst; --psl assume always val < 10; --psl cover {val = 10}; end behav;