[CS61C FA20] Lecture 11.5 - RISC-V Instruction Formats I: S-Format — Transcript
Full transcript
- 0:00[Music]
- 0:10hi
- 0:12welcome back to this 5 instruction
- 0:14encoding we have seen
- 0:17our formats and i format so far
- 0:21and we have seen that load instructions
- 0:23fit nicely into the i format
- 0:26can we fit store instructions into an
- 0:29existing
- 0:30format unfortunately not we need a
- 0:33special format for the stores
- 0:36because they use registers differently
- 0:39remember how the stores work we
- 0:42have two source registers one
- 0:46stores the the data one register source
- 0:49the data they would like to store in the
- 0:50memory
- 0:51the other one stores the base pointer
- 0:54to the memory then we also need an
- 0:57immediate value
- 0:58that we're going to add to that base
- 0:59pointer to form the address where we
- 1:01would like to
- 1:02write so this is different than what we
- 1:06have had before
- 1:07we need two of our source registers
- 1:11like we had in the r format
- 1:15but we don't need this destination
- 1:16register because
- 1:18we don't write anything into our
- 1:20registers we write
- 1:21into the memory so our instruction
- 1:24format needs to
- 1:25have space for the opcode
- 1:29rs1 and rs2 and the immediate value
- 1:33and the functory field to support
- 1:36different kinds of stores
- 1:39but what is important to notice is that
- 1:42we always want to keep the
- 1:45locations of registers
- 1:48in the same place in our instruction
- 1:51because those are important we don't
- 1:53want processors to be looking for
- 1:55registers all over the place
- 1:57where are they where are they it's like
- 1:59in grade scope
- 2:00where we when we have to put exactly
- 2:03where to look for
- 2:04the answers um when they're written
- 2:07answers uh to the test
- 2:10so these locations the fields where the
- 2:14registers are
- 2:16never move we do move however
- 2:19the the field where the
- 2:22immediate values are so in this case the
- 2:25immediate is
- 2:26split in between the upper seven
- 2:30bits and the five bits where
- 2:33the the rd used to be so it is still a
- 2:3612-bit immediate
- 2:37except that it consists of seven upper
- 2:39bits and
- 2:40five lower bits again
- 2:45this is important it looks confusing to
- 2:48us but we are not the ones that are
- 2:50important processor is important
- 2:51processor needs to find
- 2:53where are its registers very quickly
- 2:56let's take a look at an example of a
- 2:59store
- 3:01so here is an instruction to store a
- 3:02word
- 3:04from register x14 into a memory location
- 3:07that is pointed by the base register x4
- 3:10and an offset of 8 that is stored as an
- 3:13immediate value
- 3:14so we get a new opcode for stores
- 3:18this is zero one zero zero zero one one
- 3:21that's a store and we have
- 3:25a source register rs1
- 3:28is two that's our base rs2 is our
- 3:33content and then we need to form our
- 3:37immediate we need to form our offset out
- 3:39of the two parts of the immediate
- 3:41the lower five bits are here they're
- 3:43going to contain a value of eight
- 3:45the upper seven bits are in the upper
- 3:49in the topmost seven bits of the
- 3:50instruction when we put them together
- 3:53we get our combined 12-bit offset that
- 3:55in this case
- 3:56is plus eight and that's it that's an
- 4:00an illustrative example of how do does
- 4:03the store work
- 4:05there are three types of stores that
- 4:09risk 5 supports we can store bytes
- 4:12we can store half words and we can store
- 4:16words once again bytes are 8 bits wide
- 4:20half words are 16 bits wide and words
- 4:23are 32 bits wide
- 4:27and that is it for
- 4:30the s type um we will make a break here
- 4:34you may want to take a few minutes
- 4:36longer break and we'll return
- 4:38with a few more formats see you there
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 11.5 - RISC-V Instruction Formats I: S-Format by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 611 words across 105 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.