This is Incrementor.m in view mode; [Download] [Up]
//
// Incrementor
//
// An Objective-C class for the simulation of digital logic.
//
// Incrementor very simply increments its n-bit input and
// puts the result on its n-bit output.
//
#import "Incrementor.h"
@implementation Incrementor
- initNumBits:(int)nbits in:innode out:outnode
{
[super init];
numbits = nbits;
INITDEVTYPE("Incrementor");
TESTNODE("IN", innode, numbits);
TESTNODE("OUT", outnode, numbits);
IN = innode;
OUT = outnode;
one = [[One alloc] initNumBits:numbits];
foo = [[Node alloc] initNumBits:1];
adder = [[Adder alloc] initNumBits:numbits a:IN b:one cin:foo cout:foo out:OUT];
return self;
}
- free
{
[one free];
[foo free];
[adder free];
return [super free];
}
- cycle
{
[adder cycle];
return self;
}
@end
//
// End of file.
//These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.