-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New IR in place of old IR - New DDG is used in place of old scheduler - Various code improvements (e.g. return result instead of modify reference parameter) - Remove BASE_RC and MINEXTEND_RC mapper options - Really order available gates by decreasing "criticality" which was the original intent but was gonne from the code.
- Loading branch information
Showing
69 changed files
with
2,657 additions
and
5,691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "ql/ir/ir.h" | ||
|
||
namespace ql { | ||
namespace com { | ||
namespace map { | ||
|
||
/* | ||
This class is a visitor for changing virtual qubit indices to real qubit indices, given a mapping. | ||
*/ | ||
|
||
class ReferenceUpdater : public ir::RecursiveVisitor { | ||
public: | ||
using Callback = std::function<void(utils::UInt)>; | ||
|
||
/* | ||
m: a vector represening the virtual->real qubit mapping. | ||
m[i] is the real qubit index corresponding to virtual qubit i. | ||
c: a callback to be called for every mapped virtual qubit index. | ||
*/ | ||
ReferenceUpdater(ir::PlatformRef p, const utils::Vec<utils::UInt> &m, | ||
Callback c = {}) : platform(p), mapping(m), callback(c) {} | ||
|
||
void visit_node(ir::Node &node) override {}; | ||
|
||
void visit_reference(ir::Reference &ref) override; | ||
|
||
// Gate operands may be virtual qubits, but in the instruction type it's always real qubit indices. | ||
void visit_instruction_type(ir::InstructionType &t) override {}; | ||
|
||
private: | ||
ir::PlatformRef platform; | ||
const utils::Vec<utils::UInt> &mapping; | ||
Callback callback{}; | ||
}; | ||
|
||
void mapInstruction(const ir::PlatformRef &platform, const utils::Vec<utils::UInt> &mapping, const ir::CustomInstructionRef &instr, ReferenceUpdater::Callback callback = {}); | ||
|
||
void mapProgram(const ir::PlatformRef &platform, const utils::Vec<utils::UInt> &mapping, const ir::ProgramRef &program); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.