Compare commits

..

No commits in common. "f9f22f4f3192745e12e80ce762d19ef8e2eba8af" and "4d27f1663022e0c43a9df5c2ba32923449871c37" have entirely different histories.

View File

@ -123,9 +123,8 @@
;;;
;;; Parse VCD header
;;; 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)
(scope '())
(tags+signals '()))
@ -150,20 +149,18 @@
(else 'bits)))
(width (string->number (third cmd)))
(tag (fourth cmd))
(name (string-concatenate
(insert-between
(cddddr cmd) " "))))
(vname (string-concatenate
(insert-between
(cddddr cmd) " "))))
(next-cmd timescale scope
(let ((sig (signal-new (reverse scope)
name type width '())))
(if (need-signal? sig)
(let ((tag+sig (assoc tag tags+signals)))
(if tag+sig
(begin
(set-cdr! tag+sig (cons sig (cdr tag+sig)))
tags+signals)
(cons (cons tag `(,sig)) tags+signals)))
tags+signals)))))
(let ((tag+sig (assoc tag tags+signals))
(sig (signal-new (reverse scope)
vname type width '())))
(if tag+sig
(begin
(set-cdr! tag+sig (cons sig (cdr tag+sig)))
tags+signals)
(cons (cons tag `(,sig)) tags+signals))))))
((string-ci= "$upscope" (first cmd))
(next-cmd timescale (cdr scope) tags+signals))
@ -261,7 +258,7 @@
;; Update register values list
(let ((sigs (hash-table-ref/default tags+signals-ht tag #f)))
(when sigs
(unless (null? sigs)
(for-each
(lambda (sig)
(signal-add!
@ -302,9 +299,9 @@
;;; Parse whole VCD
;;; 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
(lambda () (read-header port need-signal?))
(lambda () (read-header port))
(cut read-data port <...>)))
;;;