How Do I make my own CPU from scratch?(Explained)

Do you want to build your CPU? It’s fun, but you don’t think it’s as tricky.

I have done many CPUs over the years, and there is no shortage of other custom CPUs, ranging from earnest endeavors to computers made from single chips to computers built with relays.

Not to minimize the effort, but the real problem is not the CPU, the real questions here are as follows; 

1. What kind of infrastructure?

I think Holly Grill needs to bootstrap your custom CPU into a fully-fledged Linux system. That’s the proper thing to do, and it should end there.

Although you may be more productive than I am, you probably need a certain amount of sleep, so you may want to consider whether you can do it all at the right time.

Many custom CPUs, for example, do not run interactive operating systems (or any operating system for that matter).

In extreme cases, custom CPUs have no infrastructure, and you program them directly into machine code.

The machine code is error-prone, so you need an assembler. You will also need a linker if you are working on a large machine.

Assembly language coding becomes cumbersome, so you may need a C-compiler (or another language). A debugger? What about the operating system?

Each of these things is a severe project (at the top of the plan to build a reasonably capable CPU). If you have lots of free time or a big team, you must think about how to hew some shortcuts.

2. Getting Infrastructure?

The simplest way to get infrastructure is to steal it. But does this mean that your CPU is compatible with any other available CPU (such as OpenSparc or OpenRisc) and what fun is it? Still, the Internet is full of clone CPUs that work this way.

Check this Out Related here ====== >>>  AMD Or Intel Which Processors Brand is Better For Your Devices (Explained)

What makes a clone CPU suitable? Presumably, the designer wants to use this particular processor but intends to integrate it with other devices to build the system on the chip.

Of course, sometimes people want to mimic an old machine, which can be fun.

The appeal of developing your CPU is that you make it your own. You may want to experiment with weird instruction set architectures.

You probably know how to minimize processor stalls. Or you could be just like me and want a computer that suits you better than any commercial alternative.

If so, what do you do? You can try to port the infrastructure. It’s in the middle of stealing and building from scratch.

How Do I make my own CPU from scratch?(Explained)

3. Portable options

There are plenty of options for portable assemblers. Assuming your processor doesn’t look too weird, and you don’t mind traditional assembler conventions about labels and symbols, you might consider TDASM or TASM. It is my change, AXASM, and I will discuss this shortly.

Assembly language is acceptable, but you want a high language level. Of course, your first thought would be on Port GCC, an excellent C and C ++ compiler (among other things).

There is good news, bad news, and bad news. The good news is that GCC is made portable if your architecture fits some default concepts (for example, at least 32-bit integers and flat address space). ).

The bad news is that seaports are challenging to navigate. The worst information is that there is a limited amount of documentation and much of it is outdated.

Still, it’s possible. There are three things you need to do to make a cross compiler.

  • Machine description
  • A machine header
  • Some machine-specific functions
Check this Out Related here ====== >>>  How Do you apply thermal paste to a CPU?(Explained)

However, their construction is quite complex and uses lisp-like indicators that are not always intuitive.

If you want to deal with it, several documents are of interest. A review of a fantastic slideshow, ancient official papers, and some boy’s master’s thesis.

However, be prepared to read too much source code and experience. Then you might also want to port GDP, which is unusual.

Others are C compilers. llvm is ringing in the project, which you may find a little easier to port, though it is still not what I consider trivial.

The LCC compiler began in 1995 as a book. It uses iburg to generate code, and this tool may be helpful for some other targeting projects.

Although the vbcc compiler is not often updated, its backend documentation looks tremendous and seems one of the easiest compilers to port.

There is a portable C compiler, PCC, which is quite respectable. I’ve noticed that people port some “small” variations to a different CPU, even though they’re not standard C, so it’s only for limited use.

4. Management of memory

Remember that there is much more to porting GCC than just the C compiler.

You will need to specify your ABI (application binary interface; basically, how memory is managed and arguments are passed).

You’ll also need to provide at least some Bootstrap C libraries, although you may be able to reuse a lot of standard libraries after the compiler works.

So maybe the C compiler is a little bit. There are other ways to get high-quality language.

Developing a viable JVM (or another virtual machine) allows you to compile Java and perhaps less work overall.

Check this Out Related here ====== >>>  What Matters Most for PC Gaming: GPU or CPU?(Explained)

Still, it’s not easy, and your JVM performance may not be close to what you set up. I find it easier to get to the fourth version. Jones on Forth is an excellent place to start if you get a backup copy of it.

If you cut the bullet and build the C compiler, the operating system is the next hurdle. Most Linux builds have advanced features like memory management.

There is a version, uClinux, which can be a little easier to port. You might be superior off looking at something like Contiki or FreeRTOS.

Final Thought

Creating a new CPU is not for the faint of heart and is probably not your best bet for the first FPGA project.

Sometimes, getting a decent front panel can be a challenge, regardless of the compilers and operating system.

Bootstrapping a new system on a complete Linux running monster would be a massive task for a hacker. It could be more suitable for a team of hackers. 

However, just because you can’t build the next 128-bit superscale CPU over the weekend doesn’t mean you shouldn’t try to make a CPU. You will find out a lot, and who knows if you can invent something new?.

Related Article:

How Much Would It Take To Build My Own GPU and CPU?(Explained)

Leave a Comment

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners. View more
Cookies settings
Accept
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active
  Our website address is: https://discovercpu.com.

Comments

When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

 If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed. If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

 Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website. These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

 If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

 If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue. For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where your data is sent

 Visitor comments may be checked through an automated spam detection service.
Save settings
Cookies settings