VCD file identifier length - Page 1
Forum section: electronics / general

author: MarkMLl
author_rank: Frequent Contributor
timestamp: August 14, 2023, 04:48:32 pm
content: My apologies for asking here, but since VCD is defined as a part of Verilog it seems the best place.VCD identifier codes are popularly considered to be single characters. However the 2005 version of the IEEE Verilog spec includes an example where they are two characters:Code: (plain)...#5050*@1*#1*$b10zx1110x11100 (kb1111000101z01x {2...The EBNF spec reads asCode: (plain)scalar_value_change ::=value identifier_codevector_value_change ::=b binary_number identifier_code| B binary_number identifier_code| r real_number identifier_code| R real_number identifier_codeidentifier_code ::={ ASCII character }vcd_declaration_vars ::=$var var_type size identifier_code reference $endvcd_declaration_vars ::=$var var_type size identifier_code reference $endCan anybody confirm that multi-character identifiers are valid, i.e. that the EBNF should read asCode: (plain)identifier_code ::=ASCII_character { ASCII_character }(where ASCII_character is predefined) and does this vary with different versions of the spec? Are there any conventions dictated by the first character etc.?I've previously written a parser assuming single-character identifiers, but find myself in a position where being able to use two or possibly more would be a big advantage.MarkMLl

author: slugrustle
author_rank: Frequent Contributor
timestamp: September 17, 2023, 08:49:31 pm
content: In the text box describing VCD file syntax in IEEE 1364-2005 chapter 18, I seeidentifier_code ::= { ASCII character }just as you noted. With apologies for being tedious, let's break this down based on Section 1.3,Syntactic Description."Lowercase words, some containing embedded underscores, are used to denote syntactic categories. For example: module_declaration." This applies to identifier_code."The formal syntax of the Verilog HDL is described using Backus-Naur Form (BNF)." That means ::= is the symbol derivation rule."Braces ({}) enclose a repeated item unless it appears in boldface, in which case it stands for itself. The item may appear zero or more times; the repetitions occur from left to right as with an equivalent left-recursive rule." So I take that as a yes. { ASCII character } means zero or more ASCII characters in sequence. In this case, I would hope they intended one or more ASCII characters in sequence...I also see the example you're referring to with the 2-character identifier code.IEEE 1364-2001 is the same in regards to the above, and it too has an example with a 2-character identifier code.IEEE 1364-1995 has similar contents in theSyntactic Descriptionsection and contains the example with a 2-character identifier code, but it lacks the lineidentifier_code ::= { ASCII character }in the text box describing the VCD file syntax. So maybe that's the standard body's attempt to clarify that multiple characters are allowed in identifier codes. IEEE 1364-1995 also contains the paragraph quoted below, which appears to be unchanged in the 2001 and 2005 versions of the standard.QuoteI just wrote a program that dumps output to a VCD file, and I used two-character identifier codes in order to be able to output more than 94 different variables. GTKWave had no problem with the file that I generated. I just did the "Excel Columns" thing but with ASCII values 33–126, if that makes sense: !!, !", !#, etc. There does not appear to be anything in the standard constraining the first character. Indeed, I wish it would be more explicit on these points. For example, is there amaximumidentifier length? Granted, I only skimmed tiny portions of the standard that seemed relevant to your question and may have missed one or more things.Maybe the popular conception of single character identifier codes is down to most people needing 94 or fewer variables coupled with either "good enough" philosophy, not reading the standard, or simply not thinking about it.

author: MarkMLl
author_rank: Frequent Contributor
timestamp: September 19, 2023, 06:26:56 am
content: Thanks for that, I think we're in broad agreement: there's a glitch in the specs which can trip the unwary.Apropos identifier lengths and considering the age of the technology, my suspicion is that records were originally intended to fit on 80-column cards, possibly with a 72-column restriction so that the final 8 could be used for a sequential number. It certainly wouldn't be the first time that I've come across that sort of thing, and while I don't claim vast experience one company I've been involved with had a history of using netlists as their primary design record reaching as far back as the mid 1960s, hencehttps://homepage.divms.uiowa.edu/~jones/cards/collection/GardnerDenverWireWrapsalmon.jpgetc.MarkMLl

author: AK6DN
author_rank: Regular Contributor
timestamp: September 21, 2023, 05:56:18 pm
content: Quote from: MarkMLl on August 14, 2023, 04:48:32 pmI routinely have VCD files generated with two character identifier codes, and have seen this for a long time (ie, like 20+ years).A single character can only handle 94 unique identifiers; most of my project simulations have more than that.With two characters you get 94^2 or 8836 identifiers. A couple hundred is the most I have ever seen in a VCD.I have personally never seen a three character ID code generated but I see no reason that it could not be three or four or more characters.