diff --git a/beautiful-racket/br/demo/hdl/bus.rkt b/beautiful-racket/br/demo/hdl/bus.rkt index 4858a96..e72b74f 100644 --- a/beautiful-racket/br/demo/hdl/bus.rkt +++ b/beautiful-racket/br/demo/hdl/bus.rkt @@ -33,7 +33,7 @@ (reverse (for/list ([i (in-range width)]) (bitwise-bit-field int i (add1 i))))) -(define max-bus-width 16) +(define max-bus-width 64) (define default-bus-width 1) @@ -116,7 +116,7 @@ base bus: (raise-argument-error 'id (format "bus width <= max width ~a" max-bus-width) bus-width)) (impersonate-procedure (let ([reader (make-bus-reader 'id bus-width)]) - (procedure-rename (λ args (apply reader (ID-THUNK) args)) (string->symbol (format "~a, a bus of width ~a" 'ID bus-width)))) + (procedure-rename (λ args (apply reader (ID-THUNK) args)) (string->symbol (format "~a:~a-bit" 'ID bus-width)))) #f BUS-TYPE #t))) #,(when (syntax-property caller-stx 'writer) (with-pattern diff --git a/beautiful-racket/br/demo/hdl/tokenizer.rkt b/beautiful-racket/br/demo/hdl/tokenizer.rkt index 0ba1cef..25a350d 100644 --- a/beautiful-racket/br/demo/hdl/tokenizer.rkt +++ b/beautiful-racket/br/demo/hdl/tokenizer.rkt @@ -18,8 +18,9 @@ [(char-set "[]{}(),;=.") lexeme] ["true" (token 'TRUE #t)] ["false" (token 'FALSE #f)] - [(repetition 1 +inf.0 (char-set "01")) (token 'BINARY-NUMBER (string->number lexeme 2))] [(repetition 1 +inf.0 numeric) (token 'NUMBER (string->number lexeme))] + ; bugaboo: "10" is ambiguous: number or binary number? + [(repetition 1 +inf.0 (char-set "01")) (token 'BINARY-NUMBER (string->number lexeme 2))] [(seq (repetition 1 1 alphabetic) (repetition 0 +inf.0 (union alphabetic numeric "-"))) (token 'ID (string->symbol lexeme))])) (get-token input-port)) next-token)