diff options
| author | azidar | 2016-01-27 15:17:07 -0800 |
|---|---|---|
| committer | azidar | 2016-01-28 09:25:04 -0800 |
| commit | 0408e8692e77021edc21c361f514455cf6f85a16 (patch) | |
| tree | f8141b2cc48a377347db98969557f13826411d1a /src | |
| parent | 220c44eeb0778a9c789b15250f3ec5b634d5fc5d (diff) | |
Fixed bug where you cannot extract from a single bit wire in verilog. #55.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/stanza/passes.stanza | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/stanza/passes.stanza b/src/main/stanza/passes.stanza index 51e6581c..4824cdca 100644 --- a/src/main/stanza/passes.stanza +++ b/src/main/stanza/passes.stanza @@ -1790,8 +1790,9 @@ defmethod print (o:OutputStream,op:WPrimOp) : defn v-wrap-e (e:Expression) -> Expression : match(map(v-wrap-e,e)) : (e:DoPrim) : + defn a0 () : args(e)[0] if op(e) == TAIL-OP : - match(args(e)[0]) : + match(a0()) : (e0:DoPrim) : if op(e0) == ADD-OP : DoPrim(ADDW-OP,args(e0),list(),type(e)) @@ -2087,7 +2088,11 @@ defn const-prop-e (e:Expression) -> Expression : (x:UIntValue) : val b = bits(value(x),consts(e)[0] + 1,consts(e)[1]) UIntValue(b,width(type(e) as UIntType)) - (x) : e + (x) : + if long!(type(e)) == long!(type(x)) : + if type(x) typeof UIntType : x + else : DoPrim(AS-UINT-OP,list(x),list(),type(e)) + else : e else : e (e) : e |
