Menu

Instance

StackSmith

[Table Of Contents] [Module] Instance [Wiring]

Instances

Instance declarations occur inside module definitions.

<name> <type> [name:value[,name:value...]] ;

name is the name of the instance.

type is the name of the module this instance refers to.

name:value pairs set the parameters of this instance. Each name MUST match a paramname in the type's parameter name list. There may be zero or more name:value pairs in each instance declaration.

An instance declaration is terminated by a semicolon.

Variables

Parameter values may be literal strings, such as data:0x1234 . The value may also contain a variable in the form of !abc!. In this case, the value of this module's parameter named abc will substitute the entire string !abc!. This is an extremely powerful feature that is better shown by example:

module TEST(data,string) input(IN),output(OUT) {
  myinst LAKE pa:0x123 pb:!data! pc:"hello !string! " ;
  ...
}

module TOP(){
  t1 TEST data:0xAABB string:world ;
  t2 TEST data:0x1812 string:Dolly ;
..
}

inside TOP there are two instances of TEST, each containing an instance of LAKE. Because of variables, they are different:

top/t1/myinst of type Lake:  pa:0x123  pb:0xAABB  pc:"hello world "

top/t2/myinst of type Lake:  pa:0x123  pb:0x1812  pc:"hello Dolly "

[Table Of Contents] [Module] Instance [Wiring]


Related

Wiki: Module
Wiki: Table Of Contents
Wiki: Wiring

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.