The question of the day is "Have you ever heard of a programming language called Whitespace?". If the answer is no then please refer to wikipedia article on in. Quoting directly from wikipedia for the lazy ones who would rather like to stay at this page rather than visit the wikipedia site
Whitespace is an esoteric programming language developed by Edwin Brady and Chris Morris at the University of Durham (also developers of the Kaya programming language). It was released on 1 April 2003 (April Fool's Day). Its name is a reference to whitespace characters. Unlike most programming languages, which ignore or assign little meaning to most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and linefeeds have meaning.[1] An interesting consequence of this property is that a Whitespace program can easily be contained within the whitespace characters of a program written in another language, making the text a polyglot.[citation needed]
Next question that shall be naturally occurring to you, why am I posting a link of some arbit/useless language in a blog which is devoted to verification. To answer this, I shall begin by asking you to find out the error in this code. Assume x, y, z to be simple logic variable.
`define SWAP(__a, __b) \ __a = __a ^ __b; \ __b = __a ^ __b; \ __a = __a ^ __b; ... `SWAP(x,y) `SWAP(y,z) ...
Couldn't find any issue with it. Let me show the above example with white space character as [space].
`define SWAP(__a, __b) \
__a = __a ^ __b; \
__b = __a ^ __b; \[space]
__a = __a ^ __b;
...
`SWAP(x,y)
`SWAP(y,z)
...
Now the issue is the extra white space character after \ of the SWAP macro definition. VCS doesn't like it and give some weird error which doesn't even tell that the error is due to the white-space after the \. I checked SV LRM and as per my understanding of reading the relevant section, it seems to be a valid system verilog code.
It took me half a day of banging my head in front of my monitor to find out that the issue is this extra whitespace after \ in the macro.
I feel Synopsys folks should do one of the following to make sure that no one else waste his precious time in debugging such hard-to-debug not-so-obvious issue.
- Ignore whitespce after \ in multi-line macro definition OR
- In case when a whitespace is encountered after \ in a multi-line macro, give error specifying that a whitespace character is encountered after \