[<<][rtl][>>][..]
Fri Aug 10 09:15:53 EDT 2018

Figure out conversion to nested if elif else

First, define an intermediate language derived from SeqExpr that can
represent this.

Here's the uart receiver after unsharing unique nodes, indented for clarity

0 <- (INPUT)
3 <- (SUB (NODE 2) (CONST SInt Nothing 1))
5 <- (EQU (NODE 2) (CONST SInt Nothing 0))
6 <- (EQU (SLICE (NODE 2) 3 0) (CONST SInt Nothing 0))
7 <- (EQU (NODE 1) (CONST SInt Nothing 0))
9 <- (EQU (NODE 1) (CONST SInt Nothing 1))
12 <- (EQU (NODE 1) (CONST SInt Nothing 2))
15 <- (EQU (NODE 1) (CONST SInt Nothing 3))
32 <- (IF (NODE 7) (CONST SInt Nothing 0) (IF (NODE 9) (CONST SInt Nothing 0) (IF (NODE 12) (CONST SInt Nothing 0) (IF (NODE 15) (AND (NODE 6) (NODE 0)) (CONST SInt Nothing 0)))))
1 <- (DELAY
  (IF (NODE 7)
      (IF (NODE 0)
          (CONST SInt Nothing 0)
          (CONST SInt Nothing 1))
      (IF (NODE 9)
          (IF (NODE 5) 
              (CONST SInt Nothing 2)
              (NODE 1))
          (IF (NODE 12)
              (IF (NODE 5)
                  (CONST SInt Nothing 3)
                  (NODE 1))
              (IF (NODE 15)
                  (IF (NODE 5)
                      (CONST SInt Nothing 0)
                      (NODE 1))
                  (CONST SInt Nothing 0))))))

2 <- (DELAY
  (IF (NODE 7)
      (CONST SInt Nothing 3)
      (IF (NODE 9)
          (IF (NODE 5)
              (CONST SInt Nothing 63)
              (NODE 3))
          (IF (NODE 12)
              (IF (NODE 5)
                  (CONST SInt Nothing 7)
                  (NODE 3))
              (IF (NODE 15)
                  (IF (NODE 5)
                      (CONST SInt Nothing 0)
                      (NODE 3))
                  (CONST SInt Nothing 0))))))

35 <- (DELAY 
   (IF (IF (NODE 7)
          (CONST SInt Nothing 0)
          (IF (NODE 9)
               (CONST SInt Nothing 0)
               (IF (NODE 12)
                   (NODE 6)
                   (IF (NODE 15)
                       (CONST SInt Nothing 0)
                       (CONST SInt Nothing 0)))))
       (CONC (NODE 0) (SLICE (NODE 35) 8 1))
       (NODE 35)))


Yeah this isn't very useful...
Don't do this on SeqExpr.
Do it on SeqTerm first, then perform Expr on subexpressions.





[Reply][About]
[<<][rtl][>>][..]