VHDL设计方法-用VHDL语言实现可编程数字系统设计.ppt_第1页
VHDL设计方法-用VHDL语言实现可编程数字系统设计.ppt_第2页
VHDL设计方法-用VHDL语言实现可编程数字系统设计.ppt_第3页
VHDL设计方法-用VHDL语言实现可编程数字系统设计.ppt_第4页
VHDL设计方法-用VHDL语言实现可编程数字系统设计.ppt_第5页
免费预览已结束,剩余131页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

vhdl设计方法,用vhdl语言实现可编程数字系统设计,vhdl设计方法,vhdl概述 vhdl的设计单元 vhdl的基本语法结构,第一部分,vhdl 概述,vhdl的含义,vhsic (very high speed integrated circuit) hardware description language,vhdl历史,1982年, 诞生于美国国防部赞助的vhsic项目 1987年底,vhdl被ieee和美国国防部确认为标准硬件描述语言 ,即ieee-1076(简称87版) 1993年,ieee对vhdl进行了修订,公布了新版本的vhdl,即ieee标准的1076-1993(1164)版本 1996年,ieee-1076.3成为vhdl综合标准,vhdl特点,与其他的硬件描述语言相比,vhdl具有更强的行为描述能力 vhdl丰富的仿真语句和库函数,使得在设计的早期就能查验设计系统的功能可行性,随时可对设计进行仿真模拟 vhdl语句的行为描述能力和程序结构决定了他具有支持大规模设计的分解和已有设计的再利用功能 对于用vhdl完成的一个确定的设计,可以利用eda工具进行逻辑综合和优化,并自动的把vhdl描述设计转变成门级网表 vhdl对设计的描述具有相对独立性,设计者可以不懂硬件的结构,也不必管理最终设计实现的目标器件是什么,而进行独立的设计,vhdl与其他hdl比较,vhdl “告诉我你想要电路做什么,我给你提供能实现这个功能的硬件电路” verilog 和vhdl类似 abel、ahdl “告诉我你想要什么样的电路,我给你提供这样的电路”,典型的综合流程,典型的仿真流程,第二部分,vhdl的设计单元,vhdl的设计单元,entity(实体) 用来说明模型的外部输入输出特征 architecture(构造体) 用来定义模型的内容和功能 每一个构造体必须有一个实体与它相对应,所以两者一般成对出现,实体,类似一个“黑盒”,实体描述了“黑盒”的输入输出口,实体举例,entity black_box is generic ( constant width : integer := 7;); port ( clk, rst: in std_logic; d: in std_logic_vector(width downto 0); q: out std_logic_vector(width downto 0); co: out std_logic); end black_box;,generic,类属参量 一种端口界面常数,用来规定端口的大小、实体中子元件的数目等 与常数不同,常数只能从内部赋值而类属参量可以由实体外部赋值 数据类型通常取integer或time 综合器仅支持数据类型为整数的类属值。,ports,端口(port)是实体的一部分 port 类似于器件的管脚,主要用于信号的传输 port 一般有 name, mode, 和 type 端口说明格式 port (signal name:mode type bus :=表达式 , ),端口类型,in: 数据只能从端口流入实体 out: 数据只能从端口流出实体 inout: 数据从端口流入或流出实体 buffer: 数据从端口流出实体,同时可被内部反馈,数据类型,bit :位类型,其值只能为 0或 1 bit_vector :位矢量类型,包含一组位类型 boolean:布尔类型,其值可为 true或false integer:整型,范围为-214783647到214783647(232),综合时,要对范围加以限制。常用于循环语句的循环次数、常量、数学函数或模式仿真 natural:自然数类型,整型的子类型,含零和正整数 positive:正整数类型,整型的子类型,含非零和非负整数 real:浮点类型,范围为:-1.0e38到1.0e38很多综合器不支持该类型,数据类型,枚举类型:用户定义的数据类型 例: type traffic_light is (red, yellow,green ) type int is range 0 to 100 数组类型:分一维数组和二维数组,限定性和非限定性数组 例: type bit_vector is array (natural range) of bit; type word is arrary (31 downto 0) of bit; subtype:子类型,一般用来对其父类型加以限制 例: subtype std_logic is resolved std_ulogic time:时间类型,范围和整型一样,表达时要包括数值和单位两部分。单位包括:fs、ps、ns、us、ms、sec、min、hr。一般用于仿真,数据类型,记录类型 type month_name is (jan,fab,mar,apr,may,jun,jul,aug,sep,oct,nov,dec); type date is record day : integer range 1 to 31; month : month_name; year : integer range 0 to 3000; end record; variable today : date; today : =(15, may, 1995);,std_logic数据类型,ieee 1164中定义的一种数据类型,它包含9种取值分别为: u 未初始化 用于仿真 x 强未知 用于仿真 0 强0 用于综合与仿真 1 强1 用于综合与仿真 z 高阻 用于综合与仿真 w 弱未知 用于仿真 l 弱0 用于综合与仿真 h 弱1 用于综合与仿真 _ 忽略 用于综合与仿真,std_logic数据类型,它是数字电路设计的工业标准逻辑类型 它增加了vhdl语言编程、综合和仿真的灵活性 在多值逻辑系统中std_logic和 std_logic_vector 用于取代 bit 和 bit_vector 若电路中有三态逻辑(z) 必须用std_logic 和 std_logic _vector 要使用这种类型代码中必须申明库和程序包说明语句 library ieee; use ieee.std_logic_1164.all;,练习一,编写包含以下内容的实体代码 端口 d 为12位输入总线 端口 oe 和 clk 都是1位输入 端口 ad 为 12位双向总线 端口 a为12位输出总线 端口 int 是1位输出 端口 as 是一位输出同时被用作内部反馈,练习一答案,library ieee; use ieee.std_logic_1164.all; entity my_design is port ( d: in std_logic_vector(11 downto 0); oe, clk: in std_logic; ad: inout std_logic_vector(11 downto 0); a: out std_logic_vector(11 downto 0); int: out std_logic; as: buffer std_logic); end my_design;,构造体,用来描述实体的内部结构和逻辑功能 必须和实体(entity)相联系 一个实体(entity)可以有多个构造体 构造体的运行是并发的 构造体描述方式包括: 行为描述 结构描述 混合描述,实体和构造体之间的关系,input 1,input n,output 1,output n,实体,a b c d sel,mux_out,2,构造体结构图,构造体行为描述举例,2 x 8 input and gate: entity black_box is port ( a, b: in std_logic_vector(7 downto 0); y: out std_logic_vector(7 downto 0); end black_box; architecture example of black_box is begin y = a and b; end example;,数据对象常数,指在设计中不会变的值 改善代码可读性,便于代码修改 必须在程序包、实体、构造体或进程的说明区域加以说明 一般要赋一初始值 保留字constant 例: constant width : integer :=8,数据对象信号,可代表连线、内连元件、或端口 用“=”来给信号赋值 signal signal count: bit_vector(3 downto 0); if rising_edge(clk) then count=count+1; end if; 信号在package、entity、architecture 中声明,数据对象信号,信号举例,library ieee; use ieee.std_logic_1164.all; entity simp is port(a, b, c, d : in std_logic; g : out std_logic); end simp; architecture logic of simp is signal e,f : std_logic; begin e = a or b; f=not(c or d); g =e and f; end logic;,信号赋值,signal temp : std_logic_vector (7 downto 0); 整体赋值: temp = “10101010”; temp = x”aa” ; 逐位赋值: temp(7) = 1; 多位赋值: temp (7 downto 4) = “1010”;,数据对象变量,仅用于进程和子程序 必须在进程和子程序的说明性区域说明 不能表达连线和存储元件 保留字variable variable tmp : bit; tmp:=1;,变量赋值,整体赋值: temp := “10101010”; temp := x”aa” ; 逐位赋值: temp(7) := 1; 多位赋值 temp (7 downto 4) := “1010”;,信号和变量的作用范围,architecture,信号和变量的区别,算术运算符,关系运算符,逻辑运算符,其他运算符,运算优先级,* abs not * / mod rem +正 -负 + - & sll sla srl sra rol ror = = and or nand nor xor xnor,高,低,运算重载,若两信号类型不同,不能将一个信号的值赋给另一信号 数据转换必须要用运算重载 一般可用ieee .1164中的标准重载函数实现 library ieee; use ieee_std_logic_1164.all; use ieee_std_logic_arith.all; use ieee_std_logic_unsigned.all use ieee_std_logic_signed.all,并行语句,并行语句1,构造体,并行语句2,并行语句3,signal,signal,并行语句,vhdl语言与传统软件描述语言最大的不同 有多种语句格式,包括:并行信号赋值语句、进程语句、块语句、条件信号赋值语句、元件例化语句、生成语句、并行过程调用语句 各种并行语句在结构体中的执行是同步进行的,或者说是并行运行的,其执行方式与书写的顺序无关。 在执行中,并行语句之间可以有信息往来,也可以是互为独立、互不相关、异步运行的(如多时钟情况)。 每一并行语句内部的语句运行方式可以有两种不同的方式,即并行执行方式(如块语句)和顺序执行方式(如进程语句)。,布尔表达式,vhdl支持所有的标准逻辑运算符 and, or, not, xor, xnor, nand 例: x =(a and not(s(1) and not(s(0) or (b and not(s(1) and s(0) or (c and s(1) and not(s(0) or (d and s(1) and s(0) ; y = a or b or c;,with_select_then选择信号语句,所有的“when”子句必须是互斥的 一般用 “when others”来处理未考虑到的情况 只有一个参考信号和赋值符 (=) 每一子句结尾是逗号,最后一句是分号 with selection_signal select signal_name = value_1 when value_a, value_2 when value_b, . value_n when value_n, value_x when others;,with_select_then语句举例,library ieee; use ieee.std_logic_1164.all; entity cmpl_sig is port ( a, b,c,d,s : in std_logic; x : out std_logic); end cmpl_sig; architecture logic of cmpl_sig is begin with s select x =a when “00”, b when “01”, c when “10”, d when others;,with_select_then语句举例,每个when子句可以包含多个条件: with s select x = a when ”000” | “001” | “010”, b when “101“ | “111“, c when others;,when_else选择信号语句,根据指定条件对信号赋值,条件可以为任意表达式 根据条件的出现的先后次序隐含优先权 最后一个 else子句隐含了所有未列出的条件 每一子句的结尾没有标点,只有最后一句有分号 signal_name = value_1 when condition1 else value_2 when condition2 else . value_n when conditionn else value_x;,when_else语句举例,x = a when (s = “00”) else b when (s = “01”) else c when (s = “10”) else d ;,when_else语句举例,j = w when (a = 1) else x when (b = 1) else y when (c = 1) else z when (d = 1) else 0 ;,进程语句,vhdl中最重要的语句,具有并行和顺序行为的双重性 进程和进程语句之间是并行关系 进程内部是一组连续执行的顺序语句 进程语句与构造体中的其余部分进行信息交流是靠信号完成的 基本格式: 进程标号: process (信号敏感表) is 说明区 begin 顺序语句 end process 进程标号;,进程语句,信号敏感表,进程赖以启动的敏感表。对于表中列出的任何信号的改变,都将启动进程,执行进程内相应顺序语句 一些vhdl综合器,综合后,对应进程的硬件系统对进程中的所有输入的信号都是敏感的,不论在源程序的进程中是否把所有的信号都列人敏感表中 为了使软件仿真与综合后的硬件仿真对应起来,应当将进程中的所有输人信号都列入敏感表中,顺序语句,每一条顺序语句的执行(指仿真执行)顺序是与它们的书写顺序基本一致的 顺序语句只能出现在进程(process) 、函数(funcation)和过程(procedure)中 顺序语句包括:赋值语句、流程控制语句、等待语句、子程序调用语句、返回语句、空操作语句,library ieee; use ieee.std_logic_1164.all; entity if_case is port ( a, b, c, d : in std_logic; sel : in std_logic_vector(1 downto 0); y, z : out std_logic); end if_case; architecture logic of if_case is begin if_label: process(a, b, c, d, sel) begin if sel=“00“ then y = a; elsif sel=“01“ then y = b; elsif sel=“10“ then y = c; else y = d; end if; end process if_label;,case_label: process(a, b, c, d, sel) begin case sel is when “00“ =z z z z z = 0; end case; end process case_label; end logic;,进程语句举例,敏感表举例,latchlabel: process(oe) begin if oe=1 then y = a; end if; end process if_label;,敏感表举例,latchlabel: process(oe,a) begin if oe=1 then y = a; end if; end process if_label;,顺序赋值语句举例,library ieee; use ieee.std_logic_1164.all; entity ttt1 is port (en : in std_logic; y : out std_logic_vector(0 to 7); end ttt1; architecture logic of ttt1 is signal s1,s2 :std_logic; signal t:std_logic_vector (0 to 7); begin process(s1,s2,en) variable v1,v2:std_logic;,begin if en=1 then v1:=1; v2:=1; s1=1; s2=1; t(0)=v1; t(1)=v2; t(2)=s1; t(3)=s2; v1:=0; v2:=0; s2=0; t(4)=v1; t(5)=v2; t(6)=s1; t(7)=s2; end if; end process; y=t; end;,顺序赋值语句举例,顺序赋值语句举例,architecture reg1 of reg1 is signal a, b : bit; begin process (clk) begin if rising_edge(clk) then a = d; b = a; q = b; end if; end process; end reg1;,顺序赋值语句举例,entity reg1 is port ( d : in bit; clk : in bit; q : out bit); end reg1; architecture reg1 of reg1 is signal a, b : bit; begin process (clk) begin if rising_edge(clk) then a = d; b = a; end if; end process; q = b; end reg1;,顺序赋值语句举例,entity reg1 is port ( d : in bit; clk : in bit; q : out bit); end reg1; architecture reg1 of reg1 is variable a, b : bit; begin process (clk) begin if rising_edge(clk) then a = d; b = a; q = b; end if; end process; end reg1;,在时序电路中的变量赋值,变量在if语句中被赋值,以用来表示随时钟的变化,不会产生触发器 变量只代表临时存储,不反映实际硬件 变量可用在表示一数据立即变化的表达式中,然后再将变量的值赋给信号,if_then_else语句,只能在进程内使用 至少应有一个条件句,条件句必须由布尔表达式构成。 根据条件句产生的判断结果true或false,有条件地选择执行其后的顺序语句。,if 条件句 then 顺序语句 endif,if 条件句 then 顺序语句 else 顺序语句 endif,if 条件句 then 顺序语句 elsif 条件句 then 顺序语句 else 顺序语句 endif,if_then_else语句,mux4_1: process (a, b, c, d, s) begin if s = “00” then x = a ; elsif s = “01” then x = b ; elsif s = “10” then x = c ; else x = d ; end if; end process mux4_1 ;,if_then_else语句,ex1: process (a, b) begin if a=1 then c=0; - if a and b are end if; - both 1 then if b=1 then c=1; - b has priority end if; - so c = 1; end process ex1; ex2: process (a, b) begin if b=1 then c=1; - if a and b are end if; - both 1 then if a=1 then c=0; - a has priority end if; - so c = 0; end process ex2;,case_when语句,表达式可以是一个整数类型或枚举类型的值,也可以是由这些数据类型的值构成的数组 条件句中的选择值必在表达式的取值范围内。 除非所有条件句中的选择值能完整覆盖case语句中表达式的取值,否则最末一个条件句中的选择必须用“others”表示。 case语句中每一条件句的选择值只能出现一次,不能有相同选择值的条件语句出现。 case语句执行中必须选中,且只能选中所列条件语句中的一条。,case_when语句,mux4_1: process (a,b,c,d,s) begin case s is when “00“ = x x x x = d; end case; end process mux4_1;,loop语句,基本格式: loop标号: 重复模式 loop 顺序语句; end loop loop标号,while loop 顺序语句 end loop;,for in loop 顺序语句 end loop;,loop标号: loop 顺序语句 exit loop标号 ; end loop;,next loop标号 when 语句,loop语句示例,library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity shift4 is port ( shft_lft : in std_logic; d_in : in std_logic_vector(3 downto 0); q_out : out std_logic_vector(7 downto 0); end shift4; architecture logic of shift4 is begin process(d_in, shft_lft) variable shft_var : std_logic_vector(7 downto 0);,begin shft_var(7 downto 4) := “0000“; shft_var(3 downto 0) := d_in; if shft_lft = 1 then for i in 7 downto 4 loop shft_var(i) := shft_var(i-4); end loop; shft_var(3 downto 0) := “0000”; else shft_var := shft_var; end if; q_out = shft_var; end process; end logic;,组合电路举例,library ieee; use ieee.std_logic_1164.all; entity compare is port ( a, b: in std_logic_vector(0 to 3); aeqb: out std_logic); end compare; architecture archcompare of compare is begin aeqb = 1 when a = b else 0; end archcompare;,组合电路举例,library ieee; use ieee.std_logic_1164.all; entity compare is port ( a, b: in std_logic_vector(0 to 3); aeqb: out std_logic); end compare; architecture archcompare of compare is begin aeqb = not( (a(0) xor b(0) or (a(1) xor b(1) or (a(2) xor b(2) or (a(3) xor b(3); end archcompare;,组合电路举例,architecture archcompare of compare is begin comp: process (a, b) begin if a = b then aeqb = 1; else aeqb = 0; end if; end process comp; end archcompare;,组合电路举例,architecture archincomplete of incomplete is begin im_mem: process (a,b) begin if a = 1 then c = b; end if; end process im_mem; end archincomplete;,组合电路举例,architecture archcomplete of complete is begin no_mem: process (a, b) begin if a = 1 then c = b; else c = 0; end if; end process no_mem; end archcomplete;,避免引入锁存效应,用else子句结束if.then. 语句 在case语句中覆盖所有的可能条件或在case的最后用when others子句 case select is when “100“ = key key key key = none; end case;,时序电路举例,library ieee; use ieee.std_logic_1164.all; entity dff_a is port ( d : in std_logic; clk : in std_logic; q : out std_logic); end dff_a; architecture behavior of dff_a is begin process (clk) begin if clkevent and clk = 1 then q = d; end if; end process; end behavior;,时序电路举例,architecture behavior of dff_clr is begin process(clk, clr) begin if clr = 0 then q = 0; elsif rising_edge(clk) then q = d; end if; end process; end behavior;,时序电路举例,library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; upcount: process (clk, rst) begin if rst = 1 then count = x“0“ ; elsif rising_edge(clk) then if load = 1 then count = data; else count = count + 1; end if; end if; end process upcount;,时序电路举例,architecture logic of count_a is begin process(rst, clk) variable tmp_q : std_logic_vector(15 downto 0); begin if rst = 0 then q = 0; elsif rising_edge(clk) then if updn = 1 then tmp_q := tmp_q + 1; else tmp_q := tmp_q - 1; end if; q = tmp_q; end if; end process; end logic;,三态电路举例,entity test_three is port( oe : in std_logic; data : out std_logic_vector(0 to 7); end test_three; architecture archtest_three of test_three is begin process (oe) begin if (oe=1) then data = “01100100“; else data = “zzzzzzzz“; end if; end process; end archtest_three;,双向口举例,entity ldcnt is port ( clk, ld, oe: in std_logic; count: inout std_logic_vector(7 downto 0); end ldcnt; architecture archldcnt of ldcnt is signal int_count: std_logic_vector(7 downto 0); begin cnt: process (clk) begin if rising_edge(clk) then if ld=1 then int_count = count; else int_count = int_count + 1; end if; end if; end process cnt ;,双向口举例,outen: process (oe, int_count) begin if oe = 1 then count z) ; end if ; end process outen; end archldcnt;,别 名,标志一个以存在的数据对象 引用别名等效于引用原始数据对象 给别名赋值等效于给原始数据赋值 常作为标识一组数据类型 保留字:alias alias bank:bit_vector(0 to 3) is address(24 to 27);,状态机设计,二进制状态机编码,状态机的每一个状态用二进制位来编码 例:实现4状态的状态机,其二进制编码可为 状态1“00” 状态2“01” 状态3“10” 状态4“11” 特点 触发器使用较少,速度较慢,可能产生两位同时翻转的情况。如:“01”“10”,格雷码状态机编码,格雷码编码每次仅一个状态位的值发生变化 例:实现4状态的状态机,其格雷码编码可为 状态1“00” 状态2“01” 状态3“11” 状态4“10” 特点 触发器使用较少,速度较慢,不会产生两位同时翻转的情况。当状态位的输出被异步应用时,格雷码编码是特别有益的,one hot状态机编码,one hot的编码方案对每一个状态采用一个触发器,即4个状态的状态机需4个触发器。同一时间仅1个状态位处于逻辑“l”电平 例:实现4状态的状态机,其one hot编码可为 状态1“0001” 状态2“0010” 状态3“0100” 状态4“1000” 特点 触发器使用较多,但逻辑简单,速度快,编码方式的选择,根据状态机复杂程度 状态特别多的系统只能采用2进制编码或格雷码编码 根据器件类型 fpga一般采用one hot编码,cpld一般采用2进制编码或格雷码编码 从非法状态中退出 在选择编码方案时,必须考虑状态机可能进入的潜在的非法状态数目。如果违反了状态位触发器的建立或保持时间,又没有定义所有可能出现的状态,则你的设计会终止在非法状态上。,状态机设计实体描述,library ieee; use ieee.std_logic_1164.all; entity state_machine is port ( clock, reset: in std_logic; timer1, timer2, timer3: in std_logic; r, y, g: out std_logic); end state_machine;,状态机设计方案一,architecture arch_1 of state_machine is type traffic_states is (red, yellow, green); signal sm: traffic_states; begin fsm: process (clock, reset) begin if reset = 1 then sm if timer1=1 then sm if timer2=1 then sm = yellow; end if;,状态机设计方案一,when yellow = if timer3=1 then sm sm = red; end case; end if; end process fsm; r = 1 when (sm = red) else 0; g = 1 when (sm = green) else 0; y = 1 when (sm = yellow) else 0; end arch_1;,方案分析,状态机设计方案二,architecture arch_2 of state_machine is type traffic_states is (red, yellow, green); signal sm: traffic_states; begin fsm: process (clock, reset) begin if reset = 1 then sm if timer1=1 then sm = green; r=0; g=1; y=0; else sm = red;r=1; g=0; y=0; end if;,状态机设计方案二,when green = if timer2=1 then sm if timer3=1 then sm sm = red; end case; end if; end process fsm; end arch_2;,方案二分析,状态机设计方案三,architecture arch_3 of state_machine is signal sm: std_logic_vector(2 downto 0) ; constant red:std_logic_vector(2 downto 0) := ”100“ ; constant green: std_logic_vector(2 downto 0) := “010“ ; constant yellow: std_logic_vector(2 downto 0) := “001“ ; begin fsm: process (clock, reset) begin if reset = 1 then sm if timer1=1 then sm = green; else sm = red; end if;,状态机设计方案三,when green = if timer2=1 then sm if timer3=1 then sm sm = red; end case; end if; end process fsm; r = sm(2); g = sm(1); y = sm(0); end arch_3;,方案三分析,vhdl 结构化设计基本单元,components 已设计好的一个实体 可被其它模块或高层模块引用 packages 类似于库,使实体和结构体内的数据类型、常量、子程序等对于其他设计单元可见,包括包体单元和说明单元 libraries 存放预先编译好的程序包和数据的集合体,结构化设计的方法比较,b,sel,mux2to1,a,c,symbol component,schematic entity/architecture,top level schematic top level entity/architecture,r,toplevel,q,s,c,b,mux2to1,a,sel,t,p,层次化设计管理,package 和component 举例,library ieee; use ieee.std_logic_1164.all; package mymuxpkg is component mux2to1 port ( a, b, sel: in std_logic; c: out std_logic); end component; end mymuxpkg;,library ieee; use ieee.std_logic_1164.all; entity mux2to1 is port ( a, b, sel: in std_logic; c: out std_logic); end mux2to1; architecture archmux2to1 of mux2to1 is begin c = (a and not sel) or (b and sel); end archmux2to1;,package and component declaration file (vhdl),entity/architecture file (vhdl),元件例化举例,library ieee; use ieee.std_logic_1164.all; entity toplevel is port (s: in std_logic; p, q, r: in std_logic_vector(2 downto 0); t: out std_logic_vector(2 downto 0); end toplevel; use work.mymuxpkg.all; architecture archtoplevel of toplevel is signal i: std_logic_vector(2 downto 0); begin m0: mux2to1 portmap (a=i(2), b=r(0), sel=s, c=t(0); m1: mux2to1 portmap (c=t(1), b=r(1), a=i(1), sel=s); i = p and not q; end archtoplevel;,第四部分,在maxplus ii中使用vhdl输入方式,altera vhdl,max+plus ii 支持 vhdl87 和vhdl93 max+plus ii 只提供这两个 ieee 标准的子集 详细信息可参考altera的vhdl手册,vhdl语言输入,vhdl语言输入,建立vhdl源文件,vhdl语言输入,将你的 vhdl 文件保存位 name.vhd,vhdl语言输入,选择vhdl语言编码标准,vhdl语言输入,编译vhdl文件,vhdl语言输入,关键词用蓝色显示,打开此功能,vhdl语言输入,编译错误定位,vhdl模板,建立vhdl元件符号,输入 vhdl 代码,层次化设计方法进行项目顶层设计,第五部分,将vhdl代码实现到eab,问题,设计一个状态机用于从串行数据流中检测 “011011” 序列 检测到该序列后输出为“1”,match,serial_in,clk,vhdl state machine,vhdl代码,library ieee; use ieee.std_logic_1164.all; package your_own_type is type t_state is (idle,state0,state01,state011, state0110,state01101, state011011); end your_own_type; library ieee; use ieee.std_logic_1164.all; use work.your_own_type.all; entity stmh is port (clk, serial_in, reset : in std_logic; match : out std_logic); end stmh; architecture body_stmh of stmh is signal present_state : t_state; begin process(clk,serial_in, present_state) begin if (reset = 1) then present_state = idle; else,when state01101 = if (serial_in = 1) then p

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论