summaryrefslogtreecommitdiff
path: root/books/workshops/2002/georgelin-borrione-ostier/support/fact.nif
diff options
context:
space:
mode:
authorCamm Maguire <camm@debian.org>2017-05-08 12:58:52 -0400
committerCamm Maguire <camm@debian.org>2017-05-08 12:58:52 -0400
commit092176848cbfd27b96c323cc30c54dff4c4a6872 (patch)
tree91b91b4db76805fd2a09de0745b22080a9ebd335 /books/workshops/2002/georgelin-borrione-ostier/support/fact.nif
Import acl2_7.4dfsg.orig.tar.gz
[dgit import orig acl2_7.4dfsg.orig.tar.gz]
Diffstat (limited to 'books/workshops/2002/georgelin-borrione-ostier/support/fact.nif')
-rw-r--r--books/workshops/2002/georgelin-borrione-ostier/support/fact.nif76
1 files changed, 76 insertions, 0 deletions
diff --git a/books/workshops/2002/georgelin-borrione-ostier/support/fact.nif b/books/workshops/2002/georgelin-borrione-ostier/support/fact.nif
new file mode 100644
index 0000000..5f6e487
--- /dev/null
+++ b/books/workshops/2002/georgelin-borrione-ostier/support/fact.nif
@@ -0,0 +1,76 @@
+(:language vhdl
+
+:entity_name mysystem
+:inputs_signals (arg start)
+:inputs_type (natural bit)
+:outputs_signals (res fact.done)
+:outputs_type (natural bit)
+:architecture_name fact
+:local_signals (op1 op2 resmult startmult endmult)
+:local_signals_type (natural natural natural bit bit)
+:local_variables (doit.mystate r f)
+:local_variables_type (natural natural natural)
+
+:process
+ (
+ (Mult
+ (
+ (if (<= startmult 1)
+ (
+ (resmult <= (* op1 op2))
+ )
+ )
+ (endmult <= startmult)
+ )
+ )
+
+ (Doit
+ (
+ (if (<= doit.mystate 0)
+ (
+ (r := arg)
+ (f := 1)
+ (if (= start 1)
+ (
+ (doit.mystate := 1)
+ ))
+ )
+ (
+ (if (<= doit.mystate 1)
+ (
+ (if (= r 1)
+ (
+ (res <= f)
+ (fact.done <= 1)
+ (doit.mystate := 0)
+ )
+ (
+ (startmult <= 1)
+ (op1 <= r)
+ (op2 <= f)
+ (doit.mystate := 2)
+ )
+ )
+ )
+ (
+ (if (<= doit.mystate 2)
+ (
+ (if (= endmult 1)
+ (
+ (f := resmult)
+ (r := (- r 1))
+ (startmult <= 0)
+ (doit.mystate := 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+