OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [optest.cpp] - Blame information for rev 120

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    optest.cpp
4
//
5
// Project:     Zip CPU -- a small, lightweight, RISC CPU core
6
//
7 13 dgisselq
// Purpose:     A quick test of whether we can decode opcodes properly.  This
8
//              test bypasses the assembler, and is useful when the assembler
9 70 dgisselq
//      isn't working.  Now that we've got the assembler running, this code
10
//      isn't nearly as useful anymore.  
11 2 dgisselq
//
12 70 dgisselq
//      Even more, now that we switched instruction sets, this code is all the
13
//      more useless ... until updated.
14
//
15 2 dgisselq
// Creator:     Dan Gisselquist, Ph.D.
16 69 dgisselq
//              Gisselquist Technology, LLC
17 2 dgisselq
//
18
////////////////////////////////////////////////////////////////////////////////
19
//
20
// Copyright (C) 2015, Gisselquist Technology, LLC
21
//
22
// This program is free software (firmware): you can redistribute it and/or
23
// modify it under the terms of  the GNU General Public License as published
24
// by the Free Software Foundation, either version 3 of the License, or (at
25
// your option) any later version.
26
//
27
// This program is distributed in the hope that it will be useful, but WITHOUT
28
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
29
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
30
// for more details.
31
//
32
// You should have received a copy of the GNU General Public License along
33
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
34
// target there if the PDF file isn't present.)  If not, see
35
// <http://www.gnu.org/licenses/> for a copy.
36
//
37
// License:     GPL, v3, as defined and found on www.gnu.org,
38
//              http://www.gnu.org/licenses/gpl.html
39
//
40
//
41
////////////////////////////////////////////////////////////////////////////////
42
#include <stdio.h>
43
 
44
#include "zopcodes.h"
45
 
46 109 dgisselq
#error  "This file is now obsolete.  The opcodes no longer match the CPU ISET."
47 2 dgisselq
 
48
void    optest(const ZIPI ins) {
49 70 dgisselq
        char    la[80], lb[80];
50 2 dgisselq
 
51 70 dgisselq
        zipi_to_string(ins, la, lb);
52
        printf("0x%08x ->\t%-24s\t%-24s\n", ins, la, lb);
53 2 dgisselq
}
54
 
55
int main(int argc, char **argv) {
56
        char    line[512];
57
 
58
        optest(0x00000000);     // CMP $0,R0
59
        optest(0x0f000000);     // CMP $0,PC
60
        optest(0x0e0fffff);     // CMP $-1,CC
61
        optest(0x2f007fff);     // MOV $-1+R0,PC -> JMP $-1+R0
62
        optest(0x2f0f7fff);     // MOV $-1+PC,PC -> BRA $-1
63
        optest(0x2f2f7fff);     // BRZ $-1+R0
64
        optest(0x2f4fffff);     // MOV.NE $-1+uPC,PC
65
        optest(0xbe000010);     // HALT
66
        optest(0xbe000020);     // RTU
67
        optest(0x9e00005f);     // INT
68
        optest(0xc6160000);     // CLR R6
69
        optest(0xcf1f0000);     // CLR R6
70
        optest(0xce1e0000);     // CLR CC
71
        optest(0xcd1d0000);     // CLR SP
72
        optest(0xc71e0000);     // XOR CC,R7
73
        optest(0x2f0f7fff);     // BRA $-1
74
        optest(0x2f2f7fff);     // BRZ $-1
75
        optest(0x2f4f7fff);     // BNE $-1
76
        optest(0xa0000000);     // ADD $0,R0
77
        optest(0xaf030350);     // ADD $0x197456,PC -> LJMP $197456+PC
78
        optest(0xaf230350);     // ADD.Z $0x197456,PC -> LJMP.Z $197456+PC
79
        optest(0x4e000000);     // NOOP
80
        optest(0x4f000000);     // LODILO $0,R0
81
        optest(0x4f00ffff);     // LODILO $0,R0
82
        optest(0x4f057fff);     // LODILO $0,R5
83
        optest(0x4f0c0001);     // LODILO $0,R12
84
        optest(0x4f1d0001);     // LODIHI $0,SP
85
        optest(0x601f0007);     // LOD ($7+PC),R0
86
        optest(0x60df000f);     // LOD.C $15(PC),R0
87
        optest(0x6cff003f);     // LOD.V $63(PC),R12
88
        optest(0x701f0007);     // STO R0,($7+PC)
89
        optest(0x70000007);     // STO R0,($7)
90
        optest(0x701f0000);     // STO R0,(PC)
91
 
92
        optest(0xc0100000);     // CLR R0
93
        optest(0x21000000);     // MOV R0,R1
94
        optest(0x22000001);     // MOV $1+$0,R2
95
        optest(0x23000002);     // MOV $2+$0,R3
96
        optest(0x24000022);     // MOV $22h+$0,R4
97
        optest(0x25100377);     // MOV $337h+$0,uR5
98
 
99
}
100
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.