Blockpic is a domain-specific language (DSL) for engineering block diagram typesetting, designed to produce diagrams with the aesthetics of Xilinx UG474 technical documentation.
Blockpic focuses on clear, functional, and aesthetically minimalist diagrams. It prioritizes orthogonal routing, precise port placement, and a standard color palette for hardware logic primitives.
A Block is the primary logical element. Each block
has: - Label: A unique logical designation identifier
(e.g. AND1) used for defining wire connections and layout
references. - Name: An optional display name attribute
(e.g. name: "My Gate";) shown inside the block shape on the
diagram. If omitted, the block’s Label is used for
rendering. - Kind: The type of block (e.g.,
AND, OR, FLIPFLOP,
MUX, LUT, CUSTOM). -
Input Pins: Named input ports. - Output
Pins: Named output ports. - Parameters:
Key-value pairs for configuration (e.g., init: 0x1234).
Supported parameters include: - show_port_names: Controls
pin/port name visibility (fallback check). Set
show_port_names: "true" to force rendering. -
Hint: An optional block display hint. Supported values
include: - show-ports: Forces rendering of input and output
port names. - hide-ports: Forces hiding of input and output
port names. - Dimensions: Optional width and height. -
Custom Rendering: Support for custom rendering
functions (Phase 2).
Pins are the connection points on blocks. - Type:
input or output. - Position
Hint: left, right, top,
bottom.
Wires connect an output pin of a source block to an input pin of a
destination block. - Source:
(block_name, pin_name). - Destination:
(block_name, pin_name). - Routing Hints:
Hints for the router (e.g., straight, L-shape,
Z-shape, feedback). - Signal
Directionality: Wires must render an arrowhead at the
destination pin to clearly indicate the flow of the signal. -
Feedback Routing: Support for backward-flowing signals
(e.g., in Mealy/Moore state machines), routing wires around blocks to
return to an earlier stage in the data path. - Bus
Attributes: - Thickness: Specifies if the wire
is a bus and its relative thickness. - Crossline:
Supports a crossline indicator (often used with a number to indicate bus
width).
#E6F2FF) with a Dark Grey
(#333333) outline.#F2F2F2) or transparent with
dashed borders.#FFF2E6) for carry chains
or shift registers.Blockpic strictly adheres to ANSI/IEEE Std 91-1984 for logic symbols. It supports both distinctive-shape and rectangular-shape symbols.
& : AND>=1: OR1 : Buffer/Inverter=1: XORX/Y: Specialized functions.For MSI components like Registers and Counters, Blockpic supports
IEEE dependency notation to represent internal logic relationships: -
G (AND): Gate dependency. -
C (Control): Timing/Clock dependency
(often used with the > dynamic indicator for
edge-triggering). - S (Set) / R
(Reset): Asynchronous set and reset. - EN
(Enable): Output enable. - M
(Mode): Mode dependency. - V
(OR): OR dependency.
(o)): External negation.>): Dynamic indicator for
edge-triggered inputs.(v)): Three-state (Hi-Z)
output indicator.~text~): Indicates an
active-low signal (renders a line over the text)._text_): Text formatting
indicator (renders a line under the text).Blockpic uses a custom DSL designed for readability.
diagram MyLogic {
config {
style: "Xilinx";
font: "Helvetica", 9pt;
}
// Block declarations
block LUT6_A {
kind: "LUT";
params: { init: "0x8000000000000000" };
inputs: I0, I1, I2, I3, I4, I5;
outputs: O;
size: (40, 60);
}
block DFF_1 {
kind: "FLIPFLOP";
inputs: D, CLK [bottom], CE [left];
outputs: Q;
}
// Wire declarations
wire LUT6_A.O -> DFF_1.D {
hint: "Z-shape";
}
wire BUS_IN.O -> LUT6_A.I0 {
thickness: 2;
crossline: 8; // Indicates an 8-bit bus
}
// Optional Layout
layout {
LUT6_A at (10, 10);
DFF_1 at (100, 10);
}
}
layout block.draw2d rendering engine (rectangles, lines,
text).AND, OR,
NOT).G,
C, S, R, EN).REG, CTR,
ALU).CUSTOM blocks.draw2d or complementary libraries.//ai/spec.md.//ai/tasks/.NNN prefix (e.g., 000_initial_lexer.md), where
NNN is a sequence number starting from
000.