Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Warm and Fussy

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


     

String-Based CPU

CPU oriented towards ASCII characters as the main data type
  (+3)
(+3)
  [vote for,
against]

ASCII is a seven-bit code with a parity bit, traditionally anyway. This allows ten dozen and seven characters overall. This CPU exploits that with unlimited string lengths to represent numbers.

It has an ALU for the instruction pointer and another for the single stack pointer, and it has a processor status word, but does not use a conventional ALU for arithmetic operations because it has no arithmetic operations. Instead, it uses strings instead of letters, delimited by setting the high bit, hence my reference to ASCII. Instead of performing arithmetic operations in binary, it runs algorithms which resemble those learnt in school for addition, division, multiplication and subtraction. It represents negative numbers using a leading minus sign and floating point with a full stop. Instead of instructions used for arithmetic, it uses string manipulation primitives. It can compare strings, extract substrings, return the code of a specific character within a string and concatenate.

Branching and calling subroutines are possible but rather than memory addresses, strings are used as labels. An array stores the locations of these addresses and they’re translated into literal addresses by the assembler - the user never sees these numerical values. There are also low-level control structures in the form of no operation instructions “BEGIN” and “END” and an active series of instructions “WHILE” followed by conditions referring to string values.

Bitwise operators are almost as with other CPUs except that they operate on and return the characters “F” and “T” rather than bits.

There are no general purpose registers. Instead, data are stored in main memory with an indefinite length using a set high bit in the final character as a delimiter.

Why do all this, apart from nerdy fun? Well, having no word length (actually eight bits but this is hidden) means that there’s no limit to the accuracy of arithmetic operations and two’s complement is unnecessary. Arithmetic is likely to be slower than a comparable numerically oriented CPU, but the limit of numerical values is determined only by the size of the address space and the memory installed. In fact, with virtual memory it could be even bigger than that. Assuming two dozen address lines, the maximum number of places is equivalent to millions of decimal places. In fact, it needn’t even be decimal, actual verbal names for the values can be used or even Roman numerals. This ironically means you can use binary if you want, either using “0” and “1” or “F” and “T”.

There are two dozen and two string locations of indeterminate length pointed at by the letters of the alphabet.

Numerical values are in a sense usable to refer to memory locations and positions within strings, but can’t be operated on arithmetically.

It hasn’t escaped my attention that this is inefficient as digits only need four bits to represent them, but that would lose the flexibility I’ve just mentioned. Processing of character data could be faster than on a numerically-based CPU.

So it’s an eight-bit CPU with a logic unit but no arithmetic, with a currently black box unit which can carry out fairly simple operations on character strings. I’m not sure if it’s Turing-complete or not.

nineteenthly, Sep 15 2025

String based https://en.wikipedia.org/wiki/Quipu
[pocmloc, Sep 16 2025]


Please log in.
If you're not logged in, you can see what this page looks like, but you will not be able to add anything.



Annotation:







       Oh, you had me there for a moment - I was thinking of a cup with a string   

       "Hallooo -- is this the Memory Bank? I have a need for some bits & bytes to chew on, pleaze. Send them over on the Bus."
sanman, Sep 16 2025
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle