Hardware Reference
In-Depth Information
The assignments to c , d , and e result in illegal expression forms. This is because
a bit or part select is taken from a parenthesized expression which is a part select
itself. Assignment to f is equally illegal even though the argument is just a variable
identifier in which case it would perhaps make sense to allow substitution without
the enclosing parentheses.
Do not apply any select operators on let instances.
8.1.1
Syntax of Let
let declaration and its actual arguments have the following form:
let identifier[ ( let_port_item{, let_port_item}] ) ] D expression;
let_port_item allows port types that are restricted to integral types and event .
Also, untyped formal arguments may be used to indicate any type. There is no use
of port direction, hence port direction specification is not allowed.
Untyped ports can be used at the beginning of the formal port list, but once a
type is specified on a port, then all subsequent ports must have a type or an explicit
untyped . This is illustrated in the following example:
Example 8.9. Typed arguments.
let my_let(x, bit y,z)=y?x:z;
The formal argument x is untyped. The arguments y and z are of type bit .This
means that their actual arguments must be type compatible to type bit and is first
cast to bit before substituting in the expression y?x:z in the let instance. t
The formal arguments can also have default actual argument expressions
assigned to the formal arguments.
The right-hand side of the definition and the actual arguments (default or
otherwise) are general expression forms. As we discussed earlier, the expression
must be void of implicit and explicit variable assignments.
A let instance can be used wherever an expression can be used. The instance
consists of the let identifier followed in parentheses by a list of actual arguments.
An actual argument can be specified in one of several ways, like in functions and
tasks:
￿ Missing—when an actual argument is not provided. The default expression for
the corresponding formal argument is used.
￿ Positional binding—the list of actual expressions is separated by commas. They
are associated with the formal arguments in the order of appearance.
￿ Named binding .formal_identifier(actual_expression) —the actual argu-
ment is explicitly associated with a named formal argument. The order in which
Search WWH ::




Custom Search