diff options
| author | azidar | 2016-01-17 15:52:09 -0800 |
|---|---|---|
| committer | azidar | 2016-01-17 15:52:09 -0800 |
| commit | 263559753a0584ca7896607e643d9e6348811dff (patch) | |
| tree | cfb8059ff0016edf47df6a1fab2cfd8975da67cf /src | |
| parent | 6e898b3cecdc3a6f65e58930beb13857c7e36c31 (diff) | |
Forgot to add the changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/stanza/chirrtl.stanza | 2 | ||||
| -rw-r--r-- | src/main/stanza/errors.stanza | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/stanza/chirrtl.stanza b/src/main/stanza/chirrtl.stanza index 83a9e853..58656118 100644 --- a/src/main/stanza/chirrtl.stanza +++ b/src/main/stanza/chirrtl.stanza @@ -59,7 +59,7 @@ defn to-ir (c:Circuit) : (s:CDefMemory) : val stmts = Vector<Stmt>() val naddr = firrtl-gensym(`GEN,sh) - val taddr = UIntType(IntWidth(ceil-log2(size(s)))) + val taddr = UIntType(IntWidth(max(1,ceil-log2(size(s))))) add(stmts,DefPoison(info(s),naddr,taddr)) val ndata = firrtl-gensym(`GEN,sh) val tdata = type(s) diff --git a/src/main/stanza/errors.stanza b/src/main/stanza/errors.stanza index fb754406..97660b46 100644 --- a/src/main/stanza/errors.stanza +++ b/src/main/stanza/errors.stanza @@ -391,6 +391,10 @@ defn IndexOnNonVector (info:FileInfo) : PassException $ string-join $ [info ": [module " mname "] Index illegal on non-vector type."] +defn AccessIndexNotUInt (info:FileInfo) : + PassException $ string-join $ + [info ": [module " mname "] Access index must be a UInt type."] + defn IndexNotUInt (info:FileInfo) : PassException $ string-join $ [info ": [module " mname "] Index is not of UIntType."] @@ -549,6 +553,9 @@ public defn check-types (c:Circuit) -> Circuit : match(type(exp(e))) : (t:VectorType) : false (t) : add(errors,IndexOnNonVector(info)) + match(type(index(e))) : + (t:UIntType) : false + (t) : add(errors,AccessIndexNotUInt(info)) (e:DoPrim) : check-types-primop(e,errors,info) (e:UIntValue|SIntValue) : false e |
