电子设计自动化技术 补充内容 基本术语 ? EDA(Electronic Design Automation) ? ASIC(Application Specific Integrated Circuit) ? FPGA(Field Programmable Gate-Array) ? CPLD(Complex Programmable Logic Device) ? SOC(System On a Chip) ? IP(Intellectual Property) ? ISP(In-System Programmable) 基本术语 ? Front-end(前端) ? Back-end(后端) ? PCB(Printed Circuit Board) ? MPU(MicroProcessor Unit) ? DSP(Digital Signal Processor/Processing) ? ROM (Read Only Memory) ? SRAM (Static Random Access Memory) ? EEPROM (Electrically Erasable Programmable ROM) VHDL的三大要点 ? VHDL程序的基本结构 ? Signal与Variable的比较 Signal vs Variable Signal vs Variable ? Signal Assignment (<=) ? receive the assign value after a period of time ? Variable Assignment ? happens immediately when the statement is executed, no delay (: =) Key points to remember ? Function ? Variables represent local storage ? Variables is updated immediately ? the updated value can be used later in the model for further computations ? Signals represent circuit interconnect ? Place of Declare ? Variables : Process, Function,Procedure ? Signal : Architecture,Package,Entity ? Visible ? Variable ? Signal : if define within Entity - visible within the whole Entity if define within Architecture - visible within the whole Architecture if define within Package - visible within the whole Package ? Make sure that you must have the correct Signal or Variable declaration Data Type VHDL is a strongly DATA TYPE ORIENT LANGUAGE Type Data ? VHDL is a very rigid Type Data Oriented Language Q : What is it means? A : Different type can not do any assignment e.g. a : in belongs to TYPE A b : out belongs to TYPE B b <= a; ----- ERROR because a and b is belonging to different types Q : Why VHDL does not allow this ? A : This is a kind of protection, so engineer will not do different TYPE assignment by mistake VHDL Data Type ? Data Type in VHDL ? Built In Data Type ? designer can free to use it, it comes with VHDL ? Customer Create Data Type ? designer need to create his own Data Type Built In Data Type ? There are some commonly used built in Data Type available ? BIT ? STD_LOGIC ? INTEGER ? What is the different ? ? How to use it ? BIT ? Example : a : in BIT; ? BIT can only have two value ? ‘0’ and ‘1’ Entity example is Port (a : in bit; b, c, d, e, f : out bit); end example; Architecture example_body of example is begin b <= a; c <= ‘1’; d <= ‘0’; e <= ‘Z’; f <= ‘X’; end example_body; OK! a and b are the same type BIT OK! c and d can take value ‘1’or ‘0’ ERROR! ‘Z’ and ‘X’ is not allow in BIT type STD_LOGIC ? Example : a : in STD_LOGIC; ? STD_LOGIC can have value ? ‘0’, ‘1’, ‘X’, ‘Z’ ? ‘X’ - - used for unknown ? ‘Z’ - - high impedance used for tri-state (capital Z, not z) ? There is some trick to use STD_LOGIC LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; Entity example is port ( a : in STD_LOGIC; b, c, d, e, f : out STD_LOGIC); end example; Architecture example_body of example is begin b <= a; c <= ‘1’; d <= ‘0’; e <= ‘X’; f < = ‘Z’; end example_body; Must have this statement use before any ENTITY Define a and b are STD_LOGIC type OK! a and b are the same type OK! ‘0’, ‘1’, ‘X’ and ‘Z’ are valid STD_LOGIC data type LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; Entity example is port ( a : in STD_LOGIC; b, c : out STD_LOGIC); end example; Architecture example_body of example is signal VCC : std_logic := ‘1’; signal GND : std_logic := ‘0’; begin process (a) if (a = ‘1’) then b <= VCC; c <= GND; else b <= GND; c <= VCC; end if; end process; end example_body; Mo re f o r ST D _ L O G I C INTEGER ? Example : a : in integer; b : in integer range 0 to 15; ? INTEGER can take any integer value ? Negative, Zero, Positive ? e.g. -7, 0, 100 Entity test is port ( a : in integer; b,c : out integer); end test; architecture test_body of test is begin b <= a; c <= 8; end test_body; OK! a and b are the same type OK! c can accept Integer value Something more on INTEGER data type Q : How many bit will be use for a : in integer ? A : It depend on the VHDL compiler. Altera VHDL compiler will take 32 bits Q : Can I have more control on the INTEGER DATA TYPE ? A : Yes. You can control the RANGE of the INTEGER a : in integer range 0 to 15; b : in integer range -7 to 0; c : out integer range -10 to 10; a can accept 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 b can accept -7, -6, -5, -4, -3, -2, -1, 0 only c can accept -10, -9, -8.....0.....1, 2, 3, ......10 Bus Implementation ? VHDL offers vector types to implement buses ? Common vector types are ? BIT_VECTOR ? STD_LOGIC_VECTOR ? Example of Bus Implementation a : in bit; b : out std_logic; BIT OPERATION a : in bit_vector(7 downto 0); b : out std_logic_vector (0 to 3); BUS OPERATION Define the size of the vector (how many bits) INTEGER VECTOR Integer a : in integer; Bus Integer ? a : in integer_vector ? Note : there is no INTEGER_VECTOR Bus Assignment ? a : out bit_vector(3 downto 0) ? a <= “1011”; ? a(2) <= ‘0’; ? a(0 to 1) <= “10” ? a(3 downto 1) <= “100” ? a(3 downto 0) <= x”A” ? a <= (others=> ‘1’) a(0) <= ‘1’ a(1) <= ‘1’ a(2) <= ‘0’ a(3) <= ‘1’ a(2) <= ‘0’ a(0) <= ‘1’ a(1) <= ‘0’ a(3) <= ‘1’ a(2) <= ‘0’ a(1) <= ‘0’ a(3) <= ‘1’ a(2) <= ‘1’ a(1) <= ‘1’ a(0) <= ‘1’ a(3) <= ‘1’ a(2) <= ‘0’ a(1) <= ‘1’ a(0) <= ‘0’ Different Data Type Assignment a : in std_logic_vector(3 downto 0); b : in integer range 0 to 15; c : out std_logic_vector(3 downto 0); d : out integer range 0 to 15; c <= a; d <= b; c <= b; d <= a; OK because c and a are the same std_logic type OK because d and b are the same integer type ERROR because c and b are different type ERROR because d and a are different type 作业 作业 某工艺库中有一元件I2XD3其实体说明如下: ENTITY I2XD3 IS PORT(i1,i2:in std_logic; q:out std_logic); END I2XD3; Sys模块的结构如下图所示,请给出sys模块 的vhdl描述。 AND I2XD3 U3 I2XD3 U2 SYS_OUT SYS_S1 EN SYS_S2 EN_C