FunCPU - 7 bit homebrew CPU dedicated to Functional Programming

2015.10.14. 22:01 Budapesti álmodozó

Fun CPU is a seven bit homebrew processor with unique, unconventional design to natively support functional programming in machine language. FunCPU employs a tagged architecture, but does not have registers, of which contents are exposed to the programmer. Sure, it has some internal registers, but…

Szólj hozzá!

Címkék: functional programming FunCPU Homebrew CPU functional cpu homebuilt cpu

FunCPU - Architecture

2015.10.14. 21:45 Budapesti álmodozó

The picture below depicts the overall architecture of the FunCPU. It employs a 8 bit wide databus and a 9 bit wide address bus. Please recall, that although the databus is 8 bits wide, due to the nature of the tagged architecture only 7 out of 8 bits can be used externally (i.e. by the program), and…

Szólj hozzá!

Címkék: architecture functional programming funCPU functional cpu

FunCPU - Arithmetic Logic Unit

2015.10.11. 08:54 Budapesti álmodozó

The ALU module is very simple and straightforward. It is mounted together with the control board encoding logic on a single board. It performs a simple addition operation on the two operands as described in the following table. The two selector bits define the two input sources. ALU…

Szólj hozzá!

Címkék: alu functional programming Homebrew CPU funCPU functional cpu arithmetic logic unit

FunCPU - Test Module

2015.09.04. 22:24 Budapesti álmodozó

Below a simple tester module is depicted. It is designed to facilitate the testing of other modules.  It has one incoming databus of 16 bit width. Each of the lower eight Leds of the two ten segment Led bars corresponds to one bit in the databus. The upper two Leds of the led display on the left…

Szólj hozzá!

Címkék: functional programming FunCPU module testing

Control Panel

2014.10.08. 21:36 Budapesti álmodozó

Ok, here is a photo of the real control panel. It is a little bit different from the original design. It does not look that  spectacular, but has decent functionality.  The upper section includes 8 LEDs and 8 toggle switches. These are used for data entry as indicated by the label in between.…

Szólj hozzá!

Címkék: functional programming FunCPU functional cpu control panel

Boxing Day...

2014.09.18. 21:48 Budapesti álmodozó

It is high time I had gone to look for a suitable box to be the case of the FunCPU. I have decided on the one below. It is quite ugly and girlish actually, but it was the cheapest option. At least this will be the choice for CPU-case of my first attempt to build the CPU.  I expect to implement…

Szólj hozzá!

Címkék: functional programming FunCPU functional cpu physical implementation

Overcoming Some Limitations

2014.08.19. 21:00 Budapesti álmodozó

The FunCPU (in its current version) supports only numerical computation, more precisely, operations with integers. Functional languages, such as Lisp, Clean, etc. come with a richer set of data types and also have some kind of type construct capability. For example, Lisp as its name suggests mainly…

Szólj hozzá!

Címkék: records lists functional programming FunCPU functional cpu overcoming limitations

Evaluating 1+1

2014.08.16. 22:00 Budapesti álmodozó

It is high time we turned our attention to a complex mathematical problem. Namely, how FunCPU computes:1+1=? Please recall that the definition of "add" is stored at 00 (referenced by 81) is as follows:add(x,y):=   FD 7F 7E FC 81 7E FE 7F FF The following is an extract from the FunCPU…

Szólj hozzá!

Címkék: evaluation functional programming FunCPU functional cpu function evaluation

On (in)Efficiency of FunCPU

2014.08.11. 21:45 Budapesti álmodozó

On Data and Program Representation The computation (expression reduction) process is based on string manipulations (copy, insert, replace, etc.). The input string is scanned symbol by symbol until the string is reduced to an integer. This may happen in some cases, but may not in others. In the…

Szólj hozzá!

Címkék: efficiency functional programming FunCPU reduction process expression evaluation

Some Functions and Predicates

2014.08.07. 21:48 Budapesti álmodozó

Let us have a look at some elementary functions and predicates to have a better look and feel how FunCPU works. The definitions of these objects will be suppmented with their assembly code counterparts written directly in FunCPU machine code. In the subsequent section, the following encoding is…

Szólj hozzá!

Címkék: functions functional programming Turing-complete FunCPU predicates functional cpu

