A circuit you draw once
Digital designs repeat themselves: a half adder appears in every full adder, a flip-flop in every register, the same divider in every stage of a counter. Drawing each copy gate by gate is slow, and a slip in one copy is hard to find. A block lets you draw the circuit once and place it as many times as you need.
Making a block
Draw the circuit on a layer and name its switches and lamps: click the small tag under an INPUT or OUTPUT and type a name. Those names become the pins of the block. Then open the Blocks tab and press "Make block". The dialog shows the pins it found, ordered from top to bottom as they sit on the canvas, so the order on the block mirrors your drawing.
The block appears in the Blocks tab. Click it or drag it onto the canvas as often as you like, and wire it up like any other element.
- A block needs at least one OUTPUT.
- It cannot contain a CLOCK: use an INPUT inside and wire a clock into the block from outside.
- Notes, frames, VIAs and net labels on the layer are left out.
Changing a block
Double-click a block, or press the small pencil under its name, and the circuit inside it opens on the canvas in place of your own. Edit it like any circuit, then press Done: every copy of the block, on all four layers and in the library, takes the new definition. Press Discard and nothing changes.
Pins follow their names. Rename a pin and its wire stays where it was; add a pin and the others move down with their wires; remove one and only its wire goes. While a definition is open, saving a circuit file is switched off, so a half-edited block cannot end up in a file as if it were your circuit.
Every copy has its own memory
Place the divider twice and chain the copies and you get a divide-by-four counter whose two flip-flops count independently. That is not a given. A simulator that remembers each flip-flop under its bare name would see two blocks as one and the same flip-flop wired to different pins, and both would hold identical data forever. Boolflow gives every element inside a block a path of its own, such as U1/ff and U2/ff, so each copy has its own state.
Under the hood a block is expanded into the circuit it stands for before the simulation runs, with every inner element renamed after the block it sits in. That is also why blocks can contain other blocks: the expansion simply repeats.
What a block means for the other tools
To the rest of the editor a block is not a black box. The waveform plots the flip-flops inside it, labelled with the name of the block. The test cases can drive the circuit and read it through the block pins. The truth table and the Verilog, VHDL and C++ exporters work on the circuit with every block expanded, so the exported code contains the logic inside, with the ports you named on the outside.
Saving and sharing
A circuit file carries the definition of every block it uses, so it opens on any machine without your block library. The library itself, the list in the Blocks tab, is kept in your browser: a block you made is there next time, and removing it from the library does not touch copies already placed in a circuit.
Try it yourself
Open the divider example: one DIV2 block placed twice. Press the Waveform button and watch both Q outputs. Then draw your own half adder with inputs A and B and outputs S and C, make a block from it, and wire two of them and an OR gate into a full adder.