44

On the FERIT University, we are using the PicoBlaze CPU to study Computer Architecture. And the same is true for a university in Argentina that the GitHub user agustiza is from. And we ran into a potential problem during COVID: what if physical laboratory exercises are canceled, and students run into technical problems trying to run existing assemblers and emulators for PicoBlaze on their computers? That's why my Computer Architecture professor asked me to create my PicoBlaze assembler and emulator runnable in a browser. Had we used x86 or ARM instead of PicoBlaze, such a problem would be impossible.

On the Faculty of Electrical Engineering and Computing (Fakultet elektrotehnike i računarstva; FER), University of Zagreb, they are using a CPU called FRISC, which was designed at FER and is even less widely used than PicoBlaze.

Why are universities doing that? Wouldn't that time be better spent teaching the basics of x86 assembly or ARM assembly? Aren't future programmers way more likely to need x86 assembly or ARM assembly than PicoBlaze assembly or FRISC assembly?

2
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Academia Meta, or in Academia Chat. Comments continuing discussion may be removed.
    – Bryan Krause
    Commented Apr 11 at 15:00
  • @AzorAhai-him- Please, take it to Meta if you want to continue. I have very much not made any claim that I think this question should be on topic so please don't suggest that I have and expect me to argue a position I don't have.
    – Bryan Krause
    Commented Apr 18 at 13:55

18 Answers 18

125

Computer architectures fall into a number of different categories, but within these categories, the conceptual differences are not huge. The primary purpose in teaching about architectures is to convey the ideas, not the details of an architecture, and so it is not unreasonable to pick one that is "prototypical" for a category. Other disciplines do the same: You're not learning English as a Foreign Language reading Shakespeare or Joyce, but simpler texts. You're not learning calculus starting with partial differential equations. You're not learning mechanics using nonlinear elastoplasticity but point masses in a potential field.

To the specific point of x86: This is not a great architecture to learn from. This is principally related to the fact that it is 50 years old and is carrying around a lot of baggage for backward compatibility. For example, not all registers can be used in all instructions, it still has the weird FP stack, the FP stack registers are overlaid with the MMX registers, there are several sets of floating point instructions, etc. If you're new to processor architectures, this is really not the best one to start with. But if you've understood how CISC architectures work in general, then it will not be very difficult to figure out the differences in assembler syntax, etc. So I think it is entirely reasonable to start learning with simpler architectures first -- perhaps with ones that are simple because they are academic and do not need to address the real world constraints actual processors such as x86 or ARM ones have to satisfy.

3
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Academia Meta, or in Academia Chat. Comments continuing discussion may be removed.
    – Bryan Krause
    Commented Apr 11 at 15:00
  • Do you mean "MMX" when you said "FP stack registers are overlaid with the XMM registers?
    – DannyNiu
    Commented Apr 12 at 3:50
  • @DannyNiu Yes, this had already been pointed out in one of the comments that were moved to the chat. Commented Apr 12 at 16:02
44

I did my undergrad and masters at FER (Faculty of Electrotechnics and Computing, University of Zagreb, Croatia), and went through my computer architecture course using FRICS. And I have to say, I loved it.

The reason we were officially given (which is similar in sentiment to the speculations in several answers), is that they are teaching us the basics of RISC processors, rather than any one specific instruction set. This manifested as a number of practical advantages:

  • The whole FRISC reference manual was 4 pages long. The print version of Wikibooks x86 Assembly has 90 pages. Intel 80286 (processor picked at random) reference manual has 513 pages. We were allowed to have a copy of the manual in the exams, and I had a much easier time searching through a paper copy of 4 pages than 513 (and it was also much lighter to carry around).
  • The textbook based on FRISC came out in 2002, and a second edition in 2004. The instruction set never changed. x86 was developed based on the Intel 8086 microprocessor, in 1978, and the instruction set underwent constant changes and additions
  • FRISC will never be out of date -- it will always be a perfectly valid, functional, microprocessor designed primarily for simplicity and teaching purposes. Neither x86 nor ARM assembly have been designed with simplicity in mind; and which ever instruction set you select, there is a good chance you'll be hopelessly out of date in a few years.

