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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [ziprun.cpp] - Blame information for rev 29

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

Line No. Rev Author Line
1 5 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    ziprun.cpp
4
//
5
// Project:     XuLA2 board
6
//
7
// Purpose:     To load a program for the ZipCPU into memory.
8
//
9
//      Steps:
10
//              1. Halt and reset the CPU
11
//              2. Load memory
12
//              3. Clear the cache
13
//              4. Clear any registers
14
//              5. Set the PC to point to the FPGA local memory
15
//      THIS DOES NOT START THE PROGRAM!!  The CPU is left in the halt state.
16
//      To actually start the program, execute a ./wbregs cpu 0.  (Actually,
17
//      any value between 0x0 and 0x1f will work, the difference being what
18
//      register you will be able to inspect while the CPU is running.)
19
//
20
//
21
// Creator:     Dan Gisselquist, Ph.D.
22
//              Gisselquist Technology, LLC
23
//
24
////////////////////////////////////////////////////////////////////////////////
25
//
26
// Copyright (C) 2015, Gisselquist Technology, LLC
27
//
28
// This program is free software (firmware): you can redistribute it and/or
29
// modify it under the terms of  the GNU General Public License as published
30
// by the Free Software Foundation, either version 3 of the License, or (at
31
// your option) any later version.
32
//
33
// This program is distributed in the hope that it will be useful, but WITHOUT
34
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
35
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
36
// for more details.
37
//
38
// License:     GPL, v3, as defined and found on www.gnu.org,
39
//              http://www.gnu.org/licenses/gpl.html
40
//
41
//
42
////////////////////////////////////////////////////////////////////////////////
43
//
44
//
45
//
46
#include <stdio.h>
47
#include <stdlib.h>
48 29 dgisselq
#include <sys/types.h>
49
#include <sys/stat.h>
50
#include <fcntl.h>
51 5 dgisselq
#include <unistd.h>
52
#include <strings.h>
53
#include <ctype.h>
54
#include <string.h>
55
#include <signal.h>
56
#include <assert.h>
57
 
58
#include "usbi.h"
59
#include "port.h"
60
#include "regdefs.h"
61 29 dgisselq
#include "flashdrvr.h"
62 5 dgisselq
 
63 29 dgisselq
bool    iself(const char *fname) {
64
        FILE    *fp;
65
        bool    ret = true;
66
        fp = fopen(fname, "rb");
67
 
68
        if (!fp)        return false;
69
        if (0x7f != fgetc(fp))  ret = false;
70
        if ('E'  != fgetc(fp))  ret = false;
71
        if ('L'  != fgetc(fp))  ret = false;
72
        if ('F'  != fgetc(fp))  ret = false;
73
        fclose(fp);
74
        return  ret;
75
}
76
 
77
long    fgetwords(FILE *fp) {
78
        // Return the number of words in the current file, and return the 
79
        // file as though it had never been adjusted
80
        long    fpos, flen;
81
        fpos = ftell(fp);
82
        if (0 != fseek(fp, 0l, SEEK_END)) {
83
                fprintf(stderr, "ERR: Could not determine file size\n");
84
                perror("O/S Err:");
85
                exit(-2);
86
        } flen = ftell(fp);
87
        if (0 != fseek(fp, fpos, SEEK_SET)) {
88
                fprintf(stderr, "ERR: Could not seek on file\n");
89
                perror("O/S Err:");
90
                exit(-2);
91
        } flen /= sizeof(FPGA::BUSW);
92
        return flen;
93
}
94
 
95 5 dgisselq
FPGA    *m_fpga;
96 29 dgisselq
class   SECTION {
97
public:
98
        unsigned        m_start, m_len;
99
        FPGA::BUSW      m_data[1];
100
};
101 5 dgisselq
 
102 29 dgisselq
SECTION **singlesection(int nwords) {
103
        fprintf(stderr, "NWORDS = %d\n", nwords);
104
        size_t  sz = (2*(sizeof(SECTION)+sizeof(SECTION *))
105
                +(nwords-1)*(sizeof(FPGA::BUSW)));
106
        char    *d = (char *)malloc(sz);
107
        SECTION **r = (SECTION **)d;
108
        memset(r, 0, sz);
109
        r[0] = (SECTION *)(&d[2*sizeof(SECTION *)]);
110
        r[0]->m_len   = nwords;
111
        r[1] = (SECTION *)(&r[0]->m_data[r[0]->m_len]);
112
        r[0]->m_start = 0;
113
        r[1]->m_start = 0;
114
        r[1]->m_len   = 0;
115
 
116
        return r;
117
}
118
 
