Compare commits
No commits in common. "f9f22f4f3192745e12e80ce762d19ef8e2eba8af" and "4d27f1663022e0c43a9df5c2ba32923449871c37" have entirely different histories.
f9f22f4f31
...
4d27f16630
@ -123,9 +123,8 @@
|
|||||||
;;;
|
;;;
|
||||||
;;; Parse VCD header
|
;;; Parse VCD header
|
||||||
;;; Returns values of timescale and association list (tag . (<signal> ...))
|
;;; Returns values of timescale and association list (tag . (<signal> ...))
|
||||||
;;; Predicate: (need-signal? <signal>)
|
|
||||||
;;;
|
;;;
|
||||||
(define* (read-header port need-signal?)
|
(define (read-header port)
|
||||||
(let next-cmd ((timescale #f)
|
(let next-cmd ((timescale #f)
|
||||||
(scope '())
|
(scope '())
|
||||||
(tags+signals '()))
|
(tags+signals '()))
|
||||||
@ -150,20 +149,18 @@
|
|||||||
(else 'bits)))
|
(else 'bits)))
|
||||||
(width (string->number (third cmd)))
|
(width (string->number (third cmd)))
|
||||||
(tag (fourth cmd))
|
(tag (fourth cmd))
|
||||||
(name (string-concatenate
|
(vname (string-concatenate
|
||||||
(insert-between
|
(insert-between
|
||||||
(cddddr cmd) " "))))
|
(cddddr cmd) " "))))
|
||||||
(next-cmd timescale scope
|
(next-cmd timescale scope
|
||||||
(let ((sig (signal-new (reverse scope)
|
(let ((tag+sig (assoc tag tags+signals))
|
||||||
name type width '())))
|
(sig (signal-new (reverse scope)
|
||||||
(if (need-signal? sig)
|
vname type width '())))
|
||||||
(let ((tag+sig (assoc tag tags+signals)))
|
|
||||||
(if tag+sig
|
(if tag+sig
|
||||||
(begin
|
(begin
|
||||||
(set-cdr! tag+sig (cons sig (cdr tag+sig)))
|
(set-cdr! tag+sig (cons sig (cdr tag+sig)))
|
||||||
tags+signals)
|
tags+signals)
|
||||||
(cons (cons tag `(,sig)) tags+signals)))
|
(cons (cons tag `(,sig)) tags+signals))))))
|
||||||
tags+signals)))))
|
|
||||||
|
|
||||||
((string-ci= "$upscope" (first cmd))
|
((string-ci= "$upscope" (first cmd))
|
||||||
(next-cmd timescale (cdr scope) tags+signals))
|
(next-cmd timescale (cdr scope) tags+signals))
|
||||||
@ -261,7 +258,7 @@
|
|||||||
|
|
||||||
;; Update register values list
|
;; Update register values list
|
||||||
(let ((sigs (hash-table-ref/default tags+signals-ht tag #f)))
|
(let ((sigs (hash-table-ref/default tags+signals-ht tag #f)))
|
||||||
(when sigs
|
(unless (null? sigs)
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (sig)
|
(lambda (sig)
|
||||||
(signal-add!
|
(signal-add!
|
||||||
@ -302,9 +299,9 @@
|
|||||||
;;; Parse whole VCD
|
;;; Parse whole VCD
|
||||||
;;; Returns list of time stamps and list of lists (<signal> valuse ...)
|
;;; Returns list of time stamps and list of lists (<signal> valuse ...)
|
||||||
;;;
|
;;;
|
||||||
(define* (vcd-parse port #:optional (need-signal? (lambda (s) #t)))
|
(define (vcd-parse port)
|
||||||
(call-with-values
|
(call-with-values
|
||||||
(lambda () (read-header port need-signal?))
|
(lambda () (read-header port))
|
||||||
(cut read-data port <...>)))
|
(cut read-data port <...>)))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user