While I eventually went a different direction, computer architectures was one of my favourite subjects during my studies. I'm sure that in good part, that is down to how it was implemented. Specifically, after working through a number of problems and examples in FRISC, I felt ready to tackle any assembly, regardless of the length of the manual or size of the instruction set, because I understood the governing concepts well.

We applied the same principle in other courses as well. For example, we also worked with our bespoke version of an embedded OS (as part of the "Embedded Operating Systems" course), which we built from the ground up, rather than studying something off the shelf such as Android. This allowed us to study the core concepts, rather than focusing on specific implementation flavours.

2
  • 9
    Last time I looked, the Intel x86-64 architecture reference was ten volumes.
    – Mark
    Commented Apr 10 at 22:13
  • 3
    @Mark That sounded so incredible that I went googling: intel.com/content/www/us/en/developer/articles/technical/… It is indeed ten volumes and the Instruction Set Reference takes up four of them, with page counts of: 735, 744, 725, and 326 pages for a total of 2530. That is mind-boggling.
    – Frodyne
    Commented Apr 11 at 14:32
27

The question is similar to "when you learn English, why do you read obscure or even made-up texts instead of real-world texts like Shakespeare or James Joyce?", or "when we learn Newtonian mechanics, why do we perform carefully controlled experiments instead of looking at real-world events?"

And the answer is the same: Real-world texts/CPUs/events are complex, hybrid beasts which defy simple categorization. A professor of mine got almost angry at me when I asked him "and how does the Pentium (yes, it was back then) fit in the CISC/RISC scheme?" because it incorporates elements of both (pipelining, prefetch and a complex instruction set): "It is a hybrid mess and we can learn nothing from it."

You learn concepts first, and then you apply them to the mess you find outside the lab.

5
  • 2
    Except as correctly pointed out in other comments when learning (foreign) languages you do start with English (a comparatively complex language) straight away rather than a simplistic language just to teach the concepts. Not saying that hiding complexity isn't good (just like when you teach English you will still start with teaching patterns, even if those patterns barely hold in the long term), but there are many ways to hide complexity beyond implementing your only idealistic alternative~ Commented Apr 10 at 20:40
  • @DavidMulder When learning English, you start with English. When learning x86 assembly, you start with x86 assembly. But OP wasn't asking about an x86 assembly course, but a course called "Computer Architecture".
    – Sören
    Commented Apr 11 at 13:48
  • 1
    @Sören Learning any language usually starts with "say Maa-maaa!" ;-). Commented Apr 11 at 14:00
  • My daughter was raised in a "two language" family. I feel a warm flush come over me when I recall her rare-but-occasional "blending" of words or phrases from both languages. :-) Can't imagine a compiler or assembler willing to concede the existence of an equally valid alternative syntax.
    – Fe2O3
    Commented Apr 17 at 0:22
  • 1
    @Fe2O3 Interesting, same here! We each spoke to our son in our respective mother tongue, and that worked really well. And I once had a "semi-bilingual" French-German girlfriend whose German transitioned over the course of a few ears from "incomplete and improvising" to "colorful and creative" ... natural language is fascinating. Sometimes you have a bit similar hybrid languages: Functional Linq being added to imperative C#, or inline operator calls vs. functional notation. Commented Apr 17 at 6:26
18

Because real life CPUs tend to be overly complicated due to features market is paying for, so it is much easier to learn from a made up architecture to get the principles, then you try to sort out the bane of real life architectures.

2
  • 5
    Not just deliberate "features", but also weird quirks like x86 memory segmentation or MIPS visible branch delay slots, which get in the programmer's way but have to be kept around because of backwards compatibility.
    – dan04
    Commented Apr 10 at 16:01
  • 1
    @dan04 That is what I meant by 'features market is paying for'. Obviously that from a computer architecture perspective retro compatibility always gets in the way of performance and programability, but market pays the developers' salaries, not the other way around. Commented May 22 at 2:28
