The
(vl-json cmdargs &optional (state 'state)) → state
Function:
(defun vl-json-fn (cmdargs state) (declare (xargs :stobjs (state))) (declare (xargs :guard (string-listp cmdargs))) (let ((__function__ 'vl-json)) (declare (ignorable __function__)) (b* (((mv errmsg opts start-files) (parse-vl-json-opts cmdargs)) ((when errmsg) (die "~@0~%" errmsg) state) ((vl-json-opts opts) opts) (- (acl2::set-max-mem (* (expt 2 30) opts.mem))) ((when opts.help) (vl-cw-ps-seq (vl-print *vl-json-help*)) (exit-ok) state) ((when opts.readme) (vl-cw-ps-seq (vl-print *vl-json-readme*)) (exit-ok) state) ((unless (consp start-files)) (die "No files to process.") state) (outfile (if (equal opts.outfile "") (cat (car start-files) ".json") opts.outfile)) (- (or (not opts.debug) (cw "vl json options: ~x0~%" opts))) (state (must-be-regular-files! start-files)) (state (must-be-directories! opts.search-path)) (- (cw "Parsing Verilog sources...~%")) (loadconfig (make-vl-loadconfig :edition opts.edition :strictp opts.strict :start-files start-files :search-path opts.search-path :filemapp nil)) (- (or (not opts.debug) (cw "vl load configuration: ~x0~%" loadconfig))) ((mv (vl-loadresult res) state) (cwtime (vl-load loadconfig))) (- (cw "JSON-Encoding Modules...~%")) (mods (vl-design->mods res.design)) (state (cwtime (with-ps-file outfile (vl-ps-update-autowrap-col 120) (vl-ps-update-autowrap-ind 10) (cwtime (if opts.separate (vl-jp-individual-modules mods) (vl-jp-modalist (vl-modalist mods))) :name vl-json-encode)) :name vl-json-export))) (exit-ok) state)))