Friday, January 16, 2009

One Instruction Set Computers


The logical extreme of reduced instruction set computers, as previously briefly mentioned in this article, is the use of a single parametrized op-code. To properly put this into perspective, modern x86 architectures, like the computer you are likely using now, and other CISC (complex instruction set computers) use hundreds, if not thousands, of individual instructions. The use of so many different commands within the processor forces the design to be very complex and leads to an increased chance of glitches and ultimately reduces maximum clock speed.

On the other hand, a reduced instruction set computer architecture (RISC), especially the one instruction set version (OISC), involves minimal circuitry inside the actual processor, simplifying the design and allowing components to be placed in a smaller area to enhance the speed by reducing propogation delays and latencies.



The model under investigation here is known as "Subtract-and-Branch-If-Less-than-or-Equal-to-Zero", symbolized as "subleq", and coded with no opcodes - since with the use of a sinlge op-code, the computer will not require explicit knowledge of what is expected, the opcode is implied and memory space is saved. Subleq takes three parameters, also known as operands, marked a, b, and c. The basic, and only, function of this code is to set the value at b equal to b minus a. In otherwords, b = b-a. For those that are not familar with typical assignment operators used in computer programming, the way this statement is evaluated is by taking the current value of whatever b-a happens to be. This value is then stored in and overwrited to, "assigned to", the value of b... meanwhile no change is made to a. IF the new value at b is less than or equal to 0 then program execution is "jumped" to the location held by paramter c, or more simply, the processor's program counter is set to the value of c. If a jump is not required you can't simply say 0 for c, since that would cause the program to reset and start over, 0 is the starting point for a program counter (typically). It is generally accepted to leave the third parameter c blank in these cases, which informs the processor that regardless of the previous operation, just go to the next instruction. It's still a jump, but only by one unit. Alternatively, the user can simply write in the location of the next instruction, it's exactly the same.

There are many ways to implement this design and slight modifcations are possible to create new instruction sets. Since program lengths can become extraordinarily long in such an instruction set, it can also be beneficial to add specialized hardware to the processor to allow multiplication or other mathematical functions to be performed in a single cycle. However, for proof of concept, the OISC mentioned here, is capable of universal computation! All with only one instruction.

If you've never run across such a claim before, I don't expect you to immediately understand how to program in this machine language. It's interesting that, at this point, you know everything about this one instruction set computer and yet, at the same time, probably wouldn't have any idea where to begin creating a program to drive it.

Well, here's a start, to perform addition of two numbers on this computer, all you have to do is...
    ADD a, b == subleq a, Z
subleq Z, b
subleq Z, Z
Good luck OISC programmers!

Saturday, January 10, 2009

Accelerometers - MEMS by Analog Devices


The picture to the left is the ADXL322 double axis accelerometer with analog output lines, a close variant to the triple axis version used within Nintendo's Wii video game console. The PCB on which it is shown mounted is only a break out board and has the necessary capacitors to determine the IC's samples per second rate. These easy to use and easy to solder modules typical cost around $30 USD. However, if your soldering skills are sufficient, you'd be much better off buying the accelerometer alone for as low as $3. With the rapid decline in price on these micro engineered machines, hobbyists and businesses everywhere are taking advantage of the benefits these tiny devices can provide.
These accelerometers, with sampling speeds of over 1000 times per second, can be used to directly measure dynamic acceleration and the static acceleration of gravity which can be mathematically converted to terms such as velocity, position, oritentation, jerk, and G force. With the variety of different calculations that can be performed all from this single chip, it is easy to realize a vast variety of different machines and devices such as digital hourglasses, computer pointing devices, degree of impact sensors, free fall sensors (especially important if you drop your laptop), Star Wars type lightsaber toys, image stablization for binoculars, telescopes, and cameras... the list is endless. A single chip such as this, can provide all of the sensors within a single package for a fully capable self driving car, since extrapolation of even position can be somewhat accurate, but more importantly, speed and impacts can be known, without the need to count wheel rotations and hope the wheels didn't skip, nor wire impact sensors 360 degrees around the chassis. If triple axis is desired, the ADXL330 is a very well known and widely available model to provide just that. Several other versions can provide PWM outputs, instead of analog, for easy integration with a digital microcontroller. So, please go buy some of these devices and build something amazing, and let me know how it turns out.

Wednesday, January 7, 2009

Self Driving Automobile - Version One Point Zero



