📄 altera_mf.vhd
字号:
if (IS_FAMILY_STRATIXII(device) or IS_FAMILY_HARDCOPYII(device) or IS_FAMILY_STRATIXIIGX(device) ) then var_family_stratixii := true; end if; return var_family_stratixii;end FEATURE_FAMILY_STRATIXII;function FEATURE_FAMILY_STRATIX_HC (device : in string) return boolean isvariable var_family_stratix_hc : boolean := false;begin if (IS_FAMILY_HARDCOPYSTRATIX(device) ) then var_family_stratix_hc := true; end if; return var_family_stratix_hc;end FEATURE_FAMILY_STRATIX_HC;function FEATURE_FAMILY_STRATIX (device : in string) return boolean isvariable var_family_stratix : boolean := false;begin if (IS_FAMILY_STRATIX(device) or FEATURE_FAMILY_STRATIX_HC(device) or FEATURE_FAMILY_STRATIXGX(device) or FEATURE_FAMILY_CYCLONE(device) or FEATURE_FAMILY_STRATIXII(device) or FEATURE_FAMILY_MAXII(device) or FEATURE_FAMILY_CYCLONEII(device) ) then var_family_stratix := true; end if; return var_family_stratix;end FEATURE_FAMILY_STRATIX;function FEATURE_FAMILY_MAXII (device : in string) return boolean isvariable var_family_maxii : boolean := false;begin if (IS_FAMILY_MAXII(device) ) then var_family_maxii := true; end if; return var_family_maxii;end FEATURE_FAMILY_MAXII;function FEATURE_FAMILY_CYCLONEII (device : in string) return boolean isvariable var_family_cycloneii : boolean := false;begin if (IS_FAMILY_CYCLONEII(device) ) then var_family_cycloneii := true; end if; return var_family_cycloneii;end FEATURE_FAMILY_CYCLONEII;function FEATURE_FAMILY_HAS_MEGARAM (device : in string) return boolean isvariable var_family_has_megaram : boolean := false;begin if (IS_FAMILY_STRATIX(device) or FEATURE_FAMILY_STRATIX_HC(device) or IS_FAMILY_STRATIXGX(device) or FEATURE_FAMILY_STRATIXII(device) ) then var_family_has_megaram := true; end if; return var_family_has_megaram;end FEATURE_FAMILY_HAS_MEGARAM;function FEATURE_FAMILY_HAS_M512 (device : in string) return boolean isvariable var_family_has_m512 : boolean := false;begin if (IS_FAMILY_STRATIX(device) or FEATURE_FAMILY_STRATIX_HC(device) or IS_FAMILY_STRATIXGX(device) or IS_FAMILY_STRATIXII(device) or IS_FAMILY_STRATIXIIGX(device) ) then var_family_has_m512 := true; end if; return var_family_has_m512;end FEATURE_FAMILY_HAS_M512;function FEATURE_FAMILY_HAS_STRATIXII_STYLE_RAM (device : in string) return boolean isvariable var_family_has_stratixii_style_ram : boolean := false;begin if (FEATURE_FAMILY_STRATIXII(device) or FEATURE_FAMILY_CYCLONEII(device) ) then var_family_has_stratixii_style_ram := true; end if; return var_family_has_stratixii_style_ram;end FEATURE_FAMILY_HAS_STRATIXII_STYLE_RAM;function FEATURE_FAMILY_HAS_STRATIX_STYLE_PLL (device : in string) return boolean isvariable var_family_has_stratix_style_pll : boolean := false;begin if (FEATURE_FAMILY_CYCLONE(device) or FEATURE_FAMILY_STRATIX_HC(device) or IS_FAMILY_STRATIX(device) or FEATURE_FAMILY_STRATIXGX(device) ) then var_family_has_stratix_style_pll := true; end if; return var_family_has_stratix_style_pll;end FEATURE_FAMILY_HAS_STRATIX_STYLE_PLL;function FEATURE_FAMILY_HAS_STRATIXII_STYLE_PLL (device : in string) return boolean isvariable var_family_has_stratixii_style_pll : boolean := false;begin if (FEATURE_FAMILY_STRATIXII(device) or FEATURE_FAMILY_CYCLONEII(device) ) then var_family_has_stratixii_style_pll := true; end if; return var_family_has_stratixii_style_pll;end FEATURE_FAMILY_HAS_STRATIXII_STYLE_PLL;function FEATURE_FAMILY_HAS_FLEXIBLE_LVDS (device : in string) return boolean isvariable var_family_has_flexible_lvds : boolean := false;begin if (FEATURE_FAMILY_CYCLONE(device) or FEATURE_FAMILY_CYCLONEII(device) ) then var_family_has_flexible_lvds := true; end if; return var_family_has_flexible_lvds;end FEATURE_FAMILY_HAS_FLEXIBLE_LVDS;function FEATURE_FAMILY_HAS_INVERTED_OUTPUT_DDIO (device : in string) return boolean isvariable var_family_has_inverted_output_ddio : boolean := false;begin if (FEATURE_FAMILY_CYCLONEII(device) ) then var_family_has_inverted_output_ddio := true; end if; return var_family_has_inverted_output_ddio;end FEATURE_FAMILY_HAS_INVERTED_OUTPUT_DDIO;function IS_VALID_FAMILY (device : in string) return boolean isvariable is_valid : boolean := false;begin if (((device = "ACEX1K") or (device = "acex1k") or (device = "ACEX 1K") or (device = "acex 1k")) or ((device = "APEX20K") or (device = "apex20k") or (device = "APEX 20K") or (device = "apex 20k") or (device = "RAPHAEL") or (device = "raphael")) or ((device = "APEX20KC") or (device = "apex20kc") or (device = "APEX 20KC") or (device = "apex 20kc")) or ((device = "APEX20KE") or (device = "apex20ke") or (device = "APEX 20KE") or (device = "apex 20ke")) or ((device = "APEX II") or (device = "apex ii") or (device = "APEXII") or (device = "apexii") or (device = "APEX 20KF") or (device = "apex 20kf") or (device = "APEX20KF") or (device = "apex20kf")) or ((device = "EXCALIBUR_ARM") or (device = "excalibur_arm") or (device = "Excalibur ARM") or (device = "EXCALIBUR ARM") or (device = "excalibur arm") or (device = "ARM-BASED EXCALIBUR") or (device = "arm-based excalibur") or (device = "ARM_BASED_EXCALIBUR") or (device = "arm_based_excalibur")) or ((device = "FLEX10KE") or (device = "flex10ke") or (device = "FLEX 10KE") or (device = "flex 10ke")) or ((device = "FLEX10K") or (device = "flex10k") or (device = "FLEX 10K") or (device = "flex 10k")) or ((device = "FLEX10KA") or (device = "flex10ka") or (device = "FLEX 10KA") or (device = "flex 10ka")) or ((device = "FLEX6000") or (device = "flex6000") or (device = "FLEX 6000") or (device = "flex 6000") or (device = "FLEX6K") or (device = "flex6k")) or ((device = "MAX7000B") or (device = "max7000b") or (device = "MAX 7000B") or (device = "max 7000b")) or ((device = "MAX7000AE") or (device = "max7000ae") or (device = "MAX 7000AE") or (device = "max 7000ae")) or ((device = "MAX3000A") or (device = "max3000a") or (device = "MAX 3000A") or (device = "max 3000a")) or ((device = "MAX7000S") or (device = "max7000s") or (device = "MAX 7000S") or (device = "max 7000s")) or ((device = "MAX7000A") or (device = "max7000a") or (device = "MAX 7000A") or (device = "max 7000a")) or ((device = "Mercury") or (device = "MERCURY") or (device = "mercury") or (device = "DALI") or (device = "dali")) or ((device = "Stratix") or (device = "STRATIX") or (device = "stratix") or (device = "Yeager") or (device = "YEAGER") or (device = "yeager")) or ((device = "Stratix GX") or (device = "STRATIX GX") or (device = "stratix gx") or (device = "Stratix-GX") or (device = "STRATIX-GX") or (device = "stratix-gx") or (device = "StratixGX") or (device = "STRATIXGX") or (device = "stratixgx") or (device = "Aurora") or (device = "AURORA") or (device = "aurora")) or ((device = "Cyclone") or (device = "CYCLONE") or (device = "cyclone") or (device = "ACEX2K") or (device = "acex2k") or (device = "ACEX 2K") or (device = "acex 2k") or (device = "Tornado") or (device = "TORNADO") or (device = "tornado")) or ((device = "MAX II") or (device = "max ii") or (device = "MAXII") or (device = "maxii") or (device = "Tsunami") or (device = "TSUNAMI") or (device = "tsunami")) or ((device = "HardCopy Stratix") or (device = "HARDCOPY STRATIX") or (device = "hardcopy stratix") or (device = "Stratix HC") or (device = "STRATIX HC") or (device = "stratix hc") or (device = "StratixHC") or (device = "STRATIXHC") or (device = "stratixhc") or (device = "HardcopyStratix") or (device = "HARDCOPYSTRATIX") or (device = "hardcopystratix")) or ((device = "Stratix II") or (device = "STRATIX II") or (device = "stratix ii") or (device = "StratixII") or (device = "STRATIXII") or (device = "stratixii") or (device = "Armstrong") or (device = "ARMSTRONG") or (device = "armstrong")) or ((device = "Stratix II GX") or (device = "STRATIX II GX") or (device = "stratix ii gx") or (device = "StratixIIGX") or (device = "STRATIXIIGX") or (device = "stratixiigx")) or ((device = "Cyclone II") or (device = "CYCLONE II") or (device = "cyclone ii") or (device = "Cycloneii") or (device = "CYCLONEII") or (device = "cycloneii") or (device = "Magellan") or (device = "MAGELLAN") or (device = "magellan")) or ((device = "HardCopy II") or (device = "HARDCOPY II") or (device = "hardcopy ii") or (device = "HardCopyII") or (device = "HARDCOPYII") or (device = "hardcopyii") or (device = "Fusion") or (device = "FUSION") or (device = "fusion")) or ((device = "Titan") or (device = "TITAN") or (device = "titan")) or ((device = "Barracuda") or (device = "BARRACUDA") or (device = "barracuda") or (device = "Cuda") or (device = "CUDA") or (device = "cuda"))) then is_valid := true; end if; return is_valid;end IS_VALID_FAMILY;end ALTERA_DEVICE_FAMILIES;-- END OF PACKAGE---START_PACKAGE_HEADER--------------------------------------------------------- Package Name : ALTERA_COMMON_CONVERSION---- Description : Common conversion functions-----END_PACKAGE_HEADER---------------------------------------------------------- BEGINING OF PACKAGELibrary ieee;use ieee.std_logic_1164.all;use std.textio.all;-- PACKAGE DECLARATIONpackage ALTERA_COMMON_CONVERSION is-- FUNCTION DECLARATION function INT_TO_STR_RAM (value : in integer) return string; function INT_TO_STR_ARITH (value : in integer) return string; function HEX_STR_TO_INT (str : in string) return integer; procedure SHRINK_LINE (str_line : inout line; pos : in integer);end ALTERA_COMMON_CONVERSION;package body ALTERA_COMMON_CONVERSION is-- This function converts an integer to a stringfunction INT_TO_STR_RAM (value : in integer) return string isvariable ivalue : integer := 0;variable index : integer := 0;variable digit : integer := 0;variable line_no: string(8 downto 1) := " ";begin ivalue := value; index := 1; 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 INT_TO_STR_RAM;function INT_TO_STR_ARITH (value : in integer) return string is variable ivalue : integer := 0; variable index : integer := 0; variable digit : integer := 0; variable temp: string(10 downto 1) := "0000000000";begin ivalue := value; index := 1; while (ivalue > 0) loop digit := ivalue mod 10; ivalue := ivalue/10; case digit is when 0 => temp(index) := '0'; when 1 => temp(index) := '1'; when 2 => temp(index) := '2'; when 3 => temp(index) := '3'; when 4 => temp(index) := '4'; when 5 => temp(index) := '5'; when 6 => temp(index) := '6'; when 7 => temp(index) := '7'; when 8 => temp(index) := '8'; when 9 => temp(index) := '9'; when others => ASSERT FALSE REPORT "Illegal number!" SEVERITY ERROR; end case; index := index + 1; end loop; if value < 0 then return '-'& temp(index downto 1); else return temp(index downto 1); end if;end INT_TO_STR_ARITH;-- This function converts a hexadecimal number to an integerfunction HEX_STR_TO_INT (str : in string) return integer isvariable len : integer := str'length;variable ivalue : integer := 0;variable digit : integer := 0;begin for i in len downto 1 loop case str(i) is 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 'A' => digit := 10; when 'a' => digit := 10; when 'B' => digit := 11; when 'b' => digit := 11; when 'C' => digit := 12; when 'c' => digit := 12; when 'D' => digit := 13; when 'd' => digit := 13; when 'E' => digit := 14; when 'e' => digit := 14; when 'F' => digit := 15; when 'f' => digit := 15; when others => ASSERT FALSE REPORT "Illegal character "& str(i) & "in Intel Hex File! " SEVERITY ERROR; end case; ivalue := ivalue * 16 + digit; end loop; return ivalue;end HEX_STR_TO_INT;-- This procedure "cuts" the str_line into desired lengthprocedure SHRINK_LINE (str_line : inout line; pos : in integer) issubtype nstring is string(1 to pos);variable str : nstring;begin if (pos >= 1) then read(str_line, str); end if;end;end ALTERA_COMMON_CONVERSION;-- END OF PACKAGELibrary ieee;use ieee.std_logic_1164.all;-- START PACKAGE HEADER ------------------------------------------------------------ Package Name : pllpack---- Description : Used by altpll model to calculate required advanced parameters-- for PLL simulation. Also has functions to do string->integer,-- integer->string conversions.---- END PACKAGE HEADER ------------------------------------------------------------ PACKAGE DECLARATIONpackage pllpack is-- FUNCTION DECLARATION function alt_conv_integer(arg : in std_logic_vector) return integer; function gcd (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 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -