next up previous
Next: Control flow Up: CSE240 Intermediate Computer Systems Previous: Project deadline

Bus structure

There is still some question as to the exact nature of the Bus structure. Here is what is known:

  datatype Bus
    = Bus { read  : Address -> MWord,
            write : Address * MWord -> MWord };

  fun getMWord( memory : Memory, addr : Address ) = ...;
  fun setMWord( memory : Memory, addr : Address, mword : MWord ) = ...;

  fun createBus( memory : Memory )
    = +-----------------------------------+
      |                                   |
      | it is unclear what to do in here: |
      |                                   |
      | let ?                             |
      | in Bus.new( ?, ? )                |
      | end                               |
      |                                   |
      +-----------------------------------+

Somehow we need to stuff the get/setMWord functions into the read and write fields of the Bus record.

In order to do this we need to transform the get/setMWord functions into something which will fit. Any transformation requires a the use of a function.

The first function we need transforms the getMWord function into a function which does not have a memory parameter. Or put more simply, the function must call the getMWord function by providing it with its necessary arguments. It knows what the memory argument is, but it does not know what the address argument is.



Jeffrey A. Meunier
2000-03-14