RobertZ
Community Member
Offline
the art of analog
Posts: 55
San Diego, CA
|
I found one article inside this forum, which is quoted here. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Verilog-AMS LRM 2.2 adds support for string parameters, which must be declared as such: parameter string outfile = "foo.dat"; Alas, Accellera has not yet voted on these extensions, so vendors have not implemented them. The current support for "strings" in Verilog-AMS is the variable type "reg" (see section 2.6 of the current LRM); also, there is a format specifier "%m" that is supposed to return the hierarchical name of the instance. There's an off chance that you can use these, eg, reg [8*40:1] outfile; integer fh; outfile = "%m"; fh = $fopen(outfile); or fh = $fopen("%m"); though I somewhat doubt this will work (%m probably only works in $strobe). You might be able to do something like parameter integer blocknum=0; integer fh; reg [8*40:1] outfile; outfile = "output_"; outfile[8] = blocknum+48; // 48==ascii offset of "0" fh = $fopen(outfile); -Geoffrey
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
But it didn't work in my simulator. after I use keyword "reg", an error notice appeared: Warning from spectre during SpectreHDL compile. "/projects/driveforce/lib/private/mylib/temp/veriloga/veriloga.va", line 10: Warning: `reg' is a future reserved keyword, parsing as identifier.Error found by spectre during SpectreHDL compile. "/projects/driveforce/lib/private/mylib/temp/veriloga/veriloga.va", line 10: "reg [8*30:1] File_name;<<--? " "/projects/driveforce/lib/private/mylib/temp/veriloga/veriloga.va", line 10: Error: syntax error
|