ljepson74 10 Report post Posted September 28, 2016 A backslash can be used to extend a string literal onto the next line if "the new line is immediately preceded by a \ (backslash)." Section 5.9 of 1800-2012.pdf, the SystemVerilog LRM I don't think I have ever been able to get this work and w/o looking I seem to recall it has been in Verilog/SystemVerilog for a while. Can someone tell me if vendors support this and perhaps correct the code below on edaplayground? example from LRM: $display("Humpty Dumpty sat on a wall. \ Humpty Dumpty had a great fall."); See example here (on Sept 29, urls below are updated in response to Tudor comment below. thx.): http://www.edaplayground.com/x/4Tyw https://www.edaplayground.com/x/4Tyw //if the above does not work, try this one, with https:// Quote Share this post Link to post Share on other sites
tudor.timi 52 Report post Posted September 28, 2016 Your links are broken (there are some extra characters after the '4Tyw' part in the URL). The code is OK and Riviera-Pro does support it. Quote Share this post Link to post Share on other sites
dave_59 34 Report post Posted September 28, 2016 This works for me in Modelsim/Questa. Note that the newline has been escaped and the resulting string will be displayed as a single line. If you want a newline embedded in the string, you need to add \n. Quote Share this post Link to post Share on other sites
ljepson74 10 Report post Posted September 29, 2016 Thanks, Tudor and Dave. *) I updated the urls, per Tudor comment. *) Aldec and Mentor simulators were the two that I did not use. I now tried Aldec on edaplayground and see that it works. Unfortunately, with regards to this SV feature, I'm not using either of these simulators. Can anyone confirm that neither Cadence nor Synopsys support this? (Well, I guess I've figured out that they don't, now that I have witnessed at least one simulator support it. Aldec's.) Thanks. Quote Share this post Link to post Share on other sites
dave_59 34 Report post Posted September 29, 2016 I think the problem is with EDAplayground.com appending extra characters at the end of each line. Look carefully at the error messages coming from each tool and you'll see a good explanation of the problem. I believe Aldec is incorrectly ignoring that extra character, so it appears that it is "working". Quote Share this post Link to post Share on other sites
ljepson74 10 Report post Posted October 3, 2016 EDAboard.com ?Is that a typo? You just mean my text editor, right? I confirmed that there is no extra character at the end of the line. (Note: the links above have been fixed.) Quote Share this post Link to post Share on other sites
dave_59 34 Report post Posted October 3, 2016 I meant edaplayground's editor. Quote Share this post Link to post Share on other sites
ljepson74 10 Report post Posted October 4, 2016 Doulos/Victor, any thoughts? Is your editor causing mischief and adding characters at the ends of lines? Dave, I see your point now. i.e. In edaplayground the error message seems to point to a space after the backslash. Thanks. Quote Share this post Link to post Share on other sites
dave_59 34 Report post Posted October 4, 2016 I would use the forum on EDAplayground to contact them, Quote Share this post Link to post Share on other sites
ljepson74 10 Report post Posted October 7, 2016 Yes, thanks Dave. (I shouldn't assume everyone I've seen on here monitors all the threads.)Feedback from Victor (the creator of edaplayground) on the edaplayground forum: I've seen this before. The server uses "\r\n" DOS line endings, and some simulators don't grok these. The fix for EDA Playground would be to use "\n" line endings instead of "\r\n" You can see this by using "Download files after run" Quote Share this post Link to post Share on other sites
ljepson74 10 Report post Posted October 11, 2016 From edaplayground: I'll 'add this to the To Do list... Quote Share this post Link to post Share on other sites
joniale 1 Report post Posted July 19, 2018 From http://www.asic-world.com/systemverilog/literal_values4.html string a; a = "This is multi line comment \n and this is second line"; /* Outputs: a = This is multi line comment^M and this is second line */ //You will have ^M which is the dos character for new line. if you write to a file with this line. If you want to avoid that, then the next solution should be used string tmg ={" \n" , "//periodic signal intf.KEYCONTROL_CLK \n" , "fork\n" , " begin\n" , " the_clock = 0;\n" , " forever begin\n" , " if(the_clock == 0)\n" , " #(5000000/2 * 1ps);\n" , " else\n" , " #((5000000-5000000/2) * 1ps);\n" , " the_clock=~the_clock;\n" , " end\n" , " end\n" , "join_none\n"}; $display ( tmg); Obviously, the second example is recommended Quote Share this post Link to post Share on other sites