18

Perhaps... (here comes anecdotal "evidence")

When personal organizers appeared, a large institution provided "Palm Pilots" to one half of the staff, giving the other 50% "Apple Newtons". Half way through the trial period, all staff were made to swap and use the other device.

Results: More than 75% of the staff reported "the second device was more difficult to understand and to use than the first."

Look up "Familiarity Bias" and consider its relevance to implementing your "better idea."

EDIT:
Responding to some comments below, here is a delicious 3 minute portrayal of "Familiarity Bias". Enjoy.

Religion is not innate; it is acquired.
Nondenominational tutorage should be considered a virtue.

EDIT #2:
Making it plain:

Familiarity bias can lead to biased decision-making, missed opportunities, and limited diversity of thought or experience. It is important to be aware of this bias and to try to base decisions on objective criteria, rather than simply relying on familiarity or comfort.

By using an artificial teaching tool, perceptive students will be constantly reminded that the primary purpose of the tool is to give substance to the abstract concepts they are meant to understand. Being aware that the tool is artificial, perceptive students will (it is hoped) avoid investing themselves in memorising its particulars and peculiarities, focussing their attention on the abstract concepts they are to master. Mastery of those concepts can, later, be applied to whatever implementation they encounter in their career.

In the anecdote above, the "guinea pig" staff invested themselves in mastering the first device in their hands. Although both devices fulfilled the requirements of their purpose, upon finding "the other" device required both "unlearning" and "learning", many were more comfortable with and expressed a preference for whichever was their first experience of a PDA.

Our minds want us to stay in the comfort zone and hates a change in scenario.

Consider: "I find that music genre is not to my taste (although millions of others find that genre appealing.)"

Or: Schools usually teach only one of several algorithms to compute the product of two integers. Few individuals, upon discovering that there are alternative algorithms, bother to consider them and "stick with what they know." (This is my opinion, only; not founded on any research.)

Quotes borrowed from "thebehavioralscientist.com" and "enrichwise.com"

1
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Academia Meta, or in Academia Chat. Comments continuing discussion may be removed.
    – Bryan Krause
    Commented Apr 11 at 15:01
15

The use of made up/simple CPU's has a long history.

https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming was originally written in MIX https://en.wikipedia.org/wiki/MIX_(abstract_machine) a made up 6 bit assembly language.

This has now been replaced by MMIX a made up 64 bit RISC architecture https://en.wikipedia.org/wiki/MMIX, as Knuth said.

"MMIX is a computer intended to illustrate machine-level aspects of programming. In my books The Art of Computer Programming, it replaces MIX, the 1960s-style machine that formerly played such a role… I strove to design MMIX so that its machine language would be simple, elegant, and easy to learn. At the same time I was careful to include all of the complexities needed to achieve high performance in practice, so that MMIX could in principle be built and even perhaps be competitive with some of the fastest general-purpose computers in the marketplace."

So the use of made up/simple CPU's has a long history.

The rationale of creating an easy to use machine language that illustrates the principles is still there. I think I remember there being a discussion about MMIX or ARM for the replacement of MIX, but it was a while ago, and did not really concern me.

A lot of Computer Architecture courses use/used MIPS since it was both real world and one of the original RISC implementations. Stanford MIPS vs Berkley RISC. MIPS became a CPU and RISC ended up the name for the family of CPU's.

RISC has less to learn and thus is easier to teach.

11

Kinda surprised how you got so far, but - especially in theoretical subjects like CS - the concrete content of a lecture is often just an example for the more abstract concept(s) that are actually being taught.

As an analogy: You're not supposed to remember the solution to specific integrals in calculus. You're supposed to realize how integrals work in general and how they can be used. [Then you MAY take deep dives in specialty classes about it]

So of course your prof talks about a massively simplified CPU instead of the known-bloated, absurdly complex (and also potentially outdated) x86. Because close to zero programmers will ever need concrete knowledge of x86 commands. What they need is a rough idea of how assembly works and what it is.

Because what use are the intricacies of x86 (probably only present due to legacy reasons) when the current trend is ARM anyway? And what use would be going hard in (for all students) on ARM if that turns out to not be the future?

Instead, you present a model architecture in which you can clearly and easily demonstrate the abstract ideas that CS students need as a baseline.

1
  • 1
    ne nice thing about using a soft core like a picoblaze for this is that students can easily go on to add the features of a modern processor, caches, branch predictors, deeper pipelines, and then study the tradeoffs by actually running the resulting bitstream on a suitable FPGA. You can tweak the processor to your hearts content and see how the changes impact execution of a test program. One cannot do that with hard IP.
    – Dan Mills
    Commented Apr 10 at 17:17
7

These aren't all fake, frequently a CPU is just no-longer in common use or used in unusual applications.

Micro and Pico Blaze CPUs are a real thing. They're a design used often to add a CPU core to an FPGA project. Similarly MIPS R4000 CPUs were real so all the computer architecture books that use them are based on a real CPU even if classes do everything in SPIM and MARS now.

Both of these have significant commonality with modern RISC-V CPUs.

7

Many years ago as a student, in addition to the reasons give in other answers, I was told one of the reasons the class was taught using MIPS instead of x86 was to discourage a specific form of cheating. With x86 it would have been relatively simple to write the assignment in C/C++, run a disassembler on the output and then turn that in as your work.

With virtualization and cross platform compilers much more widely available today, I suspect the deterrence value is less than it was. OTOH C and C++ are no longer widely used first languages making the other half of the potential cheat harder.

3
  • 2
    Amusingly, I teach the C++ sequence which leads into our school's architecture & assembly course (in MIPS). On the very last day I recommend and show to students that they can write future assignments in C++, compile, and check disassembly for clues on their later assembly work. But I highly doubt anyone's ever followed through with that. Commented Apr 9 at 23:27
  • 1
    @DanielR.Collins I assume the biggest gotcha would be not getting compiler settings right. Any debug support or optimization would complicate things well beyond the naive easy to understand assembly the students would want. Commented Apr 9 at 23:40
  • 1
    I'll say that for the guts of a few simple functions I've tested it on (with GCC), that hasn't struck me as a problem. Probably identifying what parts of the function boilerplate/setup/return can be elided/ignored strike me as a bigger issue. Commented Apr 9 at 23:54
7

Architecture is not the same as assembly language programming.

When I used to teach programming at the University of Hertfordshire, UK, the computer architecture course involved the students building a CPU from the ground up (using logic gates, but done in a circuit simulator). It was only possible because it was a 4 bit CPU with just 16 memory locations (of 4 bits) and at most 16 instructions. You couldn't do much with such a machine, but I think they learnt a lot in the process.

One of the little programming exercises I gave them was to write a software simulation of the instruction set, but even back then (in 1990), most programmers would never actually write any code in assembly language.

2
  • 2
    Same here, but to add insult to injury the simulator was built inside FORTRAN V (yes, that's not a typo, Fortran 5), which we all had to learn to do the lab exercises. And most of my classmates had never used any version of FORTRAN before...
    – arp
    Commented Apr 10 at 3:27
  • 3
    You had FORTAN-V? We had to do it in FORTRAN-IV. Wasn't a problem for the PDP11 instructions, but Data Structures (linked lists, for example) and Compiler Construction were somewhat complicated without pointers or recursion support. Commented Apr 10 at 11:44
6

To share a slightly different perspective: I used to teach assembly language in x86, using Kip Irvine's Assembly Language for Intel-Based Computers. This was about 20 years ago; a few things had become awkward at the time, and they'd be moreso now.

One is getting access to tools. There was a time when Microsoft Macro Assembler (MASM) was a standalone product; this book (4E) came with a CD with a version for students. Nowadays this isn't an available standalone product, and it would be a lot harder to procure and run tools like that.

Two is that there's a lot of overhead and increasing security barriers to make actual native (say) Windows executable programs. Traditionally we'd ramp-up students by having them make simple Windows .COM files, but that option is no longer available. (So: steeper onramp.)

Three is that the ability to run native code is more and more buried under countless layers of system architecture, virtualization, and so forth. One of my favorite things as a student, and I'd still do it with my students, was to take control, read and write to a floppy disk from assembly. Even at the time I was teaching, it was getting hard to dig up old floppy disks that we could use for this exercise. There was an instruction (INT 21h, Function 7305h; see Irvine Ch. 14) that would let you read and write disk sectors directly; this worked on the Windows 95 line, but was defunct in the Windows NT line with its tighter security system.

That said, I'm not entirely sold on abandoning use of the widely-used x86 architecture -- just like I think using a widely-used real-world workplace programming language is of benefit, while some others differ. When we were discussing who would take over my current school's architecture course about 6 years ago, my instinct was still to use the Irvine text for x86. Another instructor took it using MIPS instead (Patterson text).

2
  • [Microsoft] Windows .COM files, oRLY? Will NTVDM load the WoW layer when tasked with running a COM binary? Commented Apr 11 at 12:00
  • 2
    @IncnisMrsi: NTVDM doesn't exist in Windows 11 or any other in 64-bit variant. Commented Apr 11 at 12:32
6

In defense of the instructors, such as tenured/tenure-track professors and visiting/adjunct professors, and teaching assistants (T.A.s), it takes a lot of work to create/update a set of presentation slides, lecture notes, laboratory/lab assignments, and course projects for courses on computer architecture, or even their requisite course on computer systems.

This has to be done in addition to preparing for the lessons that they teach (or lectures, if you like), lab sessions that they manage, and recitation/tutorial sessions that they lead/teach. Also, they have to create/update and grade assignments, course projects, and examinations.

There is a need to find a working toolchain for the chosen instruction set architecture (I.S.A.) for the computer architecture course. Commercial/Proprietary toolchains, such as those commercial electronic design automation (EDA) software, require technical support by the teaching assistants/T.A.s. Open-source EDA software can alleviate the problem, but still need more industry buy-in. If a lot of hiring managers create job descriptions that include open-source EDA tools and recently created hardware description/construction languages (HDLs/HCLs), such as Chisel HDL, PyMTL, and PyRTL, a lot of T.A.s would support the use of such open-source EDA tools, HDLs, and HCLs.

Using the x86-64, including Intel 64 (Intel's version of x86-64), as the I.S.A. to teach computer architecture is a nightmare. I.S.A.s based on Complex Instruction Set Computers (CISC) are much harder to teach than I.S.A.s based on Reduced Instruction Set Computers (RISC). Hence, using x86 I.S.A. to teach 32-bit processor architectures is no better.

ARM I.S.A. is a RISC I.S.A., but still contains enough complex/complicated instructions that make teaching annoying.

This leads many professors to choose between ARM I.S.A., which has increasingly been used in embedded systems, and MIPS I.S.A., which is not adopted in new products for embedded systems and other computer systems.

The PicoBlaze I.S.A. is from Xilinx, Inc., and comes with a supported toolchain to help people learn to use it in designing processors on its FPGA boards, and develop software in assembly language and compilers.

This leaves RISC-V I.S.A. as a good option that allows students to share their projects online, which helps reflect the quality of their skill set while working on such projects. RISC-V International (previously RISC-V Foundation) had a Web page that shared university teaching resources for RISC-V and associated toolchains for simulating/emulating RISC-V processors, and assembling/compiling computer programs in assembly languages. It also contains benchmark programs for validating implementations of RISC-V processors in Register-Transfer Level (RTL).

But, it still takes work for instructors and T.A.s to familiarize themselves with a new I.S.A., toolchain or EDA tools, and update course materials for the new I.S.A.. This can be resolved if they are rewarded with grants by their academic departments to do so. If you want to speed up the process, you, some rich people who you are connected to, or crowdfunded sources can donate money to your academic department to speed up the process.

3

My opinion is that it is better to teach computer organization with an architecture that is fully defined and without unanticipated/unknown side effects. It reduces the complexity of grading assignments. It also doesn't bias the students towards any particular architecture they will encounter in the wild.

When the instruction set is easy to decode it is easier to write assemblers and disassemblers, which are both common assignments.

One last thing is that you don't have to deal with copyrights on existing instruction set architectures.

I first learned pdp11 assembly in 1978, then 6502, 8080, pdp8 and TMS1909. Never had a problem picking up any other to this day.

1
  • 1
    Proofs that “architectures”, commonly used in teaching, are fully defined? Note that answers on StackExchange are not about opinions. Commented Apr 11 at 12:12
2

As an addition to the answer provided by Wolfgang, by using more esoteric architectures, you begin to think critically by figuring out what in a computer architecture works and what doesn't by giving a comparative analysis to a student of the subject whom might otherwise bring in pre-conceived notions about what is good/bad about an architecture. By studying something they are almost certainly unfamiliar with, they can make their own educated decisions about the study.

1

Often times such tools are developed mostly with one goal in mind, namely to teach you concepts.

You can look at it from a different angle. What if indeed you go along with a popular architecture? You might get so accustomed to it, that you will fail to grasp key concepts just because what you have picked has them in a specific way or maybe hides something for the sake of convenience.

You can observe this with many self-taught software developers - they go for language X, get familiar with what it offers but once they have to switch to something very different, their stellar programming skills get demolished. Try switching between C, Haskell, VHDL and Java and see what happens. This is because they know the syntax, they also know many of the functionalities the language offers but they don't really know what exactly happens underneath. Perfect example for this is web development in general. While creating a simple button with React or whatever and showing on the screen does give you instant results, many forget that this button is running inside a web browser on an operating system. Alone the web browser is a very complex piece of software not to mention everything around it. And the button itself follows a specific set of design decisions made by the people behind the library you are using. If you don't have UI and UX expertise, yes, you will be able to create something by stitching things together but you will probably never be able to come up with something very unique.

1

As an example, for a bit of light reading check this paper

https://eprint.iacr.org/2024/002.pdf

which discusses the matrix multiplication instructions in your iPhone and how to use them for post-quantum encryption. That's not something that you can throw at the average student.

Start with something simple that students can actually understand and learn, and then use that as a starting point.

And complex instructions are not the problem; the problem comes when you look at the actual implementation. Any question that a student could think of, the correct answer is "it's complicated".

1

When I took a Digital Logic course for fun at Carnegie Mellon, we used a toy CPU that was designed for the course. The advantage was that it was designed with a dozen or two instructions with a full System Verilog FPGA implementation to modify and brief 10-page manual (in big font). A real-world processor necessarily has to be performance-focused and cannot be modified easily from semester to semester. The didactic CPU gets the very basics across so that later courses can focus on more complex optimizations and design quirks.

1

There are already multiple great answers here. I just want to add an anecdote that is just a little long for a comment and in some way also practically answers the question so I thought an answer is a better fit:

When I was an undergraduate student (Computer Engineering), we had two Computer Architecture/Organization courses that used MIPS and were taught using the Patterson and Hennessy textbook that also used MIPS. The next year we had an Embedded Systems course that used an ARM microcontroller and we spent a lot of time on its assembly in the course (in addition to C). For the students that mastered the material on MIPS assembly in the previous courses, the transition was very smooth. I highly doubt we could have learned the concepts as easily had we started with the ARM microcontroller assembly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .