renames
parent
3af79f911f
commit
e631c39bf2
@ -1,13 +0,0 @@
|
||||
#lang br
|
||||
|
||||
(define+provide (Nand #:a a #:b b)
|
||||
(if (< (+ a b) 2)
|
||||
1
|
||||
0))
|
||||
|
||||
(module+ test
|
||||
(require rackunit)
|
||||
(check-equal? (Nand #:a 0 #:b 0) 1)
|
||||
(check-equal? (Nand #:a 0 #:b 1) 1)
|
||||
(check-equal? (Nand #:a 1 #:b 0) 1)
|
||||
(check-equal? (Nand #:a 1 #:b 1) 0))
|
@ -0,0 +1,28 @@
|
||||
#lang br
|
||||
|
||||
(define Nand-a
|
||||
(let ([Nand-a-val 0])
|
||||
(λ ([val #f])
|
||||
(if val
|
||||
(set! Nand-a-val val)
|
||||
Nand-a-val))))
|
||||
|
||||
(define Nand-b
|
||||
(let ([Nand-b-val 0])
|
||||
(λ ([val #f])
|
||||
(if val
|
||||
(set! Nand-b-val val)
|
||||
Nand-b-val))))
|
||||
|
||||
|
||||
(define (Nand-out)
|
||||
(if (< (+ (Nand-a) (Nand-b)) 2)
|
||||
1
|
||||
0))
|
||||
|
||||
(module+ test
|
||||
(require rackunit)
|
||||
(check-equal? (begin (Nand-a 0) (Nand-b 0) (Nand-out)) 1)
|
||||
(check-equal? (begin (Nand-a 0) (Nand-b 1) (Nand-out)) 1)
|
||||
(check-equal? (begin (Nand-a 1) (Nand-b 0) (Nand-out)) 1)
|
||||
(check-equal? (begin (Nand-a 1) (Nand-b 1) (Nand-out)) 0))
|
@ -1,4 +1,4 @@
|
||||
#lang br/demo/hdl/tst
|
||||
#lang br/demo/hdl-tst
|
||||
|
||||
/* nand */
|
||||
|
@ -1,4 +1,4 @@
|
||||
#lang br/demo/hdl/tst
|
||||
#lang br/demo/hdl-tst
|
||||
|
||||
/* Not */
|
||||
|
@ -1,4 +1,4 @@
|
||||
#lang br/demo/hdl/tst
|
||||
#lang br/demo/hdl-tst
|
||||
|
||||
/* or */
|
||||
|
@ -0,0 +1,13 @@
|
||||
#lang br/demo/hdl
|
||||
|
||||
CHIP And {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Nand(a=a, b=b, out=nandout);
|
||||
Not(in=nandout, out=out);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#lang br/demo/hdl/tst
|
||||
#lang br/demo/hdl-tst
|
||||
|
||||
load Xor.hdl,
|
||||
output-list a, b, out;
|
Loading…
Reference in New Issue