1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
what does .data do?
uses the data section for storage starting at 0000_6000
what does .eqv do?
sets a variable equal to a number (.eqv variable, #)
what does .text do?
starts the coding section
what does .byte, .half, .word do?
byte designates a byte size to a term, half designates halfworld, word designates word
what does .space do?
use it as something: .space 64, which reserves 64 bytes of data for the object something
How do you use these? Create a data array of 0-3 words and start the code.
.data
array:
.word 0,1,2,3
.text
How do you write timing diagrams?
fetch starts first with execute coming after and cycling. Only read enable signals are clocked at fetch, and write is clocked at execute. Write instructions at execute, and write register results at fetch
What are the datapaths for alu?
Goes through reg_file into ALU using either registers or immediates. Then goes back into wa and PC+4 goes to PC mux 0.
What are the datapaths for branch?
Goes through the immediate generator and BAG and BCG. PC values are added to immediate or register.
what are the datapaths for jal and jalr?
Goes through imm gen and BAG either using PC value or register value for addition. PC+4 goes to reg_file wd
what are the datapaths for lw, auipc, sw?
They go through the alu using addition. Instructions with an immediate, rs1, and rs2 go through the memory module with rs2 going into DIN2 and ALU_result into address 2. auipc uses pc value in ALU with immediate and goes straight into rd, lw goes into addr2 then into wd.
How do you create machine code from instructions?
identify opcode and function 3 bits, find registers and immediate by using the bottom table for immediates.
How do you convert decimal to binary and hexadecimal to decimal?
divide the decimal by 2 and take the remainder while diving again by the quotient until 0. Place remainders in reverse order for binary. To get hex to decimal, multiply hex values by their base 16 to the power of their place and add all parts
when do you use always_ff and always_comb
use always ff for memory and synchronous (use <=). Use always comb for nonmemory and async and cases (=)
How do you create cases?
always_comb begin case(…) 0: begin … end… default; endcase… end
How do you model registers with 9-0 bits and 0-6 rows? How do you call on bits 6-4 of register 3?
logic[9:0]ram[0:6], ram[3][6:4]
When is something divisible by 4? how do you divide and multiply by 4?
a binary number divisible by 4 has 2 LSB of 0. Divide by shifting right twice and multiply by shifting left twice.
How do you find the amount of registers?
Highest - lowest + 1
what is the range of bits for unsigned bits? for signed?
unsigned is 2^n - 1. Signed is -2^(n-1):2^(n-1)-1