Enable trace of structs

This commit is contained in:
Nikolay Puzanov 2022-12-13 11:49:15 +03:00
parent cc605cce85
commit 54f7e2be54
2 changed files with 40 additions and 12 deletions

View File

@ -319,14 +319,40 @@
;;; Make legend SVG text for VCD ;;; Make legend SVG text for VCD
;;; ;;;
(define* (vcd-signals->legend signals text-spacing text-position) (define* (vcd-signals->legend signals text-spacing text-position)
(if (null? signals)
""
(let ((common-scope-len
(length
(fold
(lambda (scope common)
(let loop ((scope scope)
(common common)
(out '()))
(if (or (null? scope)
(null? common))
(reverse out)
(if (string-ci= (car scope)
(car common))
(loop (cdr scope)
(cdr common)
(cons (car scope) out))
(reverse out)))))
(vcd-signal-scope (car signals))
(map vcd-signal-scope (cdr signals))))))
(map (map
(lambda (sig n) (lambda (sig n)
(string-append (string-append
(format-inex "<text x=\"0\" y=\"~a\">~a</text>" (format-inex "<text x=\"0\" y=\"~a\">~a</text>"
(+ (* n text-spacing) text-position) (+ (* n text-spacing) text-position)
(vcd-signal-name sig)))) (string-concatenate
(insert-between
(append
(drop (vcd-signal-scope sig)
common-scope-len)
`(,(vcd-signal-name sig)))
".")))))
signals signals
(iota (length signals)))) (iota (length signals))))))
;;; ;;;
;;; Create SVG from VCD ;;; Create SVG from VCD
@ -336,7 +362,7 @@
(signal-text-position 12) (signal-text-position 12)
(margin 5) (margin 5)
(signal-spacing 5) (signal-spacing 5)
(legend-width 100) (legend-width 150)
(extra-delim-y 3)) (extra-delim-y 3))
(let ((tstart (apply min (vcd-timestamps vcd))) (let ((tstart (apply min (vcd-timestamps vcd)))
@ -556,6 +582,8 @@
(println "+1800-2017ext+sv") (println "+1800-2017ext+sv")
(println "--timing") (println "--timing")
(println "--trace") (println "--trace")
(println "--trace-structs")
(println "--trace-depth 1")
(println "--quiet-exit") (println "--quiet-exit")
(println "~a" verilog-file) (println "~a" verilog-file)
(println "~a.cpp" top)))) (println "~a.cpp" top))))
@ -610,7 +638,7 @@
(values status log (vcd-file-read (values status log (vcd-file-read
vcd-file vcd-file
(lambda (sig) (lambda (sig)
(= 2 (length (vcd-signal-scope sig)))))) (>= (length (vcd-signal-scope sig)) 2))))
(values status log #f))))) (values status log #f)))))
;;; ;;;
@ -632,7 +660,7 @@
(values status log (vcd-file-read (values status log (vcd-file-read
vcd-file vcd-file
(lambda (sig) (lambda (sig)
(= 2 (length (vcd-signal-scope sig)))))) (>= (length (vcd-signal-scope sig)) 2))))
(values status log #f))))) (values status log #f)))))
;;; ;;;

View File

@ -6,7 +6,7 @@ module __@TOPMODULE@__;
@TOPMODULE@ @TOPMODULE@ (clock); @TOPMODULE@ @TOPMODULE@ (clock);
initial begin initial begin
$dumpfile("@WORKDIR@/@TOPMODULE@.vcd"); $dumpfile("@WORKDIR@/@TOPMODULE@.vcd");
$dumpvars(0, @TOPMODULE@); $dumpvars(1, @TOPMODULE@);
$dumplimit(100000); $dumplimit(100000);
end end
endmodule endmodule