Skip to content

Commit 8d8fa41

Browse files
authored
[vuop_gen] (#238)
Also implements integer extension instructions which requires the value encoded in the instruction for sequencing.
1 parent f126c04 commit 8d8fa41

21 files changed

+479
-138
lines changed

arches/isa_json/gen_uarch_rv64v_json.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@
5151
"vwsub.wv" : {"pipe" : "vint", "uop_gen" : "WIDENING_MIXED", "latency" : 1},
5252
"vwsub.wx" : {"pipe" : "vint", "uop_gen" : "WIDENING_MIXED", "latency" : 1},
5353

54-
# TODO: Vector Integer Arithmetic Instructions: Vector Integer Extension
55-
# FIXME: Requires Mavis fix to support correctly
56-
# "vzext.vf2" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
57-
# "vsext.vf2" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
58-
# "vzext.vf4" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
59-
# "vsext.vf4" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
60-
# "vzext.vf8" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
61-
# "vsext.vf8" : {"pipe" : "vint", "uop_gen" : "ARITH_EXT", "latency" : 1},
54+
"vzext.vf2" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
55+
"vsext.vf2" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
56+
"vzext.vf4" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
57+
"vsext.vf4" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
58+
"vzext.vf8" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
59+
"vsext.vf8" : {"pipe" : "vint", "uop_gen" : "INT_EXT", "latency" : 1},
6260

6361
# Vector Integer Arithmetic Instructions: Vector Integer Add-with-Carry/Subtract-with-Borrow Instructions
6462
# FIXME: Requires Mavis fix to include vector mask

arches/isa_json/olympia_uarch_rv64v.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,21 +1735,21 @@
17351735
},
17361736
{
17371737
"mnemonic": "vsext.vf2",
1738-
"pipe": "?",
1739-
"uop_gen": "NONE",
1740-
"latency": 0
1738+
"pipe": "vint",
1739+
"uop_gen": "INT_EXT",
1740+
"latency": 1
17411741
},
17421742
{
17431743
"mnemonic": "vsext.vf4",
1744-
"pipe": "?",
1745-
"uop_gen": "NONE",
1746-
"latency": 0
1744+
"pipe": "vint",
1745+
"uop_gen": "INT_EXT",
1746+
"latency": 1
17471747
},
17481748
{
17491749
"mnemonic": "vsext.vf8",
1750-
"pipe": "?",
1751-
"uop_gen": "NONE",
1752-
"latency": 0
1750+
"pipe": "vint",
1751+
"uop_gen": "INT_EXT",
1752+
"latency": 1
17531753
},
17541754
{
17551755
"mnemonic": "vslide1down.vx",
@@ -2209,20 +2209,20 @@
22092209
},
22102210
{
22112211
"mnemonic": "vzext.vf2",
2212-
"pipe": "?",
2213-
"uop_gen": "NONE",
2214-
"latency": 0
2212+
"pipe": "vint",
2213+
"uop_gen": "INT_EXT",
2214+
"latency": 1
22152215
},
22162216
{
22172217
"mnemonic": "vzext.vf4",
2218-
"pipe": "?",
2219-
"uop_gen": "NONE",
2220-
"latency": 0
2218+
"pipe": "vint",
2219+
"uop_gen": "INT_EXT",
2220+
"latency": 1
22212221
},
22222222
{
22232223
"mnemonic": "vzext.vf8",
2224-
"pipe": "?",
2225-
"uop_gen": "NONE",
2226-
"latency": 0
2224+
"pipe": "vint",
2225+
"uop_gen": "INT_EXT",
2226+
"latency": 1
22272227
}
22282228
]

core/Inst.hpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "VectorConfig.hpp"
1919
#include "MiscUtils.hpp"
2020

21+
#include <cstdint>
2122
#include <cstdlib>
2223
#include <ostream>
2324
#include <unordered_map>
@@ -221,29 +222,34 @@ namespace olympia
221222
}
222223

223224
const VectorConfigPtr getVectorConfig() const { return vector_config_; }
225+
224226
VectorConfigPtr getVectorConfig() { return vector_config_; }
225227

226228
void setTail(bool has_tail) { has_tail_ = has_tail; }
229+
227230
bool hasTail() const { return has_tail_; }
228231

229232
void setUOpParent(sparta::SpartaWeakPointer<olympia::Inst> & parent_uop)
230233
{
231234
parent_uop_ = parent_uop;
232235
}
236+
233237
sparta::SpartaWeakPointer<olympia::Inst> getUOpParent() { return parent_uop_; }
234238

235239
// Branch instruction was taken (always set for JAL/JALR)
236240
void setTakenBranch(bool taken) { is_taken_branch_ = taken; }
237241

238242
// Is this branch instruction mispredicted?
239-
bool isMispredicted() const { return is_mispredicted_; }
240-
void setMispredicted() { is_mispredicted_ = true; }
243+
bool isMispredicted() const { return is_mispredicted_; }
244+
245+
void setMispredicted() { is_mispredicted_ = true; }
241246

