Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
114
Добавлен:
26.03.2016
Размер:
7.4 Mб
Скачать

A.2 VHDL Syntax

In the rules that follow an underline ( like this ) indicates syntax that is present in VHDL-93, but not in VHDL-87. A strikethrough ( like this ) indicates syntax that is present in VHDL-87, but not in VHDL-93; this occurs only in the rule for file_declaration (rule 38 ). This means that any VHDL-87 code that contains keywords in or out in a file declaration will not compile in a VHDL-93 environment. Except for this one exception, VHDL-93 is a superset of VHDL-87.

The VHDL productions are in alphabetical order. The highest-level production is the definition for design_file ; this is where you start to traverse the tree starting at the top level. The following parts (indicated by the use of uppercase in the BNF) are the lowest-level constructions: UPPER_CASE_LETTER ( A Z plus accented uppercase letters), LOWER_CASE_LETTER ( a z and accented lowercase letters, é , and so on), LETTER (either uppercase or lowercase letters, a Z , and all accented letters), DIGIT ( 0 9 ), SPACE_CHARACTER ( ' ' and nonbreaking space), UNDERLINE ( '_' ), SPECIAL_CHARACTER ( " # & ' () * + , - . / : ; < = > [ ] _ | ), and OTHER_SPECIAL_CHARACTER (all remaining characters such as ! $ % @ ? and so on, but not including format effectors). Format effectors are the ISO (and ASCII) characters called horizontal tabulation, vertical tabulation, carriage return, line feed, and form feed.

Keywords are shown in bold . Notice that the terms label, literal, and range are keywords ( label , literal , range ) and are also used as the name of a part ( label , literal , range ), as they are in the LRM. Construct names that commence with italics , such as time _expression , are intended to make the syntax definitions easier to read. The italic part of the construct is treated as a comment. You look up the definition for time _expression under 'e' for expression, not 't' for time. There are no formal definitions of the italic modifiers; if you are not sure exactly what is meant, you must look up the semantics in the body of the LRM.

actual_part ::= [93LRM 4.3.2.2] [1]

expression

| signal_ name | variable_ name | file_ name | open

| function_ name ( expression | signal_ name | variable_ name | file_ name | open

)

| type_mark ( expression | signal_ name | variable_ name | file_ name | open )

aggregate ::= [93LRM 7.3.2] [2]

( [ choice { | choice } => ] expression {, [ choice { | choice } => ] expression } ) alias_declaration ::= [93LRM 4.3.3] [3]

alias identifier | ' graphic_character ' | " { graphic_character } " [ : subtype_indication ] is name [ signature ] ; architecture_body ::= [93LRM 1.2] [4]

architecture identifier of entity_ name is { block_declarative_item }

begin

{ concurrent_statement }

end [ architecture ] [ architecture_ identifier ]; assertion ::= [93LRM 8.2] [5]

assert boolean_ expression [ report expression ] [ severity expression ] association_list ::= [93LRM 4.3.2.2] [6]

[ formal_part => ] actual_part {, [ formal_part => ] actual_part } attribute_declaration ::= [93LRM 4.4] attribute identifier : type_mark ; [7] attribute_name ::= [93LRM 6.6] prefix [ signature ] ' attribute_ identifier [8] [ ( expression ) ]

attribute_specification ::= [93LRM 5.1] [9]

attribute attribute_ identifier of entity_name_list : entity_class is expression ; based_literal ::= [93LRM 13.4.2] [10]

integer # DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER } [ . DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER } ]

# [ E [ + ] integer | E integer ] basic_graphic_character ::= [93LRM 13.1] [11]

UPPER_CASE_LETTER | DIGIT | SPECIAL_CHARACTER | SPACE_CHARACTER

bit_string_literal ::= [93LRM 13.7] [12]

B | O | X " [DIGIT | LETTER { [ UNDERLINE ] DIGIT | LETTER } ]" block_configuration ::= [93LRM 1.3.1] [13]

for architecture_ name

| block_statement_ label

| generate_statement_ label

[ ( discrete_ subtype_indication | range | static_ expression ) ]

{use prefix . suffix {, prefix . suffix } ; }

{block_configuration | component_configuration }

end for ;

block_declarative_item ::= [93LRM 1.2.1] [14] subprogram_specification ; | subprogram_body | type_declaration | subtype_declaration | constant_declaration | signal_declaration

| shared_ variable_declaration

| file_declaration | alias_declaration

| component_declaration | attribute_declaration

| attribute_specification | configuration_specification | disconnection_specification | use_clause

| group_template_declaration | group_declaration block_statement ::= [93LRM 9.1] [15]

block_ label :

block [ ( guard_ expression ) ] [ is ] [ generic ( generic_ interface_list );

[ generic map ( generic_ association_list ) ; ] ] [ port ( port_ interface_list );

[ port map ( port_ association_list ) ; ] ] { block_declarative_item }

begin

{concurrent_statement } end block [ block_ label ] ;

case_statement ::= [93LRM 8.8] [16] [ case_ label : ] case expression is

when choice { | choice } => { sequential_statement }

{when choice { | choice } => { sequential_statement } } end case [ case_ label ] ;

choice ::= [93LRM 7.3.2] [17]

simple_expression | discrete_range | element_ identifier | others component_configuration ::= [93LRM 1.3.2] [18]

for

instantiation_ label { , instantiation_ label } : component_ name | others : component_ name

| all : component_ name [ [ use

entity entity_ name [ ( architecture_ identifier ) ] | configuration configuration_ name

| open ]

[ generic map ( generic_ association_list ) ] [ port map ( port_ association_list ) ] ; ]

[ block_configuration ] end for ;

component_declaration ::= [93LRM 4.5] [19] component identifier [ is ]

[ generic ( local_generic_ interface_list ) ; ] [ port ( local_port_ interface_list ) ; ]

end component [ component_ identifier ] ; component_instantiation_statement ::= [93LRM 9.6] [20] instantiation_ label : [ component ] component_ name

| entity entity_ name [ ( architecture_ identifier ) ] | configuration configuration_ name

[ generic map ( generic_ association_list )] [ port map ( port_ association_list ) ] ; concurrent_statement ::= [93LRM 9] [21] block_statement

| process_statement

| [ label : ] [ postponed ] procedure_call ; | [ label : ] [ postponed ] assertion ;

| [ label : ] [ postponed ] conditional_signal_assignment | [ label : ] [ postponed ] selected_signal_assignment

| component_instantiation_statement | generate_statement

conditional_signal_assignment ::= [93LRM 9.5.1] [22]

name | aggregate <= [ guarded ] [ transport | [ reject time_ expression ] inertial ]

{waveform when boolean_ expression else } waveform [ when boolean_ expression ] ; configuration_declaration ::= [93LRM 1.3] [23] configuration identifier of entity_ name is

{use prefix . suffix { , prefix . suffix } ;

| attribute_specification | group_declaration } block_configuration

end [ configuration ] [ configuration_ identifier ] ; configuration_specification ::= [93LRM 5.2] [24] for

instantiation_ label { , instantiation_ label } : component_ name | others : component_ name

| all : component_ name [ use

entity entity_ name [ ( architecture_ identifier ) ] | configuration configuration_ name

| open ]

[ generic map ( generic_ association_list ) ] [ port map ( port_ association_list ) ] ;

constant_declaration ::= [93LRM 4.3.1.1] [25]

constant identifier { , identifier } : subtype_indication [ := expression ] ; constraint ::= range_constraint | index_constraint [93LRM 4.2] [26] decimal_literal ::= [93LRM 13.4.1] [27]

integer [ . integer ] [ E [ + ] integer | E integer ] design_file ::= [93LRM 11.1] [28]

{library_clause | use_clause } library_unit

{{ library_clause | use_clause } library_unit } disconnection_specification ::= [93LRM 5.3] [29]

disconnect guarded_ signal_list : type_mark after time_ expression ; discrete_range ::= [93LRM 3.2.1] discrete_ subtype_indication | range [30] entity_class ::= [93LRM 5.1][31]

entity

| architecture | configuration | procedure | function

| package | type | subtype | constant

| signal | variable | component | label | literal | units | group | file

entity_declaration ::= [93LRM 1.1] [32] entity identifier is

[ generic ( formal_generic_ interface_list ) ; ] [ port ( formal_port_ interface_list ) ; ]

{ subprogram_specification ; | subprogram_body | subtype_declaration | constant_declaration

| signal_declaration | file_declaration

| alias_declaration | attribute_declaration | attribute_specification | type_declaration | disconnection_specification | use_clause | shared_ variable_declaration

| group_template_declaration | group_declaration } [ begin

{ [ label : ] [ postponed ] assertion ;

| [ label : ] [ postponed ] passive_ procedure_call ; | passive_ process_statement } ]

end [ entity ] [ entity_ identifier ] ; entity_name_list ::= [93LRM 5.1] [33]

identifier | " { graphic_character } " | ' graphic_character ' [ signature ]

{ , identifier | " { graphic_character } " | ' graphic_character ' [ signature ] } | others

| all

enumeration_literal ::= [93LRM 3.1.1] identifier | ' graphic_character ' [34] exit_statement ::= [93LRM 8.11] [35]

[ label :] exit [ loop_ label ] [ when boolean_ expression ] ;

expression ::= [93LRM 7.1] [36] relation { and relation }

| relation { or relation } | relation { xor relation }

| relation [ nand relation ] | relation [ nor relation ]

| relation { xnor relation }

factor ::= [93LRM 7.1] primary [ ** primary ] | abs primary | not primary [37] file_declaration ::= [93LRM 4.3.1.4] [38]

file identifier { , identifier } : subtype_indication

[ [ open file_open_kind_ expression ] is [ in | out ] string_ expression ] ; formal_part ::= [93LRM 4.3.2.2] [39]

generic_ name | port_ name | parameter_ name

| function_ name ( generic_ name | port_ name | parameter_ name ) | type_mark ( generic_ name | port_ name | parameter_ name )

function_call ::= [93LRM 7.3.3] function_ name [ ( parameter_ association_list ) ] [40]

generate_statement ::= [93LRM 9.7] [41] generate_ label :

for identifier in

discrete_ subtype_indication | range | if boolean_ expression

generate

[ { block_declarative_item } begin ] { concurrent_statement }

end generate [ generate_ label ] ; graphic_character ::= [93LRM 13.1] [42]

basic_graphic_character | LOWER_CASE_LETTER | OTHER_SPECIAL_CHARACTER

group_declaration ::= [93LRM 4.7] [43] group identifier : group_template_ name ( name | ' graphic_character '

{ , name | ' graphic_character ' } ) ; group_template_declaration ::= [93LRM 4.6] [44]

group identifier is ( entity_class [ <> ] { , entity_class [ <> ] } ) ; identifier ::= [93LRM 13.3] [45]

LETTER { [ UNDERLINE ] LETTER | DIGIT } | \ graphic_character { graphic_character } \ if_statement ::= [93LRM 8.7] [46]

[ if_ label : ] if boolean_ expression then { sequential_statement } { elsif boolean_ expression then { sequential_statement } }

[ else { sequential_statement } ] end if [ if_ label ] ;

index_constraint ::= [93LRM 3.2.1] ( discrete_range { , discrete_range } ) [47] integer ::= [§ 13.4.1] DIGIT { [ UNDERLINE ] DIGIT } [48] interface_declaration ::= [93LRM 4.3.2] [49]

[ constant ] identifier { , identifier }

:[ in ] subtype_indication [ := static_ expression ] | [ signal ] identifier { , identifier }

:[ in | out | inout | buffer | linkage ]

subtype_indication [ bus ] [ := static_ expression ] | [ variable ] identifier { , identifier }

: [ in | out | inout | buffer | linkage ] subtype_indication [ := static_ expression ] | file identifier { , identifier } : subtype_indication

interface_list ::= [93LRM 4.3.2.1] interface_declaration {; interface_declaration } [50]

label ::= identifier [93LRM 9.7] [51]

library_clause ::= [93LRM 11.2] library identifier {, identifier } ; [52] library_unit ::= [93LRM 11.1] [53]

entity_declaration | configuration_declaration | package_declaration | architecture_body | package_body

literal ::= [93LRM 7.3.1] [54]

decimal_literal | based_literal | physical_literal

| enumeration_literal | string_literal | bit_string_literal | null loop_statement ::= [93LRM 8.9] [55]

[ loop_ label : ]

[ while boolean_ expression | for identifier in discrete_range ] loop

{ sequential_statement } end loop [ loop_ label ] ; name ::= [93LRM 6.1] [56] identifier

| " { graphic_character } " | prefix . suffix

| prefix ( expression { , expression } ) | prefix ( discrete_range )

| attribute_name

next_statement ::= [93LRM 8.10] [57]

[ label : ] next [ loop_ label ] [ when boolean_ expression ] ; null_statement ::= [93LRM 8.13] [ label : ] null ; [58] package_body ::= [93LRM 2.6] [59]

package body package_ identifier is

{subprogram_specification ; | subprogram_body | type_declaration | subtype_declaration | constant_declaration | file_declaration

| alias_declaration | use_clause | shared_ variable_declaration

| group_template_declaration | group_declaration } end [ package body ] [ package_ identifier ] ; package_declaration ::= [93LRM 2.5] [60] package identifier is

{subprogram_specification ; | type_declaration | subtype_declaration | constant_declaration | signal_declaration | file_declaration

| alias_declaration | component_declaration

| attribute_declaration | attribute_specification | disconnection_specification | use_clause

| shared_ variable_declaration

| group_template_declaration | group_declaration } end [ package ] [ package_ identifier ] ;

physical_literal ::= [93LRM 3.1.3] [ decimal_literal | based_literal ] unit_ name [61]

physical_type_definition ::= [93LRM 3.1.3] [62] range_constraint

units identifier ;

{ identifier = physical_literal ; }

end units [ physical_type_ identifier ]

prefix ::= [93LRM 6.1] name | function_call [63] primary ::= [93LRM 7.1] [64]

name | literal | aggregate | function_call

| type_mark ' ( expression ) | type_mark ' aggregate | type_mark ( expression ) | ( expression )

| new subtype_indication | new type_mark ' ( expression ) | new type_mark ' aggregate

procedure_call ::= [93LRM 8.6] procedure_ name [ ( parameter_ association_list ) ] [65]

process_statement ::= [93LRM 9.2 ] [66] [ process_ label : ]

[ postponed ] process [ ( signal_ name { , signal_ name } ) ] [ is ] { subprogram_specification ; | subprogram_body

| type_declaration

| subtype_declaration | constant_declaration | variable_declaration

| file_declaration | alias_declaration | attribute_declaration | attribute_specification | use_clause

| group_template_declaration | group_declaration } begin

{ sequential_statement }

end [ postponed ] process [ process_ label ] ; range ::= [93LRM 3.1] [67]

range_ attribute_name

| simple_expression to | downto simple_expression range_constraint ::= [93LRM 3.1] range range [68] record_type_definition ::= [93LRM 3.2.2] [69] record

identifier {, identifier } : subtype_indication ;

{ identifier {, identifier } : subtype_indication ; }

end record [ record_type_ identifier ] relation ::= [93LRM 7.1] [70]

simple_expression [ sll | srl | sla | sra | rol | ror simple_expression ] [ = | /= | < | <= | > | >=

simple_expression [ sll | srl | sla | sra | rol | ror simple_expression ] ] report_statement ::= [93LRM 8.3] [71]

[ label : ] report expression [ severity expression ] ;

return_statement ::= [93LRM 8.12] [ label : ] return [ expression ] ; [72] selected_signal_assignment ::= [93LRM 9.5.2] [73]

with expression select

name | aggregate <= [ guarded ]

[ transport | [ reject time_ expression ] inertial ] waveform when choice { | choice }

{ , waveform when choice { | choice } } ; sequential_statement ::= [93LRM 8] [74] wait_statement

| [ label : ] assertion ; | report_statement

| signal_assignment_statement

| variable_assignment_statement | [ label : ] procedure_call ;

| if_statement

| case_statement | loop_statement | next_statement | exit_statement

| return_statement

| null_statement

signal_assignment_statement ::= [93LRM 8.4] [75] [ label : ] name | aggregate <=

[ transport | [ reject time_ expression ] inertial ] waveform ; signal_declaration ::= [93LRM 4.3.1.2] [76]

signal identifier {, identifier } : subtype_indication [ register | bus ] [ := expression ] ;

signal_list ::= [93LRM 5.3] signal_ name { , signal_ name } | others | all [77] signature ::= [93LRM 2.3.2] [78]

[ [ type_mark { , type_mark } ] [ return type_mark ] ] simple_expression ::= [93LRM 7.1] [ + | - ] term { + | - | & term } [79] string_literal ::= [93LRM 13.6] " { graphic_character } " [80] subprogram_body ::= [93LRM 2.2] [81]

subprogram_specification is { subprogram_specification ; | subprogram_body

| type_declaration

| subtype_declaration | constant_declaration | variable_declaration | file_declaration

| alias_declaration

| attribute_declaration

| attribute_specification | use_clause

| group_template_declaration

| group_declaration } begin

{ sequential_statement } end [ procedure | function ]

[ identifier | " { graphic_character } " ] ; subprogram_specification ::= [93LRM 2.1] [82] procedure identifier | " { graphic_character } " [ ( parameter_ interface_list ) ]

| [ pure | impure ] function identifier | " { graphic_character } " [ ( parameter_ interface_list ) ]

return type_mark

subtype_declaration ::= [93LRM 4.2] [83] subtype identifier is

[ resolution_function_ name ] type_mark [ constraint ] ; subtype_indication ::= [93LRM 4.2] [84]

[ resolution_function_ name ] type_mark [ constraint ] suffix ::= [93LRM 6.3] [85]

identifier

| ' graphic_character '

| " { graphic_character } " | all

term ::= [93LRM 7.1] factor { * | / | mod | rem factor } [86] type_declaration ::= [93LRM 4.1] [87]

type identifier ;

| type identifier is

( identifier | ' graphic_character '

{ , identifier | ' graphic_character ' } ) ;

| range_constraint ;

| physical_type_definition ; | record_type_definition ;

| access subtype_indication ; | file of type_mark ;

| array index_constraint of element_ subtype_indication ;

| array ( type_mark range <> { , type_mark range <> } ) of element_ subtype_indication ;

type_mark ::= [93LRM 4.2] type_ name | subtype_ name [88] use_clause ::= [93LRM 10.4] use prefix . suffix {, prefix . suffix } ; [89] variable_assignment_statement ::= [93LRM 8.5] [90]

[ label : ] name | aggregate := expression ; variable_declaration ::= [93LRM 4.3.1.3] [91]

[ shared ] variable identifier {, identifier } : subtype_indication [ := expression ] ;

wait_statement ::= [93LRM 8.1] [92] [ label : ] wait

[ on signal_ name { , signal_ name } ] [ until boolean_ expression ]

[ for time_ expression ] ;

waveform ::= [93LRM 8.4] waveform_element { , waveform_element } | unaffected [93]

waveform_element ::= [93LRM 8.4.1] [94]

value_ expression [ after time_ expression ] | null [ after time_ expression ]

TABLE A.1 Index to VHDL BNF rules (list of rules that reference a rule).

1

actual_part 6

48 integer 10 , 27

2

aggregate 22 , 64 , 73 , 75 , 90

49 interface_declaration 50

3

alias_declaration 14 , 32 , 59 , 60 , 66 ,

50 interface_list 15 , 19 , 32 , 82

81

 

 

 

4

architecture_body 53

51 label 1 (see below)

5

assertion 21 , 32 , 74

52 library_clause 28

6

association_list 15 , 18 , 20 , 24 , 40 ,

53 library_unit 28

65

 

 

 

7

attribute_declaration 14 , 32 , 60 , 66 ,

54 literal 64

81

 

 

 

8

attribute_name 56 , 67

55 loop_statement 74

9

attribute_specification 14 , 23 , 32 , 60

56 name 2 (see below)

, 66 , 81

 

 

 

10 based_literal 54 , 61

57 next_statement 74

11 basic_graphic_character 42

58 null_statement 74

12 bit_string_literal 54

59 package_body 53

13 block_configuration 13 , 18 , 23

60 package_declaration 53

14 block_declarative_item 4 , 15 , 41

61 physical_literal 54 , 62

15 block_statement 21

62 physical_type_definition 87

16 case_statement 74

63 prefix 8 , 13 , 23 , 56 , 89

17 choice 2 , 16 , 74

64 primary 37

18 component_configuration 13

65 procedure_call 21 , 32 , 74

19 component_declaration 14 , 60

66 process_statement 21 , 32

20 component_instantiation_statement 21

67 range 13 , 30 , 41 , 68 , 87

21 concurrent_statement 4 , 15 , 21 , 41

68 range_constraint 26 , 62 , 87

22 conditional_signal_assignment 21

69 record_type_definition 87

23 configuration_declaration 53

70 relation 36

24 configuration_specification 14

71 report_statement 74

25

constant_declaration 14 , 32 , 59 , 60 ,

72 return_statement 74

66 , 81

 

 

 

26 constraint 83 , 84

73 selected_signal_assignment 21

27 decimal_literal 54 , 61

74

sequential_statement 16 , 46 , 55 ,

66 , 81

 

 

 

28 design_file 0

75 signal_assignment_statement 74

29

disconnection_specification 14 , 32 ,

76 signal_declaration 14 , 32 , 60

60

 

 

 

30 discrete_range 17 , 47 , 55 , 56 , 61

77 signal_list 29

31 entity_class 9 , 44

78 signature 3 , 8 , 33

32 entity_declaration 53

79 simple_expression 17 , 67 , 70

33 entity_name_list 9

80 string_literal 54

34 enumeration_literal 54

81

subprogram_body 14 , 32 , 59 , 66

, 81

 

 

 

35 exit_statement 74

82

subprogram_specification 14 , 32 ,

59 , 60 , 66 , 81

 

 

 

36 expression 3 (see below)

83

subtype_declaration 14 , 32 , 59 ,

60 , 66 , 81

 

 

 

37 factor 86

84 subtype_indication 4 (see below)

38

file_declaration 14 , 32 , 59 , 60 , 66 ,

85 suffix 13 , 23 , 56 , 89

81

 

 

 

39 formal_part 6

86 term 79

40 function_call 63 , 64

87

type_declaration 14 , 32 , 59 , 60 ,

66 , 81

 

 

 

41 generate_statement 21

88

type_mark 1 , 7 , 29 , 39 , 64 , 78 ,

82 , 83 , 84 , 87

 

 

 

 

graphic_character 3 , 33 , 34 , 42 , 43 ,

 

use_clause 14 , 28 , 32 , 59 , 60 ,

42 45 , 56 , 80 , 81 , 82 , 85 , 87

89 66 , 81

43

group_declaration 14 , 23 , 32 , 59 , 60

90 variable_assignment_statement 74

, 66 , 81

 

 

 

 

group_template_declaration 14 , 32 ,

 

variable_declaration 14 , 32 , 59 ,

44 59 , 60 , 66 , 81

91 60 , 66 , 81

45 identifier 5 (see below)

92 wait_statement 74

46 if_statement 74

93 waveform 22 , 73 , 75

47 index_constraint 26 , 87

94 waveform_element 93

1.13 , 15 , 16 , 18 , 20 , 21 , 24 , 31 , 32 , 35 , 41 , 46 , 55 , 57 , 66 , 71 , 72 , 74 ,

75, 90 , 92

2.1 , 3 , 4 , 13 , 18 , 20 , 22 , 23 , 24 , 39 , 40 , 43 , 61 , 63 , 64 , 65 65 , 66 , 73 ,

75, 77 , 83 , 84 , 88 , 90 , 92

3.1 , 2 , 5 , 8 , 9 , 13 , 15 , 16 , 17 , 22 , 25 , 29 , 35 , 39 , 41 , 46 , 49 , 55 , 56 , 57 , 64 , 67 , 70 , 71 , 72 , 73 , 75 , 76 , 79 , 90 , 91 , 92 , 94

4.3 , 13 , 25 , 30 , 38 , 41 , 49 , 64 , 69 , 76 , 87 , 91

5.3 , 4 , 7 , 8 , 9 , 17 , 18 , 18 , 20 , 23 , 24 , 25 , 32 , 33 , 34 , 38 , 41 , 43 , 44 , 49 , 51 , 52 , 55 , 56 , 59 , 60 , 61 , 62 , 69 , 76 , 81 , 82 , 83 , 85 , 87 , 91

Соседние файлы в папке Для магистратуры