projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
969b7dd
)
Add mkIndexedName utility function.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 25 Jun 2009 12:46:28 +0000
(14:46 +0200)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 25 Jun 2009 12:46:28 +0000
(14:46 +0200)
VHDLTools.hs
patch
|
blob
|
history
diff --git
a/VHDLTools.hs
b/VHDLTools.hs
index d6034e7c2ec64a4809ebda2b00667cbe07db67f4..9462a1365b7c1841027ab93990172a51e1516719 100644
(file)
--- a/
VHDLTools.hs
+++ b/
VHDLTools.hs
@@
-228,6
+228,14
@@
mkSelectedName :: AST.VHDLName -> AST.VHDLId -> AST.VHDLName
mkSelectedName name label =
AST.NSelected $ name AST.:.: (AST.SSimple label)
mkSelectedName name label =
AST.NSelected $ name AST.:.: (AST.SSimple label)
+-- Create an indexed name that selects a given element from a vector.
+mkIndexedName :: AST.VHDLName -> AST.Expr -> AST.VHDLName
+-- Special case for already indexed names. Just add an index
+mkIndexedName (AST.NIndexed (AST.IndexedName name indexes)) index =
+ AST.NIndexed (AST.IndexedName name (indexes++[index]))
+-- General case for other names
+mkIndexedName name index = AST.NIndexed (AST.IndexedName name [index])
+
-----------------------------------------------------------------------------
-- Functions dealing with VHDL types
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Functions dealing with VHDL types
-----------------------------------------------------------------------------