Skip to content

Fix factorial trace (Funcsim) #73

Closed
pavelkryukov opened this issue Apr 11, 2017 · 3 comments · Fixed by #74
Closed

Fix factorial trace (Funcsim) #73

pavelkryukov opened this issue Apr 11, 2017 · 3 comments · Fixed by #74
Assignees
Labels
0 This task has the owner who does not participate in scoring system. bug Fixes a bug or potential bug in simulation.

Comments

@pavelkryukov
Copy link
Member

pavelkryukov commented Apr 11, 2017

Currently factorial fails on instruction 62:

./perf_sim -b ../tests/samples/factorial.out -n 100 -d -f

jr $ra
perf_sim: ../func_sim/func_memory/func_memory.cpp:79: uint64 FuncMemory::read(uint64, short unsigned int) const: Assertion `check( addr)' failed.

The problem is that jal istruction does not perform writeback to $ra register.

@pavelkryukov pavelkryukov added 1 Usually one-liner tasks, but may require some deep into infrastructure. bug Fixes a bug or potential bug in simulation. labels Apr 11, 2017
@gkorepanov
Copy link
Contributor

The solution seems to be straightforward: I just have to add dst setting into initR and initJ:

dst = REG_NUM_RA

The problem is that it shouldn't be done for j and jr instructions, only for jal and jalr. So I have to discriminate them somehow. But now initJ, initR, initI are discriminating instructions only by operation type without looking at funct or opcode. So I had better add new operation type like

OUT_J_JUMPL // jal
OUT_J_JUMP  // ja
OUT_R_JUMPL // jalr
OUT_R_JUMP  // jr,

hadn't I?

@pavelkryukov
Copy link
Member Author

pavelkryukov commented Apr 11, 2017

Right.

I'd use more clear name, like 'JUMP_LINK'

@pavelkryukov
Copy link
Member Author

Instruction JALR was not implemented correctly: it can store address not to RA only, but to any register specified in rd bits. Fixed now.

@pavelkryukov pavelkryukov added 0 This task has the owner who does not participate in scoring system. and removed 1 Usually one-liner tasks, but may require some deep into infrastructure. labels Oct 2, 2017
@pavelkryukov pavelkryukov self-assigned this Oct 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0 This task has the owner who does not participate in scoring system. bug Fixes a bug or potential bug in simulation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants