Topview Logo
  • Create viral videos with
    GPT-4o + Ads library
    Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.
    Try it free
    gpt video

    I Designed My Own 16-bit CPU

    blog thumbnail

    I Designed My Own 16-bit CPU

    In a recent video, I created a new programming language. However, I found that it was not challenging enough for me. I wanted to push myself further and create something even better. That's why I decided to design my own 16-bit computer, called the Astro Eight.

    Designing the Computer

    The computer consists of several important components - the CPU, the RAM, and the video circuitry. The RAM is used for storing temporary data, while the video circuitry handles pixel rendering. The CPU handles data processing and executing instructions. It contains registers, counters for tracking instructions, and an arithmetic logic unit.

    To design the computer, I used Logisim, a digital logic simulator and circuit design tool. I mapped out the instruction set of the computer, which consists of 23 different instructions. These instructions allow for tasks such as reading and writing from memory, arithmetic operations, and jumps.

    To execute these instructions, micro instructions are used. These micro instructions are broken down steps that tell the computer what to do. Each instruction corresponds to a binary value, and a lookup table or ROM is used to determine the corresponding micro instructions. The ROM is pre-written with all the combinations of input bits, which then activate the desired micro instructions.

    The computer's memory is divided into different sections, including program memory, character memory, variable memory, and video memory. I created an entire character set for the computer to easily display symbols and letters.

    Emulation and Programming

    To test the different parts of the system, I created programs to debug and improve the computer. I wrote a compiler in C++ for a new compiled language called Armstrong. This language is specific to my computer's processor and includes features such as variables and labels.

    Initially, I ran these programs in Logisim, but I found it to be slow due to the simulation of logic gates. To run the programs at full speed, I built an emulator using C++ and SDL2 for graphics. The emulator accurately processes instructions and provides a much faster runtime.

    Pong Game Example

    As a demonstration of the computer's capabilities, I created a Pong game. The game includes a ball with position and velocity variables, left and right paddles controlled by a keyboard interface, a net in the middle, and a scorekeeping system. The expansion port of the computer is used for the keyboard input. Rectangular collision detection and character sets are utilized to implement the game mechanics.

    The Pong game shows the potential for creating more complex programs with the Astro Eight computer.

    Keywords

    16-bit CPU, computer design, instruction set, micro instructions, Logisim, emulation, programming language, Pong game.

    FAQ

    1. What is the Astro Eight computer? The Astro Eight is a 16-bit computer designed from scratch, including the CPU, RAM, and video circuitry.

    2. What programming language did you use? I created a new compiled language called Armstrong specifically for the Astro Eight computer.

    3. How did you test the computer's functionality? I used Logisim initially for simulation, but later built an emulator in C++ for faster execution of programs.

    4. Can I use the Astro Eight computer for my own projects? Yes, the computer design and compiler are open-source on GitHub, allowing others to use them or contribute to the project.

    5. What other programs can be created using the Astro Eight computer? The Astro Eight computer has the potential to run various programs, from games like Pong to more complex applications with its 16-bit architecture.

    One more thing

    In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

    TopView.ai provides two powerful tools to help you make ads video in one click.

    Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

    Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

    You may also like