📄 tbs_dec.vhd
字号:
--******************************************************************* ----IMPORTANT NOTICE ----================ ----Copyright Mentor Graphics Corporation 1996 - 1999. All rights reserved. ----This file and associated deliverables are the trade secrets, ----confidential information and copyrighted works of Mentor Graphics ----Corporation and its licensors and are subject to your license agreement ----with Mentor Graphics Corporation. ---- ----Use of these deliverables for the purpose of making silicon from an IC ----design is limited to the terms and conditions of your license agreement ----with Mentor Graphics If you have further questions please contact Mentor ----Graphics Customer Support. ---- ----This Mentor Graphics core (m8051 v1999.120) was extracted on ----workstation hostid _hostid_ Inventra ---- Auxiliary Procedures and Declarations used by M8051 test benches.-- (c) Copyright Mentor Graphics Corporation 1997. All Rights Reserved.--**********************************************************************-- File : tbs_dec.vhd-- Library : -- Created on : April 9th, 1996-- Purpose : This file contains all additional-- procedures required by the test bench.-- Version : 2.000-- Mod_Date : 6th July 1998-- Mod_Hist : 2.100 Updated TB test messages.-- : 2.000 Listing file formats revised.-- Open loop switch added.-- 1.002 Timing messages related to speed-- 1.001 Original-- --**********************************************************************-- Hierarchy record :-- called by : M8051 testbenches -- -- calls to : none--**********************************************************************Library IEEE;Use IEEE.std_logic_1164.all;Library STD;use std.textio.all;Library WORK;Use WORK.SPEED.all;--**********************************************************************package TBS_DEC is--******************************************************************* ----IMPORTANT NOTICE ----================ ----Copyright Mentor Graphics Corporation 1996 - 1999. All rights reserved. ----This file and associated deliverables are the trade secrets, ----confidential information and copyrighted works of Mentor Graphics ----Corporation and its licensors and are subject to your license agreement ----with Mentor Graphics Corporation. ---- ----Use of these deliverables for the purpose of making silicon from an IC ----design is limited to the terms and conditions of your license agreement ----with Mentor Graphics If you have further questions please contact Mentor ----Graphics Customer Support. ---- ----This Mentor Graphics core (m8051 v1999.120) was extracted on ----workstation hostid _hostid_ Inventra ---- File Handle Declarationsfile RESULTSUNI: TEXT is OUT "m8051uni.lis"; -- '87 standardfile RESULTSBIR: TEXT is OUT "m8051bir.lis"; -- '87 standardfile UNIREF: TEXT is IN "m8051uni.ref"; -- '87 standardfile BIRREF: TEXT is IN "m8051bir.ref"; -- '87 standardfile FAULTSUNI: TEXT is OUT "m8051uni.flt"; -- '87 standardfile FAULTSBIR: TEXT is OUT "m8051bir.flt"; -- '87 standard--file RESULTSUNI : TEXT open write_mode is "m8051uni.lis"; -- '93 standard--file RESULTSBIR : TEXT open write_mode is "m8051bir.lis"; -- '93 standard--file UNIREF: TEXT open read_mode is "m8051uni.ref"; -- '93 standard--file BIRREF: TEXT open read_mode is "m8051bir.ref"; -- '93 standard--file FAULTSUNI : TEXT open write_mode is "m8051uni.flt"; -- '93 standard--file FAULTSBIR : TEXT open write_mode is "m8051bir.flt"; -- '93 standard--file TCARDSTIM : TEXT open write_mode is "tcard_ext_rom.dat"; -- '93 standardsubtype byte is bit_vector (7 downto 0) ; subtype word is bit_vector (15 downto 0) ; subtype bit32 is bit_vector (31 downto 0) ; subtype address is bit_vector (23 downto 0) ;subtype logic_address is bit_vector (47 downto 0) ;subtype std_byte is std_logic_vector (7 downto 0) ;subtype std_word is std_logic_vector (15 downto 0) ;type std_byte_vector is array ( natural RANGE <> ) of std_byte ; type byte_vector is array ( natural RANGE <> ) of byte ; type word_vector is array ( natural RANGE <> ) of word ; type fifosize is array (natural RANGE 0 to 23,natural RANGE 0 to 1) of byte;type T_para is array (0 to 15) of byte;type data_buff is array (0 to 255) of byte;type T_memory is array (0 to 511) of byte;type ROM_word_memory is array (0 to 4095) of word;type RAM_word_memory is array (0 to 255) of word;type RAM_word_memory_32 is array (0 to 31) of word;type ROM_byte_memory is array (0 to 4096) of byte;type ROM_64k_byte_memory is array (0 to 65536) of byte;type RAM_64k_byte_memory is array (0 to 65536) of byte;type RAM_byte_memory is array (0 to 255) of byte;constant HIGH : std_logic := '1';constant LOW : std_logic := '0';-- OPEN_LOOP forces test bench to ignore reference filesconstant OPEN_LOOP : boolean := FALSE; --**********************************************************************procedure P_READ(L:inout LINE; VALUE: out std_logic_vector; GOOD : out BOOLEAN);procedure P_READ_HEX(L:inout LINE; DATA : out data_buff; ADDRESS: out integer; DATA_LEN:out integer; GOOD : out boolean);procedure birtext_out (OUTTEXT : string);procedure birdata_out(OUTCHARS : in string);--procedure birtcard_out(OUTCHARS : in string);procedure unitext_out(OUTTEXT : in string);procedure unidata_out(OUTCHARS : in string);procedure birdata_in(REFCHARS : out string);procedure unidata_in(REFCHARS : out string);procedure birtitle_out;procedure unititle_out;procedure birtitle_in;procedure unititle_in;procedure checkok(CHARS,REFCHARS:in string;FAULTFLAG:out bit);procedure birreportfault( CHARS,REFCHARS : in string);procedure unireportfault( CHARS,REFCHARS : in string);procedure report_status(BIRSTATUS,UNISTATUS: inout bit);function Convert_to_Int ( value : in bit_vector ) return natural ;function convertlogicbit (logbit: std_logic) return character;function convertlogihex (logvect: std_logic_vector(3 downto 0)) return character;function eightbit(logvect8:std_logic_vector(7 downto 0)) return string;function sixteenbit(logvect16:std_logic_vector(15 downto 0)) return string;end TBS_DEC;--**********************************************************************package body TBS_DEC is--******************************************************************* ----IMPORTANT NOTICE ----================ ----Copyright Mentor Graphics Corporation 1996 - 1999. All rights reserved. ----This file and associated deliverables are the trade secrets, ----confidential information and copyrighted works of Mentor Graphics ----Corporation and its licensors and are subject to your license agreement ----with Mentor Graphics Corporation. ---- ----Use of these deliverables for the purpose of making silicon from an IC ----design is limited to the terms and conditions of your license agreement ----with Mentor Graphics If you have further questions please contact Mentor ----Graphics Customer Support. ---- ----This Mentor Graphics core (m8051 v1999.120) was extracted on ----workstation hostid _hostid_ Inventra ----**********************************************************************function bit_val(c: in character) return bit_vector isvariable nible : bit_vector (3 downto 0);begincase c iswhen '0' => nible(3 downto 0) := "0000";when '1' => nible(3 downto 0) := "0001";when '2' => nible(3 downto 0) := "0010";when '3' => nible(3 downto 0) := "0011";when '4' => nible(3 downto 0) := "0100";when '5' => nible(3 downto 0) := "0101";when '6' => nible(3 downto 0) := "0110";when '7' => nible(3 downto 0) := "0111";when '8' => nible(3 downto 0) := "1000";when '9' => nible(3 downto 0) := "1001";when 'A' => nible(3 downto 0) := "1010";when 'B' => nible(3 downto 0) := "1011";when 'C' => nible(3 downto 0) := "1100";when 'D' => nible(3 downto 0) := "1101";when 'E' => nible(3 downto 0) := "1110";when 'F' => nible(3 downto 0) := "1111";when others => nible(3 downto 0) := "0000";end case;return nible;end;--**********************************************************************function int_val(c: in character) return integer isbegincase c iswhen '0' => return 0;when '1' => return 1;when '2' => return 2;when '3' => return 3;when '4' => return 4;when '5' => return 5;when '6' => return 6;when '7' => return 7;when '8' => return 8;when '9' => return 9;when 'A' => return 10;when 'B' => return 11;when 'C' => return 12;when 'D' => return 13;when 'E' => return 14;when 'F' => return 15;when others => return 0;end case;end;--**********************************************************************function extract_hex_data ( L: string) return integer isvariable INT_DATA : integer;begin INT_DATA := int_val(L(1)) * 16 + int_val(L(2));return (INT_DATA);end;--**********************************************************************function extract_hex_data (L: string) return byte isvariable data_byte: byte;begin data_byte(7 downto 4) := bit_val(L(1)) ; data_byte(3 downto 0) := bit_val(L(2)) ;return(data_byte);end;--**********************************************************************function Convert_to_Int ( value : in bit_vector ) return natural isvariable int_val : natural := 0 ;variable bit_val : natural ;beginfor i in value'range loop if value (i) = '1' then bit_val := 1 ; else bit_val := 0 ; end if ; int_val := 2**i * bit_val + int_val ; end loop ;return int_val ;end Convert_to_Int ;--**********************************************************************function convertlogicbit (logbit: std_logic) return character isbegin case logbit is when 'U' => return 'X'; when 'X' => return 'X'; when '0' => return '0'; when '1' => return '1'; when 'Z' => return 'Z'; when 'W' => return 'W'; when 'L' => return 'L'; when 'H' => return 'H'; when '-' => return '*'; end case;end convertlogicbit;--**********************************************************************function convertlogihex (logvect: std_logic_vector(3 downto 0)) return character isbegin case logvect is when "0000" =>return '0'; when "0001" =>return '1'; when "000H" =>return '1'; when "0010" =>return '2'; when "00H0" =>return '2'; when "0011" =>return '3'; when "001H" =>return '3'; when "00H1" =>return '3'; when "00HH" =>return '3'; when "0100" =>return '4'; when "0H00" =>return '4'; when "0101" =>return '5'; when "010H" =>return '5'; when "0H01" =>return '5'; when "0H0H" =>return '5'; when "0110" =>return '6'; when "01H0" =>return '6'; when "0H10" =>return '6'; when "0HH0" =>return '6'; when "0111" =>return '7'; when "011H" =>return '7'; when "01H1" =>return '7'; when "01HH" =>return '7'; when "0H11" =>return '7'; when "0H1H" =>return '7'; when "0HH1" =>return '7'; when "0HHH" =>return '7'; when "1000" =>return '8'; when "H000" =>return '8';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -