[CS61C FA20] Lecture 07.1 - RISC-V Intro: RISC-V Assembly Language — Transcript
Full transcript
- 0:00[Music]
- 0:02[Applause]
- 0:03[Music]
- 0:09welcome to the next module in 61c we are
- 0:12going to
- 0:13dive down to the next level of
- 0:15abstraction
- 0:16and cover the risk 5 instruction set
- 0:18architecture and the risk 5 assembly
- 0:20language
- 0:23remember early in the class we talked
- 0:25about the
- 0:26the ideas of layering different layers
- 0:29of abstraction
- 0:30to represent complex compute systems on
- 0:33the top
- 0:34there is a high level language and
- 0:36hopefully people have mastered c
- 0:37by now below that is the assembly
- 0:40language below that is the
- 0:42machine readable version of the assembly
- 0:44language
- 0:45which is the machine code and below that
- 0:48are different implementations of the
- 0:51architecture
- 0:52implemented perhaps as block diagrams
- 0:56that can execute that code below that
- 0:59level of abstraction there are logic
- 1:01gates that actually
- 1:03replace things that are inside these
- 1:05boxes in the block diagram
- 1:08logic gates are not the very bottom of
- 1:10the of the
- 1:12compute stack they're also an
- 1:14abstraction
- 1:15uh they're built out of transistors
- 1:16transistors are also an abstraction
- 1:19um transistors consist of different
- 1:22kinds of materials
- 1:23they're also wires and all of them
- 1:26are there to carry electrons in holes
- 1:29and we can talk about deeper than the
- 1:31deeper layers of abstraction than that
- 1:34c is not the highest level language as
- 1:36we already know
- 1:38there are more complex things that are
- 1:39built on top of it their operating
- 1:41systems
- 1:42their productivity languages their
- 1:44software frameworks
- 1:45and this entire world is built or at
- 1:48least the software view of the world
- 1:49is built on top of that
- 1:53it is important to point out that there
- 1:55are always well defined in
- 1:57interfaces between these layers of
- 1:59abstraction
- 2:00typically we don't write assembly
- 2:03language code
- 2:05we can but most commonly it is being
- 2:08produced by a compiler
- 2:11assembler produces a machine readable
- 2:14code
- 2:15instruction set architecture is what
- 2:17defines
- 2:18what will be executed by the hardware
- 2:21and
- 2:22then there are different layers
- 2:23different ways of implementing things
- 2:25below that
- 2:30when we are thinking about the assembly
- 2:32language we think
- 2:33about the instructions executed by the
- 2:35processor
- 2:36the basic job of a cpu is to execute
- 2:39lots of instructions when i say
- 2:41lots i mean lots when we speak about the
- 2:44processor
- 2:47that is running at among the speed
- 2:49nowadays of one gigahertz
- 2:51that means that one cycle in a processor
- 2:54lasts for one
- 2:55nanosecond and that's approximately a
- 2:57time that it takes to execute one
- 2:58instruction sometimes more sometimes
- 3:00less but let's say
- 3:01of the order so each
- 3:05processor will execute 1 billion
- 3:07instructions per second
- 3:09and that's a lot these instructions
- 3:13are primitive operations that cpu
- 3:16executes
- 3:17they essentially
- 3:20constitute of some kind of an action
- 3:23like a sentence
- 3:24where the operations are like verbs
- 3:27applied to operands which are objects
- 3:29that are processed in sequence
- 3:33now there are many different processor
- 3:36architectures out there and different
- 3:38sets of instructions
- 3:40different cpus implement different sets
- 3:42of
- 3:43instructions
- 3:46a particular set of instructions that
- 3:48applies
- 3:49to a processor or class of processors is
- 3:52called the instruction set architecture
- 3:54so when we you know there are many known
- 3:57instruction set architectures out there
- 4:00the most common that you'll encounter
- 4:01nowadays is the arm
- 4:04instruction set architecture and it is
- 4:07deployed in
- 4:08pretty much all of the cell phones that
- 4:09are out there in the world and many many
- 4:11other things
- 4:13very popular is intel x86 that is
- 4:16implemented in
- 4:18laptops desktops and many of the of the
- 4:21servers and cloud processors there is
- 4:24ibm power
- 4:25implemented in servers as well there
- 4:27used to be very popular ibm motorola
- 4:29power pc that was used in all their
- 4:33macs there is mips
- 4:36and there is risk five we're going to be
- 4:38talking about risk five
- 4:40and this module and beyond
- 4:44there is a book that
- 4:48actually was pointed to me by dan um
- 4:51programming from the ground up and i'm
- 4:52just gonna read a little bit from its uh
- 4:56excerpt from its review the reviewer
- 4:58says here
- 4:59i found that the key difference between
- 5:02mediocre and excellent programmers
- 5:04is whether or not they know assembly
- 5:07language
- 5:08those that do tend to understand
- 5:11computers themselves
- 5:12at a much deeper level and this really
- 5:14strikes deep
- 5:16uh with me that's why we are trying to
- 5:19cover
- 5:20assembly language such that people
- 5:22really understand
- 5:24how is that software being executed also
- 5:27many of the
- 5:28um i had quite a bit of experience
- 5:30within with the
- 5:31assembly language of a particular
- 5:33architecture of olden times
- 5:35um it was old computers like an apple
- 5:38computer just came with a basic
- 5:40interpreter
- 5:41didn't have really an operating system
- 5:43um and if you wanted to do something
- 5:45other than write code in basic that was
- 5:48a
- 5:49language of that time um you had to
- 5:51write assembly language for example i
- 5:53had to write a lot you know this was my
- 5:55first computer
- 5:56i still have it not quite sure if it
- 5:58works it's a simpler zx spectrum
- 6:00that was a british type of machine it
- 6:03was very inexpensive you could plug it
- 6:04into a tv
- 6:06and just keep coding
- 6:10it also had a basic but i really wanted
- 6:13performance out of it so i had to write
- 6:15a lot of assembly code
- 6:20back to instruction set architectures
- 6:24as the computers were developing
- 6:26somewhere in the 70s and the 80s there
- 6:28was a trend
- 6:29to try to build more and more complex
- 6:31instructions
- 6:33that led something you know to
- 6:37a division or to a trend of building
- 6:39something that is called complete
- 6:41instruction set architect
- 6:43computers um or what's then what
- 6:46you know as a as an acronym uh known as
- 6:49sisk
- 6:54there was in the early 80s
- 6:57emerged uh or a little bit earlier than
- 7:00that by john in ibm
- 7:02to try to build very simple instruction
- 7:05sets
- 7:05very basic instruction sets that was
- 7:08picked up and
- 7:09really taken to the full extent by dave
- 7:11patterson
- 7:12berkeley and john hennessy at stanford
- 7:16the idea there was to keep instructions
- 7:18that's small and simple
- 7:19and make it easier to build fast
- 7:23hardware
- 7:24so each instruction per cycle would do
- 7:27less but you would have fast hard
- 7:29hardware and will be able to
- 7:31execute more instructions in a given
- 7:34time
- 7:35and then we'll use software to build
- 7:38complicated operations by composing
- 7:40simpler ones
- 7:42um
- 7:44person hennessy one um there was a
- 7:47long debate but they eventually won and
- 7:50even though there are cisc
- 7:52instruction sets out there like x86 if
- 7:54you look at the way
- 7:56how the the processor is built
- 7:59that is really in the essence of it is
- 8:03a risk engine and these complex
- 8:05instructions are added by
- 8:07you know concatenating simpler ones
- 8:10inside
- 8:11that machine one would say
- 8:15he who loves last laughs best person
- 8:18hennessey
- 8:19as we know won the touring award two
- 8:22years ago
- 8:24when teaching computer architecture
- 8:28people you know both instructors and the
- 8:31students have a tough choice
- 8:32instructions
- 8:32in particular need to choose an
- 8:34instruction set architecture
- 8:36to teach the architecture in an
- 8:38architecture class
- 8:42so the choice there is to try to teach
- 8:45x86 but that's
- 8:46very complex and there is often quite a
- 8:49bit of a pushback by students in trying
- 8:51to teach
- 8:52us some subset of x86
- 8:56alternatives to that are
- 9:00to try to use some older instruction set
- 9:02like maps
- 9:03or an old risk or to come up with a made
- 9:06up instruction set
- 9:09the advantage of teaching x86 you know
- 9:11whoever survives the class is that
- 9:13then they can run any software on that
- 9:15architecture that they will understand
- 9:17because there is a rich x86
- 9:19you know system built out there but
- 9:24then it's easier to understand older
- 9:26instruction sets or
- 9:27made up instruction sets but the problem
- 9:30there is
- 9:31there is no really software that you can
- 9:33get to run on that
- 9:34it's really hard to even get a basic
- 9:36compiler running
- 9:39so there came risk 5. about 10 years ago
- 9:42it was conceptualized
- 9:44it really you know took off in the past
- 9:47four or five years
- 9:50it is open source and license free what
- 9:53means there
- 9:54is that anybody can use it you don't
- 9:57have to pay anybody
- 9:59the rights to use those instructions so
- 10:04it became very popular in both teaching
- 10:07but it immediately jumped into a
- 10:08commercial world
- 10:10so we have now a rich commercial
- 10:12ecosystem
- 10:13that builds risk fire from processors
- 10:15but there is a well-supported software
- 10:17stack
- 10:18so we got everything now a simple
- 10:20instruction set
- 10:21that can be extended and is being
- 10:23extended that we can teach in classes
- 10:25and there is a soft there is a rich
- 10:28collection of software
- 10:29that will run on it risk 5 comes in
- 10:32different kinds of variants to support
- 10:34from tiny microcontrollers to
- 10:36big computers it comes with
- 10:39in 32 64-bit 128 bit variants if you
- 10:43like
- 10:44that says how big are these words that
- 10:47the
- 10:48processor operates on 32 bits are
- 10:52four bytes that we have seen before 64
- 10:55bits
- 10:56are eight bytes that it operates on at a
- 10:58time
- 11:00in class we are using 32 bits because
- 11:03believe me here projects
- 11:06you know project 3 is a lot easier to
- 11:08implement when it's 32 bits
- 11:10than when it's 64 bits but the book
- 11:13covers
- 11:14a 64-bit version of the architecture
- 11:16that is called
- 11:17rb64 our variant is called rb32
- 11:22um it's what we covering class really
- 11:24fits on one page
- 11:26this is what i'm going to be talking
- 11:27about over the next
- 11:29few of these video segments that one
- 11:32page
- 11:32is the captured entire architecture the
- 11:36definition of risk five um and it's
- 11:38called the
- 11:39green card that is named after the ibm
- 11:43360 green card which was very popular
- 11:45back in the 60s
- 11:46i actually had an opportunity to program
- 11:50ibm 360 and when
- 11:53i was in high school and use the punch
- 11:55cards and
- 11:56line printers and really understood what
- 12:00does that
- 12:00slash n mean in uh in c code
- 12:04otherwise it will not return the line if
- 12:07it does
- 12:07if you don't put that in
- 12:12risk five just a few words about where
- 12:15it came from and where it's going
- 12:17um it started in summer 2010 to support
- 12:21classes
- 12:21exactly like this one 61c it was built
- 12:24for 61c
- 12:25but also for 152 and 151
- 12:29but a lot of the instructions that
- 12:30you'll find there are
- 12:33the same instructions that you found in
- 12:35the old risk one
- 12:37and raise 2 in the 80s
- 12:41as risk 5 project matured
- 12:45it started getting adopted by industry
- 12:48and it got moved into an open source you
- 12:50know a
- 12:52non-profit foundation that maintains its
- 12:55open source description it's called the
- 12:58risk5.org
- 13:01and there are as i said many uh research
- 13:04projects based on risk five
- 13:06and their products that may be open
- 13:08source but maybe
- 13:09pro proprietary
- 13:12people say they'll be next year about a
- 13:14billion
- 13:15processor called course built in risk
- 13:17five that is quite
- 13:18exciting you can read more about the
- 13:21history and the lineage
- 13:23in on the risk5.org page
- 13:27and i'll jump in the next
- 13:30video segment i'm going to jump into the
- 13:33elements of
- 13:34the architecture see you there
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 07.1 - RISC-V Intro: RISC-V Assembly Language by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,855 words across 360 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.