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

Subversion Repositories igor

[/] [igor/] [trunk/] [simulator/] [machine.c] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 atypic
#include <stdio.h>
2
#include <err.h>
3
 
4
#include "memory.h"
5
#include "regs.h"
6
#include "instructions.h"
7
#include "microcode.h"
8
#include "object.h"
9
#include "breakpoint.h"
10
#include "print.h"
11
#include "machine.h"
12
#include "profiler.h"
13
 
14
static int running = 0;
15
 
16
void
17
machine_init(char *microcodepath, char *memorypath, unsigned int availmem, char *regpath, int cache_size)
18
{
19
        if (!memory_init(availmem, memorypath))
20
                err(1, "Unable to allocate memory");
21
        if (!microcode_init(microcodepath))
22
                err(1, "Unable to initialize microcode");
23
        instructions_init();
24
        regs_init(regpath);
25
        breakpoint_init();
26
        print_init();
27
}
28
 
29
void
30
machine_shutdown(void)
31
{
32
#if 0
33
        reg_t r;
34
        int i;
35
#endif
36
 
37
        running = 0;
38
 
39
        printf("Machine halted.\n\n");
40
 
41
#if 0
42
        printf("Lowest part of memory:\n");
43
        for (i = 0; i < 32; i++) {
44
                r = memory_get(i);
45
                printf("\t0x%07X ", i);
46
                object_dump(r);
47
        }
48
 
49
        printf("Lowest part of skratch:\n");
50
        for (i = 0; i < 32; i++) {
51
                r = reg_get(i);
52
                printf("\t0x%07X ", i);
53
                object_dump(r);
54
        }
55
#endif
56
 
57
        printf("Status flags:\n");
58
        printf("\tOCNZTI\n");
59
        printf("\t%d%d%d%d%d%d\n",
60
               get_status_flag(ST_O),
61
               get_status_flag(ST_C),
62
               get_status_flag(ST_N),
63
               get_status_flag(ST_Z),
64
               get_status_flag(ST_T),
65
               get_status_flag(ST_I));
66
}
67
 
68
void
69
machine_shutup(void)
70
{
71
        reg_set(REG_ST, 0);
72
        reg_set(REG_PC, 0);
73
        running = 1;
74
}
75
 
76
int
77
machine_up(void)
78
{
79
        return running;
80
}
81
 

powered by: WebSVN 2.1.0

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