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

Subversion Repositories tinyvliw8

[/] [tinyvliw8/] [trunk/] [tools/] [asm/] [src/] [instr.h] - Blame information for rev 9

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

Line No. Rev Author Line
1 6 steckol
/**
2
 * \file   instr.h
3
 * \author Oliver Stecklina <stecklina@ihp-microelectronics.com>
4
 * \date   12.12.2015
5
 *
6
 * \brief  Instruction decoder
7
 *
8
 * <p>
9
 *    Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
10
 *
11
 * This code is free software. It is licensed under the EUPL, Version 1.1
12
 * or - as soon they will be approved by the European Commission - subsequent
13
 * versions of the EUPL (the "License").
14
 * You may redistribute this code and/or modify it under the terms of this
15
 * License.
16
 * You may not use this work except in compliance with the License.
17
 * You may obtain a copy of the License at:
18
 *
19
 * http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
20
 *
21
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" basis,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26
 * </p>
27
 */
28
 
29 5 steckol
#ifndef INSTR_H
30
#define INSTR_H
31
 
32
#include "list.h"
33
 
34
#define INSTR_FLAG_TILDE 0x01
35
#define INSTR_FLAG_MINUS 0x02
36
 
37
typedef enum _instr_opcode_e {
38
        instr_opcode_ld = 0,
39
        instr_opcode_ldi,
40
        instr_opcode_st,
41
        instr_opcode_sti,
42
        instr_opcode_add,
43
        instr_opcode_addi,
44
        instr_opcode_mov,
45
        instr_opcode_rla,
46
        instr_opcode_rlc,
47
        instr_opcode_rra,
48
        instr_opcode_rrc,
49
        instr_opcode_and,
50
        instr_opcode_nand,
51
        instr_opcode_or,
52
        instr_opcode_nor,
53
        instr_opcode_xor,
54
        instr_opcode_xnor,
55
        instr_opcode_jmp,
56
        instr_opcode_jc,
57
        instr_opcode_jz,
58
        instr_opcode_jnz
59
} instr_opcode_t;
60
 
61
typedef enum _operand_type_e {
62
        instr_operand_type_reg = 0,
63
        instr_operand_type_const,
64
        instr_operand_type_label,
65
} instr_operand_type_t;
66
 
67
typedef struct _operand_s {
68
        list_t list;
69
 
70
        instr_operand_type_t type;
71
 
72
        unsigned short value;
73
        unsigned char flags;
74
 
75
        char *label;
76
} instr_operand_t;
77
 
78
typedef struct _instr_s {
79
        instr_opcode_t opcode;
80
 
81
        list_t source;
82
        instr_operand_t dest;
83
} instr_t;
84
 
85
typedef struct _vliw_instr_s {
86
        list_t list;
87
 
88
        unsigned short addr;
89
 
90
        unsigned char num;
91
        instr_t instr[2];
92
} instr_vliw_t;
93
 
94
typedef struct _instr_label_s {
95
        list_t list;
96
 
97
        unsigned int offset;
98
        char name[0];
99
} instr_label_t;
100
 
101
void instr_label(const char *name);
102
void instr_add(const instr_t *instr, const unsigned char num);
103
void instr_add_source(list_t *head, instr_operand_type_t type, const void *data);
104
void instr_add_dest(instr_operand_t *op, const unsigned char num);
105
void instr_source_flag(list_t *source, unsigned char flag);
106
void instr_irq(unsigned char num);
107
 
108
#endif

powered by: WebSVN 2.1.0

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