⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecp2_mem.vhd

📁 porting scintilla to qt
💻 VHD
📖 第 1 页 / 共 5 页
字号:
   BEGIN        CASE data_w IS          WHEN 1 =>             result := 8;          WHEN 2 =>             result := 4;          WHEN 4 =>             result := 2;          WHEN 9 =>             result := 36864;          WHEN 18 =>             result := 36864;          WHEN 36 =>             result := 36864;          WHEN others =>             NULL;        END CASE;       RETURN result;   END;   FUNCTION init_ram (hex: string) RETURN std_logic_vector IS        CONSTANT length : integer := hex'length;        VARIABLE result1 : mem_type_5 (0 to ((length/5)-1));        VARIABLE result : std_logic_vector(((length*18)/5)-1 downto 0);   BEGIN       FOR i in 0 to ((length/5)-1) LOOP         result1(i) := str5_slv18(hex((i+1)*5 downto (i*5)+1));       END LOOP;       FOR j in 0 to 1023 LOOP         result(((j*18) + 17) downto (j*18)) := result1(j)(17 downto 0);       END LOOP;       RETURN result;   END;   FUNCTION init_ram1 (hex: string) RETURN mem_type_6 IS        CONSTANT length : integer := hex'length;        VARIABLE result : mem_type_6 (0 to ((length/4)-1));   BEGIN       FOR i in 0 to ((length/4)-1) LOOP         result(i) := str4_slv16(hex((i+1)*4 downto (i*4)+1));       END LOOP;       RETURN result;   END;-- String to std_logic_vector  FUNCTION str2slv (      str : in string  ) return std_logic_vector is  variable j : integer := str'length;  variable slv : std_logic_vector (str'length downto 1);  begin      for i in str'low to str'high loop          case str(i) is              when '0' => slv(j) := '0';              when '1' => slv(j) := '1';              when 'X' => slv(j) := 'X';              when 'U' => slv(j) := 'U';              when others => slv(j) := 'X';          end case;          j := j - 1;      end loop;      return slv;  end str2slv;function Valid_Address (    IN_ADDR : in std_logic_vector ) return boolean is    variable v_Valid_Flag : boolean := TRUE;begin    for i in IN_ADDR'high downto IN_ADDR'low loop        if (IN_ADDR(i) /= '0' and IN_ADDR(i) /= '1') then            v_Valid_Flag := FALSE;        end if;    end loop;    return v_Valid_Flag;end Valid_Address;END mem3 ;------- cell rom256x1 -------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.mem2.all; -- entity declaration --ENTITY rom256x1 IS  GENERIC (        initval : string := "0x0000000000000000000000000000000000000000000000000000000000000000";         -- miscellaneous vital GENERICs        TimingChecksOn  : boolean := FALSE;        XOn             : boolean := FALSE;        MsgOn           : boolean := FALSE;        InstancePath    : string  := "rom256x1";         -- input SIGNAL delays        tipd_ad0  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad1  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad2  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad3  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad4  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad5  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad6  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad7  : VitalDelayType01 := (0.0 ns, 0.0 ns);           -- propagation delays        tpd_ad0_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad1_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad2_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad3_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad4_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad5_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad6_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad7_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns));   port (ad0  : IN   std_logic;        ad1  : IN   std_logic;        ad2  : IN   std_logic;        ad3  : IN   std_logic;        ad4  : IN   std_logic;        ad5  : IN   std_logic;        ad6  : IN   std_logic;        ad7  : IN   std_logic;        do0   : OUT  std_logic);     ATTRIBUTE Vital_Level0 OF rom256x1 : ENTITY IS TRUE; END rom256x1; -- architecture body --ARCHITECTURE v OF rom256x1 IS    ATTRIBUTE Vital_Level0 OF v : ARCHITECTURE IS TRUE;    SIGNAL ad0_ipd  : std_logic := 'X';   SIGNAL ad1_ipd  : std_logic := 'X';   SIGNAL ad2_ipd  : std_logic := 'X';   SIGNAL ad3_ipd  : std_logic := 'X';   SIGNAL ad4_ipd  : std_logic := 'X';   SIGNAL ad5_ipd  : std_logic := 'X';   SIGNAL ad6_ipd  : std_logic := 'X';   SIGNAL ad7_ipd  : std_logic := 'X'; BEGIN    -----------------------   -- input path delays   -----------------------   WireDelay : BLOCK   BEGIN   VitalWireDelay(ad0_ipd, ad0, tipd_ad0);   VitalWireDelay(ad1_ipd, ad1, tipd_ad1);   VitalWireDelay(ad2_ipd, ad2, tipd_ad2);   VitalWireDelay(ad3_ipd, ad3, tipd_ad3);   VitalWireDelay(ad4_ipd, ad4, tipd_ad4);   VitalWireDelay(ad5_ipd, ad5, tipd_ad5);   VitalWireDelay(ad6_ipd, ad6, tipd_ad6);   VitalWireDelay(ad7_ipd, ad7, tipd_ad7);   END BLOCK;    -----------------------   -- behavior section   -----------------------   VitalBehavior : PROCESS (ad0_ipd, ad1_ipd, ad2_ipd, ad3_ipd, ad4_ipd, ad5_ipd, ad6_ipd, ad7_ipd)      VARIABLE memory   : std_logic_vector((2**8)-1 downto 0) := hex2bin(initval);      -- functionality results     VARIABLE do0_zd : std_logic :='X';          -- output glitch results     VARIABLE do0_GlitchData : VitalGlitchDataType;BEGIN   ------------------------   -- functionality section   ------------------------      do0_zd := VitalMUX (data => memory,                         dselect => (ad7_ipd, ad6_ipd, ad5_ipd, ad4_ipd, ad3_ipd, ad2_ipd, ad1_ipd, ad0_ipd));   ------------------------   -- path delay section   ------------------------   VitalPathDelay01 (     OutSignal => do0,     OutSignalName => "do0",     OutTemp => do0_zd,     Paths => (0 => (ad0_ipd'last_event, tpd_ad0_do0, TRUE),               1 => (ad1_ipd'last_event, tpd_ad1_do0, TRUE),               2 => (ad2_ipd'last_event, tpd_ad2_do0, TRUE),               3 => (ad3_ipd'last_event, tpd_ad3_do0, TRUE),               4 => (ad4_ipd'last_event, tpd_ad4_do0, TRUE),               5 => (ad5_ipd'last_event, tpd_ad5_do0, TRUE),               6 => (ad6_ipd'last_event, tpd_ad6_do0, TRUE),               7 => (ad7_ipd'last_event, tpd_ad7_do0, TRUE)),      GlitchData => do0_glitchdata,      Mode => ondetect,      XOn => XOn,       MsgOn => MsgOn);   end process; end V;  ------- cell rom128x1 -------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.mem2.all; -- entity declaration --ENTITY rom128x1 IS  GENERIC (        initval : string := "0x00000000000000000000000000000000";         -- miscellaneous vital GENERICs        TimingChecksOn  : boolean := FALSE;        XOn             : boolean := FALSE;        MsgOn           : boolean := FALSE;        InstancePath    : string  := "rom128x1";         -- input SIGNAL delays        tipd_ad0  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad1  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad2  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad3  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad4  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad5  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad6  : VitalDelayType01 := (0.0 ns, 0.0 ns);           -- propagation delays        tpd_ad0_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad1_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad2_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad3_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad4_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad5_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns);        tpd_ad6_do0     : VitalDelayType01 := (0.01 ns, 0.01 ns));   port (ad0  : IN   std_logic;        ad1  : IN   std_logic;        ad2  : IN   std_logic;        ad3  : IN   std_logic;        ad4  : IN   std_logic;        ad5  : IN   std_logic;        ad6  : IN   std_logic;        do0   : OUT  std_logic);     ATTRIBUTE Vital_Level0 OF rom128x1 : ENTITY IS TRUE; END rom128x1; -- architecture body --ARCHITECTURE v OF rom128x1 IS    ATTRIBUTE Vital_Level0 OF v : ARCHITECTURE IS TRUE;    SIGNAL ad0_ipd  : std_logic := 'X';   SIGNAL ad1_ipd  : std_logic := 'X';   SIGNAL ad2_ipd  : std_logic := 'X';   SIGNAL ad3_ipd  : std_logic := 'X';   SIGNAL ad4_ipd  : std_logic := 'X';   SIGNAL ad5_ipd  : std_logic := 'X';   SIGNAL ad6_ipd  : std_logic := 'X'; BEGIN    -----------------------   -- input path delays   -----------------------   WireDelay : BLOCK   BEGIN   VitalWireDelay(ad0_ipd, ad0, tipd_ad0);   VitalWireDelay(ad1_ipd, ad1, tipd_ad1);   VitalWireDelay(ad2_ipd, ad2, tipd_ad2);   VitalWireDelay(ad3_ipd, ad3, tipd_ad3);   VitalWireDelay(ad4_ipd, ad4, tipd_ad4);   VitalWireDelay(ad5_ipd, ad5, tipd_ad5);   VitalWireDelay(ad6_ipd, ad6, tipd_ad6);   END BLOCK;    -----------------------   -- behavior section   -----------------------   VitalBehavior : PROCESS (ad0_ipd, ad1_ipd, ad2_ipd, ad3_ipd, ad4_ipd, ad5_ipd, ad6_ipd)      VARIABLE memory   : std_logic_vector((2**7)-1 downto 0) := hex2bin(initval);      -- functionality results     VARIABLE do0_zd : std_logic :='X';          -- output glitch results     VARIABLE do0_GlitchData : VitalGlitchDataType;BEGIN   ------------------------   -- functionality section   ------------------------      do0_zd := VitalMUX (data => memory,                         dselect => (ad6_ipd, ad5_ipd, ad4_ipd, ad3_ipd, ad2_ipd, ad1_ipd, ad0_ipd));   ------------------------   -- path delay section   ------------------------   VitalPathDelay01 (     OutSignal => do0,     OutSignalName => "do0",     OutTemp => do0_zd,     Paths => (0 => (ad0_ipd'last_event, tpd_ad0_do0, TRUE),               1 => (ad1_ipd'last_event, tpd_ad1_do0, TRUE),               2 => (ad2_ipd'last_event, tpd_ad2_do0, TRUE),               3 => (ad3_ipd'last_event, tpd_ad3_do0, TRUE),               4 => (ad4_ipd'last_event, tpd_ad4_do0, TRUE),               5 => (ad5_ipd'last_event, tpd_ad5_do0, TRUE),               6 => (ad6_ipd'last_event, tpd_ad6_do0, TRUE)),      GlitchData => do0_glitchdata,      Mode => ondetect,      XOn => XOn,       MsgOn => MsgOn);   end process; end V;  ------- cell rom64x1 -------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.mem2.all; -- entity declaration --ENTITY rom64x1 IS  GENERIC (        initval : string := "0x0000000000000000";         -- miscellaneous vital GENERICs        TimingChecksOn  : boolean := FALSE;        XOn             : boolean := FALSE;        MsgOn           : boolean := FALSE;        InstancePath    : string  := "rom64x1";         -- input SIGNAL delays        tipd_ad0  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad1  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad2  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad3  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad4  : VitalDelayType01 := (0.0 ns, 0.0 ns);        tipd_ad5  : VitalDelayType01 := (0.0 ns, 0.0 ns); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -