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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [sdramscope.cpp] - Blame information for rev 30

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

Line No. Rev Author Line
1 30 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    sdramscope.cpp
4
//
5
// Project:     XuLA2-LX25 SoC based upon the ZipCPU
6
//
7
// Purpose:     
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Technology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
#include <stdio.h>
39
#include <stdlib.h>
40
#include <unistd.h>
41
#include <strings.h>
42
#include <ctype.h>
43
#include <string.h>
44
#include <signal.h>
45
#include <assert.h>
46
 
47
#include "port.h"
48
#include "regdefs.h"
49
#include "scopecls.h"
50
 
51
#define WBSCOPE         R_RAMSCOPE
52
#define WBSCOPEDATA     R_RAMSCOPED
53
 
54
FPGA    *m_fpga;
55
void    closeup(int v) {
56
        m_fpga->kill();
57
        exit(0);
58
}
59
 
60
class   RAMSCOPE : public SCOPE {
61
public:
62
        RAMSCOPE(FPGA *fpga, unsigned addr, bool vecread)
63
                : SCOPE(fpga, addr, false, false) {};
64
        ~RAMSCOPE(void) {}
65
        virtual void    decode(DEVBUS::BUSW val) const {
66
/*
67
                int     ras, cas, wen, stb, we, stall, ack, dqs, dm, oe, addr,
68
                        odat, idat, wdbg, cmd;
69
                static const char *cmdstr[] = { "[MRSET]", "[REFRESH]",
70
                                "[PRECHARGE]", "[ACTIVATE]", "[WRITE]",
71
                                "[READ]", "[ZQS]", "[NOOP]"
72
                        };
73
 
74
                ras      = (val>>31)&1;
75
                cas      = (val>>30)&1;
76
                wen      = (val>>29)&1;
77
                stb      = (val>>28)&1;
78
                we       = (val>>27)&1;
79
                stall    = (val>>26)&1;
80
                ack      = (val>>25)&1;
81
                dqs      = (val>>24)&1;
82
                dm       = (val>>23)&1;
83
                oe       = (val>>22)&1;
84
                addr     = (val>>20)&3;
85
                odat     = (val>>14)&63;
86
                idat      = (val>>8)&63;
87
                wdbg      = (val    )&0xff;
88
 
89
                cmd = (ras<<2)|(cas<<1)|wen;
90
                printf("%s%s%s%s %s%s%s %x %2xO %2xI %4xW %d%d%d%s",
91
                        (stb)?"S":" ",
92
                        (we)?"W":"R",
93
                        (stall)?"S":" ",
94
                        (ack)?"AK":"  ",
95
                        //
96
                        dqs?"D":" ",dm?"M":" ",oe?"W":"z",
97
                        addr, odat, idat, wdbg,
98
                        ras,cas,wen,
99
                        cmdstr[cmd]);
100
*/
101
                int     stb, stall, ack, err, head, tail, rid,
102
                        arvalid, arready, awvalid, awready, wvalid, wready,
103
                        rvalid, bvalid;
104
 
105
                stb      = (val>>31)&1;
106
                stall    = (val>>30)&1;
107
                ack      = (val>>29)&1;
108
                err      = (val>>28)&1;
109
                head     = (val>>22)&0x03f;
110
                tail     = (val>>16)&0x03f;
111
                rid      = (val>>10)&0x03f;
112
                arvalid  = (val>> 9)&1;
113
                arready  = (val>> 8)&1;
114
                awvalid  = (val>> 7)&1;
115
                awready  = (val>> 6)&1;
116
                wvalid   = (val>> 5)&1;
117
                wready   = (val>> 4)&1;
118
                rvalid   = (val>> 3)&1;
119
                bvalid   = (val>> 2)&1;
120
 
121
                printf("%s %s %s %s ", (stb)?"STB":"   ", (stall)?"STL":"   ",
122
                        (ack)?"ACK":"   ", (err)?"ERR":"   ");
123
 
124
                printf("%2x:%2x AR[%c%c] AW[%c%c] W[%c%c] ", head, tail,
125
                        (arvalid)?'V':' ', (arready)?'R':' ',
126
                        (awvalid)?'V':' ', (awready)?'R':' ',
127
                        (wvalid)?'V':' ', (wready)?'R':' ');
128
 
129
                if (rvalid)
130
                        printf("RV[%2x] %c", rid, bvalid?'B':' ');
131
                else if (bvalid)
132
                        printf("BV[%2x]", rid);
133
 
134
        }
135
};
136
 
137
int main(int argc, char **argv) {
138
        int     skp=0, port = FPGAPORT;
139
        bool    use_usb = false;
140
 
141
        skp=1;
142
        for(int argn=0; argn<argc-skp; argn++) {
143
                if (argv[argn+skp][0] == '-') {
144
                        if (argv[argn+skp][1] == 'u')
145
                                use_usb = true;
146
                        else if (argv[argn+skp][1] == 'p') {
147
                                use_usb = false;
148
                                if (isdigit(argv[argn+skp][2]))
149
                                        port = atoi(&argv[argn+skp][2]);
150
                        }
151
                        skp++; argn--;
152
                } else
153
                        argv[argn] = argv[argn+skp];
154
        } argc -= skp;
155
 
156
        FPGAOPEN(m_fpga);
157
 
158
        signal(SIGSTOP, closeup);
159
        signal(SIGHUP, closeup);
160
 
161
        RAMSCOPE *scope = new RAMSCOPE(m_fpga, WBSCOPE, false);
162
        if (!scope->ready()) {
163
                printf("Scope is not yet ready:\n");
164
                scope->decode_control();
165
        } else
166
                scope->read();
167
        delete  m_fpga;
168
}
169
 

powered by: WebSVN 2.1.0

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