Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
cag-uconn committed Nov 10, 2022
1 parent 4b31bae commit 03cbab8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions pa3/src/sim_stages.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct State fetch(struct State fetch_in) {
return inst;
}


/**
* Decode stage implementation
*/
Expand Down Expand Up @@ -104,12 +103,12 @@ unsigned int writeback(struct State mem_out) {




/* BRANCH PREDICTION FUNCTIONS*/

/**
* Branch Target Buffer Lookup:
* Branch target buffer lookup
*/

unsigned int BTB_lookup(unsigned int inst_addr){
int btb_hit = 0;

Expand Down Expand Up @@ -151,13 +150,12 @@ void predictor_update(unsigned int inst_addr, unsigned int branch_target, unsign




/* DATA CACHE FUNCTIONS */

/**
* Data cache lookup
*/

//Maybe increase cache size and just use memory addresses that force
unsigned int dcache_lookup(unsigned int addr_mem) {
int cache_hit = 0;

Expand Down Expand Up @@ -188,7 +186,7 @@ void update_simulator_state() {

if (dmem_busy) {
/* Stall every stage and overwrite memory for correct pipe trace */
mem_out = (struct State) {0};
mem_out = NOP;

}else {
/* Otherwise there is no memory stall and proceed pipeline as before */
Expand Down
2 changes: 1 addition & 1 deletion pa3/unittests/branching_logic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ lw $a2, 2050($s0) # Load C from mem
jal logic_gate
sw $v0, 2051($s0)
addi $s0, $s0, 4 # Increment index
slti $t2, $s0, 16 # Set to 1 if i < 20
slti $t2, $s0, 16 # Set to 1 if i < 16
bne $t2, $zero, loop
addi $zero, $zero, 1

Expand Down

0 comments on commit 03cbab8

Please sign in to comment.