deriv.cc revision 8793
14403Srdreslin@umich.edu/*
21693Sstever@eecs.umich.edu * Copyright (c) 2004-2006 The Regents of The University of Michigan
31693Sstever@eecs.umich.edu * All rights reserved.
41693Sstever@eecs.umich.edu *
51693Sstever@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
61693Sstever@eecs.umich.edu * modification, are permitted provided that the following conditions are
71693Sstever@eecs.umich.edu * met: redistributions of source code must retain the above copyright
81693Sstever@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
91693Sstever@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
101693Sstever@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
111693Sstever@eecs.umich.edu * documentation and/or other materials provided with the distribution;
121693Sstever@eecs.umich.edu * neither the name of the copyright holders nor the names of its
131693Sstever@eecs.umich.edu * contributors may be used to endorse or promote products derived from
141693Sstever@eecs.umich.edu * this software without specific prior written permission.
151693Sstever@eecs.umich.edu *
161693Sstever@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171693Sstever@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181693Sstever@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191693Sstever@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201693Sstever@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211693Sstever@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221693Sstever@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231693Sstever@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241693Sstever@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251693Sstever@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261693Sstever@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271693Sstever@eecs.umich.edu *
281693Sstever@eecs.umich.edu * Authors: Kevin Lim
293358Srdreslin@umich.edu */
303358Srdreslin@umich.edu
311516SN/A#include <string>
326654Snate@binkert.org
336654Snate@binkert.org#include "config/full_system.hh"
346654Snate@binkert.org#include "config/use_checker.hh"
356654Snate@binkert.org#include "cpu/o3/cpu.hh"
363358Srdreslin@umich.edu#include "cpu/o3/impl.hh"
373358Srdreslin@umich.edu#include "params/DerivO3CPU.hh"
386654Snate@binkert.org
396654Snate@binkert.orgclass DerivO3CPU : public FullO3CPU<O3CPUImpl>
401516SN/A{
413358Srdreslin@umich.edu  public:
423358Srdreslin@umich.edu    DerivO3CPU(DerivO3CPUParams *p)
433358Srdreslin@umich.edu        : FullO3CPU<O3CPUImpl>(p)
443358Srdreslin@umich.edu    { }
453358Srdreslin@umich.edu};
463358Srdreslin@umich.edu
473358Srdreslin@umich.eduDerivO3CPU *
483358Srdreslin@umich.eduDerivO3CPUParams::create()
493358Srdreslin@umich.edu{
503358Srdreslin@umich.edu    ThreadID actual_num_threads;
513358Srdreslin@umich.edu    if (FullSystem) {
523358Srdreslin@umich.edu        // Full-system only supports a single thread for the moment.
533360Srdreslin@umich.edu        actual_num_threads = 1;
543358Srdreslin@umich.edu    } else {
553360Srdreslin@umich.edu        if (workload.size() > numThreads) {
563360Srdreslin@umich.edu            fatal("Workload Size (%i) > Max Supported Threads (%i) on This CPU",
573360Srdreslin@umich.edu                  workload.size(), numThreads);
585255Ssaidi@eecs.umich.edu        } else if (workload.size() == 0) {
593360Srdreslin@umich.edu            fatal("Must specify at least one workload!");
603360Srdreslin@umich.edu        }
613360Srdreslin@umich.edu
625255Ssaidi@eecs.umich.edu        // In non-full-system mode, we infer the number of threads from
633358Srdreslin@umich.edu        // the workload if it's not explicitly specified.
644403Srdreslin@umich.edu        actual_num_threads =
653360Srdreslin@umich.edu            (numThreads >= workload.size()) ? numThreads : workload.size();
663358Srdreslin@umich.edu    }
673358Srdreslin@umich.edu
683358Srdreslin@umich.edu    numThreads = actual_num_threads;
693358Srdreslin@umich.edu
703358Srdreslin@umich.edu    // Default smtFetchPolicy to "RoundRobin", if necessary.
713358Srdreslin@umich.edu    std::string round_robin_policy = "RoundRobin";
723358Srdreslin@umich.edu    std::string single_thread = "SingleThread";
733358Srdreslin@umich.edu
743358Srdreslin@umich.edu    if (actual_num_threads > 1 && single_thread.compare(smtFetchPolicy) == 0)
753360Srdreslin@umich.edu        smtFetchPolicy = round_robin_policy;
763360Srdreslin@umich.edu    else
773360Srdreslin@umich.edu        smtFetchPolicy = smtFetchPolicy;
783360Srdreslin@umich.edu
793358Srdreslin@umich.edu    instShiftAmt = 2;
803358Srdreslin@umich.edu
813358Srdreslin@umich.edu    return new DerivO3CPU(this);
823358Srdreslin@umich.edu}
834403Srdreslin@umich.edu