Add help button
This commit is contained in:
parent
185dcb350d
commit
9939a226c8
@ -94,6 +94,7 @@
|
||||
|
||||
<body>
|
||||
<div id="buttons">
|
||||
<button onclick="show_help()"><span class="text">?</span></button>
|
||||
<button onclick="save_code('%SAVECODEURI%')"><span class="text">Save (ctrl-s)</span></button>
|
||||
<button onclick="save_code('%SAVEASURI%')"><span class="text">Save as new</span></button>
|
||||
Sim:
|
||||
@ -151,6 +152,10 @@
|
||||
.then((text) => { window.location.href = text; });
|
||||
};
|
||||
|
||||
function show_help() {
|
||||
alert("%HELPSTRING%");
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key.toLowerCase() === 's' && e.ctrlKey) {
|
||||
e.preventDefault();
|
||||
|
||||
@ -191,7 +191,7 @@
|
||||
#:content-type-params content-type-params))
|
||||
|
||||
;;;
|
||||
;;; Execute system command and capture stdout and stderr to string list
|
||||
;;; Execute system command and capture stdout and stderr to string
|
||||
;;;
|
||||
(define* (system-to-string cmd #:key (pwd #f))
|
||||
(let* ((cmd (string-append cmd " 2>&1"))
|
||||
@ -201,14 +201,14 @@
|
||||
(values (close-pipe p) out)))
|
||||
|
||||
;;;
|
||||
;;; Unused
|
||||
;;; Execute system command and capture stdout and stderr to string list
|
||||
;;;
|
||||
;; (define* (system-to-string-list cmd #:key (pwd #f))
|
||||
;; (let-values (((status out)
|
||||
;; (system-to-string cmd #:pwd pwd)))
|
||||
;; (values
|
||||
;; status
|
||||
;; (list-trim (string-split out #\newline) string-null?))))
|
||||
(define* (system-to-string-list cmd #:key (pwd #f))
|
||||
(let-values (((status out)
|
||||
(system-to-string cmd #:pwd pwd)))
|
||||
(values
|
||||
status
|
||||
(list-trim (string-split out #\newline) string-null?))))
|
||||
|
||||
;;;
|
||||
;;; Make pretty log from executable output
|
||||
@ -328,6 +328,18 @@
|
||||
(exe-log-pretty cmdline status out)))
|
||||
(values status (string-append compile-log execution-log)))))))))))
|
||||
|
||||
;;;
|
||||
;;; Get iverilog version
|
||||
;;;
|
||||
(define (iverilog-version iverilog-exe)
|
||||
(let-values (((status out)
|
||||
(system-to-string-list
|
||||
(format "~a -V" iverilog-exe))))
|
||||
(if (and (zero? status)
|
||||
(not (null? out)))
|
||||
(car out)
|
||||
"Unknown")))
|
||||
|
||||
;;;
|
||||
;;; Execute simulation
|
||||
;;;
|
||||
@ -426,9 +438,28 @@
|
||||
(iverilog-post-uri (encode-and-join-uri-path iverilog-path))
|
||||
(savecode-post-uri (encode-and-join-uri-path savecode-path))
|
||||
(saveas-post-uri (encode-and-join-uri-path saveas-path))
|
||||
(index-html (read-template-text index-file `(("IVERILOGPOSTURI" ,iverilog-post-uri)
|
||||
("SAVECODEURI" ,savecode-post-uri)
|
||||
("SAVEASURI" ,saveas-post-uri)))))
|
||||
(index-html
|
||||
(read-template-text
|
||||
index-file
|
||||
`(("IVERILOGPOSTURI" ,iverilog-post-uri)
|
||||
("SAVECODEURI" ,savecode-post-uri)
|
||||
("SAVEASURI" ,saveas-post-uri)
|
||||
("HELPSTRING",
|
||||
(string-concatenate
|
||||
(insert-between
|
||||
`("Verilog Playground by Punzik (c) 2022"
|
||||
""
|
||||
,(format "Icarus: ~a"
|
||||
(iverilog-version iverilog-exe))
|
||||
,(format "Verilator: ~a" "TODO")
|
||||
""
|
||||
"Rules:"
|
||||
"0. Don't fool around ;)"
|
||||
"1. (TODO) The top module must be named 'testbench'."
|
||||
"2. (TODO) The top module for the Verilator must have an input clock signal."
|
||||
"3. Code size should not exceed 10000 characters."
|
||||
"4. Code execution time no longer than 5 seconds.")
|
||||
"\\n")))))))
|
||||
|
||||
(lambda (request request-body)
|
||||
(let (;; Requested resource path
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user