Vl-blockstmt
Representation of begin/end and fork/join blocks.
This is a product type, introduced by deftagsum in support of vl-stmt.
Fields
- blocktype — vl-blocktype-p
- Kind of block statement—begin/end,
fork/join, etc.
- stmts — vl-stmtlist
- name — maybe-string
- E.g., foo in foo : begin ... end or in
begin : foo ... end, if applicable.
- atts — vl-atts
- Any (* foo, bar = 1*) style attributes associated
with this statement.
- vardecls — vl-vardecllist
- paramdecls — vl-paramdecllist
- typedefs — vl-typedeflist
- imports — vl-importlist
- loaditems — vl-blockitemlist
- Block items for this block in parse order, before splitting
out into typed lists. Should not be used except in
shadowcheck.
General Form (from Verilog-2005)
begin [ : <name> <declarations> ]
<statements>
end
fork [ : <name> <declarations> ]
<statements>
join
See Section 9.8. The difference between the two kinds of blocks
is that in a begin/end block, statements are to be executed in
order, whereas in a fork/join block, statements are executed
simultaneously.
A further remark is that "Block names give a means of uniquely
identifying all variables at any simulation time." This seems to
suggest that one might try to flatten all of the declarations in a
module by, e.g., prepending the block name to each variable
name.
With regards to declarations: "All variables shall be static;
that is, a unique location exists for all variables, and leaving or
entering blocks shall not affect the values stored in them."
SystemVerilog-2012 Extensions
In Verilog-2005 only blocks that are named can have local
declarations. SystemVerilog drops this restriction and allows
declarations even in unnamed blocks.
SystemVerilog also allows the label to occur before the
begin or fork keyword, and, more generally, allows labels
to be added to other kinds of statements. For instance, you can
write:
update_foo: foo = foo + bar;
We turn labels like this into named begin/end blocks that
surround their statement.
Note that it's not legal to label a block both before and after
the begin keyword. See SystemVerilog-2012 Section 9.3.5, Statement
Labels, on page 178.
SystemVerilog also adds different kinds of join keywords,
which we now represent as part of the block's type.
Subtopics
- Make-vl-blockstmt
- Basic constructor macro for vl-blockstmt structures.
- Vl-blockstmt->paramdecls
- Get the paramdecls field from a vl-blockstmt.
- Vl-blockstmt->loaditems
- Get the loaditems field from a vl-blockstmt.
- Vl-blockstmt->vardecls
- Get the vardecls field from a vl-blockstmt.
- Vl-blockstmt->typedefs
- Get the typedefs field from a vl-blockstmt.
- Vl-blockstmt->imports
- Get the imports field from a vl-blockstmt.
- Vl-blockstmt->blocktype
- Get the blocktype field from a vl-blockstmt.
- Change-vl-blockstmt
- Modifying constructor for vl-blockstmt structures.
- Vl-blockstmt->stmts
- Get the stmts field from a vl-blockstmt.
- Vl-blockstmt->name
- Get the name field from a vl-blockstmt.
- Vl-blockstmt->atts
- Get the atts field from a vl-blockstmt.
- Vl-blocktype-p
- Indicates whether this is a begin/end, fork/join,
fork/join_any, or fork/join_none statement.