Skip to content

Commit

Permalink
Merge branch 'artem/vampir-mult-bug', remote-tracking branch 'origin/…
Browse files Browse the repository at this point in the history
…artem/binary-test-param-print'
  • Loading branch information
mariari committed Dec 20, 2023
3 parents a9c86b4 + 64b425d + f14ea0b commit dee9221
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/seqn/trans.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ and skip 0es, making non-zero entries into wires"
(wires (loop for i from 1 to wire-count
collect (vamp:make-wire
:var (intern
(format nil "X~a" (- wire-count i))
(format nil "in~a" (- wire-count i))
:keyword)))))
(list
(vamp:make-alias
Expand All @@ -46,14 +46,18 @@ and skip 0es, making non-zero entries into wires"

(defun test-call (circuit)
"Given a compiled VampIR function with name foo and arguments x1...xn prints
an equality as foo x1 ... xn = y"
(let ((inputs (vamp:inputs circuit))
(name (vamp:name circuit)))
(list (vamp:make-equality
:lhs (if (zerop (length inputs))
(vamp:make-wire :var name)
(vamp:make-application :func name :arguments inputs))
:rhs (vamp:make-wire :var :y)))))
an equality as foo in1 ... in2 = out"
(let* ((inputs (vamp:inputs circuit))
(name (vamp:name circuit)))
(flet ((app (x) (vamp:make-application :func name :arguments x)))
(list (vamp:make-equality
:lhs (cond ((zerop (length inputs))
(vamp:make-wire :var name))
((= (length inputs) 1)
(app (list (vamp:make-wire :var :in))))
(t
(app inputs)))
:rhs (vamp:make-wire :var :out))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SeqN to Vamp-IR Compilation
Expand Down Expand Up @@ -258,7 +262,7 @@ removed already and hence we cannot count as usual"

(defmethod to-vampir ((obj seqn-multiply) inputs constraints)
(declare (ignore constraints))
(list (infix-creation :* (car obj) (cadr obj))))
(list (infix-creation :* (car inputs) (cadr inputs))))

(defmethod to-vampir ((obj seqn-divide) inputs constraints)
(declare (ignore constraints))
Expand Down

0 comments on commit dee9221

Please sign in to comment.