Skip to main content

Module hardware_spec

Module hardware_spec 

Source
Expand description

The line grammar the Hardware-mode specs share — pigeons: 6, registers: 3, tmp: 1-5, and each line’s # … comment — read one way by their parsers and by the editor, so what the editor paints as a comment is exactly what the parsers skip.

Constants§

FIELDS
Every field a Hardware spec names before its value.
PIGEONS
The pigeonhole spec’s one field: how many pigeons go into one fewer holes.
PIGEONS_RANGE
How many pigeons a spec may ask for: one pigeon with no hole is degenerate, and past twenty the picture stops being legible.
REGISTERS
The register-allocation spec’s budget: how many physical registers there are.

Functions§

comment_start
Where line’s comment starts: the first run of # that opens_comment.
content
A spec line without its comment, trimmed.
field_value
The value after field: on a spec line, trimmed and without the line’s comment, when the line names that field.
hover
What the editor’s hover says about the word at byte offset of a spec: the field it names, or the live range it reads. Markdown, as the language server’s hovers are.
is_field
Whether word names field the way the parsers accept it: lowercase, or capitalised.
opens_comment
Whether a run of # whose next character is after opens a comment: it does when a space or the end of the line follows (# note, ## Title). Verilog’s #5 and #(10) delays are code.
problems
What is wrong in a spec, placed under the value at fault: a field its parser would refuse, a live range that never starts or ends. A spec that names no field has nothing to check here.