2023-10-05 15:23:41 +00:00
|
|
|
//
|
|
|
|
// Perform.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 05/10/2023.
|
|
|
|
// Copyright © 2023 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Perform_h
|
|
|
|
#define Perform_h
|
|
|
|
|
|
|
|
#include "Instruction.hpp"
|
2023-10-05 18:37:58 +00:00
|
|
|
#include "Model.hpp"
|
2023-11-02 20:55:38 +00:00
|
|
|
#include "Flags.hpp"
|
2023-10-05 15:23:41 +00:00
|
|
|
|
|
|
|
namespace InstructionSet::x86 {
|
|
|
|
|
2023-11-01 21:03:23 +00:00
|
|
|
template <
|
|
|
|
Model model_,
|
|
|
|
typename FlowControllerT,
|
|
|
|
typename RegistersT,
|
|
|
|
typename MemoryT,
|
|
|
|
typename IOT
|
|
|
|
> struct ExecutionContext {
|
|
|
|
FlowControllerT flow_controller;
|
2023-11-02 20:55:38 +00:00
|
|
|
Flags flags;
|
2023-11-01 21:03:23 +00:00
|
|
|
RegistersT registers;
|
|
|
|
MemoryT memory;
|
|
|
|
IOT io;
|
|
|
|
static constexpr Model model = model_;
|
|
|
|
};
|
|
|
|
|
2023-10-05 20:49:02 +00:00
|
|
|
/// Performs @c instruction querying @c registers and/or @c memory as required, using @c io for port input/output,
|
2023-10-05 15:23:41 +00:00
|
|
|
/// and providing any flow control effects to @c flow_controller.
|
|
|
|
///
|
|
|
|
/// Any change in processor status will be applied to @c status.
|
|
|
|
template <
|
2023-10-05 18:37:58 +00:00
|
|
|
typename InstructionT,
|
2023-11-01 21:03:23 +00:00
|
|
|
typename ContextT
|
2023-10-05 15:23:41 +00:00
|
|
|
> void perform(
|
2023-10-05 18:37:58 +00:00
|
|
|
const InstructionT &instruction,
|
2023-11-01 21:03:23 +00:00
|
|
|
ContextT &context
|
|
|
|
);
|
|
|
|
|
|
|
|
template <
|
|
|
|
typename ContextT
|
|
|
|
> void interrupt(
|
|
|
|
int index,
|
|
|
|
ContextT &context
|
2023-10-05 15:23:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-05 18:37:58 +00:00
|
|
|
#include "Implementation/PerformImplementation.hpp"
|
|
|
|
|
2023-10-05 15:23:41 +00:00
|
|
|
#endif /* Perform_h */
|