Intefacing with the Functional CPU

2014.07.29. 22:32 Budapesti álmodozó

Now let us take a look at how the functional CPU (FunCPU for short) can be programmed in reality, from the programmer’s point of view.   This will be covered by looking at each gizmo  (i.e. button, switch, LED, etc.) on the front/control panel. On the bottom right side, the purpose of the…

Szólj hozzá!

Címkék: functional programming Homebrew CPU funCPU control board

FunCPU - Passing Arguments

2014.07.23. 20:13 Budapesti álmodozó

It is not trivial how to handle argument passing in the lack of stack, or any dedicated storage for parameters. Consider the following examples: fac (n):= n*fac(n-1) fac(add(2,3))? ack(add(fac(fac(2)+fac(1)),fac(1)),1)? I wanted a simple solution, which still works without posing serious…

Szólj hozzá!

Címkék: functional programming FunCPU Homebrew CPU argument passing

FunCPU - Parenthesis, Precedence

2014.07.22. 17:03 Budapesti álmodozó

When evaluating expressions, the CPU must exactly know how to evaluate an expression, what function/expression parts should be evaluated first, next, and last etc. Therefore the representation of expressions and functions must be unambigous with respect to parenthesis and priorities. In…

Szólj hozzá!

Címkék: functional programming FunCPU Homebrew CPU parenthesis operator precedence

FunCPU - Evaluation Strategy

2014.07.22. 16:52 Budapesti álmodozó

It is not trivial how expressions should be reduced, i.e. evaluated. I have already mentioned that while some strategy could be fruitful in reducing an expression in a given interpretation, others may be not. Let us have a look at the following simple example of evaluation of the factorial function…

Szólj hozzá!

Címkék: functional programming FunCPU evaluation strategy reduction strategy reducing expressions

FunCPU - Memory Models

2014.07.21. 14:05 Budapesti álmodozó

Needless to say that not only initial and final expression, but also temporary expressions should be stored in memory somehow. The way of how expressions are represented has impact on hardware design. During reduction the cycles, expression symbols are being copied one by one. When a function…

Szólj hozzá!

Címkék: functional programming FunCPU homebrew cpu memory model

FunCPU - Function Encoding Schema

2014.07.18. 22:43 Budapesti álmodozó

In the previous post we have seen how 8 bit symbols represent literals, arguments, functions, etc. Similarly, it was vital to have a good and efficient function encoding. Basically in the context of function encoding we need to be able to answer the following question: Where does the function…

Szólj hozzá!

Címkék: functional programming FunCPU Homebrew CPU function encoding

FunCPU - Tagged Architecture

2014.07.16. 22:03 Budapesti álmodozó

In the memory, different type of symbols are stored together. It is essential for the CPU to be able to differentiate among them. Therefore type information is required to be assigned to each unit of information. This piece of information is tagged to each symbol. A lot of effort has been dedicated…

Szólj hozzá!

Címkék: functional programming funcpu tagged architecture homebrew cpu

FunCPU - Computational Model

2014.07.13. 22:40 Budapesti álmodozó

As the computational model will be purely functional without any imperative elements (which could introduce side effects), a simple expression rewriting system will be adequate. User-defined functions will make up a library, which will in turn, also define the rewriting rules. Functions from…

Szólj hozzá!

Címkék: expression evaluation functional programming funcpu rewrtiting computational model

FunCPU - Instruction set

2014.07.10. 21:42 Budapesti álmodozó

FunCPU will operate with 7-bit numerals (to understand why see the next couple of posts) and will directly support the following built-in functions: inc(x) is used for incrementing a value, that is for any x: x+1=inc(x). dec(x) is used for decrementing a value in the similar fashion. if-then-else…

Szólj hozzá!

Címkék: functional programming FunCPU Homebrew CPU built-in functions

FunCPU - Goals

2014.07.09. 14:28 Budapesti álmodozó

It has been a long time since my last CPU project, which focused on a very simple 8 bit CPU. Nothing groundbreaking, just a very simple variation of an accumulator machine.  This time I have set out a different, more ambitious goal. I have wanted to create still something simple, but…

Szólj hozzá!

Címkék: cpu homebrew functional programming unconventional Turing-complete

süti beállítások módosítása