Computer circuits, assembly lang - from scratch

Click For Summary

Discussion Overview

The discussion revolves around the design and conceptualization of a simple computer from scratch, focusing on fundamental computing principles, including the algorithm for multiplication, assembly language, and the necessary physical components. Participants explore various approaches, materials, and educational resources related to computer architecture and logic design.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses a desire to design a simple computer with a single instruction for multiplying two single-digit numbers and seeks help with assembly language and physical components.
  • Another participant clarifies the distinction between machine language and assembly language, suggesting that writing an assembler could be a fun extension of the project.
  • Some participants propose using both discrete logic and modern Verilog for the design, highlighting the educational value of different approaches.
  • A participant shares their experience building a simple ALU and discusses how machine language naturally arises from the operations supported by the ALU.
  • One participant indicates they are not looking to build an electronic computer but rather one using alternate materials, emphasizing the need for equivalent components regardless of the materials used.
  • Questions are raised about the total number of binary units required for an operable device, with suggestions that this depends on the types of instructions implemented.
  • Another participant lists potential operations for the computer, including logical operations and arithmetic, and discusses the implications for circuit design and gate requirements.
  • There is a discussion about the universality of computing principles, suggesting that computing can be achieved with various materials as long as discrete states can be held and manipulated.

Areas of Agreement / Disagreement

Participants express a variety of views on the design and implementation of the computer, with no consensus on specific methodologies or materials. The discussion remains open-ended, with multiple competing ideas and approaches presented.

Contextual Notes

Participants mention the need for clarity on the types of instructions and operations to be implemented, as well as the implications for circuit complexity and component requirements. There is also uncertainty regarding the use of alternate materials and how they would affect the design.

Who May Find This Useful

This discussion may be of interest to individuals exploring computer architecture, digital design, and alternative computing methods, as well as those looking for educational resources and project ideas in these areas.

DaveC426913
Gold Member
2025 Award
Messages
24,443
Reaction score
8,678
I wish to design (if not actually build) an ultra-simple "computer" from scratch, just for fun and profit. I'm looking at only a fundamental level of computing power, with only one instruction, such as: "Given two single-digit numbers, output the product."

I need three to design 3 things:

1] The algorithm for multiplication - likely in binary.

2] The assembly language that controls how the instructions are executed (store this value here, jump to that storage space, read its value, etc.)

3] The parts themselves: the memory, the input buffer, the output buffer, the logic gate(s).


I'm sure I can figure out 1] myself. (Take digit 1, start at rightmost placeholder, logically AND it with itself, proceed to next placeholder, repeat, decrement loop, etc.)

What I'd like help with is 2] and 3]. More specifically, how can I find or write the assembly language "programming" that will make this happen? And what physical components are required that I've left out? Registers? Cache?
 
Computer science news on Phys.org
Hi Dave,

Sounds like a fun project. I did that project back in Undergrad -- it was a whole quarter-long class lab in an intro to digital design and computer architecture class.

Strictly speaking, in -2- you are referring to machine language, not assembly language. To use assembly language, you would need to write your own assembler to generate the machine code. That would be fun too, so maybe you can grow this project into that after you get the machine language part of it running.

Here is a pretty useful website with lots of info about the different levels of computer design:

http://dept-info.labri.u-bordeaux.fr/~strandh/Teaching/AMP/Common/Strandh-Tutorial/Dir.html

Heck, when I did that lab back in the late '70s, we built the computer out of discrete logic. But now, you could design it in Verilog and implement it on a Xilinx demo board. Doing that would actually teach you even more skills!
 
It'd actually be pretty educational to develop it not only with K-maps and 74' series discrete logic, but also with a modern Verilog flow and a PLA or FPGA. Each approach shows you the same design from an entirely different perspective.

A good undegraduate book on computer architecture and logic design would be indispensable. It's a fairly broad topic, so we couldn't document all the steps you'd need to take here, but we can certainly help you if you get stuck.

- Warren
 
I built a simple ALU in a course i took a while ago. It supported basic operations such as add, subtract, logical AND/OR/NOT, etc on 4 bit numbers. It was a lot of fun. The machine language kind of comes naturally since your ALU must be able to identify which operation you want it to do. So you end up encoding each operation. Say Add is 001. Then to add two numbers you would pass the numbers AAAA and BBBB plus the operation onto the ALU, so 001AAAABBBB would be an instruction.
 