119
SECTION **rawsection(const char *fname) {
120
        SECTION         **secpp, *secp;
121
        unsigned        num_words;
122
        FILE            *fp;
123
        int             nr;
124
 
125
        fp = fopen(fname, "r");
126
        if (fp == NULL) {
127
                fprintf(stderr, "Could not open: %s\n", fname);
128
                exit(-1);
129
        }
130
 
131
        if ((num_words=fgetwords(fp)) > MEMWORDS) {
132
                fprintf(stderr, "File overruns Block RAM\n");
133
                exit(-1);
134
        }
135
        secpp = singlesection(num_words);
136
        secp = secpp[0];
137
        secp->m_start = RAMBASE;
138
        secp->m_len = num_words;
139
        nr= fread(secp->m_data, sizeof(FPGA::BUSW), num_words, fp);
140
        if (nr != (int)num_words) {
141
                fprintf(stderr, "Could not read entire file\n");
142
                perror("O/S Err:");
143
                exit(-2);
144
        } assert(secpp[1]->m_len == 0);
145
 
146
        return secpp;
147
}
148
 
149
unsigned        byteswap(unsigned n) {
150
        unsigned        r;
151
 
152
        r = (n&0x0ff); n>>= 8;
153
        r = (r<<8) | (n&0x0ff); n>>= 8;
154
        r = (r<<8) | (n&0x0ff); n>>= 8;
155
        r = (r<<8) | (n&0x0ff); n>>= 8;
156
 
157
        return r;
158
}
159
 
160
// #define      CHEAP_AND_EASY
161
#ifdef  CHEAP_AND_EASY
162
#else
163
#include <libelf.h>
164
#include <gelf.h>
165
 
