• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
          • Vl-lint
          • Vl-server
          • Vl-gather
            • Vl-gather-opts-p
            • Vl-modulelist-original-sources
            • Vl-module-original-source
              • Vl-gather-top
              • *vl-gather-help*
              • Vl-gather-main
              • Vl-design-original-source
            • Vl-zip
            • Vl-main
            • Split-plusargs
            • Vl-shell
            • Vl-json
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Vl-gather

    Vl-module-original-source

    Signature
    (vl-module-original-source mod filemap) → original-source
    Arguments
    mod — Guard (vl-module-p mod).
    filemap — Guard (vl-filemap-p filemap).
    Returns
    original-source — Type (stringp original-source).

    Definitions and Theorems

    Function: vl-module-original-source

    (defun
     vl-module-original-source (mod filemap)
     (declare (xargs :guard (and (vl-module-p mod)
                                 (vl-filemap-p filemap))))
     (let
      ((__function__ 'vl-module-original-source))
      (declare (ignorable __function__))
      (b*
       (((vl-module mod) mod)
        (minloc mod.minloc)
        (maxloc mod.maxloc)
        ((vl-location minloc) minloc)
        ((vl-location maxloc) maxloc)
        ((unless (equal minloc.filename maxloc.filename))
         (raise
          "Expected modules to begin/end in the same file, but ~s0 ~
                    starts at ~s1 and ends at ~s2."
          mod.name (vl-location-string minloc)
          (vl-location-string maxloc))
         "")
        (file (cdr (hons-assoc-equal minloc.filename filemap)))
        ((unless file)
         (raise "File not found in the file map: ~s0"
                minloc.filename)
         "")
        (maxloc
          (change-vl-location maxloc
                              :col (+ maxloc.col (length "endmodule"))))
        (lines (vl-string-between-locs file minloc maxloc))
        ((unless lines)
         (raise "Error extracting module contents for ~s0"
                mod.name)
         ""))
       (cat "// " mod.name " from "
            minloc.filename ":" (natstr minloc.line)
            *nls* lines))))

    Theorem: stringp-of-vl-module-original-source

    (defthm
         stringp-of-vl-module-original-source
         (b* ((original-source (vl-module-original-source mod filemap)))
             (stringp original-source))
         :rule-classes :type-prescription)