Base Graphics: Integration with draw2d
for vector rendering.
Aesthetics: The default netlistsvg skin,
skins/skin_xilinx.svg, follows the figures of AMD’s UG474:
Helvetica or Arial of regular weight, thin lines without arrowheads, pin
names inside generic blocks and flip-flops (D,
CE, CK, Q), small port flags, and
plain multiplexer trapezoids. skins/skin_with_arrows.svg,
the earlier bold monospace look with arrowheads, is chosen with the
skin argument of blockpic_diagram.
Shapes Library:
Basic Logic: AND, OR, NOT
(IEEE standard geometry).
Sequential: DFF (D-Flip-Flop with clock tick).
Routing: MUX (Trapezoidal multiplexer).
Fallback: Standard rectangular block rendering.
Wire Routing:
Support for thickness styling.
Bus-width marks: every wire wider than one bit is crossed by a short
slash with its width beside it. The width is the wire’s
crossline when it has one, else its thickness.
A wire with a type: "name" shows the type’s name instead,
and blockpic import takes it from the wiretype
attribute that Yosys gives a wire declared with a SystemVerilog
typedef.
Auto-Layout: Basic flow-based coordinate assignment
for unmapped blocks.
Groups: ELK lays each group out as one
box, so no other block falls inside its dashed outline. Groups that
share a block cannot each be one box; their outlines are drawn around
their blocks after the layout, as before.
Commutative inputs: The inputs of an
AND, NAND, OR, NOR,
XOR, XNOR, ADD, MUL,
EQ or NE block go to their wires in the order
the wires arrive, the topmost input to the wire from highest, so that
the wires do not cross on their way in. A change is kept only when the
drawing has fewer crossings, or as many and fewer bends.
Straight single wires: A block with one wire, such
as a constant or a port, moves up or down until its wire runs straight
to the pin at the other end, where it has room to.
No jogs: A middle run of a wire that steps aside
and back, as ELK leaves one that crosses a group’s border, slides into
line with the run before or after it, where it then runs through no
block or label.
blockpic layout <netlist.json> -src <file.blockpic> -skin <skin.svg> -nsv <nsv> [-o layout.json] [-netlist arranged.json] [-v]:
Lays a rendered netlist out with ELK and improves the layout, as
described in section 3, for //tools/netlistsvg:nsv to draw.
It writes the layout to -o, and to -netlist
the netlist to draw with it, whose commutative inputs may be reordered;
-v says what it changed. blockpic_diagram runs
it between render and refine.
blockpic refine <file.blockpic> -svg <drawn.svg> [-layout layout.json] [-o out.svg]:
Finishes a drawing: thick buses with their width marks, the blocks’
names, and the groups’ boxes, where -layout puts them or
else around their blocks.
blockpic import <netlist.json> [-top MODULE] [-o out.blockpic]:
Writes a Yosys JSON netlist, such as the one
rules_openxc7’s vivado_synthesis gives, as
blockpic source. Each cell becomes a block of its type, and each module
port an INPUT_PIN or OUTPUT_PIN block. A bus
is one thick wire when all its bits go to one pin, and one pin per bit
(PORT_i) when they do not. Constants become
GND, VCC or CONST blocks, which
the skins draw as tie-offs: the value beside a short stub at the
pin.
5. Continuous
Delivery
Automated Releases: GitHub Workflow for multi-arch
binary releases (Linux, macOS).
Versioning: Automatic semantic version
tagging.
6. IEEE Standard
Shape Library
Blockpic provides a comprehensive library of digital logic blocks
based on IEEE standards.
6.1 Supported Shapes
Logic Gates: AND, OR,
NOT, XOR.
Sequential Logic: DFF,
JKFF, TFF, SRFF.
Routing: MUX, DEMUX.
Power/Signal: VCC, GND
(drawn as tie-offs), CLOCK.
Blockpic includes a validation layer to ensure logical correctness
before rendering. * Unique Names: Blocks must have
unique identifiers. * Connectivity: Wire source and
destination blocks must exist. * Pin Verification:
Referenced pins must exist on their respective blocks.
8. Pins and Buses
Blockpic supports explicit pin rendering and multi-bit bus
visualization. * Pin Rendering: Named inputs and
outputs are rendered on block boundaries. * Bus
Thickness: Wires can have custom thickness to represent buses.
* Crossline Indicator: Standard bus width indicators
with labels.
Blockpic automatically calculates block dimensions based on the
number of input and output pins. * Automatic Height:
Blocks expand vertically to accommodate multiple pins while maintaining
even distribution. * Precise Pin Positioning: Pins are
positioned exactly at the boundary intersection, ensuring clean
orthogonal routing.
Blockpic strictly adheres to IEEE Std 91-1984 for MSI components. *
Common Control Block: MSI blocks like
REGISTER and COUNTER feature a separated top
section for common controls. * Dependency Notation:
Pins are labeled using IEEE functional indicators (C for
clock, EN for enable, R for reset,
S for set). * Dynamic Indicators: Clocks
(CLK, C) are rendered with the standard
> wedge indicator.
10.1
Visual Reference and Source Code
diagram MSIBlocks {
block REG8 {
kind: "REGISTER";
inputs: D [left], CLK [left], EN [left], R [left];
outputs: Q [right];
params: { width: "8" };
}
block CTR4 {
kind: "COUNTER";
inputs: CLK [left], EN [left], R [left];
outputs: Q [right], TC [right];
params: { width: "4" };
}
layout {
REG8 at (20, 20)
CTR4 at (200, 20)
}
}
MSI Blocks
11. Pin-Aware Routing
Blockpic routes wires orthoganally, considering the physical side of
the block where the pin is located. * Directional
Exits: Wires exit perpendicular to the boundary they originate
from. * Directional Entries: Wires enter perpendicular
to the boundary they terminate at. * Supported Hints:
straight, L-shape, Z-shape paths
intelligently adapt to top/bottom/left/right pin orientations.
Blockpic features a robust layer-based automatic layout engine. *
Dependency Grouping: Blocks are grouped into columns
(layers) based on their logical depth from inputs to outputs. *
Topological Sorting: Longest-path layer assignment
ensures clear left-to-right flow without manual coordinate mapping. *
Cycle Handling: The algorithm gracefully handles
feedback loops by assigning arbitrary starting layers to cyclic
components.
Blockpic supports mapping its blocks to the comprehensive set of
standard netlistsvg skin components natively. This enables
rich schematic diagrams containing arithmetic operators, bitwise logic,
latches, multiplexers, and specialized multi-input gates.
Blockpic natively supports advanced ElkJS layout features via the
integrated netlistsvg engine, including automatic cycle
resolution for feedback loops. Additionally, text decorators such as
unicode overbars (for active-low signals) and multiline parameters are
fully supported. Furthermore, all wires are styled with directional
arrowheads to clearly denote signal flow.
Blockpic supports high-fidelity schematic replication of common FPGA
vendor diagrams. Below is a comparison between the original Xilinx UG474
figure_1_1 documentation image and the exact identical
layout recreated directly from Blockpic source code.
This demonstrates the engine’s capability to render complex
hierarchical layouts, custom element sizing, dashed group bounding
boxes, and thick hollow block-arrow buses.