Which of the following is correct syntax for block definition?

Which of the following is correct syntax for block definition?
A.
Code:
    label : BLOCK
    declarative_part;
    BEGIN
    concurrent_statements;
    end BLOCK label;
B.
Code:
    label : BLOCK
    declarative_part;
    BEGIN
    concurrent_statements;
    end label BLOCK;
C.
Code:
    BLOCK block_name;
    declarative_part;
    BEGIN
    concurrent_statements;
    end BLOCK block_name;
D.
Code:
    BLOCK block_name
    declarative_part;
    BEGIN
    sequential_statements;
    end BLOCK;
 
Answer: a
Explanation: A block is declared by using some label. First, a label is given to the block which is followed by a colon and then the keyword BLOCK. In the next line, signals, components, constants etc. are declared. After the declaration part of the block, BEGIN keyword is used followed by concurrent statements describing the behavior of the block.
 

Tìm kiếm

Back
Top