1/36
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
li
puts numbers into registers
what’s system memory
where does the cpu run programs?
temporary storage hardware
it’s smaller, faster, and expensive than the persistent storage
where the programs and data resides
cpu can only run programs from system memory
what’s a memory?
1d array of bytes
bytes have addresses
words
comfy integer size for us
it’s usually 32 bits which is equal to 4 bytes
accumulator archirectures
used on register
add more registers that served specific purposes
what’s a word-addressable memory vs. byte addressable memory
each address usually points to an entire word
byte addressable store a 32-bit word
each byte is has it’s own address
why does the address increase by 4?
they increase by 4 because we’re taking in 32 bit words and we continue to increase
32 bits = 4 bytes
address vs. value
addy tells you where the word is (4, 8, etc)
value tells you what’s stored in there (DECE0EBE)
what does the equation 2^nB mean?
2^n is the address representaion
B is the number of bytes
it’s a memory capacity
now explain how we could store words into an address that only stores one byte?
another example, one word= 4 bytes but our memory holds bytes
so we just take every 4 addresses and make that our word!
if we have a word and it starts at address 4 and goes up to address 8, then the word is in address 4
we always take the address where the word starts the beginning which is address 4 and goes up to 8
what’s an accumulator
olden days, ppl only added into one register only
acc is the place and result was also there
general purpose registers
very fast storage location inside cpu
used for many things
load
you take smth from memory and move it into a register
variables tend to be stored in memory u gotta physically take them out
stores
copy data from CPU registers into memory
how does memory start, so what do we do?
it starts off as an empty slate
we exectute in memory address 0×00400000
so the cpu knows when to start
what happens after we execute the memory address?
we start fetching instructions from memory
t or f does everything in memory has an address?
true it does memory stores ALL the information
what does every piece of data have
it has two parts
an address and a value
how do we access words?
we use lw
this loads word from MEMORY to CPU REGISTERS
we use sq
this stores word from CPU REGISTERS to MEMORY
li
load immediate means directly put values into the registers
li, sw, lw
li — I know the number or addy. Put it in the register.
lw — Go to this memory address and bring me what's stored there.
sw — Take the value in this register and save it at this memory address.
la vs. li
la basically we give it a variable and it finds the address and value
li basically we directly assign it to a register it’s never stored in memory
lw
This tells the computer:
Look at register to find the address, which is 1000.
Go to memory address 1000.
Read the value stored there, which is 7.
Put that value into $t1.
indirect
memory address is in the value in a register
offset
you add a constant to that value
what does byte do?
stores 1 byte of data
tiny: .byte 4
half
stores 2 bytes
small: .half 4
word
x: .word 4
stores 4 bytes
lb
load byte
memory→ register
lbu
load byte unsigned
memory→ register
sb
stores byte
memory→ byte
lh
load half-word
memory→ register
lhu
load half word unsigned
memory→ register
sh
store half-word
register→ mem
sign extension vs. zero extension
so sign extension checks if the msb is 1 or 0 and based on that copies the bit and zero extension j keeps copying the 0's
big endian vs. little endian
big
it’s when the number is the smallest to biggest
little
it’s when the number is big to all
we base them off of their place value
comps use little endian
truncating concetp
sometimes we truncate extras if we want to store a specific amt of bytes, so we always take the stuff from the right and truncate the left so we
we j get rid of extras that dont fit
we keep the lowest-order buts and et rid of the upper order buts
if we’re keep 8 bits then the lsb value is taken
if we’re keeping half words then the two lsbs are taken
if we keep a whole word nothing’s rly truncated usually