This is Decrementor.m in view mode; [Download] [Up]
//
// Decrementor
//
// An Objective-C class for the simulation of digital logic.
//
// Decrementor very simply decrements its n-bit input and
// puts the result on its n-bit output.
//
#import "Decrementor.h"
@implementation Decrementor
- initNumBits:(int)nbits in:innode out:outnode
{
[super init];
numbits = nbits;
INITDEVTYPE("Decrementor");
TESTNODE("IN", innode, numbits);
TESTNODE("OUT", outnode, numbits);
IN = innode;
OUT = outnode;
negone = [[Node alloc] initNumBits:numbits fill:1]; // Negative one.
foo = [[Node alloc] initNumBits:1];
adder = [[Adder alloc] initNumBits:numbits a:IN b:negone cin:foo cout:foo out:OUT];
return self;
}
- free
{
[negone 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.