Able to change iverilog/vvp executable path
This commit is contained in:
parent
d1456cd16e
commit
00d846d18c
@ -214,7 +214,7 @@
|
|||||||
;;;
|
;;;
|
||||||
;;; Execute testbench
|
;;; Execute testbench
|
||||||
;;;
|
;;;
|
||||||
(define (execute-icarus code)
|
(define (execute-icarus code vvp-exe iverilog-exe)
|
||||||
(let ((top-module (module-name code)))
|
(let ((top-module (module-name code)))
|
||||||
(if (not top-module)
|
(if (not top-module)
|
||||||
"No modules declared\n"
|
"No modules declared\n"
|
||||||
@ -228,8 +228,8 @@
|
|||||||
;; Compile
|
;; Compile
|
||||||
(let ((log
|
(let ((log
|
||||||
(let ((cmdline
|
(let ((cmdline
|
||||||
(format "iverilog -DTESTBENCH -g2012 -o ~a/testbench.vvp ~a ~a ~a"
|
(format "~a -DTESTBENCH -g2012 -o ~a/testbench.vvp ~a ~a ~a"
|
||||||
work-dir verilog-file timeout-file dump-file)))
|
iverilog-exe work-dir verilog-file timeout-file dump-file)))
|
||||||
(let-values (((status out)
|
(let-values (((status out)
|
||||||
(system-to-string cmdline)))
|
(system-to-string cmdline)))
|
||||||
(let ((compile-log
|
(let ((compile-log
|
||||||
@ -243,7 +243,7 @@
|
|||||||
compile-log
|
compile-log
|
||||||
|
|
||||||
;; Execute
|
;; Execute
|
||||||
(let ((cmdline (format "vvp ~a/testbench.vvp" work-dir)))
|
(let ((cmdline (format "~a ~a/testbench.vvp" vvp-exe work-dir)))
|
||||||
(let-values (((status out)
|
(let-values (((status out)
|
||||||
(system-to-string cmdline)))
|
(system-to-string cmdline)))
|
||||||
(let ((execution-log
|
(let ((execution-log
|
||||||
@ -255,13 +255,14 @@
|
|||||||
(format "--\n~a\n" out)))))
|
(format "--\n~a\n" out)))))
|
||||||
(string-append compile-log execution-log))))))))))
|
(string-append compile-log execution-log))))))))))
|
||||||
|
|
||||||
(delete-recursive work-dir)
|
;; (delete-recursive work-dir)
|
||||||
log)))))
|
log)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Web page handler
|
;;; Web page handler
|
||||||
;;;
|
;;;
|
||||||
(define (make-page-handler host root index-file)
|
(define (make-page-handler host root index-file
|
||||||
|
vvp-exe iverilog-exe)
|
||||||
(let* ((root-path (split-and-decode-uri-path root))
|
(let* ((root-path (split-and-decode-uri-path root))
|
||||||
(sim-path (append root-path '("simulate")))
|
(sim-path (append root-path '("simulate")))
|
||||||
(post-uri (string-append host "/" (encode-and-join-uri-path sim-path)))
|
(post-uri (string-append host "/" (encode-and-join-uri-path sim-path)))
|
||||||
@ -297,7 +298,9 @@
|
|||||||
(printlog "-- Request simulate")
|
(printlog "-- Request simulate")
|
||||||
(let ((log (execute-icarus
|
(let ((log (execute-icarus
|
||||||
(sanitize-verilog
|
(sanitize-verilog
|
||||||
(utf8->string request-body)))))
|
(utf8->string request-body))
|
||||||
|
vvp-exe
|
||||||
|
iverilog-exe)))
|
||||||
(make-response log #:type 'text/plain)))
|
(make-response log #:type 'text/plain)))
|
||||||
|
|
||||||
;; Index page
|
;; Index page
|
||||||
@ -310,7 +313,6 @@
|
|||||||
(printlog "-- Request wrong path")
|
(printlog "-- Request wrong path")
|
||||||
(not-found request)))))))
|
(not-found request)))))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; ----------------------------------------------------------------------
|
;;; ----------------------------------------------------------------------
|
||||||
;;; ------------------------------- MAIN ---------------------------------
|
;;; ------------------------------- MAIN ---------------------------------
|
||||||
@ -332,6 +334,8 @@
|
|||||||
(-> " -p, --port PORT Listen on PORT port. Default: 8080")
|
(-> " -p, --port PORT Listen on PORT port. Default: 8080")
|
||||||
(-> " -s, --host URL Run on URL hostname. Default: http://127.0.0.1:8080")
|
(-> " -s, --host URL Run on URL hostname. Default: http://127.0.0.1:8080")
|
||||||
(-> " -r, --root URN Service location root. Default: ''")
|
(-> " -r, --root URN Service location root. Default: ''")
|
||||||
|
(-> " --ivverilog-exe PATH Set Icarus Verilog compiler executable. Default: iverilog")
|
||||||
|
(-> " --vvp-exe PATH Set Icarus Verilog interpreter executable. Default: vvp")
|
||||||
(-> " -h, --help Print this message and exit")
|
(-> " -h, --help Print this message and exit")
|
||||||
(-> "")
|
(-> "")
|
||||||
(-> "Source code and issue tracker: <https://github.com/punzik/>")))))
|
(-> "Source code and issue tracker: <https://github.com/punzik/>")))))
|
||||||
@ -341,17 +345,22 @@
|
|||||||
(let-values
|
(let-values
|
||||||
(((opts rest err)
|
(((opts rest err)
|
||||||
(parse-opts (cdr args)
|
(parse-opts (cdr args)
|
||||||
'(#\a addr required)
|
'(("addr" #\a) required)
|
||||||
'(#\p port required)
|
'(("port" #\p) required)
|
||||||
'(#\s host required)
|
'(("host" #\s) required)
|
||||||
'(#\r root required)
|
'(("root" #\r) required)
|
||||||
'(#\h help none))))
|
'(("vvp-exe") required)
|
||||||
(let ((addr (string-trim (or (option-get opts 'addr) "127.0.0.1")))
|
'(("iverilog-exe") required)
|
||||||
(port (string->number (string-trim (or (option-get opts 'port) "8080"))))
|
'(("help" #\h) none))))
|
||||||
(host (string-trim (or (option-get opts 'host) "http://127.0.0.1:8080")))
|
|
||||||
(root (string-trim (or (option-get opts 'root) ""))))
|
|
||||||
|
|
||||||
(if (option-get opts 'help)
|
(let ((addr (string-trim (or (option-get opts "addr") "127.0.0.1")))
|
||||||
|
(port (string->number (string-trim (or (option-get opts "port") "8080"))))
|
||||||
|
(host (string-trim (or (option-get opts "host") "http://127.0.0.1:8080")))
|
||||||
|
(root (string-trim (or (option-get opts "root") "")))
|
||||||
|
(vvp (string-trim (or (option-get opts "vvp-exe") "vvp")))
|
||||||
|
(iverilog (string-trim (or (option-get opts "iverilog-exe") "iverilog"))))
|
||||||
|
|
||||||
|
(if (option-get opts "help")
|
||||||
(begin
|
(begin
|
||||||
(print-help (car args))
|
(print-help (car args))
|
||||||
(exit -1))
|
(exit -1))
|
||||||
@ -360,5 +369,5 @@
|
|||||||
(printlog "Server URL: '~a/~a'" host root)
|
(printlog "Server URL: '~a/~a'" host root)
|
||||||
|
|
||||||
(run-server
|
(run-server
|
||||||
(make-page-handler host root INDEX-FILE)
|
(make-page-handler host root INDEX-FILE vvp iverilog)
|
||||||
'http `(#:host ,addr #:port ,port)))))))
|
'http `(#:host ,addr #:port ,port)))))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user