-
Notifications
You must be signed in to change notification settings - Fork 78
Implement vset* and vector CSRs #467
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
Changes from 2 commits
a4c0deb
c922f47
536ad31
3c1878e
5211e8a
7a29980
c833986
35b70f7
35c2da9
9e7ea5b
a713489
e7b2d04
fe42aad
f1f3cfc
31b051f
b4fd2b8
cb984f9
46c52cd
b474edf
d143311
712c3ac
855a04a
7fe516b
879a548
a88e079
fe0a0da
c0b3b3c
34e2bb0
94daf9d
2921e24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,11 @@ | |
| $schema: "inst_schema.json#" | ||
| kind: instruction | ||
| name: vsetivli | ||
| long_name: No synopsis available. | ||
| long_name: Set vector configuration (immediate immediate). | ||
| description: | | ||
| No description available. | ||
| Vset (i,i) allows rapid configuration of the values in vl and vtype CSRs to match application | ||
| needs. The vsetvl instruction sets the vtype and vl CSRs based on the arguments, and writes | ||
| the new value of vl into rd. | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| definedBy: V | ||
| assembly: xd, imm | ||
| encoding: | ||
|
|
@@ -24,7 +26,19 @@ access: | |
| vu: always | ||
| data_independent_timing: false | ||
| operation(): | | ||
| XReg state = vector_state(); | ||
jmawet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| XReg VLMAX = state.log2_multiplier * VLEN * state.sew; | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # todo: state.lmul_type | ||
|
|
||
| if (xs1 < VLMAX){ | ||
jmawet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| CSR[vl] = uimm; | ||
| } else { | ||
| CSR[vl] = VLMAX; | ||
|
||
| } | ||
|
|
||
| CSR[vtype] = zimm11; | ||
|
||
| X[rd] = CSR[vl]; | ||
| CSR[vstart] = 0; | ||
| sail(): | | ||
| { | ||
| let VLEN_pow = get_vlen_pow(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| %version: 1.0 | ||
|
|
||
| # - test suite? | ||
| # - Vector params (there will be many) | ||
| # - Vector state | ||
| # - Order (might be dictated somewhat by test suite) | ||
| # - vset* | ||
| # - integer arith (vadd/vsub/vrsub(.vv,.vx,.vi), compare, min, max) | ||
| # - integer widening arith () | ||
|
|
||
| # the vector register file | ||
| Bits<VLEN> v[32] = [0, 0, 0, 0, 0, 0, 0, 0, | ||
| 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 0, 0, 0, 0, 0, 0, 0, 0]; | ||
|
|
||
| enum VectorLmulType { | ||
| Divide | ||
| Multiply | ||
| } | ||
|
|
||
| struct VectorState { | ||
| Bits<7> sew; | ||
| VectorMultiplierDirection lmul_type; | ||
| Bits<2> log2_multiplier; | ||
| } | ||
|
|
||
| function vector_state { | ||
| returns VectorState | ||
| description { | ||
| Get the current vector state from CSRs | ||
| } | ||
| body { | ||
| VectorState state; | ||
|
|
||
| state.sew = 7'b1 << (3 + CSR[VTYPE].VSEW); | ||
| Bits<3> vlmul = CSR[VTYPE].VLMUL; | ||
| state.lmul_type = CSR[vtype].VLMUL[2] == 1'b1 ? VectorLmulType::Divide : VectorLmulType::Multiply; | ||
| state.log2_multiplier = CSR[vtype].VLMUL[1:0]; | ||
| if (vlmul == 3'b101) { | ||
| state.log2_multiplier = 8; | ||
| } else if (vlmul == 3'b110) { | ||
| state.log2_multiplier = 4; | ||
| } else if (vlmul == 3'b111) { | ||
| state.log2_multiplier = 2; | ||
| } | ||
|
|
||
| return state; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.