166
void    elfread(const char *fname, unsigned &entry, SECTION **&sections) {
167
        Elf     *e;
168
        int     fd, i;
169
        size_t  n;
170
        char    *id;
171
        Elf_Kind        ek;
172
        GElf_Ehdr       ehdr;
173
        GElf_Phdr       phdr;
174
        const   bool    dbg = false;
175
 
176
        if (elf_version(EV_CURRENT) == EV_NONE) {
177
                fprintf(stderr, "ELF library initialization err, %s\n", elf_errmsg(-1));
178
                perror("O/S Err:");
179
                exit(EXIT_FAILURE);
180
        } if ((fd = open(fname, O_RDONLY, 0)) < 0) {
181
                fprintf(stderr, "Could not open %s\n", fname);
182
                perror("O/S Err:");
183
                exit(EXIT_FAILURE);
184
        } if ((e = elf_begin(fd, ELF_C_READ, NULL))==NULL) {
185
                fprintf(stderr, "Could not run elf_begin, %s\n", elf_errmsg(-1));
186
                exit(EXIT_FAILURE);
187
        }
188
 
189
        ek = elf_kind(e);
190
        if (ek == ELF_K_ELF) {
191
                ; // This is the kind of file we should expect
192
        } else if (ek == ELF_K_AR) {
193
                fprintf(stderr, "Cannot run an archive!\n");
194
                exit(EXIT_FAILURE);
195
        } else if (ek == ELF_K_NONE) {
196
                ;
197
        } else {
198
                fprintf(stderr, "Unexpected ELF file kind!\n");
199
                exit(EXIT_FAILURE);
200
        }
201
 
202
        if (gelf_getehdr(e, &ehdr) == NULL) {
203
                fprintf(stderr, "getehdr() failed: %s\n", elf_errmsg(-1));
204
                exit(EXIT_FAILURE);
205
        } if ((i=gelf_getclass(e)) == ELFCLASSNONE) {
206
                fprintf(stderr, "getclass() failed: %s\n", elf_errmsg(-1));
207
                exit(EXIT_FAILURE);
208
        } if ((id = elf_getident(e, NULL)) == NULL) {
209
                fprintf(stderr, "getident() failed: %s\n", elf_errmsg(-1));
210
                exit(EXIT_FAILURE);
211
        } if (i != ELFCLASS32) {
212
                fprintf(stderr, "This is a 64-bit ELF file, ZipCPU ELF files are all 32-bit\n");
213
                exit(EXIT_FAILURE);
214
        }
215
 
216
        if (dbg) {
217
        printf("    %-20s 0x%jx\n", "e_type", (uintmax_t)ehdr.e_type);
218
        printf("    %-20s 0x%jx\n", "e_machine", (uintmax_t)ehdr.e_machine);
219
        printf("    %-20s 0x%jx\n", "e_version", (uintmax_t)ehdr.e_version);
220
        printf("    %-20s 0x%jx\n", "e_entry", (uintmax_t)ehdr.e_entry);
221
        printf("    %-20s 0x%jx\n", "e_phoff", (uintmax_t)ehdr.e_phoff);
222
        printf("    %-20s 0x%jx\n", "e_shoff", (uintmax_t)ehdr.e_shoff);
223
        printf("    %-20s 0x%jx\n", "e_flags", (uintmax_t)ehdr.e_flags);
224
        printf("    %-20s 0x%jx\n", "e_ehsize", (uintmax_t)ehdr.e_ehsize);
225
        printf("    %-20s 0x%jx\n", "e_phentsize", (uintmax_t)ehdr.e_phentsize);
226
        printf("    %-20s 0x%jx\n", "e_shentsize", (uintmax_t)ehdr.e_shentsize);
227
        printf("\n");
228
        }
229
 
230
 
231
        // Check whether or not this is an ELF file for the ZipCPU ...
232
        if (ehdr.e_machine != 0x0dadd) {
233
                fprintf(stderr, "This is not a ZipCPU ELF file\n");
234
                exit(EXIT_FAILURE);
235
        }
236
 
237
        // Get our entry address
238
        entry = ehdr.e_entry;
239
 
240
 
241
        // Now, let's go look at the program header
242
        if (elf_getphdrnum(e, &n) != 0) {
243
                fprintf(stderr, "elf_getphdrnum() failed: %s\n", elf_errmsg(-1));
244
                exit(EXIT_FAILURE);
245
        }
246
 
247
        unsigned total_octets = 0, current_offset=0, current_section=0;
248
        for(i=0; i<(int)n; i++) {
249
                total_octets += sizeof(SECTION *)+sizeof(SECTION);
250
 
251
                if (gelf_getphdr(e, i, &phdr) != &phdr) {
252
                        fprintf(stderr, "getphdr() failed: %s\n", elf_errmsg(-1));
253
                        exit(EXIT_FAILURE);
254
                }
255
 
256
                if (dbg) {
257
                printf("    %-20s 0x%x\n", "p_type",   phdr.p_type);
258
                printf("    %-20s 0x%jx\n", "p_offset", phdr.p_offset);
259
                printf("    %-20s 0x%jx\n", "p_vaddr",  phdr.p_vaddr);
260
                printf("    %-20s 0x%jx\n", "p_paddr",  phdr.p_paddr);
261
                printf("    %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
262
                printf("    %-20s 0x%jx\n", "p_memsz",  phdr.p_memsz);
263
                printf("    %-20s 0x%x [", "p_flags",  phdr.p_flags);
264
 
265
                if (phdr.p_flags & PF_X)        printf(" Execute");
266
                if (phdr.p_flags & PF_R)        printf(" Read");
267
                if (phdr.p_flags & PF_W)        printf(" Write");
268
                printf("]\n");
269
                printf("    %-20s 0x%jx\n", "p_align", phdr.p_align);
270
                }
271
 
272
                total_octets += phdr.p_memsz;
273
        }
274
 
275
        char    *d = (char *)malloc(total_octets);
276
        memset(d, 0, total_octets);
277
 
278
        SECTION **r = sections = (SECTION **)d;
279
        current_offset = (n+1)*sizeof(SECTION *);
280
        current_section = 0;
281
 
282
        for(i=0; i<(int)n; i++) {
283
                r[i] = (SECTION *)(&d[current_offset]);
284
 
285
                if (gelf_getphdr(e, i, &phdr) != &phdr) {
286
                        fprintf(stderr, "getphdr() failed: %s\n", elf_errmsg(-1));
287
                        exit(EXIT_FAILURE);
288
                }
289
 
290
                if (dbg) {
291
                printf("    %-20s 0x%jx\n", "p_offset", phdr.p_offset);
292
                printf("    %-20s 0x%jx\n", "p_vaddr",  phdr.p_vaddr);
293
                printf("    %-20s 0x%jx\n", "p_paddr",  phdr.p_paddr);
294
                printf("    %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
295
                printf("    %-20s 0x%jx\n", "p_memsz",  phdr.p_memsz);
296
                printf("    %-20s 0x%x [", "p_flags",  phdr.p_flags);
297
 
298
                if (phdr.p_flags & PF_X)        printf(" Execute");
299
                if (phdr.p_flags & PF_R)        printf(" Read");
300
                if (phdr.p_flags & PF_W)        printf(" Write");
301
                printf("]\n");
302
 
303
                printf("    %-20s 0x%jx\n", "p_align", phdr.p_align);
304
                }
305
 
306
                current_section++;
307
 
308
                r[i]->m_start = phdr.p_vaddr;
309
                r[i]->m_len   = phdr.p_filesz/ sizeof(FPGA::BUSW);
310
 
311
                current_offset += phdr.p_memsz + sizeof(SECTION);
312
 
313
                // Now, let's read in our section ...
314
                if (lseek(fd, phdr.p_offset, SEEK_SET) < 0) {
315
                        fprintf(stderr, "Could not seek to file position %08lx\n", phdr.p_offset);
316
                        perror("O/S Err:");
317
                        exit(EXIT_FAILURE);
318
                } if (phdr.p_filesz > phdr.p_memsz)
319
                        phdr.p_filesz = 0;
320
                if (read(fd, r[i]->m_data, phdr.p_filesz) != (int)phdr.p_filesz) {
321
                        fprintf(stderr, "Didnt read entire section\n");
322
                        perror("O/S Err:");
323
                        exit(EXIT_FAILURE);
324
                }
325
 
326
                // Next, we need to byte swap it from big to little endian
327
                for(unsigned j=0; j<r[i]->m_len; j++)
328
                        r[i]->m_data[j] = byteswap(r[i]->m_data[j]);
329
 
330
                if (dbg) for(unsigned j=0; j<r[i]->m_len; j++)
331
                        fprintf(stderr, "ADR[%04x] = %08x\n", r[i]->m_start+j,
332
                        r[i]->m_data[j]);
333
        }
334
 
335
        r[current_section]->m_start = 0;
336
        r[current_section]->m_len   = 0;
337
 
338
        elf_end(e);
339
        close(fd);
340
}
341
#endif
342
 
343
void    usage(void) {
344
        printf("USAGE: ziprun [-hmprux] <zip-program-file>\n");
345
        printf("\n"
346
"\t-h\tDisplay this usage statement\n"
347
"\t-m\tClear unused memory locations.  Note this only applies to SDRAM\n"
348
"\t\t(if used) and block ram, not flash.\n"
349
"\t-p [PORT]\tConnect to the XuLA device across a network access\n"
350
"\t\tconnection using port PORT, rather than attempting a USB\n"
351
"\t\tconnection.  If PORT is not given, %s:%d will be\n"
352
"\t\tassumed as a default.\n"
353
"\t-u\tAccess the XuLA board via the USB connector [DEFAULT]\n"
354
"\t-x\tClear all of the ZipCPU registers to a known initial state\n\n",
355
        FPGAHOST,FPGAPORT);
356
}
357
 
358 5 dgisselq
int main(int argc, char **argv) {
359 29 dgisselq
        int             skp=0, port = FPGAPORT;
360
        bool            use_usb = true, permit_raw_files = false;
361
        unsigned        entry = RAMBASE;
362
        bool            clear_registers = false, clear_memory = false;
363
        FLASHDRVR       *flash = NULL;
364 5 dgisselq
 
365 29 dgisselq
        if (argc < 2) {
366
                usage();
367
                exit(EXIT_SUCCESS);
368
        }
369
 
370 5 dgisselq
        skp=1;
371
        for(int argn=0; argn<argc-skp; argn++) {
372
                if (argv[argn+skp][0] == '-') {
373 29 dgisselq
                        switch(argv[argn+skp][1]) {
374
                        case 'h':
375
                                usage();
376
                                exit(EXIT_SUCCESS);
377
                        case 'm':
378
                                clear_memory = true;
379
                                fprintf(stderr, "Clear memory feature not yet implemented\n");
380
                                exit(EXIT_FAILURE);
381
                                break;
382
                        case 'p':
383 5 dgisselq
                                use_usb = false;
384
                                if (isdigit(argv[argn+skp][2]))
385
                                        port = atoi(&argv[argn+skp][2]);
386 29 dgisselq
                                break;
387
                        case 'r':
388
                                permit_raw_files = true;
389
                                break;
390
                        case 'u':
391
                                use_usb = true;
392
                                break;
393
                        case 'x':
394
                                clear_registers = true;
395
                                break;
396
                        } skp++; argn--;
397 5 dgisselq
                } else
398
                        argv[argn] = argv[argn+skp];
399
        } argc -= skp;
400
 
401
        if (use_usb)
402
                m_fpga = new FPGA(new USBI());
403
        else
404
                m_fpga = new FPGA(new NETCOMMS(FPGAHOST, port));
405
 
406
        if ((argc<=0)||(access(argv[0],R_OK)!=0)) {
407
                printf("Usage: ziprun obj-file\n");
408
                printf("\n"
409
"\tziprun loads the object file into memory, resets the CPU, and leaves it\n"
410
"\tin a halted state ready to start running the object file.\n");
411
                exit(-1);
412 29 dgisselq
        } const char *codef = argv[0];
413 5 dgisselq
 
414
        printf("Halting the CPU\n");
415 11 dgisselq
        m_fpga->usleep(5);
416 5 dgisselq
        m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT);
417
 
418
        try {
419 29 dgisselq
                SECTION **secpp = NULL, *secp;
420 5 dgisselq
 
421 29 dgisselq
                if(iself(codef)) {
422
#ifndef CHEAP_AND_EASY
423
                        // zip-readelf will help with both of these ...
424
                        elfread(codef, entry, secpp);
425 5 dgisselq
 
426 29 dgisselq
                        fprintf(stderr, "Secpp = %08lx\n", (unsigned long)secpp);
427
                        for(int i=0; secpp[i]->m_len; i++) {
428
                                secp = secpp[i];
429
                                fprintf(stderr, "Sec[%2d] - %08x - %08x\n",
430
                                        i, secp->m_start,
431
                                        secp->m_start+secp->m_len);
432
                        }
433
#else
434
                        char    tmpbuf[TMP_MAX], cmdbuf[256];
435
                        int     unused_fd;
436
 
437
                        strcpy(tmpbuf, "/var/tmp/ziprunXXXX");
438
 
439
                        // Make a temporary file
440
                        unused_fd = mkostemp(tmpbuf, O_CREAT|O_TRUNC|O_RDWR);
441
                        // Close it immediately, since we won't be writing to it
442
                        // ourselves
443
                        close(unused_fd);
444
 
445
                        // Now we write to it, as part of calling objcopy
446
                        // 
447
                        sprintf(cmdbuf, "zip-objcopy -S -O binary --reverse-bytes=4 %s %s", codef, tmpbuf);
448
 
449
                        if (system(cmdbuf) != 0) {
450
                                unlink(tmpbuf);
451
                                fprintf(stderr, "ZIPRUN: Could not comprehend ELF binary\n");
452
                                exit(-2);
453
                        }
454
 
455
                        secpp = rawsection(tmpbuf);
456
                        unlink(tmpbuf);
457
                        entry = RAMBASE;
458 5 dgisselq
#endif
459 29 dgisselq
                } else if (permit_raw_files) {
460
                        secpp = rawsection(codef);
461
                        entry = RAMBASE;
462
                }
463 5 dgisselq
 
464 29 dgisselq
                // assert(secpp[1]->m_len = 0);
465
                for(int i=0; secpp[i]->m_len; i++) {
466
                        bool    valid = false;
467
                        secp=  secpp[i];
468
                        if ((secp->m_start >= RAMBASE)&&(secp->m_start+secp->m_len <= RAMBASE+MEMWORDS))
469
                                valid = true;
470
                        else if ((secp->m_start >= SDRAMBASE)&&(secp->m_start+secp->m_len <= SDRAMBASE+SDRAMWORDS))
471
                                valid = true;
472
                        else if ((secp->m_start >= SPIFLASH)&&(secp->m_start+secp->m_len <= SPIFLASH+FLASHWORDS))
473
                                valid = true;
474
                        if (!valid) {
475
                                fprintf(stderr, "No such memory on board: 0x%08x - %08x\n",
476
                                        secp->m_start, secp->m_start+secp->m_len);
477
                                exit(-2);
478
                        }
479
                }
480 5 dgisselq
 
481 29 dgisselq
                if (clear_memory) for(int i=0; secpp[i]->m_len; i++) {
482
                        secp = secpp[i];
483
                        if ((secp->m_start >= RAMBASE)
484
                                        &&(secp->m_start+secp->m_len
485
                                                        <= RAMBASE+MEMWORDS)) {
486
                                FPGA::BUSW      zbuf[128], a;
487
                                memset(zbuf, 0, 128*sizeof(FPGA::BUSW));
488
                                for(a=RAMBASE; a<RAMBASE+MEMWORDS; a+=128)
489
                                        m_fpga->writei(a, 128, zbuf);
490
                                break;
491
                        }
492 5 dgisselq
                }
493 29 dgisselq
 
494
                if (clear_memory) for(int i=0; secpp[i]->m_len; i++) {
495
                        secp = secpp[i];
496
                        if ((secp->m_start >= SDRAMBASE)
497
                                        &&(secp->m_start+secp->m_len
498
                                                <= SDRAMBASE+SDRAMWORDS)) {
499
                                FPGA::BUSW      zbuf[128], a;
500
                                memset(zbuf, 0, 128*sizeof(FPGA::BUSW));
501
                                for(a=SDRAMBASE; a<SDRAMBASE+SDRAMWORDS; a+=128)
502
                                        m_fpga->writei(a, 128, zbuf);
503
                                break;
504
                        }
505 5 dgisselq
                }
506 29 dgisselq
 
507
                for(int i=0; secpp[i]->m_len; i++) {
508
                        bool    inflash=false;
509 11 dgisselq
 
510 29 dgisselq
                        secp = secpp[i];
511
                        if ((secp->m_start >= SPIFLASH)
512
                                        &&(secp->m_start+secp->m_len
513
                                                        <= SPIFLASH+FLASHWORDS))
514
                                inflash = true;
515
                        if (inflash) {
516
                                if (!flash)
517
                                        flash = new FLASHDRVR(m_fpga);
518
                                flash->write(secp->m_start, secp->m_len, secp->m_data, true);
519
                        } else
520
                                m_fpga->writei(secp->m_start, secp->m_len, secp->m_data);
521 5 dgisselq
                }
522 29 dgisselq
                m_fpga->readio(R_ZIPCTRL);
523 5 dgisselq
 
524 29 dgisselq
                // Clear any buffers
525
                printf("Clearing the cache\n");
526
                m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT|CPU_CLRCACHE);
527
 
528
                if (clear_registers) {
529
                        printf("Clearing all registers to zero\n");
530
                        // Clear all registers to zero
531
                        for(int i=0; i<32; i++) {
532
                                m_fpga->writeio(R_ZIPCTRL, CPU_HALT|i);
533
                                m_fpga->writeio(R_ZIPDATA, 0);
534
                        }
535
                }
536
 
537
                // Start in interrupt mode
538
                m_fpga->writeio(R_ZIPCTRL, CPU_HALT|CPU_sCC);
539 5 dgisselq
                m_fpga->writeio(R_ZIPDATA, 0x000);
540
 
541 29 dgisselq
                // Set our entry point into our code
542 5 dgisselq
                m_fpga->writeio(R_ZIPCTRL, CPU_HALT|CPU_sPC);
543 29 dgisselq
                m_fpga->writeio(R_ZIPDATA, entry);
544
        } catch(BUSERR a) {
545
                fprintf(stderr, "XULA-BUS error\n");
546
                m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT|CPU_CLRCACHE);
547
                exit(-2);
548 5 dgisselq
        }
549
 
550
        delete  m_fpga;
551
}
552
 

powered by: WebSVN 2.1.0

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