a ->
RangedWord s ->
RangedWord s ->
- Bit ->
+ Bool ->
((MemState s a), a )
blockRAM (State mem) data_in rdaddr wraddr wrenable =
((State mem'), data_out)
where
data_out = mem!rdaddr
-- Only write data_in to memory if write is enabled
- mem' = case wrenable of
- Low -> mem
- High -> replace mem wraddr data_in
+ mem' = if wrenable then
+ replace mem wraddr data_in
+ else
+ mem
wform = AST.Wform [AST.WformElem data_in Nothing]
ramassign = AST.SigAssign ramloc wform
rising_edge_clk = genExprFCall rising_edge (AST.PrimName $ AST.NSimple clockId)
- statement = AST.IfSm (AST.And rising_edge_clk (wrenable AST.:=: AST.PrimLit "'1'")) [ramassign] [] Nothing
+ statement = AST.IfSm (AST.And rising_edge_clk wrenable) [ramassign] [] Nothing
-----------------------------------------------------------------------------
-- Function to generate VHDL for applications