aboutsummaryrefslogtreecommitdiff
path: root/src/Assembly/Pipeline.v
diff options
context:
space:
mode:
authorGravatar Robert Sloan <varomodt@gmail.com>2016-06-23 16:14:02 -0400
committerGravatar Robert Sloan <varomodt@gmail.com>2016-06-23 16:14:02 -0400
commit75543f3bd0d74406de85796b6ce9b6cd54b93053 (patch)
treef5224ad1ee60f641aaa0cbb3495417c73579c0a1 /src/Assembly/Pipeline.v
parentb9fcdc12c330b078574ba3feb2ab9e383fbc4e83 (diff)
Pipeline: several new examples
Diffstat (limited to 'src/Assembly/Pipeline.v')
-rw-r--r--src/Assembly/Pipeline.v44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/Assembly/Pipeline.v b/src/Assembly/Pipeline.v
index 9d6c4c9da..67e39a804 100644
--- a/src/Assembly/Pipeline.v
+++ b/src/Assembly/Pipeline.v
@@ -21,20 +21,56 @@ Module Pipeline.
omap (toQhasm p) (StringConversion.convertProgram tt tt).
End Pipeline.
-Module PipelineExample.
+Module PipelineExamples.
Import Pipeline ListNotations StateCommon EvalUtil ListState.
Local Notation "v [[ i ]]" := (nth i v (wzero _)) (at level 40).
Local Notation "$$ v" := (natToWord _ v) (at level 40).
- Definition example: @pseudeq 32 W32 1 1 (fun v =>
+ Definition add_example: @pseudeq 32 W32 1 1 (fun v =>
plet a := $$ 1 in
plet b := v[[0]] in
+ [a ^+ b]).
+ pseudo_solve.
+ Defined.
+
+ Definition add_ex_str :=
+ (Pipeline.toString (proj1_sig add_example)).
+
+ Definition and_example: @pseudeq 32 W32 1 1 (fun v =>
+ plet a := $$ 1 in
+ plet b := v[[0]] in
+ [a ^& b]).
+ pseudo_solve.
+ Defined.
+
+ Definition and_ex_str :=
+ (Pipeline.toString (proj1_sig and_example)).
+
+ Definition mult_example: @pseudeq 32 W32 1 1 (fun v =>
+ plet a := $$ 1 in
+ plet b := v[[0]] in
+
+ (* NOTE: we want the lets in this format to unify with
+ pseudo_mult_dual *)
plet c := multHigh a b in
plet d := a ^* b in
+
[b ^& d]).
pseudo_solve.
Defined.
- Eval vm_compute in (Pipeline.toString (proj1_sig example)).
-End PipelineExample.
+ Definition mult_ex_str :=
+ (Pipeline.toString (proj1_sig mult_example)).
+
+ Definition comb_example: @pseudeq 32 W32 1 1 (fun v =>
+ plet a := $$ 7 in
+ plet b := v[[0]] in
+ ([b ^& a; a ^+ b])).
+ pseudo_solve.
+ Admitted. (*TODO (rsloan): eapply unification *)
+
+ Definition comb_ex_str :=
+ (Pipeline.toString (proj1_sig comb_example)).
+
+End PipelineExamples.