more
This commit is contained in:
parent
cb0c24c293
commit
6a5e7a8366
|
@ -1,7 +1,7 @@
|
|||
#lang br
|
||||
|
||||
(module reader br
|
||||
(require br/reader-utils "tst/parser.rkt" "tst/tokenizer.rkt")
|
||||
(require br/reader-utils "hdl-tst/parser.rkt" "hdl-tst/tokenizer.rkt")
|
||||
(define-read-and-read-syntax (source-path input-port)
|
||||
#`(module hdl-mod br/demo/hdl/tst/expander
|
||||
#`(module hdl-mod br/demo/hdl-tst/expander
|
||||
#,(parse source-path (tokenize input-port)))))
|
|
@ -19,7 +19,7 @@
|
|||
[#'output (shared-syntax 'output)])
|
||||
#'(begin
|
||||
(provide (all-defined-out))
|
||||
(define shared-procname (dynamic-require _filename-string 'shared-procname))
|
||||
(define shared-procname (dynamic-require (findf file-exists? (list _filename-string (format "~a.rkt" _filename-string))) 'shared-procname))
|
||||
(display-header '_colid ... '_outid)
|
||||
(define _colid (make-parameter 0)) ...
|
||||
(define (_outid)
|
19
beautiful-racket/br/demo/hdl-tst/hdlprint.rkt
Normal file
19
beautiful-racket/br/demo/hdl-tst/hdlprint.rkt
Normal file
|
@ -0,0 +1,19 @@
|
|||
#lang racket
|
||||
|
||||
|
||||
(define (hdlprint val fmt)
|
||||
(match-define (list _ radix-letter number-strings) (regexp-match #px"^%(.)(.*)$" fmt)) ; like %B1.16.1
|
||||
(match-define (list left-margin width right-margin) (map string->number (string-split number-strings ".")))
|
||||
(define radix (case radix-letter
|
||||
[("B") 2]))
|
||||
(string-append (make-string left-margin #\space)
|
||||
(if (number? val)
|
||||
(~r val #:min-width width #:pad-string "0" #:base radix)
|
||||
(~a val #:min-width width #:pad-string " " #:align 'center))
|
||||
(make-string right-margin #\space)))
|
||||
|
||||
(module+ test
|
||||
(require rackunit)
|
||||
(define a 123)
|
||||
(check-equal? (hdlprint a "%B1.16.1") " 0000000001111011 ")
|
||||
(check-equal? (hdlprint "out" "%B1.16.1") " out "))
|
|
@ -1,4 +1,4 @@
|
|||
#lang br/demo/hdl/tst
|
||||
#lang br/demo/hdl-tst
|
||||
|
||||
/* and */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user