Start of topic | Skip to actions

Task: Verilog Parser

Owner: Jennifer Gillenwater

Goal

To build a parser for Verilog. This will allow us to import standard commerical and open source circuit descriptions into PreVIEW, as well as allow us to build simulators and analysis tools for Verilog. It will also allow us to explore extensions to Verilog.

References

Administrivia

  1. Getting an account on the CS network (talking to BJ, Lena, or Darnell. There'll be a form for me to sign) [done]
  2. Getting an account on (or "register for") the wiki. [done]
  3. Make a CVS directory for your work (after getting account on CS). [done]

Proposed Work Plan

  1. Construct a restricted Verilog BNF containing only the more frequently used syntax constructs.
    • Find small Verilog example programs in Wikipedia at http://en.wikipedia.org/wiki/Verilog
    • Figure out what subset of the entire Verilog grammar is used for these examples
    • Find more examples in Verilog tutorials such as http://tutor.al-williams.com/wpv-1.htm to see if the basic subset still needs to grow
    • Write out the subset in a file (copy from BNF page and modify)
    • Describe in English what the subset does and what the rest of the language does (what main elements or functionality is excluded from the subset)
  2. Design and implement an OCaml algebraic datatype to represent the abstract syntax tree (AST) Verilog programs
  3. Design and implement a lexer for Verilog. This lexer will read from a file or string and generate a sequence of tokens
  4. Implement a parser which will take the sequence of tokens and generate the correct Verilog AST for the circuit.
  5. Implement a pretty-printer for the Verilog AST.
    • This involves developing a function in OCaml which accepts an AST and returns a nicely formatted string of the program.
    • Refer to the Little Rapster for Pretty Printing with the OCaml Format Library (chapter 11) and the example MetaOCaml Pretty Printer (chapter 12).
    • Also, consult the Format library documentation
    • More help can be found in the Dr. Lint documentation section of The Little Rapster (chapter 14).
    • Examples can be found in the Dr. Lint project as well as in PreVIEW.
  6. Implement a translator which will convert PreVIEW programs into equivalent Verilog programs.
    • Implement a function which accepts a PreVIEW AST and returns a Verilog representation of the program using the AST developed for step 2.
    • Consult the text-to-graph and graph-to-text translation functions and function implementations in the PreVIEW project.
    • PreVIEW documentation can be found in Ellner's Master's thesis and in the CVS tree.
  7. Implement a translator which will convert Verilog programs into equivalent PreVIEW programs.
    • Implement a function which accepts a Verilog AST and returns a PreVIEW text or graph representation.
    • The text-to-graph and graph-to-text translation functions in PreVIEW will serve as good reference material.
    • PreVIEW documentation can be found in Ellner's Master's thesis.

Parts 1 to 5 constitute the basic components for representing, reading and writing Verilog programs. Parts 6 and 7 constitute the integration of the parser into PreVIEW and in the CVS tree.

Done

toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
docdoc UtilityoftheRestrictedVerilogGrammar.doc manage 30.0 K 05 Sep 2007 - 13:29 Main.JenGillenwater Grammar Semantics
txttxt complex_BNF_constructs.txt manage 17.8 K 05 Sep 2007 - 13:29 Main.JenGillenwater More Complex Grammar Constructs
txttxt restricted_verilog_BNF.txt manage 11.8 K 05 Sep 2007 - 13:29 Main.JenGillenwater  
txttxt verilog_sample_programs.txt manage 5.1 K 05 Sep 2007 - 13:29 Main.JenGillenwater Wikipedia Verilog Examples
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.