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

MT Cannon: add cannon load/store opcodes tests #12196

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

GrapeBaBa
Copy link
Contributor

Description

This PR add lb/lh/lw/lbu/lhu/lwl/lwr/sb/sh/swl/sw/swr tests

Tests

Additional context

Metadata

@GrapeBaBa GrapeBaBa requested review from a team as code owners September 28, 2024 11:11
Copy link

codecov bot commented Sep 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.97%. Comparing base (6ba2ac0) to head (44689d4).
Report is 30 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12196      +/-   ##
===========================================
- Coverage    75.19%   74.97%   -0.22%     
===========================================
  Files           49       49              
  Lines         3656     3656              
===========================================
- Hits          2749     2741       -8     
- Misses         734      743       +9     
+ Partials       173      172       -1     
Flag Coverage Δ
cannon-go-tests 74.97% <ø> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just left a few quibbles.

imm = uint32(0x5)
}

insn = tt.opcode<<26 | uint32(9)<<21 | uint32(8)<<16 | imm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) For clarity, would be helpful to replace the magic numbers here with variables, something like:

Suggested change
insn = tt.opcode<<26 | uint32(9)<<21 | uint32(8)<<16 | imm
insn = tt.opcode<<26 | uint32(baseReg)<<21 | uint32(rtReg)<<16 | imm

Comment on lines 257 to 262
{name: "sb", opcode: uint32(0x28), rt: uint32(0xaa_bb_cc_dd), expectRes: uint32(0xaa_bb_cc_dd), expectMemVal: uint32(0xdd_00_00_00)}, // sb $t0, 4($t1)
{name: "sh", opcode: uint32(0x29), rt: uint32(0xaa_bb_cc_dd), expectRes: uint32(0xaa_bb_cc_dd), expectMemVal: uint32(0xcc_dd_00_00)}, // sh $t0, 4($t1)
{name: "swl", opcode: uint32(0x2a), rt: uint32(0xaa_bb_cc_dd), expectRes: uint32(0xaa_bb_cc_dd), expectMemVal: uint32(0xaa_bb_cc_dd)}, // swl $t0, 4($t1)
{name: "sw", opcode: uint32(0x2b), rt: uint32(0xaa_bb_cc_dd), expectRes: uint32(0xaa_bb_cc_dd), expectMemVal: uint32(0xaa_bb_cc_dd)}, // sw $t0, 4($t1)
{name: "swr unaligned address", opcode: uint32(0x2e), rt: uint32(0xaa_bb_cc_dd), isUnAligned: true, expectRes: uint32(0xaa_bb_cc_dd), expectMemVal: uint32(0xcc_dd_00_00)}, // swr $t0, 5($t1)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store operations don't write back to a register, so I'd suggest cutting the expectedRes value for these, and only setting an expectation on the return register iff we have a value for expectedRes.

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.

MTCannon: Create load/store opcodes tests
2 participants