242247
// TBD -- add branch prediction
243248
void setSpeculative(bool spec) { is_speculative_ = spec; }
244249

245250
// Last instruction within the cache block fetched from the ICache
246251
void setLastInFetchBlock(bool last) { last_in_fetch_block_ = last; }
252+
247253
bool isLastInFetchBlock() const { return last_in_fetch_block_; }
248254

249255
// Opcode information
@@ -271,25 +277,20 @@ namespace olympia
271277
bool hasZeroRegSource() const
272278
{
273279
return std::any_of(getSourceOpInfoList().begin(), getSourceOpInfoList().end(),
274-
[](const mavis::OperandInfo::Element & elem)
275-
{
276-
return elem.field_value == 0;
277-
});
280+
[](const mavis::OperandInfo::Element & elem)
281+
{ return elem.field_value == 0; });
278282
}
279283

280284
bool hasZeroRegDest() const
281285
{
282286
return std::any_of(getDestOpInfoList().begin(), getDestOpInfoList().end(),
283-
[](const mavis::OperandInfo::Element & elem)
284-
{
285-
return elem.field_value == 0;
286-
});
287+
[](const mavis::OperandInfo::Element & elem)
288+
{ return elem.field_value == 0; });
287289
}
288290

289291
uint64_t getImmediate() const
290292
{
291-
sparta_assert(has_immediate_,
292-
"Instruction does not have an immediate!");
293+
sparta_assert(has_immediate_, "Instruction does not have an immediate!");
293294
return opcode_info_->getImmediate();
294295
}
295296

@@ -298,7 +299,8 @@ namespace olympia
298299
try
299300
{
300301
// If vm bit is 0, masking is enabled
301-
const uint64_t vm_bit = opcode_info_->getSpecialField(mavis::OpcodeInfo::SpecialField::VM);
302+
const uint64_t vm_bit =
303+
opcode_info_->getSpecialField(mavis::OpcodeInfo::SpecialField::VM);
302304
return vm_bit == 0;
303305
}
304306
catch (const mavis::UnsupportedExtractorSpecialFieldID & mavis_exception)
@@ -344,7 +346,8 @@ namespace olympia
344346

345347
bool isVector() const { return is_vector_; }
346348

347-
void setCoF(const bool &cof) { is_cof_ = cof; }
349+
void setCoF(const bool & cof) { is_cof_ = cof; }
350+
348351
bool isCoF() const { return is_cof_; }
349352

350353
// Rename information

core/InstArchInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ namespace olympia
6363
{"NARROWING", InstArchInfo::UopGenType::NARROWING},
6464
{"MAC", InstArchInfo::UopGenType::MAC},
6565
{"MAC_WIDE", InstArchInfo::UopGenType::MAC_WIDE},
66+
{"INT_EXT", InstArchInfo::UopGenType::INT_EXT},
6667
{"NONE", InstArchInfo::UopGenType::NONE}
6768
};
6869

core/InstArchInfo.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ namespace olympia
7878
NARROWING,
7979
MAC,
8080
MAC_WIDE,
81+
INT_EXT,
8182
NONE,
8283
UNKNOWN
8384
};

core/InstGenerator.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ namespace olympia
137137

138138
if (jinst.find("vaddr") != jinst.end())
139139
{
140-
uint64_t vaddr = std::strtoull(jinst["vaddr"].get<std::string>().c_str(), nullptr, 0);
140+
uint64_t vaddr =
141+
std::strtoull(jinst["vaddr"].get<std::string>().c_str(), nullptr, 0);
141142
inst->setTargetVAddr(vaddr);
142143
}
143144

144145
VectorConfigPtr vector_config = inst->getVectorConfig();
145146
if (jinst.find("vtype") != jinst.end())
146147
{
147148
// immediate, so decode from hex
148-
uint64_t vtype = std::strtoull(jinst["vtype"].get<std::string>().c_str(), nullptr, 0);
149+
uint64_t vtype =
150+
std::strtoull(jinst["vtype"].get<std::string>().c_str(), nullptr, 0);
149151
std::string binaryString = std::bitset<32>(vtype).to_string();
150152
uint32_t sew = std::pow(2, std::stoi(binaryString.substr(26, 3), nullptr, 2)) * 8;
151153
uint32_t lmul = std::pow(2, std::stoi(binaryString.substr(29, 3), nullptr, 2));
@@ -155,7 +157,7 @@ namespace olympia
155157

156158
if (jinst.find("vta") != jinst.end())
157159
{
158-
const bool vta = jinst["vta"].get<uint64_t>() > 0 ? true: false;
160+
const bool vta = jinst["vta"].get<uint64_t>() > 0 ? true : false;
159161
vector_config->setVTA(vta);
160162
}
161163

0 commit comments

Comments
 (0)