Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:avoid unchecked overflow #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

varun-doshi
Copy link

Ref #79

The following files have been corrected so far:

  1. In machine/src/core.rs:
    a. In the implementation of Add:add for Word, on line 57
    b. In the implementation of Sub::sub for Word, on line 67
  2. In alu_u32/src/add/mod.rs:
    a. In the implementation of Add32Chip::op_to_row:
    i. The addition on line 108
    ii. The first addition on line 109
    iii. The second addition on line 109
    iv. The first addition on line 113
    v. The second addition on line 113
    b. In the implementation of Instruction::execute for Add32Instruction:
    i. The addition on line 141 (computing read_addr_1)
    ii. The addition on line 142 (computing write_addr_1)
    iii. The addition on line 149 (computing read_addr_2)
    iv. The addition on line 153 (computing a)
  3. In cpu/src/lib.rs:
    a. In Instruction::execute for ReadAdviceInstruction:
    i. The two additions on line 410
    ii. The multiplication on line 410
    b. In Instruction::execute for WriteAdviceInstruction:
    i. The first and second additions on line 436 (i.e., fp + mem_addr)
    ii. The third addition on line 436 (i.e., (fp + mem_addr) + mem_buf_len)
    c. In Instruction::execute for Load32Instruction:
    i. The addition on line 470 (computing read_addr_1)
    ii. The addition on line 472 (computing write_addr)
    d. In Instruction::execute for Store32Instruction:
    i. The addition on line 491 (computing read_addr)
    ii. The addition on line 492 (computing write_addr)
    e. In Instruction::execute for JalInstruction:
    i. The addition on line 512 (computing write_addr)
    ii. The addition on line 513 (computing next_pc)
    ii. The addition on line 518
    f. In Instruction::execute for JalvInstruction:
    i. The addition on line 536 (computing write_addr)
    ii. The addition on line 537 (computing next_pc)
    iii. The addition on line 540 (computing read_addr)
    iv. The addition on line 543 (computing read_addr)
    v. The additive assignment on line 545
    g. In Instruction::execute for BeqInstruction:
    i. The addition on line 562 (computing read_addr_1)
    ii. The addition on line 570 (computing read_addr_2)
    iii. The addition on line 576
    h. In Instruction::execute for BneInstruction:
    i. The addition on line 594 (computing read_addr_1)
    ii. The addition on line 602 (computing read_addr_2)
    iii. The addition on line 608
    i. In Instruction::execute for Imm32Instruction:
    i. The addition on line 624 (computing write_addr)
    j. Every instance of state.cpu_mut().pc += 1;
    k. In impl CpuChip:
    i. On line 655 and 660, self.pc += 1;
    ii. On line 668, self.clock += 1;

As I correct the other files, I'll keep updating the PR description to serve as a list of pending files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant