The Sparta Modeling Framework
Loading...
Searching...
No Matches
Decode.hpp
1// <Decode.h> -*- C++ -*-
2
3
4
5#pragma once
6
7#include <string>
13#include "CoreTypes.hpp"
14#include "FlushManager.hpp"
15
16namespace core_example
17{
18
27 class Decode : public sparta::Unit
28 {
29 public:
32 {
33 public:
36 { }
37
38 PARAMETER(uint32_t, num_to_decode, 4, "Number of instructions to process")
39 PARAMETER(uint32_t, fetch_queue_size, 10, "Size of the fetch queue")
40 };
41
49 const DecodeParameterSet * p);
50
52 static constexpr char name[] = "decode";
53
54 private:
55
56 // The internal instruction queue
57 InstQueue fetch_queue_;
58
59 // Port listening to the fetch queue appends - Note the 1 cycle delay
60 sparta::DataInPort<InstGroup> fetch_queue_write_in_ {&unit_port_set_, "in_fetch_queue_write", 1};
61 sparta::DataOutPort<uint32_t> fetch_queue_credits_outp_ {&unit_port_set_, "out_fetch_queue_credits"};
62
63 // Port to the uop queue in dispatch (output and credits)
64 sparta::DataOutPort<InstGroup> uop_queue_outp_ {&unit_port_set_, "out_uop_queue_write"};
65 sparta::DataInPort<uint32_t> uop_queue_credits_in_{&unit_port_set_, "in_uop_queue_credits", sparta::SchedulingPhase::Tick, 0};
66
67 // For flush
69 {&unit_port_set_, "in_reorder_flush", sparta::SchedulingPhase::Flush, 1};
70
71 // The decode instruction event
72 sparta::UniqueEvent<> ev_decode_insts_event_ {&unit_event_set_, "decode_insts_event", CREATE_SPARTA_HANDLER(Decode, decodeInsts_)};
73
75 // Decoder callbacks
76 void sendInitialCredits_();
77 void fetchBufferAppended_ (const InstGroup &);
78 void receiveUopQueueCredits_(const uint32_t &);
79 void decodeInsts_();
80 void handleFlush_(const FlushManager::FlushingCriteria & criteria);
81
82 uint32_t uop_queue_credits_ = 0;
83 const uint32_t num_to_decode_;
84 };
85}
File that defines Data[In,Out]Port<DataT>
A set of sparta::Parameters per sparta::ResourceTreeNode.
#define PARAMETER(type, name, def, doc)
Parameter declaration.
#define CREATE_SPARTA_HANDLER(clname, meth)
Basic Node framework in sparta device tree composite pattern.
File that defines the UniqueEvent class.
File that defines the Unit class, a common grouping of sets and loggers.
Parameters for Decode model.
Definition Decode.hpp:32
static constexpr char name[]
Name of this resource. Required by sparta::UnitFactory.
Definition Decode.hpp:52
DataInPort receives data from sender using a DataOutPort.
Definition DataPort.hpp:289
DataOutPort is used for transferring any data to another module.
Definition DataPort.hpp:77
Generic container of Parameters.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
A type of Event that uniquely schedules itself on the schedule within a single time quantum....
The is the base class for user defined blocks in simulation.
Definition Unit.hpp:38
sparta::EventSet unit_event_set_
The Unit's event set.
Definition Unit.hpp:114
sparta::PortSet unit_port_set_
The Unit's Ports.
Definition Unit.hpp:111
@ Tick
Most operations (combinational logic) occurs in this phase.
@ Flush
Phase where flushing of pipelines, etc can occur.