Deleted Added
sdiff udiff text old ( 9915:d9e3ad574162 ) new ( 9919:803903a8dac1 )
full compact
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 29 unchanged lines hidden (view full) ---

38#include "arch/isa_traits.hh"
39#include "arch/kernel_stats.hh"
40#include "arch/types.hh"
41#include "base/trace.hh"
42#include "config/the_isa.hh"
43#include "cpu/o3/comm.hh"
44#include "debug/IEW.hh"
45
46/**
47 * Simple physical register file class.
48 */
49class PhysRegFile
50{
51 private:
52
53 typedef TheISA::IntReg IntReg;
54 typedef TheISA::FloatReg FloatReg;
55 typedef TheISA::FloatRegBits FloatRegBits;
56
57 typedef union {
58 FloatReg d;
59 FloatRegBits q;
60 } PhysFloatReg;
61
62 /** Integer register file. */
63 IntReg *intRegFile;
64
65 /** Floating point register file. */
66 PhysFloatReg *floatRegFile;
67
68 /**
69 * The first floating-point physical register index. The physical
70 * register file has a single continuous index space, with the
71 * initial indices mapping to the integer registers, followed
72 * immediately by the floating-point registers. Thus the first
73 * floating-point index is equal to the number of integer
74 * registers.
75 */
76 unsigned baseFloatRegIndex;
77
78 /** Total number of physical registers. */
79 unsigned totalNumRegs;
80
81 public:
82 /**
83 * Constructs a physical register file with the specified amount of
84 * integer and floating point registers.
85 */
86 PhysRegFile(unsigned _numPhysicalIntRegs,
87 unsigned _numPhysicalFloatRegs);
88
89 /**
90 * Destructor to free resources
91 */
92 ~PhysRegFile();
93
94 /** @return the number of integer physical registers. */
95 unsigned numIntPhysRegs() const { return baseFloatRegIndex; }
96
97 /** @return the number of floating-point physical registers. */
98 unsigned numFloatPhysRegs() const
99 { return totalNumRegs - baseFloatRegIndex; }
100
101 /** @return the total number of physical registers. */

--- 96 unchanged lines hidden (view full) ---

198 int(reg_idx), (uint64_t)val);
199
200 floatRegFile[reg_offset].q = val;
201 }
202
203};
204
205
206inline
207PhysRegFile::PhysRegFile(unsigned _numPhysicalIntRegs,
208 unsigned _numPhysicalFloatRegs)
209 : baseFloatRegIndex(_numPhysicalIntRegs),
210 totalNumRegs(_numPhysicalIntRegs + _numPhysicalFloatRegs)
211{
212 intRegFile = new IntReg[_numPhysicalIntRegs];
213 floatRegFile = new PhysFloatReg[_numPhysicalFloatRegs];
214
215 memset(intRegFile, 0, sizeof(IntReg) * _numPhysicalIntRegs);
216 memset(floatRegFile, 0, sizeof(PhysFloatReg) * _numPhysicalFloatRegs);
217}
218
219
220inline
221PhysRegFile::~PhysRegFile()
222{
223 delete intRegFile;
224 delete floatRegFile;
225}
226
227#endif //__CPU_O3_REGFILE_HH__