Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / rst / rstzip3 / rstzip_v3 / testrz3iu.C
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: testrz3iu.C
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#include <stdio.h>
22#include <sys/types.h>
23
24#include "rz3iu.h"
25#include "spix_sparc.h"
26
27void mismatch(const char * fcn, uint32_t instr, bool sp, bool rz) {
28 if (sp != rz) {
29 printf("spix, rz3iu %s mismatch instr=%08x (%c/%c)\n", fcn, instr, sp?'T':'F', rz?'T':'F');
30 exit(1);
31 }
32}
33
34int main(int argc, char **argv)
35{
36
37 uint32_t instr;
38
39 uint32_t start_instr = 0xc0000000;
40 instr = start_instr;
41 do {
42 spix_sparc_iop_t iop = spix_sparc_iop(SPIX_SPARC_V9, &instr);
43
44 if ((iop != SPIX_SPARC_IOP_ILLTRAP) && (((int)iop) != -1)) {
45 mismatch("dcti", instr, spix_sparc_iop_isdcti(iop), rz3iu_is_dcti(instr));
46
47 mismatch("isbranch", instr, spix_sparc_iop_isbranch(iop), rz3iu_is_branch(instr));
48 // in spix, ubranch <=> branch_always; and branch_never => cbranch
49 // in rz3, ubranch includes br_always and br_never.
50 mismatch("iscbranch", instr, spix_sparc_iop_iscbranch(iop), rz3iu_is_cbranch(instr)||rz3iu_is_ubranch_never(instr));
51 mismatch("isubranch", instr, spix_sparc_iop_isubranch(iop), rz3iu_is_ubranch_always(instr));
52
53 mismatch("isbpr", instr, spix_sparc_iop_isbpr(iop), rz3iu_is_bpr(instr));
54 mismatch("isbpcc", instr, spix_sparc_iop_isbpcc(iop), rz3iu_is_bpcc(instr));
55 mismatch("isbicc", instr, spix_sparc_iop_isbicc(iop), rz3iu_is_bicc(instr));
56 mismatch("isfbfcc", instr, spix_sparc_iop_isfbfcc(iop), rz3iu_is_fbfcc(instr));
57 mismatch("isfbpfcc", instr, spix_sparc_iop_isfbpfcc(iop), rz3iu_is_fbpfcc(instr));
58
59 mismatch("iscall", instr, (iop==SPIX_SPARC_IOP_CALL), rz3iu_is_call(instr));
60 mismatch("isreturn", instr, (iop==SPIX_SPARC_IOP_RETURN), rz3iu_is_return(instr));
61
62 mismatch("isdone", instr, (iop==SPIX_SPARC_IOP_DONE), rz3iu_is_done(instr));
63 mismatch("isretry", instr, (iop==SPIX_SPARC_IOP_RETRY), rz3iu_is_retry(instr));
64
65 mismatch("isprefetch", instr, spix_sparc_iop_isprefetch(iop), rz3iu_is_prefetch(instr));
66 mismatch("isload", instr, spix_sparc_iop_isload(iop)&&!spix_sparc_iop_isprefetch(iop), rz3iu_is_load(instr) || rz3iu_is_load_store(instr));
67 mismatch("isustore", instr, spix_sparc_iop_isustore(iop), rz3iu_is_store(instr) || rz3iu_is_load_store_unconditional(instr));
68 mismatch("iscstore", instr, spix_sparc_iop_iscstore(iop), rz3iu_is_load_store_conditional(instr));
69 }
70
71 if (instr & 0xffffff); else printf("%08x\n", instr);
72
73 instr++;
74 } while(instr != start_instr);
75
76 return 0;
77} // main