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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [doc/] [architecture.eco32e] - Blame information for rev 197

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

Line No. Rev Author Line
1 6 hellwig
 
2
Instruction Formats
3
-------------------
4
 
5
RRR (three register operands)
6
RRS (two registers and a signed half operand)
7
RRH (two registers and an unsigned half operand)
8
RHH (one register and a half operand, high-order 16 bits encoded)
9
RRB (two registers and a 16 bit signed offset operand)
10
J   (no registers and a 26 bit signed offset operand)
11
JR  (one register operand)
12
 
13
 
14
Instruction Set
15
---------------
16
 
17
Notation:
18
  'r[n]'        The bits representing 'r' are padded with zeroes
19
                to the left (or zeroes are dropped from the left)
20
                until a width of n bits is reached.
21
  'a || b'      The bits representing 'a' and 'b' are concatenated;
22
                'a' occupies the more significant bits.
23
All numbers are given in decimal (base 10), except when prefixed
24
with "0x", which means they are given in hexadecimal (base 16).
25
 
26
ADD (add)
27
  format:       RRR
28
  coding:       0x00[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
29
  assembler:    add  rd,rs1,rs2
30
  example:      add  $1,$2,$3
31
  operation:    The contents of register rs2 are added to the contents
32
                of register rs1. The result is stored into register rd.
33
                Overflow is ignored.
34
 
35
ADDI (add immediate)
36
  format:       RRS
37
  coding:       0x01[6] || rs1[5] || rd[5] || simm[16]
38
  assembler:    add  rd,rs1,simm
39
  example:      add  $1,$2,1234
40
  operation:    The sign-extended immediate constant simm is added to
41
                the contents of register rs1. The result is stored into
42
                register rd. Overflow is ignored.
43
 
44
SUB (subtract)
45
  format:       RRR
46
  coding:       0x02[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
47
  assembler:    sub  rd,rs1,rs2
48
  example:      sub  $1,$2,$3
49
  operation:    The contents of register rs2 are subtracted from the
50
                contents of register rs1. The result is stored into
51
                register rd. Overflow is ignored.
52
 
53
SUBI (subtract immediate)
54
  format:       RRS
55
  coding:       0x03[6] || rs1[5] || rd[5] || simm[16]
56
  assembler:    sub  rd,rs1,simm
57
  example:      add  $1,$2,1234
58
  operation:    The sign-extended immediate constant simm is subtracted
59
                from the contents of register rs1. The result is stored
60
                into register rd. Overflow is ignored.
61
 
62
AND (logical and)
63
  format:       RRR
64
  coding:       0x10[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
65
  assembler:    and  rd,rs1,rs2
66
  example:      and  $1,$2,$3
67
  operation:    The contents of register rs2 are bitwise anded with the
68
                contents of register rs1. The result is stored into
69
                register rd.
70
 
71
ANDI (logical and immediate)
72
  format:       RRH
73
  coding:       0x11[6] || rs1[5] || rd[5] || uimm[16]
74
  assembler:    and  rd,rs1,uimm
75
  example:      and  $1,$2,1234
76
  operation:    The zero-extended immediate constant uimm is bitwise
77
                anded with the contents of register rs1. The result
78
                is stored into register rd.
79
 
80
OR (logical or)
81
  format:       RRR
82
  coding:       0x12[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
83
  assembler:    or  rd,rs1,rs2
84
  example:      or  $1,$2,$3
85
  operation:    The contents of register rs2 are bitwise ored with the
86
                contents of register rs1. The result is stored into
87
                register rd.
88
 
89
ORI (logical or immediate)
90
  format:       RRH
91
  coding:       0x13[6] || rs1[5] || rd[5] || uimm[16]
92
  assembler:    or  rd,rs1,uimm
93
  example:      or  $1,$2,1234
94
  operation:    The zero-extended immediate constant uimm is bitwise
95
                ored with the contents of register rs1. The result
96
                is stored into register rd.
97
 
98
XOR (logical xor)
99
  format:       RRR
100
  coding:       0x14[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
101
  assembler:    xor  rd,rs1,rs2
102
  example:      xor  $1,$2,$3
103
  operation:    The contents of register rs2 are bitwise xored with the
104
                contents of register rs1. The result is stored into
105
                register rd.
106
                Remark: (a xor b) <=> ((a and ~b) or (~a and b))
107
 
108
XORI (logical xor immediate)
109
  format:       RRH
110
  coding:       0x15[6] || rs1[5] || rd[5] || uimm[16]
111
  assembler:    xor  rd,rs1,uimm
112
  example:      xor  $1,$2,1234
113
  operation:    The zero-extended immediate constant uimm is bitwise
114
                xored with the contents of register rs1. The result
115
                is stored into register rd.
116
                Remark: (a xor b) <=> ((a and ~b) or (~a and b))
117
 
118
XNOR (logical xnor)
119
  format:       RRR
120
  coding:       0x16[6] || rs1[5] || rs2[5] || rd[5] || 0[11]
121
  assembler:    xnor  rd,rs1,rs2
122
  example:      xnor  $1,$2,$3
123
  operation:    The contents of register rs2 are bitwise xnored with the
124
                contents of register rs1. The result is stored into
125
                register rd.
126
                Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
127
 
128
XNORI (logical xnor immediate)
129
  format:       RRH
130
  coding:       0x17[6] || rs1[5] || rd[5] || uimm[16]
131
  assembler:    xnor  rd,rs1,uimm
132
  example:      xnor  $1,$2,1234
133
  operation:    The zero-extended immediate constant uimm is bitwise
134
                xnored with the contents of register rs1. The result
135
                is stored into register rd.
136
                Remark: (a xnor b) <=> ((a and b) or (~a and ~b))
137
 
138
LDHI (load high immediate)
139
  format:       RHH
140
  coding:       0x1F[6] || 0[5] || rd[5] || uimm[16]
141
  assembler:    ldhi  rd,uimm
142
  example:      ldhi  $1,1234
143
  operation:    The zero-extended immediate constant uimm is shifted
144
                left by 16 bits. The result is stored into register rd.
145
 
146
BEQ (branch on equal)
147
  format:       RRB
148
  coding:       0x20[6] || rs1[5] || rs2[5] || simm[16]
149
  assembler:    beq  rs1,rs2,target
150
  example:      beq  $1,$2,label3
151
  operation:    If the contents of register rs1 are equal to the contents
152
                of register rs2, the sign-extended immediate constant
153
                simm is shifted left by two bits and added to the address
154
                of the instruction following the branch instruction. The
155
                result is placed into the program counter. If the contents
156
                differ, the next instruction after the branch is executed.
157
 
158
BNE (branch on not equal)
159
  format:       RRB
160
  coding:       0x21[6] || rs1[5] || rs2[5] || simm[16]
161
  assembler:    bne  rs1,rs2,target
162
  example:      bne  $1,$2,label3
163
  operation:    If the contents of register rs1 are not equal to the contents
164
                of register rs2, the sign-extended immediate constant
165
                simm is shifted left by two bits and added to the address
166
                of the instruction following the branch instruction. The
167
                result is placed into the program counter. If the contents
168
                are equal, the next instruction after the branch is executed.
169
 
170
BLEU (branch on less or equal unsigned)
171
  format:       RRB
172
  coding:       0x23[6] || rs1[5] || rs2[5] || simm[16]
173
  assembler:    bleu  rs1,rs2,target
174
  example:      bleu  $1,$2,label3
175
  operation:    If the contents of register rs1 are less than or equal
176
                to the contents of register rs2 (both are interpreted as
177
                unsigned numbers), the sign-extended immediate constant
178
                simm is shifted left by two bits and added to the address
179
                of the instruction following the branch instruction. The
180
                result is placed into the program counter. If the contents
181
                do not satisfy the condition, the next instruction after
182
                the branch is executed.
183
 
184
BLTU (branch on less than unsigned)
185
  format:       RRB
186
  coding:       0x25[6] || rs1[5] || rs2[5] || simm[16]
187
  assembler:    bltu  rs1,rs2,target
188
  example:      bltu  $1,$2,label3
189
  operation:    If the contents of register rs1 are less than the contents
190
                of register rs2 (both are interpreted as unsigned numbers),
191
                the sign-extended immediate constant simm is shifted left
192
                by two bits and added to the address of the instruction
193
                following the branch instruction. The result is placed into
194
                the program counter. If the contents do not satisfy the
195
                condition, the next instruction after the branch is executed.
196
 
197
BGEU (branch on greater or equal unsigned)
198
  format:       RRB
199
  coding:       0x27[6] || rs1[5] || rs2[5] || simm[16]
200
  assembler:    bgeu  rs1,rs2,target
201
  example:      bgeu  $1,$2,label3
202
  operation:    If the contents of register rs1 are greater than or equal
203
                to the contents of register rs2 (both are interpreted as
204
                unsigned numbers), the sign-extended immediate constant
205
                simm is shifted left by two bits and added to the address
206
                of the instruction following the branch instruction. The
207
                result is placed into the program counter. If the contents
208
                do not satisfy the condition, the next instruction after
209
                the branch is executed.
210
 
211
BGTU (branch on greater than unsigned)
212
  format:       RRB
213
  coding:       0x29[6] || rs1[5] || rs2[5] || simm[16]
214
  assembler:    bgtu  rs1,rs2,target
215
  example:      bgtu  $1,$2,label3
216
  operation:    If the contents of register rs1 are greater than the contents
217
                of register rs2 (both are interpreted as unsigned numbers),
218
                the sign-extended immediate constant simm is shifted left
219
                by two bits and added to the address of the instruction
220
                following the branch instruction. The result is placed into
221
                the program counter. If the contents do not satisfy the
222
                condition, the next instruction after the branch is executed.
223
 
224
J (jump)
225
  format:       J
226
  coding:       0x2A[6] || simm[26]
227
  assembler:    j  target
228
  example:      j  label3
229
  operation:    The sign-extended immediate constant simm is shifted left
230
                by two bits and added to the address of the instruction
231
                following the jump instruction. The result is placed into
232
                the program counter.
233
 
234
JR (jump register)
235
  format:       JR
236
  coding:       0x2B[6] || rs[5] || 0[5] || 0[16]
237
  assembler:    jr  rs
238
  example:      jr  $31
239
  operation:    The contents of register rs are placed into the program
240
                counter.
241
 
242
JAL (jump and link)
243
  format:       J
244
  coding:       0x2C[6] || simm[26]
245
  assembler:    jal  target
246
  example:      jal  label3
247
  operation:    The address of the instruction following the jal instruction
248
                is placed into register 31. The sign-extended immediate
249
                constant simm is shifted left by two bits and added to the
250
                address of the instruction following the jal instruction.
251
                The result is placed into the program counter.
252
 
253
LDW (load word)
254
  format:       RRS
255
  coding:       0x30[6] || rs[5] || rd[5] || simm[16]
256
  assembler:    ldw  rd,rs,simm
257
  example:      ldw  $1,$2,1234
258
  operation:    The sign-extended immediate constant simm is added to the
259
                contents of register rs to form an effective memory address.
260
                A word is read from this address and stored into register
261
                rd.
262
 
263
LDH (load halfword)
264
  format:       RRS
265
  coding:       0x31[6] || rs[5] || rd[5] || simm[16]
266
  assembler:    ldh  rd,rs,simm
267
  example:      ldh  $1,$2,1234
268
  operation:    The sign-extended immediate constant simm is added to the
269
                contents of register rs to form an effective memory address.
270
                A halfword is read from this address, sign-extended, and
271
                stored into register rd.
272
 
273
LDHU (load halfword unsigned)
274
  format:       RRS
275
  coding:       0x32[6] || rs[5] || rd[5] || simm[16]
276
  assembler:    ldhu  rd,rs,simm
277
  example:      ldhu  $1,$2,1234
278
  operation:    The sign-extended immediate constant simm is added to the
279
                contents of register rs to form an effective memory address.
280
                A halfword is read from this address, zero-extended, and
281
                stored into register rd.
282
 
283
LDB (load byte)
284
  format:       RRS
285
  coding:       0x33[6] || rs[5] || rd[5] || simm[16]
286
  assembler:    ldb  rd,rs,simm
287
  example:      ldb  $1,$2,1234
288
  operation:    The sign-extended immediate constant simm is added to the
289
                contents of register rs to form an effective memory address.
290
                A byte is read from this address, sign-extended, and stored
291
                into register rd.
292
 
293
LDBU (load byte unsigned)
294
  format:       RRS
295
  coding:       0x34[6] || rs[5] || rd[5] || simm[16]
296
  assembler:    ldbu  rd,rs,simm
297
  example:      ldbu  $1,$2,1234
298
  operation:    The sign-extended immediate constant simm is added to the
299
                contents of register rs to form an effective memory address.
300
                A byte is read from this address, zero-extended, and stored
301
                into register rd.
302
 
303
STW (store word)
304
  format:       RRS
305
  coding:       0x35[6] || rs[5] || rd[5] || simm[16]
306
  assembler:    stw  rd,rs,simm
307
  example:      stw  $1,$2,1234
308
  operation:    The sign-extended immediate constant simm is added to the
309
                contents of register rs to form an effective memory address.
310
                The contents of register rd (all 32 bits) are stored
311
                as a word to this address.
312
 
313
STH (store halfword)
314
  format:       RRS
315
  coding:       0x36[6] || rs[5] || rd[5] || simm[16]
316
  assembler:    sth  rd,rs,simm
317
  example:      sth  $1,$2,1234
318
  operation:    The sign-extended immediate constant simm is added to the
319
                contents of register rs to form an effective memory address.
320
                The contents of register rd (the lower 16 bits) are stored
321
                as a halfword to this address.
322
 
323
STB (store byte)
324
  format:       RRS
325
  coding:       0x37[6] || rs[5] || rd[5] || simm[16]
326
  assembler:    stb  rd,rs,simm
327
  example:      stb  $1,$2,1234
328
  operation:    The sign-extended immediate constant simm is added to the
329
                contents of register rs to form an effective memory address.
330
                The contents of register rd (the lowest 8 bits) are stored
331
                as a byte to this address.
332
 
333
 
334
Interrupts and Exceptions
335
-------------------------
336
 
337
There are neither interrupts nor exceptions in this version of ECO32e.
338
Unknown opcodes should nevertheless be recognized. A CPU simulation can
339
then report the execution of an unknown opcode; an implementation may
340
trap such an execution in a state of its controller which cannot be left
341
without reset.
342
 
343
 
344
Peripherals
345
-----------
346
 
347
Peripherals are memory-mapped. They need only support word accesses.
348
A sensible reaction to accesses with smaller widths (halfword or byte)
349
is not required.
350
 
351
In this version of ECO32e there are only two peripherals: a character
352
display and a keyboard.
353
 
354
The character display is capable of showing 30 lines with 80 characters
355
each. Its base address is 0x30100000. Each line occupies 128 words in
356
the I/O address space, one word for each column (and 48 unusable columns
357
at the end of the line). Therefore the address to which a character is
358
written and its location on the screen are related as follows:
359
    address = 0x30100000 + (line * 128 + column) * 4
360
The character to be displayed must be written as a word to the corresponding
361
address with its ASCII code contained in the lowest 8 bits of the word.
362
 
363
The keyboard is represented by two I/O registers. The status register
364
is located at address 0x30200000. When read (32 bits), its LSB indicates
365
if a character has been received from the physical keyboard. If this bit
366
is 1, the character can be read at address 0x30200004, the address of
367
the data register. By reading this latter address, the LSB of the
368
status register is automatically reset to 0. The data register must be
369
read with a word read; the character read is contained in the lowest
370
8 bits of the word.
371
 

powered by: WebSVN 2.1.0

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