• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
          • Ps
          • Basic-printing
          • Verilog-printing
          • Printing-locally
          • Formatted-printing
          • Accessing-printed-output
            • Vl-print-to-file
              • Vl-ps->chars
              • Vl-ps->string
              • With-ps-file
            • Vl-printedlist
            • Json-printing
          • Esim-vl
          • Well-formedness
        • Sv
        • Vwsim
        • Fgl
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Accessing-printed-output

    Vl-print-to-file

    Write the printed characters to a file.

    Signature
    (vl-print-to-file filename &key (ps 'ps) (state 'state)) 
      → 
    state
    Arguments
    filename — Guard (stringp filename).
    Returns
    state — Type (state-p1 state), given (force (state-p1 state)).

    (vl-print-to-file filename) writes the printed characters to the indicated file.

    Definitions and Theorems

    Function: vl-print-to-file-fn

    (defun vl-print-to-file-fn (filename ps state)
           (declare (xargs :stobjs (ps state)))
           (declare (xargs :guard (stringp filename)))
           (let ((__function__ 'vl-print-to-file))
                (declare (ignorable __function__))
                (b* ((filename (string-fix filename))
                     ((mv channel state)
                      (open-output-channel filename
                                           :character state))
                     ((unless channel)
                      (raise "Error opening file ~s0 for writing."
                             filename)
                      state)
                     (state (princ$ (vl-ps->string) channel state)))
                    (close-output-channel channel state))))

    Theorem: state-p1-of-vl-print-to-file

    (defthm
         state-p1-of-vl-print-to-file
         (implies (force (state-p1 state))
                  (b* ((state (vl-print-to-file-fn filename ps state)))
                      (state-p1 state)))
         :rule-classes :rewrite)

    Theorem: vl-print-to-file-fn-of-str-fix-filename

    (defthm vl-print-to-file-fn-of-str-fix-filename
            (equal (vl-print-to-file-fn (str-fix filename)
                                        ps state)
                   (vl-print-to-file-fn filename ps state)))

    Theorem: vl-print-to-file-fn-streqv-congruence-on-filename

    (defthm
         vl-print-to-file-fn-streqv-congruence-on-filename
         (implies (streqv filename filename-equiv)
                  (equal (vl-print-to-file-fn filename ps state)
                         (vl-print-to-file-fn filename-equiv ps state)))
         :rule-classes :congruence)