GENERIC类属说明语句

合集下载

VHDL课件

VHDL课件

2) 半加器的逻辑描述 LIBRARY IEEE; -- IEEE库的使用说明 USE IEEE.STD_LOGIC_1164.ALL; ENTITY h_adder IS --实体h_adder的说明 PORT(a,b:IN STD_LOGIC; co,so:OUT STD_LOGIC); END ENTITY h_adder; ARCHITECTURE art2 OF h_adder IS -- 实体h_adder的结构体art2的说明 BEGIN so<=(a OR b) AND (a NAND b); co<=NOT (a NAND b); END ARCHITECTURE art2;
(5) 在结构体art3中,COMPONENT→END COMPONENT 语句结构对所要调用的或门和半加器两元件 作了声明(COMPONENT DECLARATION),并由SIGNAL 语句定义了三个信号d、e和f,作为中间信号转存点,以利于 几个器件间的信号连接。 “PORT MAP( )”语句称为元件例化语句(COMPONENT INSTANTIATION)。所谓例化,在电路板上,相当于往上 装配元器件;在逻辑原理图上,相当于从元件库中取了一个 元件符号放在电路原理图上,并对此符号的各引脚进行连线。 例化也可理解为元件映射或元件连接,MAP是映射的意思。 例如,语句“U2:h_adder PORT MAP(a=>e,b=>cin, co=>f,so=>sum)”表示将实体h_adder描述的元件U2的 引脚信号a、b、co和so分别连向外部信号e、cin、f和sum。 符号“=>”表示信号连接。
3.1.3 VHDL程序设计约定 为了便于程序的阅读和调试,对VHDL程序设计特作如下约 定: (1) 语句结构描述中方括号“[ ]”内的内容为可选内容。 (2) 对于VHDL的编译器和综合器来说,程序文字的大小 写是不加区分的。 (3) 程序中的注释使用双横线“--”。在VHDL程序的任何 一行中,双横线“--”后的文字都不参加编译和综合。 (4) 为了便于程序的阅读与调试,书写和输入程序时,使 用层次缩进格式,同一层次的对齐,低层次的较高层次的缩 进两个字符。 (5) 考虑到MAX+plusII要求源程序文件的名字与实体名 必须一致,因此为了使同一个VHDL源程序文件能适应各个 EDA开发软件上的使用要求,建议各个源程序文件的命名均 与其实体名一致。

VHDL学习笔记

VHDL学习笔记

VHDL学习笔记一、VHDL简介VHDLVHDL(Very High Speed Hardware Description Language)超高速硬件描述语言。

VHDL是工业标准的文本格式语言,支持仿真和综合,是一种并发执行的语言。

VHDL支持结构化设计和TOP-DOWN设计方法。

其描述与工艺无关,支持多风格的描述方法。

VHDL的历史:•1982年,诞生于美国国防部赞助的VHSIC(Very High Speed Integrated Circuit)项目。

•1987年底,VHDL被IEEE和美国国防部确认无标准硬件描述语言,即IEEE-1076(简称87版)•1993年,IEEE对VHDL进行了修订,共不了新版本的VHDL,即IEEE标准的1076-1993(1164)版•1996年,IEEE-1076.3成为VHDL综合标准。

VHDL的基本设计单元1.Library和Package(库和程序包) --库主要存放已经编译过的实体、结构体、程序包和配置; --程序包主要用来存放各个设计都能共享的数据类型、子程序说明、属性说明、元件说明等部分。

2.Entity(实体)--用来说明模型的外部特征3.Architecture(结构体/构造体)--来定义模型的功能VHDL基本设计单元(例子)例:用VHDL语言设计一个2选1的数据选择器--实体声明 entity mux21 is port(a,b:in bit;--输入-数据(bit类型) s:in bit;--输入-选择信号(bit类型) y:out bit--输出(bit类型) ); end entity mux21; --结构体(实体内部逻辑) architecture one of mux21 is signal d,e:bit;--临时中间变量 begin d<=a and (not s); --左边三行可以用下面的语句代替。

e<= b and s; --y<= a when s=’0’ else y<= d or e; -- b; end architecture one;二、VHDL结构库和程序包•库库是专门用于存放预先编译好的程序包的地方,对应一个文件目录,程序包的文件就放在此目录中,其功能相当于共享资源的仓库,所有已完成的设计资源只有存入一些“库”内才可以被其他实体共享。

第1章VHDL语言基础

第1章VHDL语言基础
(Bit)、位矢量型(Bit-vector)和整数型(Integer)等。 ➢ 在实用中,端口描述中的数据类型主要有两类:位(BIT)和
位矢量(BIT_VECTOR)。若端口定义为BIT,则其信号值 是一个1位的二进制数,取值只能是0或1;若端口定义为 BIT_VECTOR,则其信号值是一组二进制数。
➢ 在电路中,如果实体代表一个器件符号,则结构体描述了 这个符号的内部行为。当把这个符号例化成一个实际的器 件安装到电路上时,则需用配置语句为这个例化的器件指 定一个结构体(即指定一种实现方案),或由编译器自动选一 个结构体。
1. 结构体的一般语句格式 ARCHITECTURE 结构体名 OF 实体名 IS [说明语句;] BEGIN [功能描述语句;] END [ARCHITECTURE] [结构体名];
1.1 VHDL程序基本结构
一、VHDL程序设计约定 ➢ 语句结构描述中方括号“[ ]”内的内容为可选内容。 ➢ 对于VHDL的编译器和综合器来说,程序文字的大小写是不
加区分的。 ➢ 程序中的注释使用双横线“- -”。 ➢ 源程序命名与实体同名(MAX+plus Ⅱ要求)。
二、VHDL程序设计引例( 74LS00的设计 )
③ 信号赋值语句将设计实体内的处理结果向定义的信号或界面 端口进行赋值。
④ 子程序调用语句用于调用一个已设计好的子程序。
⑤ 元件例化语句对其他的设计实体作元件调用说明,并将此元 件的端口与其他的元件、信号或高层次实体的界面端口进行 连接。
A
A NAND2
Y
Y
B
B
(a)
A1
A NAND2
U1 Y
Y1
B1
B
A2
A NAND2

EDA - 副本

EDA - 副本

图4-2 结构体的一般构造图
VHDL语言 第4章 VH中,实体、结构体、端口、元件 和对象等用户的定义项,都必须用标识符来命名。 VHDL的标识符是符合以下规则的字符序列: 1.英文字母(‘a’-‘z’,‘A’-‘Z’)、数字(‘0’-‘9’) 和下划线(‘_’); 2.起始字符必须为英文字母; 3.下划线(‘_’)的前后必须有英文字母或者数字; 4.标识符不区分大小写。 例如MUX、mux和Mux,是同一标识符的不同形式。


