mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Internals: Standardize internal FileLine filenames.
This commit is contained in:
parent
2cedd14d43
commit
f7f73a0825
@ -124,6 +124,8 @@ public:
|
||||
V3LangCode language() const { return singleton().numberToLang(m_filenameno); }
|
||||
string ascii() const;
|
||||
const string filename() const { return singleton().numberToName(m_filenameno); }
|
||||
bool filenameIsGlobal() const { return (filename() == commandLineFilename()
|
||||
|| filename() == internalDefineFilename()); }
|
||||
const string filenameLetters() const { return singleton().filenameLetters(m_filenameno); }
|
||||
const string filebasename() const;
|
||||
const string filebasenameNoExt() const;
|
||||
@ -147,6 +149,8 @@ public:
|
||||
void tracingOn(bool flag) { warnOn(V3ErrorCode::I_TRACING, flag); }
|
||||
|
||||
// METHODS - Global
|
||||
static string commandLineFilename() { return "COMMAND_LINE"; }
|
||||
static string internalDefineFilename() { return "INTERNAL_VERILATOR_DEFINE"; }
|
||||
static void globalWarnLintOff(bool flag) {
|
||||
defaultFileLine().warnLintOff(flag); }
|
||||
static void globalWarnStyleOff(bool flag) {
|
||||
|
@ -60,11 +60,11 @@ protected:
|
||||
// Create the implementation pointer
|
||||
if (env) {}
|
||||
if (!s_preprocp) {
|
||||
FileLine* cmdfl = new FileLine("COMMAND_LINE", 0);
|
||||
FileLine* cmdfl = new FileLine(FileLine::commandLineFilename(), 0);
|
||||
s_preprocp = V3PreProc::createPreProc(cmdfl);
|
||||
s_preprocp->debug(debug());
|
||||
// Default defines
|
||||
FileLine* prefl = new FileLine("INTERNAL_VERILATOR_DEFINE", 0);
|
||||
FileLine* prefl = new FileLine(FileLine::internalDefineFilename(), 0);
|
||||
s_preprocp->defineCmdLine(prefl, "VERILATOR", "1"); // LEAK_OK
|
||||
s_preprocp->defineCmdLine(prefl, "verilator", "1"); // LEAK_OK
|
||||
s_preprocp->defineCmdLine(prefl, "verilator3", "1"); // LEAK_OK
|
||||
@ -178,7 +178,7 @@ void V3PreShell::preprocInclude(FileLine* fl, const string& modname) {
|
||||
V3PreShellImp::s_preImp.preprocInclude(fl, modname);
|
||||
}
|
||||
void V3PreShell::defineCmdLine(const string& name, const string& value) {
|
||||
FileLine* prefl = new FileLine("COMMAND_LINE_DEFINE", 0);
|
||||
FileLine* prefl = new FileLine(FileLine::commandLineFilename(), 0);
|
||||
V3PreShellImp::s_preprocp->defineCmdLine(prefl, name, value);
|
||||
}
|
||||
void V3PreShell::undef(const string& name) {
|
||||
|
@ -127,7 +127,8 @@ void V3Global::readFiles() {
|
||||
const V3StringList& vFiles = v3Global.opt.vFiles();
|
||||
for (V3StringList::const_iterator it = vFiles.begin(); it != vFiles.end(); ++it) {
|
||||
string filename = *it;
|
||||
parser.parseFile(new FileLine("COMMAND_LINE", 0), filename, false,
|
||||
parser.parseFile(new FileLine(FileLine::commandLineFilename(), 0),
|
||||
filename, false,
|
||||
"Cannot find file containing module: ");
|
||||
}
|
||||
|
||||
@ -137,7 +138,8 @@ void V3Global::readFiles() {
|
||||
const V3StringSet& libraryFiles = v3Global.opt.libraryFiles();
|
||||
for (V3StringSet::const_iterator it = libraryFiles.begin(); it != libraryFiles.end(); ++it) {
|
||||
string filename = *it;
|
||||
parser.parseFile(new FileLine("COMMAND_LINE", 0), filename, true,
|
||||
parser.parseFile(new FileLine(FileLine::commandLineFilename(), 0),
|
||||
filename, true,
|
||||
"Cannot find file containing library module: ");
|
||||
}
|
||||
//v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("parse.tree"));
|
||||
@ -582,7 +584,8 @@ int main(int argc, char** argv, char** env) {
|
||||
// Command option parsing
|
||||
v3Global.opt.bin(argv[0]);
|
||||
string argString = V3Options::argString(argc-1, argv+1);
|
||||
v3Global.opt.parseOpts(new FileLine("COMMAND_LINE", 0), argc-1, argv+1);
|
||||
v3Global.opt.parseOpts(new FileLine(FileLine::commandLineFilename(), 0),
|
||||
argc-1, argv+1);
|
||||
if (!v3Global.opt.outFormatOk()
|
||||
&& !v3Global.opt.preprocOnly()
|
||||
&& !v3Global.opt.lintOnly()
|
||||
|
@ -4,77 +4,76 @@
|
||||
<files>
|
||||
<file id="a" filename="AstRoot" language="1800-2017"/>
|
||||
<file id="b" filename="COMMAND_LINE" language="1800-2017"/>
|
||||
<file id="e" filename="COMMAND_LINE_DEFINE" language="1800-2017"/>
|
||||
<file id="c" filename="INTERNAL_VERILATOR_DEFINE" language="1800-2017"/>
|
||||
<file id="d" filename="input.vc" language="1800-2017"/>
|
||||
<file id="f" filename="t/t_xml_first.v" language="1800-2017"/>
|
||||
<file id="e" filename="t/t_xml_first.v" language="1800-2017"/>
|
||||
</files>
|
||||
<module_files>
|
||||
<file id="f" filename="t/t_xml_first.v" language="1800-2017"/>
|
||||
<file id="e" filename="t/t_xml_first.v" language="1800-2017"/>
|
||||
</module_files>
|
||||
<cells>
|
||||
<cell fl="f6" name="t" submodname="t" hier="t">
|
||||
<cell fl="f18" name="cell1" submodname="mod1" hier="t.cell1"/>
|
||||
<cell fl="f24" name="cell2" submodname="mod2" hier="t.cell2"/>
|
||||
<cell fl="e6" name="t" submodname="t" hier="t">
|
||||
<cell fl="e18" name="cell1" submodname="mod1" hier="t.cell1"/>
|
||||
<cell fl="e24" name="cell2" submodname="mod2" hier="t.cell2"/>
|
||||
</cell>
|
||||
</cells>
|
||||
<netlist>
|
||||
<module fl="f6" name="t" origName="t" topModule="1">
|
||||
<var fl="f12" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="f13" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="f14" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<var fl="f16" name="between" dtype_id="2" vartype="logic" origName="between"/>
|
||||
<instance fl="f18" name="cell1" defName="mod1" origName="cell1">
|
||||
<port fl="f18" name="q" direction="out" portIndex="1">
|
||||
<varref fl="f18" name="between" dtype_id="2"/>
|
||||
<module fl="e6" name="t" origName="t" topModule="1">
|
||||
<var fl="e12" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="e13" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="e14" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<var fl="e16" name="between" dtype_id="2" vartype="logic" origName="between"/>
|
||||
<instance fl="e18" name="cell1" defName="mod1" origName="cell1">
|
||||
<port fl="e18" name="q" direction="out" portIndex="1">
|
||||
<varref fl="e18" name="between" dtype_id="2"/>
|
||||
</port>
|
||||
<port fl="f21" name="clk" direction="in" portIndex="2">
|
||||
<varref fl="f21" name="clk" dtype_id="1"/>
|
||||
<port fl="e21" name="clk" direction="in" portIndex="2">
|
||||
<varref fl="e21" name="clk" dtype_id="1"/>
|
||||
</port>
|
||||
<port fl="f22" name="d" direction="in" portIndex="3">
|
||||
<varref fl="f22" name="d" dtype_id="2"/>
|
||||
<port fl="e22" name="d" direction="in" portIndex="3">
|
||||
<varref fl="e22" name="d" dtype_id="2"/>
|
||||
</port>
|
||||
</instance>
|
||||
<instance fl="f24" name="cell2" defName="mod2" origName="cell2">
|
||||
<port fl="f24" name="d" direction="in" portIndex="1">
|
||||
<varref fl="f24" name="between" dtype_id="2"/>
|
||||
<instance fl="e24" name="cell2" defName="mod2" origName="cell2">
|
||||
<port fl="e24" name="d" direction="in" portIndex="1">
|
||||
<varref fl="e24" name="between" dtype_id="2"/>
|
||||
</port>
|
||||
<port fl="f27" name="q" direction="out" portIndex="2">
|
||||
<varref fl="f27" name="q" dtype_id="2"/>
|
||||
<port fl="e27" name="q" direction="out" portIndex="2">
|
||||
<varref fl="e27" name="q" dtype_id="2"/>
|
||||
</port>
|
||||
<port fl="f29" name="clk" direction="in" portIndex="3">
|
||||
<varref fl="f29" name="clk" dtype_id="1"/>
|
||||
<port fl="e29" name="clk" direction="in" portIndex="3">
|
||||
<varref fl="e29" name="clk" dtype_id="1"/>
|
||||
</port>
|
||||
</instance>
|
||||
</module>
|
||||
<module fl="f33" name="mod1" origName="mod1">
|
||||
<var fl="f35" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="f36" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="f37" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<always fl="f39">
|
||||
<sentree fl="f39">
|
||||
<senitem fl="f39" edgeType="POS">
|
||||
<varref fl="f39" name="clk" dtype_id="1"/>
|
||||
<module fl="e33" name="mod1" origName="mod1">
|
||||
<var fl="e35" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="e36" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="e37" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<always fl="e39">
|
||||
<sentree fl="e39">
|
||||
<senitem fl="e39" edgeType="POS">
|
||||
<varref fl="e39" name="clk" dtype_id="1"/>
|
||||
</senitem>
|
||||
</sentree>
|
||||
<assigndly fl="f40" dtype_id="2">
|
||||
<varref fl="f40" name="d" dtype_id="2"/>
|
||||
<varref fl="f40" name="q" dtype_id="2"/>
|
||||
<assigndly fl="e40" dtype_id="2">
|
||||
<varref fl="e40" name="d" dtype_id="2"/>
|
||||
<varref fl="e40" name="q" dtype_id="2"/>
|
||||
</assigndly>
|
||||
</always>
|
||||
</module>
|
||||
<module fl="f44" name="mod2" origName="mod2">
|
||||
<var fl="f46" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="f47" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="f48" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<contassign fl="f51" dtype_id="2">
|
||||
<varref fl="f51" name="d" dtype_id="2"/>
|
||||
<varref fl="f51" name="q" dtype_id="2"/>
|
||||
<module fl="e44" name="mod2" origName="mod2">
|
||||
<var fl="e46" name="clk" dtype_id="1" dir="input" vartype="logic" origName="clk"/>
|
||||
<var fl="e47" name="d" dtype_id="2" dir="input" vartype="logic" origName="d"/>
|
||||
<var fl="e48" name="q" dtype_id="2" dir="output" vartype="logic" origName="q"/>
|
||||
<contassign fl="e51" dtype_id="2">
|
||||
<varref fl="e51" name="d" dtype_id="2"/>
|
||||
<varref fl="e51" name="q" dtype_id="2"/>
|
||||
</contassign>
|
||||
</module>
|
||||
<typetable fl="a0">
|
||||
<basicdtype fl="f46" id="1" name="logic"/>
|
||||
<basicdtype fl="f13" id="2" name="logic" left="3" right="0"/>
|
||||
<basicdtype fl="e46" id="1" name="logic"/>
|
||||
<basicdtype fl="e13" id="2" name="logic" left="3" right="0"/>
|
||||
</typetable>
|
||||
</netlist>
|
||||
</verilator_xml>
|
||||
|
@ -4,81 +4,80 @@
|
||||
<files>
|
||||
<file id="a" filename="AstRoot" language="1800-2017"/>
|
||||
<file id="b" filename="COMMAND_LINE" language="1800-2017"/>
|
||||
<file id="e" filename="COMMAND_LINE_DEFINE" language="1800-2017"/>
|
||||
<file id="c" filename="INTERNAL_VERILATOR_DEFINE" language="1800-2017"/>
|
||||
<file id="d" filename="input.vc" language="1800-2017"/>
|
||||
<file id="f" filename="t/t_xml_tag.v" language="1800-2017"/>
|
||||
<file id="e" filename="t/t_xml_tag.v" language="1800-2017"/>
|
||||
</files>
|
||||
<module_files>
|
||||
<file id="f" filename="t/t_xml_tag.v" language="1800-2017"/>
|
||||
<file id="e" filename="t/t_xml_tag.v" language="1800-2017"/>
|
||||
</module_files>
|
||||
<cells>
|
||||
<cell fl="f11" name="m" submodname="m" hier="m">
|
||||
<cell fl="f28" name="itop" submodname="ifc" hier="m.itop"/>
|
||||
<cell fl="e11" name="m" submodname="m" hier="m">
|
||||
<cell fl="e28" name="itop" submodname="ifc" hier="m.itop"/>
|
||||
</cell>
|
||||
</cells>
|
||||
<netlist>
|
||||
<module fl="f11" name="m" origName="m" topModule="1">
|
||||
<var fl="f13" name="clk_ip" tag="clk_ip" dtype_id="1" dir="input" vartype="logic" origName="clk_ip"/>
|
||||
<var fl="f14" name="rst_ip" dtype_id="1" dir="input" vartype="logic" origName="rst_ip"/>
|
||||
<var fl="f15" name="foo_op" tag="foo_op" dtype_id="1" dir="output" vartype="logic" origName="foo_op"/>
|
||||
<typedef fl="f19" name="my_struct" tag="my_struct" dtype_id="2"/>
|
||||
<instance fl="f28" name="itop" defName="ifc" origName="itop"/>
|
||||
<var fl="f28" name="itop__Viftop" dtype_id="3" vartype="ifaceref" origName="itop__Viftop"/>
|
||||
<var fl="f30" name="this_struct" tag="this_struct" dtype_id="4" vartype="" origName="this_struct"/>
|
||||
<var fl="f32" name="dotted" dtype_id="5" vartype="logic" origName="dotted"/>
|
||||
<contassign fl="f32" dtype_id="5">
|
||||
<varxref fl="f32" name="value" dtype_id="6" dotted="itop"/>
|
||||
<varref fl="f32" name="dotted" dtype_id="5"/>
|
||||
<module fl="e11" name="m" origName="m" topModule="1">
|
||||
<var fl="e13" name="clk_ip" tag="clk_ip" dtype_id="1" dir="input" vartype="logic" origName="clk_ip"/>
|
||||
<var fl="e14" name="rst_ip" dtype_id="1" dir="input" vartype="logic" origName="rst_ip"/>
|
||||
<var fl="e15" name="foo_op" tag="foo_op" dtype_id="1" dir="output" vartype="logic" origName="foo_op"/>
|
||||
<typedef fl="e19" name="my_struct" tag="my_struct" dtype_id="2"/>
|
||||
<instance fl="e28" name="itop" defName="ifc" origName="itop"/>
|
||||
<var fl="e28" name="itop__Viftop" dtype_id="3" vartype="ifaceref" origName="itop__Viftop"/>
|
||||
<var fl="e30" name="this_struct" tag="this_struct" dtype_id="4" vartype="" origName="this_struct"/>
|
||||
<var fl="e32" name="dotted" dtype_id="5" vartype="logic" origName="dotted"/>
|
||||
<contassign fl="e32" dtype_id="5">
|
||||
<varxref fl="e32" name="value" dtype_id="6" dotted="itop"/>
|
||||
<varref fl="e32" name="dotted" dtype_id="5"/>
|
||||
</contassign>
|
||||
<func fl="f34" name="f" dtype_id="1">
|
||||
<var fl="f34" name="f" dtype_id="1" dir="output" vartype="logic" origName="f"/>
|
||||
<var fl="f34" name="m" dtype_id="7" dir="input" vartype="string" origName="m"/>
|
||||
<display fl="f35" displaytype="$display">
|
||||
<sformatf fl="f35" name="%@" dtype_id="7">
|
||||
<varref fl="f35" name="m" dtype_id="7"/>
|
||||
<func fl="e34" name="f" dtype_id="1">
|
||||
<var fl="e34" name="f" dtype_id="1" dir="output" vartype="logic" origName="f"/>
|
||||
<var fl="e34" name="m" dtype_id="7" dir="input" vartype="string" origName="m"/>
|
||||
<display fl="e35" displaytype="$display">
|
||||
<sformatf fl="e35" name="%@" dtype_id="7">
|
||||
<varref fl="e35" name="m" dtype_id="7"/>
|
||||
</sformatf>
|
||||
</display>
|
||||
</func>
|
||||
<initial fl="f38">
|
||||
<begin fl="f38">
|
||||
<taskref fl="f40" name="f">
|
||||
<arg fl="f40">
|
||||
<const fl="f40" name=""	   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"" dtype_id="7"/>
|
||||
<initial fl="e38">
|
||||
<begin fl="e38">
|
||||
<taskref fl="e40" name="f">
|
||||
<arg fl="e40">
|
||||
<const fl="e40" name=""	   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"" dtype_id="7"/>
|
||||
</arg>
|
||||
</taskref>
|
||||
</begin>
|
||||
</initial>
|
||||
</module>
|
||||
<iface fl="f6" name="ifc" origName="ifc">
|
||||
<var fl="f7" name="value" dtype_id="6" vartype="integer" origName="value"/>
|
||||
<modport fl="f8" name="out_modport">
|
||||
<modportvarref fl="f8" name="value" direction="out"/>
|
||||
<iface fl="e6" name="ifc" origName="ifc">
|
||||
<var fl="e7" name="value" dtype_id="6" vartype="integer" origName="value"/>
|
||||
<modport fl="e8" name="out_modport">
|
||||
<modportvarref fl="e8" name="value" direction="out"/>
|
||||
</modport>
|
||||
</iface>
|
||||
<typetable fl="a0">
|
||||
<basicdtype fl="f30" id="5" name="logic" left="31" right="0"/>
|
||||
<basicdtype fl="f7" id="6" name="integer" left="31" right="0"/>
|
||||
<basicdtype fl="f13" id="1" name="logic"/>
|
||||
<structdtype fl="f19" id="2" name="m.my_struct">
|
||||
<memberdtype fl="f20" id="8" name="clk" tag="this is clk" sub_dtype_id="9"/>
|
||||
<memberdtype fl="f21" id="10" name="k" sub_dtype_id="11"/>
|
||||
<memberdtype fl="f22" id="12" name="enable" tag="enable" sub_dtype_id="13"/>
|
||||
<memberdtype fl="f23" id="14" name="data" tag="data" sub_dtype_id="15"/>
|
||||
<basicdtype fl="e30" id="5" name="logic" left="31" right="0"/>
|
||||
<basicdtype fl="e7" id="6" name="integer" left="31" right="0"/>
|
||||
<basicdtype fl="e13" id="1" name="logic"/>
|
||||
<structdtype fl="e19" id="2" name="m.my_struct">
|
||||
<memberdtype fl="e20" id="8" name="clk" tag="this is clk" sub_dtype_id="9"/>
|
||||
<memberdtype fl="e21" id="10" name="k" sub_dtype_id="11"/>
|
||||
<memberdtype fl="e22" id="12" name="enable" tag="enable" sub_dtype_id="13"/>
|
||||
<memberdtype fl="e23" id="14" name="data" tag="data" sub_dtype_id="15"/>
|
||||
</structdtype>
|
||||
<basicdtype fl="f20" id="9" name="logic"/>
|
||||
<basicdtype fl="f21" id="11" name="logic"/>
|
||||
<basicdtype fl="f22" id="13" name="logic"/>
|
||||
<basicdtype fl="f23" id="15" name="logic"/>
|
||||
<ifacerefdtype fl="f28" id="3" modportname=""/>
|
||||
<unpackarraydtype fl="f30" id="4" sub_dtype_id="2">
|
||||
<range fl="f30">
|
||||
<const fl="f30" name="32'h1" dtype_id="5"/>
|
||||
<const fl="f30" name="32'h0" dtype_id="5"/>
|
||||
<basicdtype fl="e20" id="9" name="logic"/>
|
||||
<basicdtype fl="e21" id="11" name="logic"/>
|
||||
<basicdtype fl="e22" id="13" name="logic"/>
|
||||
<basicdtype fl="e23" id="15" name="logic"/>
|
||||
<ifacerefdtype fl="e28" id="3" modportname=""/>
|
||||
<unpackarraydtype fl="e30" id="4" sub_dtype_id="2">
|
||||
<range fl="e30">
|
||||
<const fl="e30" name="32'h1" dtype_id="5"/>
|
||||
<const fl="e30" name="32'h0" dtype_id="5"/>
|
||||
</range>
|
||||
</unpackarraydtype>
|
||||
<refdtype fl="f30" id="16" name="my_struct" sub_dtype_id="2"/>
|
||||
<basicdtype fl="f34" id="7" name="string"/>
|
||||
<refdtype fl="e30" id="16" name="my_struct" sub_dtype_id="2"/>
|
||||
<basicdtype fl="e34" id="7" name="string"/>
|
||||
</typetable>
|
||||
</netlist>
|
||||
</verilator_xml>
|
||||
|
Loading…
Reference in New Issue
Block a user