You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
447 B
Racket
19 lines
447 B
Racket
9 years ago
|
#lang br
|
||
9 years ago
|
(provide (prefix-out Nand- (all-defined-out)))
|
||
9 years ago
|
(require "bus.rkt")
|
||
9 years ago
|
|
||
9 years ago
|
(define-input-bus a)
|
||
|
(define-input-bus b)
|
||
9 years ago
|
|
||
9 years ago
|
(define (out . etc)
|
||
9 years ago
|
(if (< (+ (a) (b)) 2)
|
||
9 years ago
|
1
|
||
|
0))
|
||
|
|
||
|
(module+ test
|
||
|
(require rackunit)
|
||
9 years ago
|
(check-equal? (begin (a-write 0) (b-write 0) (out)) 1)
|
||
|
(check-equal? (begin (a-write 0) (b-write 1) (out)) 1)
|
||
|
(check-equal? (begin (a-write 1) (b-write 0) (out)) 1)
|
||
|
(check-equal? (begin (a-write 1) (b-write 1) (out)) 0))
|