To simply press a button and expect your car to safely and flawlessly drive itself and its occupants to a destination still seems far off in the future. To navigate an innumerable possible obstructions, law variations, and unpredictable human behaviors in surrounding traffic nearly requires an impossibly complicated set of instructions and algorithms far too vast for today's processors. At least, this is the current consensus of most artificial intelligence researchers. However, new methods of machine learning, pattern recognition, object avoidance, path finding algorithms, and prediction mechanisms just might make this dream a reality.

To achieve this possibility, I have developed a simple experiment, involving a reduced risk environment. After all, placing one's own vehicle in jeopardy is both financially and morally dangerous. Instead, an inexpensive radio controlled model car will suffice, of course deprived of its internal radio receiving circuit. In it's place, an advanced learning processor will assume total control over the vehicle's movements. Enhanced by a network of proximity sensors, accelerometers, and a 360 degree VGA camera which can be rotated to the CPU's desire, the learning machine will explore it's world, learning the causal relationships between events such as approaching wall and an immanent collision. Under self control, the car is able to exceed normal operating limits with high speed 20 volt sprints, rear differential locking, and dynamic electronic breaking to perform the otherwise impossible maneuvering for quick escapes from the difficult to predict real world variables.

Rather than using a neural network the processor will emulate a virtual system which is capable of open ended evolution. Much of my previous involvements in this approach are explained in prior postings within this blog. In essence, this virtual system will be coded by a genetic sequence. Since nano technology and auto assembly is currently beyond most hobbyists' budgets, this car will not have any replication, repair, or homeostasis abilities, so with respect to most definitions it will not be considered alive. However, possibly more importantly, it's mind - the virtual system being emulated by the car's processors, will be capable of self organization and full blown open evolution, affected directly by the natural laws of natural selection. This means, basically, that it's "brain" can be physically changed (within it's virtual world), not only it's software, but also it's hardware. The genetic sequence which encodes the construction of the automaton's mind is to be stored within a 4GB Flash card, which in theory is enough to hold the entire human genome.

Since open ended evolution can be aimless at times, I have decided to add directives to the processor which controls the virtual evolution experiment. It is important to understand the levels of abstraction involved with this device, so I will straight forwardly reiterate. The car is physical and it has a physical processor and physical sensors. The processor, however, generates a virtual computer through a process called emulation. It is that virtual computer that sees through the sensors and drives the car. The physical processor will supply some parameters to the evolution experiment, such as collision results in death and therefore whatever specific genetic code was running at the time is a failure. Performance will be ranked and behaviors such as object avoidance, trajectory prediction, and camera pattern recognition will emerge. The system will be rewarded for exploring larger areas, requiring greater accuracy of the vision system to avoid impacts while traveling. Unlike GM's supposed claim of a self driving car, this machine would be capable of learning, limited only by cheap memory, and would never require human intervention.

The evolutionary process, taking the car from a system which doesn't understand the visual input at all to an expert driver, could potentially take several years to complete. It would be taught rather than programmed and the algorithms generated by this selection effort could be utilized in a wide variety of useful tasks which one day may be combined in a more advanced design to safely and reliably transport the world's population to their destinations in fully automatic, self aware vehicles.

Wednesday, December 31, 2008

One Bit Manipulation - A Reduced Instruction Set Computer


The esoteric computer programming language, brainfuck, a reduced instruction set language and slight variation of p prime prime, uses a set of only eight instructions to perform universal computation. In otherwords, it can perform operations equivalent in complexity to any other computer, regardless of the fact that most modern processors use instruction sets consisting of several thousands of commands. Brainfuck uses basic operations to control both it's program counter and it's one and only memory pointer. By moving the memory and program pointers back and forth and incrementing and decrementing the values contained within up and down with conditional control, the limited language is capable of solving any algorithmically expressable problem. The 8 instructions are:
+ (increment value at pointer)
- (decrement value at pointer)
> (move pointer right)
< (move pointer left)
[ (jump forward to the matcing "]" *they can be nested if value at pointer is zero
] (jump backward to the command after the matching "[" if the value at the pointer is non zero
. (output the value at the pointer)
, (accept an input and store it in the location pointed to by the pointer)

Although this set may seem already maximally reduced, it can be decreased further! Firstly, the input and output commands are completely unnecessary. They simply provide a convenient method of transfering data between the processor and the external world. Other methods exists, such as memory mapping, and because of this, they can be eliminated.

On top of that, the brainfuck language assumes that the registers comprising the memory locations are 8 bit, however 8 bit wide registers are not necessary and reducing them to the logical extreme of only one bit allows for the + and - commands to be reduced to a single instruction. Since incrementing or decrementing a 1 bit value simple reverses the current value, for example ones turns to zeros and a zeros turns to ones, only one command is necessary and so for purposes of this article we can express it as "x", meaning to flip the current bit.

With this modified language, constructed from only 5 opcodes, one can create an even less efficient way of solving any problem. Is it possible to reduce the instruction set even further? Actually, surprisingly, the answer is yes. By the inclusions of more complicated internal architecture and addition of parameter based operations, the instruction set can be reduced to only one instruction. This impractical system doesn't do much more than to illustrate the methods by which a single instruction computer can work, however, it greatly reduces the quantity of transistors required to fabricate the processor and assuming that one day transistor switching times are reduced sufficiently, it could very well become cost effective.

Superior Digital Design

The design of the impossible is now in your hands. Allow us to professionally and affordably develop your advanced electronic computerized super invention. We offer software development, microcontroller programming, digital electronic circuit design, high power electronic controllers, artificial intelligences, and just about anything else. Designs for $300, if they're simple. You may never know if you don't request a free quote.













Monday, December 29, 2008

Genetic Error Correction Mechanism

What I've learned, through experimentation with open ended evolution by computer simulation, is that evolution will take a random path towards no particular goal as long as reproduction remains successful. If, however, there is an added parameter to maintaining survival, a particular evolutionary response (linear on average) will result. In extraordinarily simple self replicating machines, the process is nearly immediate, since it is necessary, but in more advanced systems, there is a great deal of redundancy and seemingly dormant code can "reactivate" to allow the organism to persevere. Also, interestingly, it is very common for complementary pairs of "genetic" code to form which each disallows the other from mutating. It is only when both of these is coincidentally mutated in the correct way that either of them can be changed successfully. This is a very natural, very common process, which acts as an error correcting mechanism very similar to that of a checksum.

Of course in my experiments there is no actual genetic code, meaning there is no DNA, however there is a code and that code is capable of mutation. I assume that essentially the natural laws of evolution and processes of natural selection can be governed by a universal mathematical description and for any system, regardless of material composition, the same will apply.

I'd like to hear from people about this, if anyone has had similar results with experiments. Also, if there are any readers out there that would like to take advantage of some of my source code for the universal open ended evolver please leave me a message. Thanks!

Persistance of Vision

Interesting, low part count, relatively simple devices, called Persistence of Vision displays, utilize the exceptionally slow response time of the retina to optical variations. Exploiting these effects make it possible to build a graphical matrix display with far fewer light emitting pixels than one might first intuitively expect. For example, this first picture illustrates my attempt of a hand built rotating POV clock without the need of any specialty machining tools. Using only seven LEDs, a 0.1 Horse power AC electric motor, 16Mhz microcontroller, and a solidly constructed aluminum frame, a virtual seven by 120 pixel display appears to come into existance. Electric power is supplied to the rotating circuit board by an isulated rotary contact and spring brush. The motor's rotor provides the necessary grounding connection and reduces the otherwise increase in friction that would result with a second brush. Alternative methods for supplying power to the board are numerous and probably would result in a quieter, longer lived design. Of these variations, the the simplest, quietest, and possibly least electrically efficient is to use an air core resonant transformer. This method consists of a primary coil mounted stationary to the motor which induces an electromagnetic field upon a secondary coil which travels with the rotating display platform providing a contactless power bridge to the control circuitry.

Since the display contains only minimal LEDs and weight is a factor, resolution can be improved simply by a faster control circuit and finer pitched bulbs. With LEDs spaced closer together and with the ability to control them more precisely, the designer can create images with better quality without resorting to spending extra money. Some have taken this concept to the extreme and produced full HD quality video using only about a 1000 emitters. Since rotation speed directly affects picture quality, it is important to minimize system components and mass. An aerodynamic design or placing the device in a vacuumed chamber can greatly improve refresh rates.

Rather than rotating the light source, a specially angled type mirror can be used to automatically reflect the light source into scanning rows upon a projection screen. The motor simply spins this 7 sided cylindrical mirror (each side having a slightly different tilt). When a stationary mounted laser is bounced off the rotating mirror a raster pattern is produced on the screen. By keeping track of rotational indexes and other timing information, a processor can determine whether to turn the laser on or off at extremely high speeds. The end result is the stable illusion of an image on the wall.

A still better approach is to use a flat mirror on a double axis, spring suspended mount. Electromagnets can force the mirror into a scanning pattern where rows are generated more often than columns. Very similar to a television's electron beam control, but far superior in its ability to project images beyond a vacuum chamber and zero requirement for a phosphorescent doped screen, a mechanically scanned laser projector can generate images of any size, with any resolution, and is only limited by the intensity of the laser's beam and the reaction speed of the electronics.