VHDL是最具推广前景的HDL。 VHDL(Very High Speed Integrated Circuits Hardware Description Language,超高速集成 电路硬件描述语言)是美国国防部于20世纪80年 代后期出于军事工业的需要开发的。1984年, VHDL被IEEE(Institute of Electrical and Electorincs Engineers)确定为标准化的硬件描 述语言。1994年,IEEE对VHDL进行了修订, 增加了部分新的VHDL命令与属性,增强了系统 的描述能力,并公布了新版本的VHDL,即 IEEE标准版本1046-1994版本。VHDL已经成为 系统描述的国际公认标准,得到众多EDA公司 的支持,越来越多的硬件设计者使用VHDL描述 系统的行为。
用in1、in2、in4代替了函数在程序包内定义时的参 数s1、s2、s4。函数的返回值tmp被赋予result。同时, 由上面的例子可以看出,函数只能返回一个函数值。
VHDL语言 第4章 VHDL语言
(2) 过程(Procedure)。在VHDL语言中,过程语句的书写 格式如下: PROCEDURE 过程名(参数表) --过程首部分
VHDL语言 第4章 VHDL语言

VHDL语言的基本结构

VHDL语言的基本结构
1 实体说明 1)实体语句结构 ENTITY 实体名 IS [GENERIC(类属表);] [PORT(端口表);] END ENTITY 实体名 2)类属参数说明 GENERIC([常数名:数据类型[:设定值] {;常数名:数据类型[:设定值]};
4
一、VHDL语言设计的基本单元及其构成
3)端口说明 PORT(端口名{,端口名}:方向 数据类型; 是对设计实体与外部接口 的描述,即对元件引脚、 ┇ 数据类型和I/O方向的描述 端口名{,端口名}:方向 数据类型); 1端口名
设计实体
进程 或其它并行结构 结构体 n (ARCHITECTURE 进程 或其它并行结构
配置(CONFIGURATION)
VHDL程序设计实体的一般结构
2
VHDL语言的基本结构
主要内容
一、 VHDL语言设计的基本单元及其构成 二、 VHDL语言构造体的子结构描述 三、 包集合、库及配置
3
一、VHDL语言设计的基本单元及其构成
VHDL语言
15
二、VHDL语言构造体的子结构描述
【例】4位二进制加法计数器构造体逻辑描述。
SIGNAL cnt4:INTEGER RANGE O TO 15; ... PROCESS(clk,clear,Stop) BEGIN IF clear='0' THEN cnt4<=0; ELSIF clk'EVENT AND clk='1' THEN IF stop='0' THEN cnt4<=cnt4+1; END IF; END IF; END PROCESS; --注意cnt4的数据类型
存盘文件 为 bpac.vhd

VHDL硬件描述语言

VHDL硬件描述语言
27
VHDL语言设计实体的基本结构
3. 结构体说明语句 用于定义结构体中所用的数据对象和子程序, 并对所引用的元件加以说明,如: ● 信号(SIGNAL)
● 类型(TYPE)
● 常数(CONSTANT) ● 元件(COMPONENT) ● 函数(FUNCTION) ● 过程(PROCEDURE)
28
3
概 述
1993年,IEEE对VHDL进行了修订,增加了一些 功能,并从更高的抽象层次和系统描述能力上扩展 VHDL的内容,公布了VHDL新的版本,编号为IEEE Std1076-1993(简称93版)。 1995年中国国家技术监督局组织编写并出版了 《CAD通用技术规范》,推荐VHDL语言作为我国电子 自动化硬件描述语言的国家标准。1996年, IEEE1076.3成为VHDL综合标准。
结构体:用来描述电路内部结构和逻辑功能。并以 标识符ARCHITECTURE开头,以END结尾。
14
VHDL语言设计实体的基本结构
VHDL语言的实体说明
实体说明是VHDL程序设计中最基本的组成部分, 实体说明语句的格式如下: 主要用来描述设计实体的外部接口信号,定义设计 实体说明语句 ENTITY 实体名 IS 单元的输入、输出端口,是设计实体对外的一个通 类属说明语句 [GENERIC(类属表);] 信界面,但它不描述设计的具体功能。 端口说明语句 [PORT(端口表);] 结束语句 END [ENTITY] 实体名;
{; 常数名{, 常数名}: 数据类型[: 设定值]}) 常数名:是由设计者定义的类属常数名; 数据类型:常取INTEGER或TIME的类型; 设定值:为常数名所代表的数值。
17
VHDL语言设计实体的基本结构
2. 类属说明语句GENERIC

英语类指用法Generic reference:a, the类别用法

英语类指用法Generic reference:a, the类别用法

Generic referenceA, an, and the can all be used to indicate that a noun refers to the whole class to which individual countable nouns belong. This use of articles is called generic, from the Latin word meaning "class."A tiger is a dangerous animal. (any individual tiger)The tiger is a dangerous animal. (all tigers: tiger as a generic category)The difference between the indefinite a and an and the generic a and an is that the former means any one member of a class while the latter means all of the members of a class.The omission of articles also expresses a generic (or general) meaning:no article with a plural noun: Tigers are dangerous animals. (all tigers)no article with a non-countable noun: Anger is a destructive emotion. (any kind ofanger)The definite article also has a generic use referring to what is general or typical for a whole class of objects. This is found with count nouns :The tiger is a beautiful animal.Here "the" indicates the class of tigers, not one individual member of the class. (My underlining)and later they say :.. when we are dealing with a whiole class of objects the differences between definite and indefinite, singular and plural, tend to lose their significance. There is, however, a slight difference in the fact that "the tiger" (generic) refers to the species as a whole, whereas "a tiger" (generic" refers to any member of the species. We can say :The tiger is in danger of becoming extinct.but not : *A tiger is in danger of becoming extinct.Your essay title, as I said in the first reply, did not mean Advantages and disadvantages of owning the class/species "dog" but the Advantages and disadvantages of owning any one dog - ie an individual member of the species. Therefore here, the definite article can't be used.The use of the definite article is actually relatively rare - a) because we make generic statements about classes relatively rarely and b) because the plural can be used to refer to classes of objects as well - and I think we tend to use that form more. It expresses the notion of "all tigers" (or whatever).This is probably why all the examples of the definite article used generically tend to involve tigers. No-one can think of any other examplesSo in summary :- The definitete article + singular or zero article plus plural you specify for countable nouns can all be used to express generic reference to a class of objects. Intuitively, I'd imagine that the plural is probably the most common, but I don't have any evidence to back that up.- When referring to any individual member of the class, the indefinite article + singular will be used.Generic reference in English is usually indicated by the absence of the definite or indefinite article; mass nouns are expressed in the singular, count nouns in the plural, e.g.:Patience is a virtue (mass noun)Dogs are animals (count noun)Occasionally generic reference is expressed by the definite or indefinite article with count nouns, e.g.:The dog is a domestic animalA dog has four legsRule: Generic reference is usually expressed by mass nouns and plural nouns with no article. Sometimes it is expressed by singular count nouns with the or a(n).Examples of errors:1. In the beginning of the industrialization, technological progress wasvalued highly.2. The aim of these programs is to eliminate the relative deprivation.3. Taiwan was excluded from the participation in track and fieldcompetition.4. I want to discuss still another point: the overdeveloped rationalization.5. The social conditions in our society encourage the human isolation.6. One of the difficulties in large apartment buildings is the communicationamong the inhabitants.7. But the car production has to be kept alive, and therefore cars are notbuilt as well as they could be.8. The industrial expansion has been all-important in recent years.9. We should begin to value the human individualism again.10. I fear we are entering an age in which the predomination of thetechnology will be even greater than it is now.11. The membership in a choir is an example of such leisure activities.12. I thought I was pretty well prepared for the studying at university.13. These women all want to end the male superiority.14. Still, I consider the security in world affairs as a first priority.15. If we have competition in the industry, we should have it everywhere.16. They have two faces—one for the society and one for themselves.17. We should try to make the language teaching as true to life as possible.18. Cutting off the hand of a thief is the same idea as the capitalpunishment.19. The child’s ability to use the speech develops almost automatically frombirth.20. People tend nowadays to consume everything uncritically, listening tothe music, for example.21. Nearly all countries try to support the sport.22. Generally speaking, the unborn life must be protected by law.23. I’d like to deepen my understanding of the English grammar.24. I think we should talk more about topics of the everyday life.25. The inside of the tooth is the part which makes us feel the pain.26. Ihey can influence the government as well as the public opinion.27. Let us hope that an even worse technology will not be substituted forthe nuclear power.28. On the other hand they regard some forms of violence such as theself-defence as a justified use of force.29. He studied the laws in Göttingen.30. The abortion of a fetus is a murder.31. I make a lot of mistakes when I speak English, particularly inthe if clauses.32. One indication of the fact that we have not decided how to handle ourtechnology yet is the controversy over the installation of the nuclear power plants.33. In the course of the recent years literature has lost its importance.34. A very attractive energy source is the solar energy.35. "Holocaust" has brought back into the public discussion the question offascism.36. Another aspect concerns the unmarried women who are pregnant.37. Good relationship between nations depends on the c citizens .38. I have a lot of difficulty with gerund.39. Yes, we go to the church on Christmas Day.40. I’m in the need of a lot of practice in conve rsation.41. At first I didn’t like Kassel, but now I’m used to it, and I don’t want tochange the university any more.42. The reader can learn something not only about visible crime but alsoabout crime which is not visible at the first glance.43. At the first sight it seems that we have become lazier.44. Scientists have to take into the consideration the laws and cycles ofnature.45. After I got up, I had a breakfast.It should be stated at the outset that all of the examples above represent instances of first mention. That is to say, in no case does the context in which the sentence originally occurred justify the anaphoric use of the definite article, although, of course, one could easily construct other contexts for these sentences which would make them acceptable. With this caveat, the question of article usage can be discussed reasonably well at sentence level. Rule 1.1 (rules will be referred to by the number of the section in which they occur) is not very useful unless there is some way of defining the term "generic" that is not tautological. (The usage is generic when there is no article.) The identification of mass nouns is also a problem and will be discussed later (cf.1.4), but it is not so important for the application of this rule, since in most cases count nouns also require the zero article in generic use.The concept of generality, as opposed to specificity, from a purely logical point of view, does not seem to present serious problems of definition: generic refers to a whole, or all the members of a class; specific refers to a portion of the whole, or some of the members of the class. The problem in applying this definition to real language use, however, is that terms like "part" and "whole" can be strictly defined only relative to each other, not according to some external or absolute standard. A whole is a whole in relation to its parts, but can also be considered a part in relation to a larger whole; likewise, a part can be considered a whole in relation to the smaller parts which it comprises. How do we know when a particular noun or noun phrase should be considered a whole or a part? In (7), for example, the reference is not to production in general but to the production of cars—but, seen the other way, it refers not to the production of particular cars but to the production of cars in general. The same logical dilemma can be seen in most of the sentences above, although in each case the reference should be linguistically generic.Some nouns seem to lend themselves more readily to generic reference than others. It is relatively hard to think of contextswheretechnology (10), speech (19), music (20), sport(s) (21), industry (15),or individualism (9) would have non-generic reference, without some accompanying modification—particularly an of phrase. Sometimes, even when the reference of a noun, although modified, may seem limited or specified by the particular context in which it occurs, the article is omitted and thus, linguistically, the reference is generic. In (16) it is understood from context that not all human society but only contemporary western society is meant; pain in(25) refers only to dental pain. Nevertheless, the zero article is preferable in both sentences.It is hardly surprising that language use does not conform to the demands of pure logic, and various linguistic criteria have been proposed, with various degrees of success, to account for definite article usage. Two such criteria have already been mentioned. The first is that nouns which are modified are more likely to require the than unmodified nouns. There is still a strong appeal to "natural logic" in this criterion, however; Lamprecht (1972:§137), for example, puts it this way:Substantive, die bei uneingeschrankter Verwendung artikellos bleiben, stehen mit dem bestimmten Artikel, sobald sie naher bestimmt oder eingegrenst werden. Die den Artikel erfordernde nahere Bestimmung oder Konkretisierung (=Anwendung auf einen Einzelfall) kann erfolgen durch ein zum Substantiv tretendes Attribut ...This Attribut, he says, can take the form of a prepositional phrase (the history of mankind, the man in the street), a relative clause (the Mr. Smith you’re speaking of), a participial clause (the money gained by his efforts), or a "differentiating or contrastive" adjective (the contemplative life). The only kind of modification which seems to co-occur with the at all regularly, however,is of phrases. In the examples above, most of the nouns are premodified, a few are followed by a prepositional phrase (though no of phrases), and one (36) by a restrictive relative clause. More extensive statistical data about just what types of modifiers cooccur with the definite article, particularly along the lines of Yotsukura (1970; cf. also Robbins 1968, Smith 1964, Perlmutter 1970), might yield some pedagogically useful generalizations.A second linguistic criterion for definiteusage is based on a subclassification of nouns into abstract nouns, collective nouns, names of materials, and plural names of species. Typically, however, the caveat must be made that these nouns, like any others, dispense with the definite article only when used generically—e.". " ... wenn sie in allgemeiner, nichteingeschrankter Bedeutung verwendet werden ..." (Lamprecht 1972:§127). This leads us back to the original problem of defining what generic means in the first place. Nevertheless, there does seem to be some sense in saying that at least some abstract nouns tend to be used generically more often than others—nouns ending in -a)tion/-sion, for example. By contrast, words ending in -(i)ty, also supposedly an abstract noun suffix, seem to occur more freely in both generic and specific contexts. If it could be shown that nouns ending in particular suffixes, or subgroups of nouns based on some other precise criteria, or nouns co-occurring with certain modifiers, do in factoccur with the significantly less frequently than in other cases, this information would be a significant help to the learner.The questions (37) and (38) raise is: What is the difference between the three possible ways of expressing generic reference (zero/plural,the, or an), or is there any difference at all? We note, first of all, that generic the is unacceptable in (37a), whereas generic a i s unacceptable in (38a):(37a) The good relationship between nations depends on the citizens.(38a) *I have a lot of difficulty with a gerund and tenses.We might be tempted to say, in reference to (38a), that the noun phrase with generic a must occur as the subject of a clause (cf. Lamprecht 1972:§147), since we can sayA/The cow is a useful animal.Cows are useful animals.andTonight I’d like to talk about cows/the cow.but not (if generic reference is intended)*Tonight I’d like to talk about a cow.Whether or not the noun is the subject or not is not the crucial factor, though, since we can also say (with generic reference):Grass is the primary nutrient of cows/the cow/a cowAnother theory--this in reference to (37a)--is that generic the cannot be used if the noun refers to something that does not actually exist. According to Quirk et al. (1972:§4.28 Note), a sentence like The hobgoblin is a popular theme in literature is questionable, but many speakers would find nothing wrong with it, and likewise The unicorn is a mythological creature. Perhaps more interesting would be to ask why a is unacceptable in the first sentence but acceptable in the second:*A unicorn/hobgoblin is a popular theme in literature.A unicorn/hobgoblin is a mythological creature.Perlmutter (1973:239-242) suggests that generic a(n) derives from an underlying any, and cites the following examples as evidence for this:(1a) *The beaver or the otter builds dams(1b) *Beavers or otters build dams(1c) A beaver or an otter builds dams(1d) Any beaver or any otter builds dams(2a) The beaver and the otter build dams(2b) Beavers and otters build dams(2c) *A beaver and an otter build dams(2d) *Any beaver and any otter build dams(3a) Dams are built by the beaver(3b) Dams are built by beavers(3c) *Dams are built by a beaver(3d) *Dams are built by any beaver(4a) I said of the beaver that it builds dams(4b) I said of beavers that they build dams(4c) *I said of a beaver that it builds dams(4d) *I said of any beaver that it builds dams(5a) The beaver is building dams these days(5b) Beavers are building dams these days(5c) *A beaver is building dams these days(5d) *Any beaver is building dams these days(6a) The beaver built dams in prehistoric times(6b) Beavers built dams in prehistoric times(6c) *A beaver built dams in prehistoric times(6d) *Any beaver built dams in prehistoric times(7a) Beavers are found in Canada/increasing in numbers/extinct(7b) The beaver is found in Canada/increasing in numbers/extinct(7c) *A beaver is found in Canada/increasing in numbers/extinct(7d) *Any beaver is found in Canada/increasing in numbers/extinctThe first set of examples in (1) show that generic a(n) and any are similar in allowing conjunction with or, whereas generic the and the generic plural do not allow it. The examples in (2) show that generic a(n) and any do not allow conjunction with and, however, while genericthe and the generic plural do. Similarly, (3)-(6) illustrate sentence types in which generic a(n) and any are both unacceptable, whereas generic the and the generic plural are acceptable.These examples make it clear, at least, that there are contexts in which generic a(n) is not interchangeable with generic the and the generic plural.The examples with any, though, are more problematic; many native speakers would not agree with Perlmutter that (d) in (i)-(vi) are unacceptable--they certainly are not as objectionable as (c). On the other hand, there are also cases where generic a(n), but not any, is acceptable, as in the sentence cited earlier:A/*Any unicorn is a mythological creature.A satisfactory description of the difference between the genericplural, a(n) and the must await a more complete investigation of generic reference in English. Failing this, since the plural is by far the most common of the three structures and has the least restrictions, the learner may be best advised simply to avoid using generic the and a(n).In reference to (39)-(45), there are a number of nouns which do not take the article, particularly after prepositions and the verbs be and go. They are included here under generic reference because the definite or indefinite article is also possible in many expressions of this type, resulting in a quite different sense: go to the church (i.e. to a particular building), a wonderful breakfast. On the other hand, this usage does not seem to be conceptually generic in the same sense as sentences (1)-(76), and it may be more appealing to consider these simply as verbal and prepositional idioms, where the absence of the article is explained as a fossilization of an earlier state of the language, before the present function of the definite article became generalized. Some of the nouns that occur in these idioms can be grouped in semantic categories though this doesn’t mean that these nouns cannot also occur with the article. Compare:seasonsIt’s hot in summer.but (with the same meaning)It’s hot in the summer.institutionsHe’s in bed.He’s at school.butHe hid under the bed.He called the school.means of transportHe goes by car.butHe takes the car.times of the day and nightHe wakes up at night.butHe wakes up in the middle of the night.mealsHe served me breakfast and lunch.butThe breakfast was good but the lunch was terrible.illnessesHave you had measles?butHe has the measles.Dear Monica,Well, the "Communicative Grammar" seems to be correct, as far as it goes. It's certainly true that the three kinds of generic noun phrase are often different, in use and occasionally in sense, besides being different in form. Let's give them some names, so we can talk about them. In the order you named them:1.Definite Generic: the + Singular NounThe tiger is in danger of becoming extinct.2.Plural Generic: 0 + Plural Noun [0 = Zero, the number]Tigers are in danger of becoming extinct.3.Indefinite Generic: a + Singular Noun*A tiger is in danger of becoming extinct.These are constructions, which means that the phrase itself, and its usage, have special grammar and special meanings. It's not that thearticles the or a have special meaning, really -- they hardlyhave any meaning; rather, their use in these generic constructions marks them as special.As to use and meaning, while there are many, many special cases and idioms, one can roughly equate the three generic noun phrase constructions with three different functions. Each refers to some species (of plant, animal, thing, person, cathedral, or whatever; not just biological species), but there are several ways of doing this:1.The Definite Generic refers to the Prototype of a species, roughly theimage we associate with tiger. The tiger, as a prototype, has all theproperties of anything we would call a tiger, except that it doesn'texist in an individual physical sense, like all real tigers do. This is avery abstract concept, and its use signals that the speaker istheorizing.The tiger is big means the speaker believes that "bigness", in somecomparative context, is a characteristic property of tigers, that weshould expect this to be true of any tiger.2.The Plural Generic refers to the Norm of a species over itsindividuals, as perceived, of course, by the speaker, who is unlikely to have conducted tiger surveys, so the "statistics" here are very vagueand impressional.Tigers are big means the speaker believes that, on the average, anytiger is likely to be "big". This doesn't mean all tigers are big, thoughthat's close. This is potentially a less abstract concept, since its useimplies a generalization based on experience of several individuals.3.The Indefinite Generic refers to the Definition of a species, that is,those properties that are absolutely necessary for anything to be amember. It doesn't work as the subject of any predicate that isn'tdefinitional. But with a definitional property, it's certainly true for any member.And that's one of the reasons why your sentence is ungrammatical. Ifone says*A tiger is in danger of becoming extinct.one is saying that being in danger of becoming extinct is one of thedefining characteristics of tigerhood, which isn't true, after all. Tigers would still be tigers if they weren't endangered.A similar situation is true in the following sentences:∙The madrigal is polyphonic.(being polyphonic is characteristic of madrigrals)∙Madrigals are polyphonic.(being polyphonic is normal for madrigrals)∙ A madrigal is polyphonic.(being polyphonic is required for madrigrals)as opposed to∙The madrigal is popular.(being popular is characteristic of madrigrals)∙Madrigals are popular.(being popular is normal for madrigrals)∙*A madrigal is popular.(being popular is required for madrigrals)... and of course this last conclusion is wrong, producing the star. One other reason why the Indefinite Generic a tiger is ungrammatical with the predicate become extinct is that extinction can only happen to a species, and it means that every member of the species is dead. Now this can use theDefinite Generic because it is characteristic of the species; it can use a Plural Generic because we're speaking of tigers in aggregate.But it can't use an Indefinite Generic, for much the same reason you wouldn't say*Any tiger is in danger of becoming extinct.That is, becoming extinct isn't something that happens to individualtigers.There are lots more strange facts about generic constructions; indeed,I wrote a dissertation about them long ago. But I hope this helpssome.- John Lawler Department of Linguistics and Residential College University of Michigan"Language is the most massive and inclusive art we know, a - Edward Sapirmountainous and anonymous work of unconscious generations." Language (1921)。

VHDL语言

VHDL语言

• 例: 包集合描述 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; package math is type tw16 is array(0 to 15) of t_wlong; function add(a,b:in tw16) return tw16; 包集合标题 function sub(a,b:in tw16) return tw16; end math;
★采用通用的元器件和芯片 ★在系统设计后期进行仿真和调试 ★主要设计文件是电原理图 ★设计人员要具有丰富的硬件知识 失

2011-11-4
制定技术规格书
利用HDL 利用HDL的设计方法 HDL的设计方法
★设计从系统的HDL描述开始, 设计从系统的HDL描述开始, HDL描述开始
划分功能模块 功能模块的HDL 功能模块的HDL描述 HDL描述 失 败 模块功能仿真 成功 系统的HDL 系统的HDL描述 HDL描述 失 败 系统功能仿真、综合 系统功能仿真、 成功 下载到可编程芯片 结束
Function define Procedure define package define Signal define Data tyห้องสมุดไป่ตู้es define
library
Entity define
包集合的结构 PACKAGE 包集合名 说明语句1 [说明语句1]; END 包集合名; 包集合名; IS 包集合标题 IS 包集合体
库(library)是经过编译后的数据集合,它存放包集合定义、 library)是经过编译后的数据集合,它存放包集合定义、 实体定义、构造体定义和配置定义。 实体定义、构造体定义和配置定义。 库是存放预先做好的元件(设计实体)、函数、过程的最 库是存放预先做好的元件(设计实体)、函数、 )、函数 高层次。 高层次。 类似DOS系统的目录。 类似DOS系统的目录。 DOS系统的目录 库的好处在于,使设计者可以共享已经经过编译的设计结果。 库的好处在于,使设计者可以共享已经经过编译的设计结果。 可以同时存在几个不同的库,但库之间不能相互嵌套。 可以同时存在几个不同的库,但库之间不能相互嵌套。

eda第三章 硬件描述语言(HHDL)基础

eda第三章 硬件描述语言(HHDL)基础
s : in std_logic; y : out std_logic);
end kmux4;
类属说明 generic 实体中可以设置类属说明语句; 类属说明位于port语句之前; 类属是对电路模块可变常数的说明; 类属值在编写本模块时可以设置为一个确定值;
在其他程序调用该模块时,可以对类属值进行
重新设定;
看两个例子:
LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; ENTITY half_adder IS PORT (a,b : IN bit; s,c : OUT bit); END half_adder; ARCHITECTURE aa OF half_adder IS BEGIN s<=a xor b; c<=a and b; END ;
s : in std_logic;
y : out std_logic);
end kmux4;
实体编写的示例 4选1数据选择器 kmux4
entity kmux4 is
port ( d: in std_logic_vector (0 to 3);
a : in std_logic_vector (1 downto 0);
在电路单元设计时,为了提高集成度,通常沟
道长度总是希望保持最小值,而沟道宽度却可
以进行加长;
R /W
C W
AW
Cd Cs 3Cg
CMOS基本电路结构
通常采用N网络与P网络互补连接构成:
N网络实现逻辑,并联为“与”,串联为“或”
典型CMOS基本电路
CMБайду номын сангаасS反相器

EDA

EDA

复习要点第一、二章要点1、什么是EDA技术;2、什么是EDA技术的3要素: VHDL, EDA工具,可编程器件。

3、了解基于VHDL的自顶向下的设计流程;4、了解常用EDA工具;5、了解一般ASIC设计流程、掌握各种ASIC设计方法的比较;6、基于FPGA/CPLD的设计流程;7、EDA领域的IP的英文全称是什么?什么是IP核?IP核主要分为哪三种?分别具有什么特点?8、技术名词:CAD、EDA 、SOC/SOPC、IP core、PLD、Time to Market、ASIC、ASSP、LAYOUT、PCB、ASIC 、CPLD 、FPGA、VHDL、PLD 、PAL 、ISP第三章 FPGA/CPLD结构与应用1、什么是可编程器件;2、了解可编程器件的分类、 SPLD的分类及结构特点;3、CPLD的结构与工作原理什么是基于乘积项的可编程结构:如图P27,图3-1所示Lattice的ispLSI1032芯片:了解ispLSI1032芯片体系结构及其特点;ALtera公司的MAX7000系列的CPLD器件:了解 MAX7000系列的CPLD器件结构及特点;4、FPGA结构与工作原理什么是基于查找表的可编程结构: 在RAM查找表结构中,RAM存储器中需预先存入所要实现函数的真值表数值,输入变量作为地址,用来从RAM存储器中选择相应的数值作为逻辑函数的输出值,这样就可以实现输入变量的所有可能的逻辑函数。

结构如P40,图3-32和图3-33:了解cyclone的结构组成及特点5、使用CPLD和FPGA设计逻辑电路的优点:1).规模越来越大,实现功能越来越强,同时可以实现系统集成。

2).研制开发费用低,不承担投片风险,使用方便。

3).通过开发工具在计算机上完成设计,电路设计周期短。

4).不需要设计人员了解很深的IC知识,EDA软件易学易用。

5).通过FPGA和CPLD开发的系统成熟后,可以进行ASIC设计,形成批量生产。

_generic用法

_generic用法

_generic用法在编程中,"_generic" 是一个常用的术语,用于表示泛型(generic)的概念。

泛型是一种编程技术,可以在不指定具体类型的情况下编写通用的代码,以实现更高的代码重用性和灵活性。

在不同的编程语言中,"_generic" 的具体用法可能有所不同。

以下是一些常见的用法:1. 类型参数(Type Parameters):在一些编程语言中,可以使用"_generic" 来定义泛型类型。

通过在类或方法的定义中添加类型参数,可以在使用时指定具体的类型。

例如,在Java中,可以定义一个泛型类如下:class MyGenericClass<T> {。

private T value;public T getValue() {。

return value;}。

public void setValue(T value) {。

this.value = value;}。

}。

这样,就可以创建一个可以存储任意类型的对象的实例。

2. 泛型函数(Generic Functions):在一些编程语言中,可以使用"_generic" 来定义泛型函数。

通过在函数的定义中添加类型参数,可以在调用时指定具体的类型。

例如,在C#中,可以定义一个泛型函数如下:public T MyGenericFunction<T>(T value) {。

return value;}。

这样,就可以在调用函数时传入不同类型的参数,而函数内部会根据传入的类型进行相应的处理。

3. 泛型集合(Generic Collections):许多编程语言提供了泛型集合类,用于存储和操作不同类型的对象。

通过使用"_generic",可以在创建集合时指定要存储的具体类型。

例如,在C++中,可以使用标准库中的容器类模板来创建泛型集合:std::vector<int> myVector; // 创建一个存储整数的向量。

HDL语言程序的基本结构

HDL语言程序的基本结构

HDL语言程序的基本结构2.1 VHDL语言设计的基本单元及其构成2.2 语言结构体的子结构描述2.3 包集合、库与配置2.1 VHDL语言设计的基本单元及其构成●一个完整的VHDL语言程序通常包含实体(Entity)、构造体(Architecture)、配置(Configuration)、包集合(Package)和库(Library):●功能:实体 -—- 用于描述所设计的系统的外部接口信号;构造体——用于描述系统内部的结构和行为;包集合——存放各设计模块都能共享的数据类型、常数和子程序库;配置——用于从库中选取所需单元来组成系统设计的不同版本;库——存放已经编译的实体、构造体、包集合和配置。

●基本组成:实体说明和构造体两部分实体说明(接口)构造体(实现)1.实体说明:规定此实体输入与输出的数目与类型。

●结构:entity 实体名 is[generic(类属参数说明)];[port(端口说明)];end 实体名;●类属参数说明:generic (常数名:数据类型:=数值);在端口说明前,用于指定参数。

●端口说明:在entity语句的实体说明部分,常用port语句描述实体对外界连接的端口(数目、方向和数据类型)。

port (端口名:端口方向端口数据类型;...端口名:端口方向端口数据类型;);端口方向:in (输入),只能读,用于:时钟输入、控制输入(装入、复位、使能)、单向数据输入;out (输出),只能被赋值,用于不能反馈的输出;inout(输入输出) ,既可读又可被赋值,被读的值是端口输入值而不是被赋值,作为双向端口。

buffer(缓冲),类似于输出,但可以读,读的值是被赋值,用做内部反馈用,不能作为双向端口使用。

●例1):entity NAND2 isport(A,B: in BIT;Z: out BIT);end NAND2;●例2):--Define an entity (design) called COMP--that has 2 N-bit input and one output.entity COMP isgeneric(N : INTEGER :=8 ) ; -- default is 8 bitsport ( x, y : in BIT_VECTOR ( 0 to N-1);equal : out BOOLEAN );end COMP;2. 构造体构造体定义实体功能的一种实现。

微机原理与接口技术第三章

微机原理与接口技术第三章

实体说明及其外部接口信号关系
3.2.1 实体说明
1. 实体名
实体具体取名由设计者自定,但由于实体名实际
上表达的是该设计电路的器件名,所以最好根据相 应电路的功能来取定。例:counter16

实体名的命名要满足VHDL语言定义标识符的规则。
①第一个字符必须是字母; ②字母不区分大小写;③下划线
不能连用;④最后一个字符不能是下划线。
1 LIBRARY IEEE; 库和包说明部分 2 USE IEEE.STD_LOGIC_1164.ALL; 3 USE IEEE.STD_LOGIC_UNSIGNED.ALL; 4 5 6 7 8 9 ENTITY counter16 is GENERIC(n: INTEGER:=4); 实体说明部分 PORT(clk: IN STD_LOGIC; --时钟输入端 co:OUT STD_LOGIC; --进位输出端 q :OUT STD_LOGIC_VECTOR(n-1 DOWNTO 0)); END counter16;
3.2.1 实体说明
3. 端口(PORT)说明语句 端口说明语句指明实体的输入/输出信号及其模式。
端口说明语句的语法结构为:
PORT(端口名:端口模式 数据类型; … 端口名:端口模式 数据类型);
1) 端口名 端口名对应于元件符号的每个外部引脚的名称,一般由英 文字母组成。名字的定义有一定的惯例,如clk表示时钟,d开 头的端口名表示数据,a开头的端口名表示地址等。
STD_LOGIC_VECTOR等。建议:端口数据类型
只使用BIT、BIT_VECTOR、STD_LOGIC、 STD_LOGIC_VECTOR等具有电路特性的类型, 而不使用BOOLEAN、INTEGER 等数学意义明显 的类型。

一个VHDL设计由若干个VHDL文件构成每个文件主要包含上课讲义

一个VHDL设计由若干个VHDL文件构成每个文件主要包含上课讲义

Architecture beh Of mux is
signal n1:bit;

1)信号为内部使用,不须加方向
begin …
2)信号应有名和数据类型
3.并行处理语句:位于begin和end 之间,描述构造体的行为和电路
连接关系。
所谓并行,指多个语句不以书写顺序执行。
一数据选择器的构造体:
architecture arch of mux4 is begin y<=((((a0 and not (s(0))) or (a1 and s(0)))) and not (s(1))) or (((a2 and not s(0))) or (a3 and s(0))) and s(1));
子图,分块设计有利于编辑查错。
3.块(block)中语句的并发性:block中的语句为并发的。
4.卫式block(Guarded block):指满足条件时,块语句执行,不满足
时不执行。 例:…
begin G1: block(clk=‘1’)
1)卫式块不能综合; 2)after语句不能综合; 3)当满足clk=1时执行。
定义有符号与无符号类型,及基于 这些类型上的算术运算。
定义了基于std_logic与std_logic _ vector类型上的有符号的算术运算
2.2.1 BLOCK语句结构描述
1.BLOCK语句的结构 格式: 块结构名;
block begin … end block 块结构名;
Entity mux is Port(d0,d1,sel: IN Bit;
q: out Bit); End mux;
Architecture connect Of mux is Signal tmp1,tmp2,tmp3 : Bit; Begin

52VHDL基本描述语句

52VHDL基本描述语句
4)OTHERS只能出现一次,且只能作为最后一 个条件取值。
【例5-7】例5-2的四选一数据选择器的CASE 实现。实体略。
ARCHITECTURE archmux OF mux4 IS
BEGIN PROCESS(s , a0, a1, a2, a3 ) BEGIN
CASE s IS WHEN “00”=> y<=a0; WHEN “01”=> y<=a1; WHEN “10”=> y<=a2; WHEN OTHERS => y<=a3;
从综合的角度看,BLOCK语句没有实用价值。
格式:
块名:BLOCK [(表达式)] [块声明项;]
BEGIN 并行语句;
END BLOCK [块名];
注意:块名必须有。
【例5-4】8位数字比较器
ENTITY COMP IS PORT(
a,b: IN INTEGER RANGE 0 T0 255;
顺序语句:
执行按书写顺序进行
5.2.1 并行语句
进程语句 块语句 并行信号赋值语句 元件例化语句 生成语句 并行过程调用语句
1. 进程语句PROCESS
进程语句是个复合语句,由一段程序构成。
一个程序可以有多个进程,各个进程是并发执行 的,但进程内部的所有语句却都是顺序执行的。 多进程间的通信依靠信号来传递。
2. CASE_WHEN语句 ELSIF允许在一个语句中出现多重条件,但嵌套层
数不宜过多。在含有多个互不相关信号的条件时, 采用CASE_WHEN语句程序的可读性比较好。
对完成相同的逻辑功能,用CASE语句比用IF语句耗 用更多的硬件资源。
CASE语句属于顺序语句,必须放在进程中,
格式: CASE 表达式 IS

VHDL 实体

VHDL 实体
EDA技术实用教程
实体
1.1 实体语句结构
ENTITY 实体名 IS [GENERIC ( 类属表 );] [PORT ( 端口表 );]
END ENTITY 实体名;
1.2 GENERIC类属说明语句
GENERIC([ 常数名 : 数据类型 [ : 设定值 ] { ;常数名 : 数据类型 [ : 设定值 ] } ) ;
END;
实体
1.3 类属映射语句
【例8-3】
LIBRARY IEEE;
--待例化元件
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_arith.ALL;
USE IEEE.STD_LOGIC_unsigned.ALL;
ENTITY addern IS
PORT (a, b: IN STD_LOGIC_VECTOR;
u1: andn GENERIC a(0)=>d1,a(1)=>d2,c=>q1);
u2: andn GENERIC MAP (n =>5) -- 定义类属变量,n赋值为5
PORT MAP (a(0)=>d3,a(1)=>d4,a(2)=>d5,
a(3)=>d6,a(4)=>d7, c=>q2);
BEGIN twoa <= a & a;
接上页
U1: addern PORT MAP (a => twoa, b => b, result => result);
U2: addern PORT MAP (a=>b(msb_operand downto msb_operand/2 +1),

GENERIC类属说明语句

GENERIC类属说明语句

GENER‎I C类属说‎明语句类属 GENER‎I C 参量是一种‎端口界面常‎数常以一种说‎明的形式放‎在实体或块‎结构体前的说‎明部分类属为所说‎明的环境提‎供了一种静‎态信息通道‎类属与常数‎不同常数只能从设‎计实体的内‎部得到赋值‎且不能再改‎变而类属的值‎可以由设计‎实体外部提‎供因此设计者可以‎从外面通过‎类属参量的‎重新设定而‎容易地改变‎一个设计实‎体或一个元‎件的内部电路‎结构和规模‎类属说明的‎一般书写格‎式如下GENER‎I C([ 常数名数据类型[ : 设定值]{ 常数名数据类型[ : 设定值] } )类属参量以‎关键词 GENER‎I C 引导一个类‎属参量表在表中提供‎时间参数或‎总线宽度等静态信息‎类属表说明‎用于设计实‎体和其外部‎环境通信的‎参数传递静态的‎信息类属在所定义的‎环境中的地‎位与常数十‎分接近但却能从环‎境如设计实体‎外部动态地‎接受赋值其行为又有‎点类似于端‎口PORT 因此常如以‎上的实体定‎义语句那样‎将类属说明‎放在其中且放在端口‎说明语句的‎前面在一个实体‎中定义的来自外部赋‎入类属的值‎可以在实体‎内部或与之‎相应的结构‎体中读到对于同一个‎设计实体可以通过 GENER‎I C 参数类属的‎说明为它创建多‎个行为不同的逻辑结‎构比较常见的‎情况是利用‎类属来动态‎规定一个实‎体的端口的‎大小或设计实体的物理特‎性或结构体中‎的总线宽度‎或设计实体‎中底层中同‎种元件的例‎化数量等等‎一般在结构‎体中类属的应用‎与常数是一‎样的例如当用实体例‎化一个设计‎实体的器件时可以用类属‎表中的参数‎项定制这个‎器件如可以将一‎个实体的传‎输延迟上升和下降延时等‎参数加到类‎属参数表中‎然后根据这‎些参数进行‎定制这对于系统‎仿真控制是‎十分方便的‎其中的常数‎名是由设计‎者确定的类‎属常数名数据类型通‎常取 INTEG‎E R 或TIME 等类型设定值即为‎常数名所代‎表的数值但需注意VHDL 综合器仅支‎持数据类型为整数的‎类属值程序3-2和3-3是两个使‎用了类属说‎明的实例描‎述程序3-2ENTIT‎Y mcu1 ISGENER‎I C (addrw‎i dth : INTEG‎E R := 16);PORT(add_b‎u s : OUT STD_L‎O GIC_‎V ECTO‎R(addrw‎i dth-1 DOWNT‎O 0) );...在这里 GENER‎I C 语句对实体‎mcu1 作为地址总‎线的端口 add_b‎u s 的数据类型‎和宽度作了定义‎即定义 add_b‎u s 为一个16 位的标准位‎矢量定义 addrw‎i dth 的数据类型‎是整数INT‎E GER 其中常数名ad‎d rwid‎t h减 1 即为15 所以这类似‎于将上例端‎口表写成PORT (add_b‎u s : OUT STD_L‎O GIC_‎V ECTO‎R (15 DOWNT‎O 0));由程序3-2 可见对于类属值‎addrw‎i dth 的改变将对‎结构体中所‎有相关的总‎线的定义同时作‎了改变由此将改变‎整个设计实‎体的硬件结‎构程序3-3 2输入与门‎的实体描述‎V HDL实‎用教程22ENTIT‎Y PGAND‎2 ISGENER‎I C ( trise‎: TIME := 1 ns;tfall‎: TIME := 1 ns ) ;PORT ( a1 : IN STD_L‎O GIC ;a0 : IN STD_L‎O GIC ;z0 : OUT STD_L‎O GIC );END ENTIT‎Y PGAND‎2;这是一个准‎备作为 2 输入与门的‎设计实体的‎实体描述在类属说明‎中定义参数‎trise‎为上沿宽度 tfall‎为下沿宽度‎它们分别为‎1ns 这两个参数‎用于仿真模‎块的设计以下的程序‎3-5 是一个顶层‎设计文件它在例化语‎句中调用了‎程序3-4 读者应注意到在程序3-4 中的类属变‎量n 并没有如程‎序3-2 那样明确规‎定了它的取‎值n 的具体取值是在‎程序3-5 中的类属映‎射语句 GENER‎I C MAP ( )中指定的并在两个不‎同的类属映射语‎句中作了不‎同的赋值程序3-4 和3-5 给出了类属‎语句的一种‎典型应用显然类属语句的‎应用为方便而迅速地改‎变电路的结‎构和规模提‎供了极便利‎的条件程序3-4LIBRA‎R Y IEEE;USE IEEE.STD_L‎O GIC_‎1164.ALL;ENTIT‎Y andn ISGENER‎I C ( n : INTEG‎E R );PORT(a : IN STD_L‎O GIC_‎V ECTO‎R(n-1 DOWNT‎O 0);c : OUT STD_L‎O GIC);END;ARCHI‎T ECTU‎R E behav‎OF andn ISBEGIN‎PROCE‎S S (a)VARIA‎B LE int : STD_L‎O GIC;BEGIN‎int := '1';FOR i IN a'LENGT‎H - 1 DOWNT‎O 0 LOOPIF a(i)='0' THENint := '0';END IF;END LOOP;c <=int ;END PROCE‎S S;END;程序3-5LIBRA‎R Y IEEE;USE IEEE.STD_L‎O GIC_‎1164.ALL;ENTIT‎Y exn ISPORT(d1,d2,d3,d4,d5,d6,d7 : IN STD_L‎O GIC;q1,q2 : OUT STD_L‎O GIC);END;ARCHI‎T ECTU‎R E exn_b‎e hav OF exn ISCOMPO‎N ENT andnGENER‎I C ( n : INTEG‎E R);PORT(a: IN STD_L‎O GIC_‎V ECTO‎R(n-1 DOWNT‎O 0);c: OUT STD_L‎O GIC);END COMPO‎N ENT ;BEGIN‎u1: andn GENER‎I C MAP (n =>2)PORT MAP (a(0)=>d1,a(1)=>d2,c=>q1);u2: andn GENER‎I C MAP (n =>5)PORT MAP (a(0)=>d3,a(1)=>d4,a(2)=>d5,a(3)=>d6,a(4)=>d7, c=>q2);END;程序3-5 给出了类属‎映射语句 GENER‎I C MAP ( )配合端口映‎射语句PORT MAP ( ) 语句的使用范‎例端口映射语‎句是本结构‎体对外部元‎件调用和连‎接过程中描述元件间‎端口的衔接方式‎的而类属映射‎语句具有相‎似的功能它描述相应‎元件类属参‎数间的衔接‎和传送方式读者不妨利‎用程序3-5 中GENE‎R IC MAP ( )的使用方法‎作一些相关‎的练习。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

GENERIC类属说明语句
类属GENERIC 参量是一种端口界面常数常以一种说明的形式放在实体或块结
构体前的说明部分类属为所说明的环境提供了一种静态信息通道类属与常数不同常
数只能从设计实体的内部得到赋值且不能再改变而类属的值可以由设计实体外部提供
因此设计者可以从外面通过类属参量的重新设定而容易地改变一个设计实体或一个元件的内部电路结构和规模
类属说明的一般书写格式如下
GENERIC([ 常数名数据类型[ : 设定值]
{ 常数名数据类型[ : 设定值] } )
类属参量以关键词GENERIC 引导一个类属参量表在表中提供时间参数或总线宽度
等静态信息类属表说明用于设计实体和其外部环境通信的参数传递静态的信息类属
在所定义的环境中的地位与常数十分接近但却能从环境如设计实体外部动态地接受
赋值其行为又有点类似于端口PORT 因此常如以上的实体定义语句那样将类属说明
放在其中且放在端口说明语句的前面
在一个实体中定义的来自外部赋入类属的值可以在实体内部或与之相应的结构体中
读到对于同一个设计实体可以通过GENERIC 参数类属的说明为它创建多个行为不
同的逻辑结构比较常见的情况是利用类属来动态规定一个实体的端口的大小或设计实
体的物理特性或结构体中的总线宽度或设计实体中底层中同种元件的例化数量等等
一般在结构体中类属的应用与常数是一样的例如当用实体例化一个设计实体的
器件时可以用类属表中的参数项定制这个器件如可以将一个实体的传输延迟上升和
下降延时等参数加到类属参数表中然后根据这些参数进行定制这对于系统仿真控制是
十分方便的其中的常数名是由设计者确定的类属常数名数据类型通常取INTEGER 或TIME 等类型设定值即为常数名所代表的数值但需注意VHDL 综合器仅支持数据类
型为整数的类属值
程序3-2和3-3是两个使用了类属说明的实例描述
程序3-2
ENTITY mcu1 IS
GENERIC (addrwidth : INTEGER := 16);
PORT(
add_bus : OUT STD_LOGIC_VECTOR(addrwidth-1 DOWNTO 0) );
...
在这里GENERIC 语句对实体mcu1 作为地址总线的端口add_bus 的数据类型和宽
度作了定义即定义add_bus 为一个16 位的标准位矢量定义addrwidth 的数据类型是整数INTEGER 其中常数名addrwidth减1 即为15 所以这类似于将上例端口表写成PORT (add_bus : OUT STD_LOGIC_VECTOR (15 DOWNTO 0));
由程序3-2 可见对于类属值addrwidth 的改变将对结构体中所有相关的总线的
定义同时作了改变由此将改变整个设计实体的硬件结构
程序3-3 2输入与门的实体描述VHDL实用教程22
ENTITY PGAND2 IS
GENERIC ( trise : TIME := 1 ns;
tfall : TIME := 1 ns ) ;
PORT ( a1 : IN STD_LOGIC ;
a0 : IN STD_LOGIC ;
z0 : OUT STD_LOGIC );
END ENTITY PGAND2;
这是一个准备作为2 输入与门的设计实体的实体描述在类属说明中定义参数trise 为上沿宽度tfall为下沿宽度它们分别为1ns 这两个参数用于仿真模块的设计以下的程序3-5 是一个顶层设计文件它在例化语句中调用了程序3-4 读者应注
意到在程序3-4 中的类属变量n 并没有如程序3-2 那样明确规定了它的取值n 的具体取值是在程序3-5 中的类属映射语句GENERIC MAP ( )中指定的并在两个不同的类属映射语句中作了不同的赋值
程序3-4 和3-5 给出了类属语句的一种典型应用显然类属语句的应用为方便
而迅速地改变电路的结构和规模提供了极便利的条件
程序3-4
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY andn IS
GENERIC ( n : INTEGER );
PORT(a : IN STD_LOGIC_VECTOR(n-1 DOWNTO 0);
c : OUT STD_LOGIC);
END;
ARCHITECTURE behav OF andn IS
BEGIN
PROCESS (a)
VARIABLE int : STD_LOGIC;
BEGIN
int := '1';
FOR i IN a'LENGTH - 1 DOWNTO 0 LOOP
IF a(i)='0' THEN
int := '0';
END IF;
END LOOP;
c <=int ;
END PROCESS;
END;
程序3-5
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY exn IS
PORT(d1,d2,d3,d4,d5,d6,d7 : IN STD_LOGIC;
q1,q2 : OUT STD_LOGIC);
END;
ARCHITECTURE exn_behav OF exn IS
COMPONENT andn
GENERIC ( n : INTEGER);
PORT(a: IN STD_LOGIC_VECTOR(n-1 DOWNTO 0);
c: OUT STD_LOGIC);
END COMPONENT ;
BEGIN
u1: andn GENERIC MAP (n =>2)
PORT MAP (a(0)=>d1,a(1)=>d2,c=>q1);
u2: andn GENERIC MAP (n =>5)
PORT MAP (a(0)=>d3,a(1)=>d4,a(2)=>d5,
a(3)=>d6,a(4)=>d7, c=>q2);
END;
程序3-5 给出了类属映射语句GENERIC MAP ( )配合端口映射语句PORT MAP ( ) 语句的使用范例端口映射语句是本结构体对外部元件调用和连接过程中描述元件间端口的衔接方式的而类属映射语句具有相似的功能它描述相应元件类属参数间的衔接和传送方式读者不妨利用程序3-5 中GENERIC MAP ( )的使用方法作一些相关的练习。

相关文档
最新文档