Um. I studied computing and used to compute on punch cards, and I have no idea what you guys are talking about, what with all these acronyms.

Nonetheless, I don't want to mislead you. I'm not looking to build an electronic computer, I'm looking to build one with ... alternate materials.

But regardless of the materials, I'll still need the equivalent of all these components.

"Say Add is 001. Then to add two numbers you would pass the numbers AAAA and BBBB plus the operation onto the ALU, so 001AAAABBBB would be an instruction."

Right. This is what I'm thinkin'. So I need to figure out the nuts and bolts of what it means to have and instruction and the data it opeartes on. Well, that's going to be stored in more memory registers. And something somewhere i.e. the central processor - "reads" that instruction and executes it in yet more memory registers.
 
Last edited:
Here's a question that will "bracket" the scope of the project for me:

All interactions and spaces in a computer are some form of binary unit, either on or off, even the logic gates and processor.

As a ballpark figure, how many on/off units would you say - in total i.e. including storing instructions and processor logic, tables etc. - are we lookin' at to make an operable device?
 
Well, a working 4-bit computer really only needs two 4-bit registers, plus enough memory to store whatever program you wish it to run. A single instruction will minimally be a 4-bit opcode and one 4-bit operand. If you wanted to store a maximum of 10 instructions, you might be able to get away with a total of 88 "flip-flops."

Adding two numbers would involve three total instructions:

MOV R1, 50 ; move the number 50 into register R1
MOV R2, 05 ; move the number 05 into register R2
ADD R1, R2 ; add R1 and R2, leaving the result (55) in R1

You might also be able to get away with not using any registers at all, and only having one type of memory. Your logic gets much more complicated, though, since operands to instructions like ADD then involve indirection.

Have you seen the article about the Altair in the latest Make magazine?

- Warren
 
DaveC426913 said:
Here's a question that will "bracket" the scope of the project for me:

All interactions and spaces in a computer are some form of binary unit, either on or off, even the logic gates and processor.

As a ballpark figure, how many on/off units would you say - in total i.e. including storing instructions and processor logic, tables etc. - are we lookin' at to make an operable device?

I'd say that's completely dependent on how many and what type of instructions you're thinking of implementing. I think the first step is to identify what your operations will be, for example:
Logical AND
Logical OR
Logical NOT
Shift Left
Shift Right
Compare a Number With 0
Compare Two Numbers
Addition
Subtraction
Multiplication
Division

These are the ones i can think of right now. You should also think about the number representation you'll use. For example, are you going to allow for negative numbers, floating point numbers? Floating point is probably a little much, but you can have negative numbers by using a Two's Complement representation.
Once you have settled on these you should go over their respective circuits (i would look up the most efficient algorithms for addition and multiplication, for example). This will give you an idea of how many gates you'll need, the kind of board you'll need, etc.

By the way, have you thought about what clock you're going to use? What do you mean by building a computer with "alternate materials"?
 
-Job- said:
I'd say that's completely dependent on how many and what type of instructions you're thinking of implementing. I think the first step is to identify what your operations will be, for example:
I specified this in my OP: two single digit numbers, multiplied together. That's it. I'll add one more stipulation: non-negative.

-Job- said:
Once you have settled on these you should go over their respective circuits (i would look up the most efficient algorithms for addition and multiplication, for example). This will give you an idea of how many gates you'll need, the kind of board you'll need, etc.

Berkeman's link:
http://dept-info.labri.u-bordeaux.fr/~strandh/Teaching/AMP/Common/Strandh-Tutorial/Dir.html"
covers more of this than I could possibly have hoped to find in one place.

-Job- said:
By the way, have you thought about what clock you're going to use? What do you mean by building a computer with "alternate materials"?

The principles of computing are more universal than electronics. As long as you have ways of holding (storing) two states (i.e. 1 and 0), and a way of changing those states, you can build a device that computes.

You could build it with water from a stream. If you have ways of holding and releasing discrete units, you can make a water-powered computer (albeit it will be very, very slow, and very, very large).

In a SciAm mag years back, they claimed to have unearthed just such a device at an archeological dig. It was, of course, an April Fool's joke, nonetheless, the principle is sound.
 
Last edited by a moderator:

Similar threads

  • · Replies 102 ·
4
Replies
102
Views
3K
Replies
14
Views
4K
Replies
2
Views
8K
Replies
10
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K