/*--------------------------------------------------------------*/ /* FICHEIRO: DATA.H */ /* AUTOR: António J. A. Esteves */ /* DATA: 18 Maio 1996 */ /* */ /* É neste ficheiro que se definem variáveis, constantes,etc */ /* Este ficheiro só é utilizado no ficheiro que contém o main() */ /*--------------------------------------------------------------*/ #include /*---------------------- OPÇÕES DE COMPILAÇÃO ---------------------*/ /* #define PC */ /* Para correr num 80x86 */ #define T32 /* Para correr num Transputer */ #define VSR_EM_SW /* Para usar a versao de S/W do VSR */ /* #define TEMPO_PARCIAL */ /* Para calcular e apresentar os */ /* tempos em varias fases da execucao */ /* das instrucoes */ #define DEBUG /* Para ter acesso ao menu de depuracao*/ /*-----------------------------------------------------------------*/ #ifdef PC /* PC com inteiros de 16 bits */ typedef long WORD; typedef unsigned long UWORD; #define SIZE 2 #define PALAVRA 32 #define WORD_UM 0xFFFFFFFF #endif #ifdef T32 /* Transputer com palavra de 32 bits */ typedef int WORD; typedef unsigned int UWORD; #define SIZE 2 #define PALAVRA 32 #define WORD_UM 0xFFFFFFFF #endif #ifdef T16 /* ALTERADO **** Transputer com palavra de 16 bits */ typedef long WORD; typedef unsigned long UWORD; #define SIZE 2 #define PALAVRA 32 #define WORD_UM 0xFFFFFFFF #endif #define NINSTRUCOES 66 /* incluiu-se a funcao shift_vsr() */ #define NCHIPS 100 int num_chip; int posFirst[4]; char VOUT[NCHIPS]; /* guarda VOUT devolvido por shiftVsr() */ char VIN[NCHIPS]; /* guarda VIN a enviar para o VSR por shiftVsr() */ /*-----------------------------------------------------------------*/ #define WORD_ZERO (WORD)0 #define COLUNCAM 64 #define PES_CHIP 64 #define BITSSUBSET 4 #define ZERO 0 #define UM 1 #define DCARE 2 /*-----------------------------------------------------------------*/ #define MAX_INSTR 200 /*----------------------------- CAM -------------------------------*/ WORD cam[COLUNCAM][SIZE]; /* 64 bits = */ WORD sub[BITSSUBSET][SIZE]; WORD pos1,pos2; char patt1[9], patt2[9]; /* 8 + Terminador de string (ver fetch.c) */ char subset[BITSSUBSET+1]; char actual[100], prev[100]; /* fetch.c */ WORD inst2, breakpoint; /*--------------------------- PEs e CAM ---------------------------*/ WORD md0[SIZE]; /* =1 se houver match de todos os zeros, =0 no */ /* caso contrario */ WORD md1[SIZE]; /* =1 se houver match de todos os uns, =0 no caso*/ /* contrario */ WORD ms[SIZE]; /* =1 se houver match do subset,=0 caso contrario*/ WORD msbak[SIZE]; /*-------------------------------- PEs ----------------------------*/ WORD tag[SIZE]; WORD cy[SIZE]; /*----------------------------------- PBL -------------------------*/ char pblr[COLUNCAM]; /*-----------------------------------------------------------------*/ /* Estruturas necessarias p/ comunicar c/ o exterior do chip (linhas) */ #define RESET 0 #define SET 1 WORD AltIn[SIZE], Enable[SIZE]; /* Ver PE_ROM.C */ WORD FirstIn[SIZE]; WORD linhas; /*---------------- Tabela de apontadores para as funcoes ---------*/ void (*PE_ROM[NINSTRUCOES])(void); /* Inicializacao: init_rom () */ void inicializacoes (WORD * , char *); void erro (char *); void util_tags(int); /*-----------------------------------------------------------------*/ /*** Usados p/ comunicar entre os PEs e o PBLR, em operacoes read */ /*** Se linhacam=-1 usar tag2 senao usar linhacam ***/ WORD linhacam, tag2[SIZE]; FILE *prog; /*-----------------------------------------------------------------*/ /* Enderecos fisicos das FPGAs que implementam o VSR e interface */ unsigned long *addVsrCs, *add4Interface; /*--------- para usar a versao do VSR implementado em sw ----------*/ #ifdef VSR_EM_SW #define COLUNVSR 8 WORD vsr[SIZE][COLUNVSR]; char PESOBIT[COLUNVSR], VALORNULO[COLUNVSR]; #endif /*----------------------------------------------------------------- Enderecos fisicos para comunicar com o exterior do chip. NOVO: Passaram a ser variaveis (uma por chip). -----------------------------------------------------------------*/ WORD EVSR0[NCHIPS], EVSR1[NCHIPS], EINSTRUCAO[NCHIPS]; char EFLAGS_IN[NCHIPS], EFLAGS_OUT[NCHIPS]; WORD EPATT0[NCHIPS], EPATT1[NCHIPS]; char EPOS0[NCHIPS], EPOS1[NCHIPS], ESUBSET[NCHIPS]; /*-----------------------------------------------------------------*/ /* Máscaras para manipular as flags */ #define TAGUPABOVE 1 /* tagUp e tagAbove -----------+ */ #define TAGDOWNBELOW 2 /* tagDown e tagBelow ----+ | */ #define FIRSTINOUT 4 /* firstIn e fisrtOut --+ | | */ #define ALTINOUT 8 /* altIn e altOut ---+ | | | */ #define ENABLEINOUT 16 /* e..In e e..Out--+ | | | | */ #define TAGOUT 32 /*----+ | | | | | */ #define CARRYOUT 64 /*-+ | +----------+ | | | | */ | | | | | | | +-------+ | | +-----+ | | | /* | +-----+ | | +--+ | | | | | | | | | 7 6 5 4 3 2 1 0 +------------------------------------------------+ Flags IN | X X X ENIN ALTIN FSIN TGB TGA | +------------------------------------------------+ +------------------------------------------------+ Flags OUT | X CYOUT TGOUT ENOUT ALTOUT FSOUT TGD TGU | +------------------------------------------------+ 7 6 5 4 3 2 1 0 */ /* NOVO: Uteis para alt(), tag_alt(), carry_alt(), first() */ #define ALT 0 #define TAG_ALT 1 #define CARRY_ALT 2 #define NCHIPS 100 #define BLOCO 10 #define CHIP 11 #define ARRAY 12 #define CONTINUE 13 #define CICLICO 14 char rbrs[NCHIPS][COLUNCAM/2];