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

fix: CRC instruction operands #62

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/Decoder/SemanticActions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ crcAction(SemanticInstruction* anInstruction,
eOperandCode anInputCode,
eOperandCode anInputCode2,
eOperandCode anOutputCode,
std::vector<std::list<InternalDependance>>& rs_deps,
bool is64);
predicated_action
countAction(SemanticInstruction* anInstruction,
Expand Down
13 changes: 10 additions & 3 deletions components/Decoder/SemanticActions/ReverseAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ struct CRCAction : public PredicatedSemanticAction
eOperandCode anInputCode2,
eOperandCode anOutputCode,
bool is64)
: PredicatedSemanticAction(anInstruction, 1, true)
: PredicatedSemanticAction(anInstruction, 2, true)
, theInputCode(anInputCode)
, theInputCode2(anInputCode2)
, theOutputCode(anOutputCode)
, thePoly(aPoly)
, the64(is64)
Expand All @@ -207,7 +208,7 @@ struct CRCAction : public PredicatedSemanticAction

Operand in = theInstruction->operand(theInputCode);
Operand in2 = theInstruction->operand(theInputCode2);
uint32_t acc = (uint32_t)(boost::get<bits>(in));
uint32_t acc = uint32_t(boost::get<uint64_t>(in));
// bits val = boost::get<bits> (in2);

bits tempacc = (bits)((bitReverse(acc)) << (the64 ? 64 : 32));
Expand All @@ -228,7 +229,8 @@ struct CRCAction : public PredicatedSemanticAction

data &= 0xffffffff;

theInstruction->setOperand(theOutputCode, data);
theInstruction->setOperand(theOutputCode, uint64_t(data));
satisfyDependants();
}

void describe(std::ostream& anOstream) const { anOstream << theInstruction->identify() << " CRCAction "; }
Expand Down Expand Up @@ -287,10 +289,15 @@ crcAction(SemanticInstruction* anInstruction,
eOperandCode anInputCode,
eOperandCode anInputCode2,
eOperandCode anOutputCode,
std::vector<std::list<InternalDependance>>& rs_deps,
bool is64)
{
CRCAction* act = new CRCAction(anInstruction, aPoly, anInputCode, anInputCode2, anOutputCode, is64);
anInstruction->addNewComponent(act);
for (uint32_t i = 0; i < rs_deps.size(); ++i) {
rs_deps[i].push_back(act->dependance(i));
}

return predicated_action(act, act->predicate());
}

Expand Down
2 changes: 1 addition & 1 deletion components/Decoder/encodings/DataProcReg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ CRC(archcode const& aFetchedOpcode, uint32_t aCPU, int64_t aSequenceNo)
std::vector<std::list<InternalDependance>> rs_deps(2);
uint32_t poly = crc32c ? 0x1EDC6F41 : 0x04C11DB7;

predicated_action act = crcAction(inst, poly, kOperand1, kOperand2, kResult, sf);
predicated_action act = crcAction(inst, poly, kOperand1, kOperand2, kResult, rs_deps, sf);

readRegister(inst, 1, rn, rs_deps[0], false);
readRegister(inst, 2, rm, rs_deps[1], sf);
Expand Down