CPE223 Midterm

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

what does .data do?

uses the data section for storage starting at 0000_6000

2
New cards

what does .eqv do?

sets a variable equal to a number (.eqv variable, #)

3
New cards

what does .text do?

starts the coding section

4
New cards

what does .byte, .half, .word do?

byte designates a byte size to a term, half designates halfworld, word designates word

5
New cards

what does .space do?

use it as something: .space 64, which reserves 64 bytes of data for the object something

6
New cards

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

7
New cards

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

8
New cards

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.

9
New cards

What are the datapaths for branch?

Goes through the immediate generator and BAG and BCG. PC values are added to immediate or register.

10
New cards

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

11
New cards

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.

12
New cards

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.

13
New cards

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

14
New cards

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 (=)

15
New cards

How do you create cases?

always_comb begin case(…) 0: begin … end… default; endcase… end

16
New cards

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]

17
New cards

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.

18
New cards

How do you find the amount of registers?

Highest - lowest + 1

19
New cards

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