This is Memory.h in view mode; [Download] [Up]
// // Memory // // An Objective-C class for simulating main memory subsystems for computer simulations. // The memory has n-bit words, and m-bit addresses. // // Can be used for main RAM memory, ROM, Cache memory, and microstore. // #import <objc/Object.h> #import "Node.h" #import <stdio.h> #define MEM_RAM 0 #define MEM_ROM 1 @interface Memory : Object { // // Internal State: // int type; // Type of memory. int wait; // Number of cycles to wait. int cyclenum; // Cycle number. bit *data; // Memory array. int databits; // Number of bits per memory word. int addressbits; // Number of bits in addresses. int numwords; // Number of physical words installed. int numbits; // Total number of bits in memory. bit lastenable; // Copies of the values from the last cycle. bit lastrw; long lastaddrin; long lastdatain; // // External Interface: // Node *ENABLE; // 1-bit ENABLE inptus node. Node *RW; // 1-bit RW intput node. Node *ADDRIN; // m-bit ADDRIN intput node. Node *DATAIN; // n-bit DATAIN intput node. Node *READY; Node *DATAOUT; // n-bit DATAOUT output node. Node *EXC; // 1-bit EXC output node. } - initType:(int)atype // Type of memory. dataBits:(int)dbits // Number of bits in a memory word. addressBits:(int)abits // Number of bits in an address. physical:(int)nwords // Amount of memory actually in subsystem. wait:(int)wcycles // Number of cycles memory access takes. datain:din // Node for data in. addrin:ain // Node for address in. ready:rout // Node for ready signal out. dataout:dout // Node for data out. exception:eout // Node for exception signal out. enable:e // Node for enable. rw:rw; // Node for read/write select. - free; - cycle; // Execute one cycle - loadAt:(int)addr fromFile:(FILE *)afile; // Load some data into the memory. - dumpWord:(int)addr toFile:(FILE *)aFile; - dumpStart:(int)start // Dump a portion of memory to a file. stop:(int)stop toFile:(FILE *)afile; @end // // End of file. //
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.