ForSyDe-3.1.1: ForSyDe's Haskell-embedded Domain Specific Language.

Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se

ForSyDe.Shallow.Memory

Description

This module contains the data structure and access functions for the memory model.

Synopsis

Documentation

data Memory a Source

The data type Memory is modeled as a vector.

Constructors

Mem Adr (Vector (AbstExt a)) 

Instances

Eq a => Eq (Memory a) 
Show a => Show (Memory a) 

data Access a Source

The data type Access defines two access patterns.

Constructors

Read Adr

'Read adr' reads an address from the memory.

Write Adr a

'Write Adr a' writes a value into an address.

Instances

Eq a => Eq (Access a) 
Show a => Show (Access a) 

type Adr = IntSource

newMem :: MemSize -> Memory aSource

The function newMem creates a new memory, where the number of entries is given by a parameter.

memState :: Memory a -> Access a -> Memory aSource

The function memState gives the new state of the memory, after an access to a memory. A Read operation leaves the memory unchanged.

memOutput :: Memory a -> Access a -> AbstExt aSource

The function memOutput gives the output of the memory after an access to the memory. A Write operation gives an absent value as output.