* emultempl/pe.em (gld_${EMULATION_NAME}_before_allocation): Put
[deliverable/binutils-gdb.git] / sim / mips / sky-vu0.c
1 /* Copyright (C) 1998, Cygnus Solutions
2
3 */
4
5 #include "sim-main.h"
6
7 #include "sky-device.h"
8 #include "sky-vu.h"
9 #include "sky-vu0.h"
10
11 VectorUnitState vu0_state;
12
13 /* these are aligned versions of zalloc() pointers - do not zfree()! */
14 static char* vu0_mem0_buffer = 0;
15 static char* vu0_mem1_buffer = 0;
16
17
18 void
19 vu0_issue(void)
20 {
21 }
22
23 static int
24 vu0_io_read_buffer(device *me,
25 void *dest,
26 int space,
27 address_word addr,
28 unsigned nr_bytes,
29 sim_cpu *processor,
30 sim_cia cia)
31 {
32 if (addr < VU0_REGISTER_WINDOW_START)
33 return 0;
34
35 addr -= VU0_REGISTER_WINDOW_START;
36
37 /* Adjust nr_bytes if too big */
38 if ((addr + nr_bytes) > VU_REG_END)
39 nr_bytes -= addr + nr_bytes - VU_REG_END;
40
41 return read_vu_registers (&vu0_state, addr, nr_bytes, dest);
42 }
43
44 static int
45 vu0_io_write_buffer(device *me,
46 const void *source,
47 int space,
48 address_word addr,
49 unsigned nr_bytes,
50 sim_cpu *processor,
51 sim_cia cia)
52 {
53 if (addr < VU0_REGISTER_WINDOW_START)
54 return 0;
55
56 addr -= VU0_REGISTER_WINDOW_START;
57
58 /* Adjust nr_bytes if too big */
59 if ((addr + nr_bytes) > VU_REG_END)
60 nr_bytes -= addr + nr_bytes - VU_REG_END;
61
62 return write_vu_registers (&vu0_state, addr, nr_bytes, source);
63 }
64
65 device vu0_device =
66 {
67 "vu0",
68 &vu0_io_read_buffer,
69 &vu0_io_write_buffer
70 };
71
72 void
73 vu0_attach(SIM_DESC sd)
74 {
75 sim_core_attach (sd,
76 NULL,
77 0 /*level*/,
78 access_read_write,
79 0 /*space ???*/,
80 VU0_REGISTER_WINDOW_START,
81 VU_REG_END /*nr_bytes*/,
82 0 /*modulo*/,
83 &vu0_device,
84 NULL /*buffer*/);
85
86 vu0_mem0_buffer = zalloc(VU0_MEM0_SIZE);
87 vu0_mem0_buffer = (void*) ALIGN_16((unsigned)vu0_mem0_buffer);
88 sim_core_attach (sd,
89 NULL,
90 0 /*level*/,
91 access_read_write,
92 0 /*space ???*/,
93 VU0_MEM0_WINDOW_START,
94 VU0_MEM0_SIZE /*nr_bytes*/,
95 0 /*modulo*/,
96 0 /*device*/,
97 vu0_mem0_buffer /*buffer*/);
98
99 vu0_mem1_buffer = zalloc(VU0_MEM1_SIZE);
100 vu0_mem1_buffer = (void*) ALIGN_16((unsigned)vu0_mem1_buffer);
101 sim_core_attach (sd,
102 NULL,
103 0 /*level*/,
104 access_read_write,
105 0 /*space ???*/,
106 VU0_MEM1_WINDOW_START,
107 VU0_MEM1_SIZE /*nr_bytes*/,
108 0 /*modulo*/,
109 0 /*device*/,
110 vu0_mem1_buffer /*buffer*/);
111 }
This page took 0.031012 seconds and 4 git commands to generate.