Skip to content

Commit

Permalink
Merge remote-tracking branches 'origin/artem/vampir-lists' and 'origi…
Browse files Browse the repository at this point in the history
…n/artem/vampir-exponential'
  • Loading branch information
mariari committed Jun 30, 2023
3 parents 91db30f + e5d5bfd + 8b47964 commit e914e7d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/vampir/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
;; vampir api functions
:*bool*
:bool
:*base-range*
:*next-range*
:next-range
:*range-n*
:range-n
:*range32*
:range32

Expand Down
3 changes: 2 additions & 1 deletion src/vampir/spec.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
`(or wire constant))

(deftype primitive ()
`(or (eql :+) (eql :-) (eql :*) (eql :^) (eql :\\) (eql :%) (eql :/)))
`(or (eql :+) (eql :-) (eql :*) (eql :^) (eql :\\)
(eql :%) (eql :/) (eql :|:|) (eql :^)))

(deftype constraint-list ()
`(satisfies constraint-list))
Expand Down
37 changes: 26 additions & 11 deletions src/vampir/vampir.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
:func :negative31
:arguments (list a)))


(defparameter *base-range*
(make-alias
:name :base_range
:inputs (list (make-constant :const 0))
:body
(list (make-wire :var :[]))))

(defparameter *next-range*
(let ((a-wire (make-wire :var :a)))
(make-alias
Expand Down Expand Up @@ -149,18 +157,25 @@
(make-infix :op :\\
:lhs a-wire
:rhs (make-constant :const 2)))))
(make-equality :lhs a-wire
:rhs
(make-infix :op :+
:lhs (make-wire :var :a0)
:rhs (make-infix :op :*
:lhs (make-constant :const 2)
:rhs (make-wire :var :a1))))
(make-tuples :wires (list
(make-wire :var :a0)
(make-application :func :range
(make-infix :op :|:|
:lhs (make-wire :var :a0)
:rhs (make-application :func :range
:arguments
(list (make-wire :var :a1)))))))))
(list (make-wire :var :a1))))))))
(defparameter *range-n*
(make-alias
:name :range-n
:inputs (list :n)
:body
(list (make-application :func :iter
:arguments (list (make-wire :var :n)
(make-wire :var :next_range)
(make-wire :var :base_range))))))

(defun range-n (n a)
(make-application :func :range-n
:arguments (list n
a)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Range
Expand Down

0 comments on commit e914e7d

Please sign in to comment.