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

Subversion Repositories tinyvliw8

[/] [tinyvliw8/] [trunk/] [tools/] [asm/] [src/] [instr.h] - Rev 6

Compare with Previous | Blame | View Log

/**
 * \file   instr.h
 * \author Oliver Stecklina <stecklina@ihp-microelectronics.com>
 * \date   12.12.2015
 * 
 * \brief  Instruction decoder
 *
 * <p>
 *    Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
 *
 * This code is free software. It is licensed under the EUPL, Version 1.1
 * or - as soon they will be approved by the European Commission - subsequent
 * versions of the EUPL (the "License").
 * You may redistribute this code and/or modify it under the terms of this
 * License.
 * You may not use this work except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */
 
#ifndef INSTR_H
#define INSTR_H
 
#include "list.h"
 
#define INSTR_FLAG_TILDE 0x01
#define INSTR_FLAG_MINUS 0x02
 
typedef enum _instr_opcode_e {
	instr_opcode_ld = 0,
	instr_opcode_ldi,
	instr_opcode_st,
	instr_opcode_sti,
	instr_opcode_add,
	instr_opcode_addi,
	instr_opcode_mov,
	instr_opcode_rla,
	instr_opcode_rlc,
	instr_opcode_rra,
	instr_opcode_rrc,
	instr_opcode_and,
	instr_opcode_nand,
	instr_opcode_or,
	instr_opcode_nor,
	instr_opcode_xor,
	instr_opcode_xnor,
	instr_opcode_jmp,
	instr_opcode_jc,
	instr_opcode_jz,
	instr_opcode_jnz
} instr_opcode_t;
 
typedef enum _operand_type_e {
	instr_operand_type_reg = 0,
	instr_operand_type_const,
	instr_operand_type_label,
} instr_operand_type_t;
 
typedef struct _operand_s {
	list_t list;
 
	instr_operand_type_t type;
 
	unsigned short value;
	unsigned char flags;
 
	char *label;
} instr_operand_t;
 
typedef struct _instr_s {
	instr_opcode_t opcode;
 
	list_t source;
	instr_operand_t dest;
} instr_t;
 
typedef struct _vliw_instr_s {
	list_t list;
 
	unsigned short addr;
 
	unsigned char num;
	instr_t instr[2];
} instr_vliw_t;
 
typedef struct _instr_label_s {
	list_t list;
 
	unsigned int offset;
	char name[0];
} instr_label_t;
 
void instr_label(const char *name);
void instr_add(const instr_t *instr, const unsigned char num);
void instr_add_source(list_t *head, instr_operand_type_t type, const void *data);
void instr_add_dest(instr_operand_t *op, const unsigned char num);
void instr_source_flag(list_t *source, unsigned char flag);
void instr_irq(unsigned char num);
 
#endif
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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