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

📄 xilinx_simprims.vhd

📁 free hardware ip core about sparcv8,a soc cpu in vhdl
💻 VHD
📖 第 1 页 / 共 5 页
字号:
------------------------------------------------------------------------------ Simple simulation models for some Xilinx blocks-- Author: Jiri Gaisler------------------------------------------------------------------------------ pragma translate_offlibrary ieee;use ieee.std_logic_1164.all;library STD;use STD.TEXTIO.all;package simple_simprim_pck is  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN STRING := "";    Constant Unit : IN STRING := "";    Constant ExpectedValueMsg : IN STRING := "";    Constant ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    );  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN INTEGER;    Constant Unit : IN STRING := "";    Constant ExpectedValueMsg : IN STRING := "";    Constant ExpectedGenericValue : IN INTEGER;    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    );  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN BOOLEAN;    Constant Unit : IN STRING := "";    Constant ExpectedValueMsg : IN STRING := "";    Constant ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    );  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN INTEGER;    CONSTANT Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    );  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN REAL;    CONSTANT Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    );  procedure detect_resolution ( constant model_name : in string);end;package body simple_simprim_pck is  procedure detect_resolution (    constant model_name : in string    ) IS    variable test_value : time;    variable Message : LINE;  BEGIN    test_value := 1 ps;    if (test_value = 0 ps) then      Write (Message, STRING'(" Simulator Resolution Error : "));      Write (Message, STRING'(" Simulator resolution is set to a value greater than 1 ps. "));      Write (Message, STRING'(" In order to simulate the "));      Write (Message, model_name);      Write (Message, STRING'(", the simulator resolution must be set to 1ps or smaller "));      ASSERT FALSE REPORT Message.ALL SEVERITY ERROR;      DEALLOCATE (Message);    end if;  END detect_resolution;  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN STRING := "";    Constant Unit : IN STRING := "";    Constant ExpectedValueMsg : IN STRING := "";    Constant ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    ) IS    VARIABLE Message : LINE;  BEGIN    Write ( Message, HeaderMsg );    Write ( Message, STRING'(" The attribute ") );    Write ( Message, GenericName );    Write ( Message, STRING'(" on ") );    Write ( Message, EntityName );    Write ( Message, STRING'(" instance ") );    Write ( Message, InstanceName );    Write ( Message, STRING'(" is set to  ") );    Write ( Message, GenericValue );    Write ( Message, Unit );    Write ( Message, '.' & LF );    Write ( Message, ExpectedValueMsg );    Write ( Message, ExpectedGenericValue );    Write ( Message, Unit );    Write ( Message, TailMsg );    ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity;    DEALLOCATE (Message);  END GenericValueCheckMessage;  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN INTEGER;    CONSTANT Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN INTEGER;    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    ) IS    VARIABLE Message : LINE;  BEGIN    Write ( Message, HeaderMsg );    Write ( Message, STRING'(" The attribute ") );    Write ( Message, GenericName );    Write ( Message, STRING'(" on ") );    Write ( Message, EntityName );    Write ( Message, STRING'(" instance ") );    Write ( Message, InstanceName );    Write ( Message, STRING'(" is set to  ") );    Write ( Message, GenericValue );    Write ( Message, Unit );    Write ( Message, '.' & LF );    Write ( Message, ExpectedValueMsg );    Write ( Message, ExpectedGenericValue );    Write ( Message, Unit );    Write ( Message, TailMsg );    ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity;    DEALLOCATE (Message);  END GenericValueCheckMessage;  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN BOOLEAN;    Constant Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    ) IS    VARIABLE Message : LINE;  BEGIN    Write ( Message, HeaderMsg );    Write ( Message, STRING'(" The attribute ") );    Write ( Message, GenericName );    Write ( Message, STRING'(" on ") );    Write ( Message, EntityName );    Write ( Message, STRING'(" instance ") );    Write ( Message, InstanceName );    Write ( Message, STRING'(" is set to  ") );    Write ( Message, GenericValue );    Write ( Message, Unit );    Write ( Message, '.' & LF );    Write ( Message, ExpectedValueMsg );    Write ( Message, ExpectedGenericValue );    Write ( Message, Unit );    Write ( Message, TailMsg );    ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity;    DEALLOCATE (Message);  END GenericValueCheckMessage;  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN INTEGER;    CONSTANT Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    ) IS    VARIABLE Message : LINE;  BEGIN    Write ( Message, HeaderMsg );    Write ( Message, STRING'(" The attribute ") );    Write ( Message, GenericName );    Write ( Message, STRING'(" on ") );    Write ( Message, EntityName );    Write ( Message, STRING'(" instance ") );    Write ( Message, InstanceName );    Write ( Message, STRING'(" is set to  ") );    Write ( Message, GenericValue );    Write ( Message, Unit );    Write ( Message, '.' & LF );    Write ( Message, ExpectedValueMsg );    Write ( Message, ExpectedGenericValue );    Write ( Message, Unit );    Write ( Message, TailMsg );    ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity;    DEALLOCATE (Message);  END GenericValueCheckMessage;  PROCEDURE GenericValueCheckMessage (    CONSTANT HeaderMsg      : IN STRING := " Attribute Syntax Error ";    CONSTANT GenericName : IN STRING := "";    CONSTANT EntityName : IN STRING := "";    CONSTANT InstanceName : IN STRING := "";    CONSTANT GenericValue : IN REAL;    CONSTANT Unit : IN STRING := "";    CONSTANT ExpectedValueMsg : IN STRING := "";    CONSTANT ExpectedGenericValue : IN STRING := "";    CONSTANT TailMsg      : IN STRING;    CONSTANT MsgSeverity    : IN SEVERITY_LEVEL := WARNING    ) IS    VARIABLE Message : LINE;  BEGIN    Write ( Message, HeaderMsg );    Write ( Message, STRING'(" The attribute ") );    Write ( Message, GenericName );    Write ( Message, STRING'(" on ") );    Write ( Message, EntityName );    Write ( Message, STRING'(" instance ") );    Write ( Message, InstanceName );    Write ( Message, STRING'(" is set to  ") );    Write ( Message, GenericValue );    Write ( Message, Unit );    Write ( Message, '.' & LF );    Write ( Message, ExpectedValueMsg );    Write ( Message, ExpectedGenericValue );    Write ( Message, Unit );    Write ( Message, TailMsg );    ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity;    DEALLOCATE (Message);  END GenericValueCheckMessage;end;library ieee;use ieee.std_logic_1164.all;package simple_simprim is  component ramb4_generic  generic ( abits : integer := 10; dbits : integer := 8 );  port (DI     : in std_logic_vector (dbits-1 downto 0);        EN     : in std_ulogic;        WE     : in std_ulogic;        RST    : in std_ulogic;        CLK    : in std_ulogic;        ADDR   : in std_logic_vector (abits-1 downto 0);        DO     : out std_logic_vector (dbits-1 downto 0)       );  end component;  component ramb4_sx_sx  generic (abits : integer := 10; dbits : integer := 8 );  port (DIA    : in std_logic_vector (dbits-1 downto 0);        DIB    : in std_logic_vector (dbits-1 downto 0);        ENA    : in std_ulogic;        ENB    : in std_ulogic;        WEA    : in std_ulogic;        WEB    : in std_ulogic;        RSTA   : in std_ulogic;        RSTB   : in std_ulogic;        CLKA   : in std_ulogic;        CLKB   : in std_ulogic;        ADDRA  : in std_logic_vector (abits-1 downto 0);        ADDRB  : in std_logic_vector (abits-1 downto 0);        DOA    : out std_logic_vector (dbits-1 downto 0);        DOB    : out std_logic_vector (dbits-1 downto 0)       );  end component;  component ramb16_sx  generic (abits : integer := 10; dbits : integer := 8 );  port (    DO : out std_logic_vector (dbits-1 downto 0);    ADDR : in std_logic_vector (abits-1 downto 0);    DI : in std_logic_vector (dbits-1 downto 0);    EN : in std_ulogic;    CLK : in std_ulogic;    WE : in std_ulogic;    SSR : in std_ulogic);  end component;  component ram16_sx_sx  generic (abits : integer := 10; dbits : integer := 8 );  port (   DOA : out std_logic_vector (dbits-1 downto 0);   DOB : out std_logic_vector (dbits-1 downto 0);   ADDRA : in std_logic_vector (abits-1 downto 0);   CLKA : in std_ulogic;   DIA : in std_logic_vector (dbits-1 downto 0);   ENA : in std_ulogic;   WEA : in std_ulogic;   ADDRB : in std_logic_vector (abits-1 downto 0);   CLKB : in std_ulogic;   DIB : in std_logic_vector (dbits-1 downto 0);   ENB : in std_ulogic;   WEB : in std_ulogic);  end component;end;library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity ramb4_generic is  generic ( abits : integer := 10; dbits : integer := 8 );  port (DI     : in std_logic_vector (dbits-1 downto 0);        EN     : in std_ulogic;        WE     : in std_ulogic;        RST    : in std_ulogic;        CLK    : in std_ulogic;        ADDR   : in std_logic_vector (abits-1 downto 0);        DO     : out std_logic_vector (dbits-1 downto 0)       );end;architecture behavioral of ramb4_generic is  type mem is array(0 to (2**abits -1))	of std_logic_vector((dbits -1) downto 0);begin  main : process(clk)  variable memarr : mem;  begin    if rising_edge(clk)then      if (en = '1') and not (is_x(addr)) then        do <= memarr(to_integer(unsigned(addr)));      end if;      if (we and en) = '1' then        if not is_x(addr) then   	  memarr(to_integer(unsigned(addr))) := di;        end if;      end if;    end if;  end process;end;library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity ramb16_sx is  generic ( abits : integer := 10; dbits : integer := 8 );  port (    DO : out std_logic_vector (dbits-1 downto 0);    ADDR : in std_logic_vector (abits-1 downto 0);    DI : in std_logic_vector (dbits-1 downto 0);    EN : in std_ulogic;    CLK : in std_ulogic;

⌨️ 快捷键说明

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