Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / pli / src / SS_ValSync.cc
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: SS_ValSync.cc
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21
22#include "SS_ValSync.h"
23
24SS_ValSync::SS_ValSync( SS_Strand* _strand )/*{{{*/
25 :
26 strand(_strand)
27{
28 strand->asi_map.set_asi_read(&asi_rd);
29 strand->ctr_sync = &ctr_rd;
30 for (int i = 0; i < SS_Asi::MAX; i++)
31 multi_entry[i] = false;
32}
33/*}}}*/
34
35void SS_ValSync::ctr_read( SS_Registers::Index idx, uint64_t data )/*{{{*/
36{
37 // We only allow a subset of registers to have "follow me" value syncing
38 assert(SS_Registers::is_asr(idx) || SS_Registers::is_pr(idx) || SS_Registers::is_hpr(idx));
39 ctr_rd[idx] = data;
40}
41/*}}}*/
42void SS_ValSync::ctr_write( SS_Registers::Index idx, uint64_t data )/*{{{*/
43{
44 // We only allow a subset of registers to have "follow me" value syncing
45 assert(SS_Registers::is_asr(idx) || SS_Registers::is_pr(idx) || SS_Registers::is_hpr(idx));
46 (strand->set_state)(strand,idx,data);
47}
48/*}}}*/
49
50void SS_ValSync::asi_read( uint8_t asi, SS_Vaddr va, uint64_t data )/*{{{*/
51{
52 // Mask va into the valid range so we can actually find value sync info.
53 va &= strand->asi_map[asi].get_mask();
54 std::map<SS_Vaddr,std::list<uint64_t>*>::iterator i = asi_rd[asi].find(va);
55 if (i == asi_rd[asi].end())
56 {
57 // no list is created to this asi/va yet, do that first
58 asi_rd[asi][va] = new std::list<uint64_t>;
59 }
60 if (multi_entry[asi])
61 {
62 // these asi's need multi-entry support, so just add the new follow-me
63 // value to the end of the queue, they will be used in FIFO order.
64 asi_rd[asi][va]->push_back(data);
65 }
66 else
67 {
68 // other asi's use single-entry, so make sure there will be only one entry
69 // in the queue.
70 asi_rd[asi][va]->clear();
71 asi_rd[asi][va]->push_back(data);
72 }
73}
74/*}}}*/
75void SS_ValSync::asi_write( uint8_t asi, SS_Vaddr va, uint64_t data )/*{{{*/
76{
77 // Mask va into the valid range so we can actually find value sync info.
78 va &= strand->asi_map[asi].get_mask();
79 strand->asi_map.wr64(strand,asi,va,data);
80}
81/*}}}*/
82
83void SS_ValSync::csr_read( SS_Paddr pa, uint64_t data, bool little_endian )/*{{{*/
84{
85 csr_rd[pa] = data;
86}
87/*}}}*/
88void SS_ValSync::csr_write( SS_Paddr pa, uint64_t data, bool little_endian )/*{{{*/
89{
90}
91/*}}}*/