Cerilog
Cerilog is a C-flavored hardware description language that transpiles to
SystemVerilog (.sv) or Verilog-2005 (.v). Curly braces instead of
begin/end, ports declared in the module header, one logic type, one
always keyword. The output is plain, readable HDL that goes into Quartus,
Vivado, Verilator or Icarus unchanged.
counter.cel ──cerilog──▶ counter.sv / counter.v ──▶ Quartus / Vivado / Verilator
Example
// counter.cel
module Counter(
input logic clk,
input logic rst,
output logic[7:0] count
) {
always(posedge clk) {
if (rst) count <= 0;
else count <= count + 1;
}
}
cerilog counter.cel -o counter.sv:
module Counter (
input logic clk,
input logic rst,
output logic [7:0] count
);
always_ff @(posedge clk) begin
if (rst) begin
count <= 0;
end else begin
count <= count + 1;
end
end
endmodule
cerilog counter.cel -o counter.v, for tools without SystemVerilog support:
module Counter (
input wire clk,
input wire rst,
output reg [7:0] count
);
always @(posedge clk) begin
if (rst) begin
count <= 0;
end else begin
count <= count + 1;
end
end
endmodule
(Real output also has a header line and // source: counter.cel:N comments,
which tie tool errors back to your source.)
Features
{ }blocks; braces are optional around single statements, as in C- Ports and parameters declared in the module header
logiceverywhere. For Verilog output,wirevsregis worked out for youalways()for combinational logic,always(posedge clk)for flip-flops- C-style stacked
caselabels (fallthrough) forloops: insidealwaysthey're procedural, at module level they become generate loops- Multiple modules per file and SystemVerilog-style instances
- Memories,
localparam, initial values, the full SystemVerilog operator set,$clog2and friends - Errors and warnings with
file:line:col, the source line and a caret - VS Code extension: highlighting, error squiggles on save, a ▶ compile
button and an
.sv/.vtarget picker
The full language is described in docs/language_spec.md.
Install
Requires Python 3.10+.
pip install cerilog
This installs the cerilog command and its one dependency, the lark
parser library.
To work on Cerilog itself:
git clone https://github.com/R0mba-Na11avan/Cerilog.git
cd Cerilog
pip install -e ".[dev]"
Usage
cerilog counter.cel # SystemVerilog to stdout
cerilog counter.cel -o counter.sv # SystemVerilog to a file
cerilog counter.cel -o counter.v # Verilog-2005 (target taken from the extension)
cerilog counter.cel --target v # Verilog-2005 to stdout
cerilog counter.cel --check # only report errors and warnings
| Flag | Meaning |
|---|---|
-o FILE |
write to FILE; a .sv or .v extension picks the target |
--target sv|v |
choose the output language (also systemverilog / verilog); overrides the extension |
--check |
parse and check only; write nothing |
--no-source-maps |
leave out the // source: file.cel:N comments |
--tokens, --ast |
print the token stream or the syntax tree (debugging) |
Errors and warnings go to stderr. The exit status is 1 if there were errors.
counter.cel:8:28: error: expected ';' before 'else'
if (rst) count <= 0
^
VS Code
The extension in editors/vscode adds syntax highlighting,
error checking on save, a ▶ compile button, and a status-bar switch between
.sv and .v output. See its README to install it.
Project layout
cerilog/
├── __main__.py command line
├── compiler.py compile_source(): parse → analyse → emit
├── errors.py diagnostics and their formatting
├── lexer/lexer.py token stream (debugging, --tokens)
├── parser/grammar.lark the grammar: every token and syntax rule
├── parser/parser.py Lark parse tree → AST, syntax error messages
├── ast/nodes.py AST node dataclasses
├── analysis/checks.py symbol checks, drivers, wire/reg inference, warnings
└── codegen/emitter.py SystemVerilog and Verilog output
examples/ example .cel programs
tests/ pytest suite, golden outputs, Verilator lint
editors/vscode/ VS Code extension
docs/language_spec.md language reference
Tests
python -m pytest
tests/golden/compiles every file inexamples/to both targets and compares the result withtests/golden/expected/. After an intended output change, regenerate withCERILOG_UPDATE_GOLDEN=1 python -m pytest tests/goldenand review the diff.tests/lint/runsverilator --lint-onlyon every example in both targets. It is skipped when Verilator isn't installed.
License
MIT
Metadata
Release files for cerilog 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cerilog-0.1.0.tar.gz | 29.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cerilog-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.7 kB
Release files / cerilog-0.1.0.tar.gz
| Download URL | cerilog-0.1.0.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94769d31693b21cf1aa955026b8ca90f1036f54b6aeefcf4921c45a4c00fc02b
|
|
BLAKE2b-256 checksum How to use checksums |
a5da9f1b6496ffbf10a5c767e07144ca5ce96b514c13ed78de9789a963104d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / cerilog-0.1.0-py3-none-any.whl
| Download URL | cerilog-0.1.0-py3-none-any.whl |
|---|---|
| Size | 29.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d343a17c7c36ea45e39c23b90820ad35b28b924e5d4351b512fa71b74716d7c
|
|
BLAKE2b-256 checksum How to use checksums |
7e19febb3c86492eed49ce47e9e6480492a3071c08c416508146a0676655f0b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for cerilog 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cerilog-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.