• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
          • Ps
          • Verilog-printing
          • Basic-printing
          • Printing-locally
          • Formatted-printing
          • Accessing-printed-output
            • Vl-print-to-file
              • Vl-print-to-file-and-clear
            • Vl-ps->chars
            • Vl-ps->string
            • With-ps-file
          • Json-printing
          • Vl-printedlist
        • Kit
        • Mlib
        • Transforms
      • 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)

Subtopics

Vl-print-to-file-and-clear
Write the printed characters to a file and clear out the ps.