EditFiles(3)
π NAME π
Okay bestie, welcome to the Verilog::EditFiles page β filed under User Contributed Perl Documentation, living in the EditFiles(3) manual corner. The whole vibe is: Split Verilog modules into separate files. β¨
πΈ SYNOPSIS πΈ
See the splitmodule command for the full story. π«Ά
use Verilog::EditFiles;
my $split = Verilog::EditFiles->new
(outdir => "processed_rtl",
translate_synthesis => 0,
lint_header => undef,
celldefine => 1,
);
$split->read_and_split(glob("inbound_rtl/*.v"));
$split->write_files();
$split->edit_file(filename=>"foo", cb => sub { return $_[0]; });
π¦ DESCRIPTION π¦
Verilog::EditFiles provides an easy way to split library Verilog files that contain multiple modules into many files, with one module per file. Lowkey magical, no cap. π
π₯ FUNCTIONS π₯
π
new (...) π
Create a new Verilog::EditFiles object. Named parameters may be specified:
celldefineβ If true, add`celldefinebefore every module statement. Slay.lint_commandβ For thewrite_lintmethod, the name of the linter to use. Defaults tovlint --brief.lint_headerβ If defined, add the provided text before every module statement. Generally used to insert lint off pragmas.outdirβ Name of the directory to write the output modules to. Defaults to..programβ Name of the program to add to comments. Defaults toVerilog::EditFiles.timescale_headerβ If defined, add the provided text before every module statement. Generally set to the next needed to#includea timescale file. Use withtimescale_removal.timescale_removalβ If set, remove any`timescales.translate_synthesisβ If1, replace any synopsys translate on/offs with`ifdef SYNTHESISand`endifs. If set to a string, use that string instead of"SYNTHESIS".v_suffixβ The suffix to add to convert a module name into a filename. Defaults to.v.verboseβ If true, print what files are being read and written.
π§ $self->read_and_split([filenames]) π§
Read from the specified filenames.
If there is no module statement in the file, assume it is an include file, and when write_files is called, place all of the file contents into the output. If there is a module statement, when write_files is called, place all following output into a file named based on the module, with .v added. π
π $self->write_files() π
Write all of the files created by read_and_split to the outdir.
β $self->write_lint([filename=>...]) β
Create a shell script that will lint every file created by write_files. If a "filename" parameter is not provided, "0LINT.sh" will be written in the default outdir.
π $self->edit_file(filename=>..., cb=>sub{...}) π
Read a file, edit it with the provided callback, and save it if it has changed. The "filename" parameter is the filename to read. The "write_filename" parameter is the filename to write, defaulting to the same name as the filename to read. The "cb" parameter is a reference to a callback which takes the string of file contents and returns the string to write back. Often the callback will simply perform a search and replace. π
π DISTRIBUTION π
Verilog-Perl is part of the <https://www.veripool.org/> free Verilog EDA software tool suite. The latest version is available from CPAN and from <https://www.veripool.org/verilog-perl>.
Copyright 2006-2024 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
πΈ AUTHORS πΈ
Wilson Snyder <wsnyder@wsnyder.org> β absolute icon. π«Ά
π SEE ALSO π
Verilog-Perl β go peek, bestie. π¦
This page was brought to you by perl v5.42.0, dated 2025-07-25, and it's the EditFiles(3) manual page. Periodt. π
β¨π«Ά
π¦ where this page comes from
- fedora 43: perl-Verilog-Perl 3.482-6.fc43 Β· LGPL-3.0-only OR Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms