Basics · 4 of 4
Constants
Numbers repeated throughout a program are hard to change. define gives a value a name:
define wg_width = 500nm
define wg_len: size = 20um # the type is optionalA top-level constant can be used anywhere in the file, even above its definition: laylight evaluates constants in the order of their dependencies (a constant that depends on itself is an error). Constants cannot be changed.
Two more things you will meet in programs:
define dbu = 1nmsets the database unit, the grid all coordinates are rounded to in the output. It is optional and defaults to 1 nm.- Line breaks matter in one place: an operator cannot start a line. A line ending in
a +continues on the next line, but a line starting with+ bdoes not continue the one before.
Exercise
Introduce constants for the waveguide width and the spacing, named wg_width and pitch, and use them in Bus. Then change the design through them: make all three waveguides 800 nm wide and 4 µm apart.