//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
//-- Company:
|
//-- Company:
|
//--
|
//--
|
//-- File: cpBlazeMRG.c
|
//-- File: cpBlazeMRG.c
|
//--
|
//--
|
//-- Description:
|
//-- Description:
|
//-- projet copyBalze
|
//-- projet copyBalze
|
//-- initialize a VHDL memory
|
//-- initialize a VHDL memory
|
//--
|
//--
|
//-- File history:
|
//-- File history:
|
//-- v1.0: 20/10/11: Creation
|
//-- v1.0: 20/10/11: Creation
|
//--
|
//--
|
//-- Targeted device: ProAsic A3P250 VQFP100
|
//-- Targeted device: ProAsic A3P250 VQFP100
|
//-- Author: AbdAllah Meziti
|
//-- Author: AbdAllah Meziti
|
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <string.h>
|
#include <string.h>
|
#include <ctype.h>
|
#include <ctype.h>
|
#include <math.h>
|
#include <math.h>
|
#include <time.h>
|
#include <time.h>
|
|
|
#define PROG_NAME "cpBlazeMRG"
|
#define PROG_NAME "cpBlazeMRG"
|
#define PROG_REV "01.00"
|
#define PROG_REV "01.00"
|
|
|
#define ko 1024
|
#define ko 1024
|
|
|
#define PROGRAM_COUNT 1*ko /* total program word */
|
#define PROGRAM_COUNT 1*ko /* total program word */
|
#define MAX_LINE_COUNT PROGRAM_COUNT /* max 1000 lines allowed */
|
#define MAX_LINE_COUNT PROGRAM_COUNT /* max 1000 lines allowed */
|
|
|
#define MAX_LINE_LENTH 200 /* max number of caractere per line */
|
#define MAX_LINE_LENTH 200 /* max number of caractere per line */
|
|
|
#define EXTENSION_IN ".hex"
|
#define EXTENSION_IN ".hex"
|
#define EXTENSION_OUT ".vhd"
|
#define EXTENSION_OUT ".vhd"
|
|
|
char filename[MAX_LINE_LENTH];
|
char filename[MAX_LINE_LENTH];
|
FILE *ifp;
|
FILE *ifp;
|
FILE *ofp;
|
FILE *ofp;
|
FILE *ffp;
|
FILE *ffp;
|
|
|
char linebuf[MAX_LINE_LENTH];
|
char linebuf[MAX_LINE_LENTH];
|
int line_count = 0;
|
int line_count = 0;
|
|
|
unsigned program_word[PROGRAM_COUNT]; /* program word array */
|
unsigned program_word[PROGRAM_COUNT]; /* program word array */
|
|
|
|
|
/*====================================== */
|
/*====================================== */
|
void error_out(void)
|
void error_out(void)
|
{
|
{
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
/*====================================== */
|
/*====================================== */
|
/* write program word in hex format */
|
/* write program word in hex format */
|
void write_bin(void)
|
void write_bin(void)
|
{
|
{
|
int i;
|
int i;
|
char *ptr;
|
char *ptr;
|
|
|
ptr = strstr(filename, ".log");
|
ptr = strstr(filename, ".log");
|
*ptr = '\0';
|
*ptr = '\0';
|
strcat(filename,".bin");
|
strcat(filename,".bin");
|
|
|
ffp = fopen(filename, "w");
|
ffp = fopen(filename, "w");
|
if (ffp == NULL){
|
if (ffp == NULL){
|
printf("\nCan not open bin file\n");
|
printf("\nCan not open bin file\n");
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
for(i = 0; i < PROGRAM_COUNT; i++){
|
for(i = 0; i < PROGRAM_COUNT; i++){
|
fprintf(ffp, "%3d : %05X\n", i, program_word[i]);
|
fprintf(ffp, "%3d : %05X\n", i, program_word[i]);
|
}
|
}
|
|
|
fclose(ffp);
|
fclose(ffp);
|
}
|
}
|
|
|
/*====================================== */
|
/*====================================== */
|
/* write vhdl module ROM */
|
/* write vhdl module ROM */
|
void write_vhd(void)
|
void write_vhd(void)
|
{
|
{
|
#define DATA_HEX
|
#define DATA_HEX
|
#define WIDTH_ADDRESS 10
|
#define WIDTH_ADDRESS 10
|
#define WIDTH_INSTRUCTION 18
|
#define WIDTH_INSTRUCTION 18
|
#define WIDTH_ROM 20
|
#define WIDTH_ROM 20
|
#define WIDTH_LENGTH PROGRAM_COUNT
|
#define WIDTH_LENGTH PROGRAM_COUNT
|
|
|
int i, j;
|
int i, j;
|
char *ptr;
|
char *ptr;
|
char basename[MAX_LINE_LENTH];
|
char basename[MAX_LINE_LENTH];
|
|
|
time_t rawtime;
|
time_t rawtime;
|
struct tm * timeinfo;
|
struct tm * timeinfo;
|
|
|
time ( &rawtime );
|
time ( &rawtime );
|
timeinfo = localtime ( &rawtime );
|
timeinfo = localtime ( &rawtime );
|
ptr = strstr(filename, ".bin");
|
ptr = strstr(filename, ".bin");
|
*ptr = '\0';
|
*ptr = '\0';
|
strcpy(basename, filename);
|
strcpy(basename, filename);
|
strcat(filename,".vhd");
|
strcat(filename,".vhd");
|
|
|
ffp = fopen(filename, "w");
|
ffp = fopen(filename, "w");
|
if (ffp == NULL){
|
if (ffp == NULL){
|
printf("\nCan not open vhd file\n");
|
printf("\nCan not open vhd file\n");
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
/* *************** */
|
/* *************** */
|
/* VHDL generation */
|
/* VHDL generation */
|
/* *************** */
|
/* *************** */
|
// VHDL : header
|
// VHDL : header
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"-- AUTOMATICALLY GENERATED BY : %s rev %s \n", PROG_NAME, PROG_REV);
|
fprintf(ffp,"-- AUTOMATICALLY GENERATED BY : %s rev %s \n", PROG_NAME, PROG_REV);
|
fprintf(ffp,"-- Company: \n");
|
fprintf(ffp,"-- Company: \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- File: %s.vhd \n",basename);
|
fprintf(ffp,"-- File: %s.vhd \n",basename);
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- Description: \n");
|
fprintf(ffp,"-- Description: \n");
|
fprintf(ffp,"-- projet copyBalze \n");
|
fprintf(ffp,"-- projet copyBalze \n");
|
fprintf(ffp,"-- copyBalze µP code ROM content : width[%d] x depth[%d] \n", WIDTH_INSTRUCTION, PROGRAM_COUNT);
|
fprintf(ffp,"-- copyBalze µP code ROM content : width[%d] x depth[%d] \n", WIDTH_INSTRUCTION, PROGRAM_COUNT);
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- File history: \n");
|
fprintf(ffp,"-- File history: \n");
|
fprintf(ffp,"-- v1.0: %s", asctime (timeinfo));
|
fprintf(ffp,"-- v1.0: %s", asctime (timeinfo));
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- Targeted device: ProAsic A3P250 VQFP100 \n");
|
fprintf(ffp,"-- Targeted device: ProAsic A3P250 VQFP100 \n");
|
fprintf(ffp,"-- Author: AbdAllah Meziti \n");
|
fprintf(ffp,"-- Author: AbdAllah Meziti \n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
|
|
// VHDL : library
|
// VHDL : library
|
fprintf(ffp,"library ieee;\n");
|
fprintf(ffp,"library ieee;\n");
|
fprintf(ffp,"use ieee.std_logic_1164.all;\n");
|
fprintf(ffp,"use ieee.std_logic_1164.all;\n");
|
fprintf(ffp,"use ieee.numeric_std.all;\n\n");
|
fprintf(ffp,"use ieee.numeric_std.all;\n\n");
|
|
|
// VHDL : entity
|
// VHDL : entity
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"-- Entity: %s \n",basename);
|
fprintf(ffp,"-- Entity: %s \n",basename);
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- Description: \n");
|
fprintf(ffp,"-- Description: \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- REMARQUE: \n");
|
fprintf(ffp,"-- REMARQUE: \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- History: \n");
|
fprintf(ffp,"-- History: \n");
|
fprintf(ffp,"-- v1.0: %s", asctime (timeinfo));
|
fprintf(ffp,"-- v1.0: %s", asctime (timeinfo));
|
fprintf(ffp,"-- AM: Creation \n");
|
fprintf(ffp,"-- AM: Creation \n");
|
fprintf(ffp,"-- --------------------- \n");
|
fprintf(ffp,"-- --------------------- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"-- \n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"--------------------------------------------------------------------------------\n");
|
|
|
fprintf(ffp,"entity %s is\n",basename);
|
fprintf(ffp,"entity %s is\n",basename);
|
fprintf(ffp,"\tgeneric\n");
|
fprintf(ffp,"\tgeneric\n");
|
fprintf(ffp,"\t(\n");
|
fprintf(ffp,"\t(\n");
|
fprintf(ffp,"\t GEN_WIDTH_PC : positive := %d;\n",WIDTH_ADDRESS);
|
fprintf(ffp,"\t GEN_WIDTH_PC : positive := %d;\n",WIDTH_ADDRESS);
|
fprintf(ffp,"\t GEN_WIDTH_INST : positive := %d\n",WIDTH_INSTRUCTION);
|
fprintf(ffp,"\t GEN_WIDTH_INST : positive := %d\n",WIDTH_INSTRUCTION);
|
fprintf(ffp,"\t);\n");
|
fprintf(ffp,"\t);\n");
|
fprintf(ffp,"\tport\n");
|
fprintf(ffp,"\tport\n");
|
fprintf(ffp,"\t(\n");
|
fprintf(ffp,"\t(\n");
|
fprintf(ffp,"\t\tClk_i\t\t: in std_ulogic;\n");
|
fprintf(ffp,"\t\tClk_i\t\t: in std_ulogic;\n");
|
fprintf(ffp,"\t\tAddress_i\t: in std_ulogic_vector(GEN_WIDTH_PC-1 downto 0);\n");
|
fprintf(ffp,"\t\tAddress_i\t: in std_ulogic_vector(GEN_WIDTH_PC-1 downto 0);\n");
|
fprintf(ffp,"\t\tDout_o\t\t: out std_ulogic_vector(GEN_WIDTH_INST-1 downto 0)\n");
|
fprintf(ffp,"\t\tDout_o\t\t: out std_ulogic_vector(GEN_WIDTH_INST-1 downto 0)\n");
|
fprintf(ffp,"\t);\n");
|
fprintf(ffp,"\t);\n");
|
fprintf(ffp,"end;\n\n");
|
fprintf(ffp,"end;\n\n");
|
|
|
// VHDL : architecture
|
// VHDL : architecture
|
fprintf(ffp, "--------------------------------------------------------------------------------\n");
|
fprintf(ffp, "--------------------------------------------------------------------------------\n");
|
fprintf(ffp, "-- Architecture: RTL \n");
|
fprintf(ffp, "-- Architecture: RTL \n");
|
fprintf(ffp, "-- of entity : %s\n", basename);
|
fprintf(ffp, "-- of entity : %s\n", basename);
|
fprintf(ffp, "--------------------------------------------------------------------------------\n");
|
fprintf(ffp, "--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"architecture rtl of %s is\n\n", basename);
|
fprintf(ffp,"architecture rtl of %s is\n\n", basename);
|
|
|
fprintf(ffp,"\tconstant ROM_WIDTH\t: INTEGER:= %d;\n",WIDTH_ROM);
|
fprintf(ffp,"\tconstant ROM_WIDTH\t: INTEGER:= %d;\n",WIDTH_ROM);
|
fprintf(ffp,"\tconstant ROM_LENGTH\t: INTEGER:= %d;\n\n",WIDTH_LENGTH);
|
fprintf(ffp,"\tconstant ROM_LENGTH\t: INTEGER:= %d;\n\n",WIDTH_LENGTH);
|
|
|
fprintf(ffp,"\tsubtype rom_word is std_ulogic_vector(ROM_WIDTH-1 downto 0);\n");
|
fprintf(ffp,"\tsubtype rom_word is std_ulogic_vector(ROM_WIDTH-1 downto 0);\n");
|
fprintf(ffp,"\ttype\trom_table is array (0 to ROM_LENGTH-1) of rom_word;\n\n");
|
fprintf(ffp,"\ttype\trom_table is array (0 to ROM_LENGTH-1) of rom_word;\n\n");
|
|
|
fprintf(ffp,"constant rom: rom_table := rom_table'(\n");
|
fprintf(ffp,"constant rom: rom_table := rom_table'(\n");
|
// VHDL : start initialization of the ROM memory
|
// VHDL : start initialization of the ROM memory
|
for(i = 0; i < PROGRAM_COUNT-1; i++){
|
for(i = 0; i < PROGRAM_COUNT-1; i++){
|
#ifdef DATA_HEX
|
#ifdef DATA_HEX
|
fprintf(ffp, "\tx\"");
|
fprintf(ffp, "\tx\"");
|
fprintf(ffp, "%05X", program_word[i]);
|
fprintf(ffp, "%05X", program_word[i]);
|
#else //DATA_BIN
|
#else //DATA_BIN
|
fprintf(ffp, "\t\"");
|
fprintf(ffp, "\t\"");
|
for(j = WIDTH_INSTRUCTION-1; j >= 0; j--) fprintf(ffp, "%d", (program_word[i]>>j) & 1); //print binary
|
for(j = WIDTH_INSTRUCTION-1; j >= 0; j--) fprintf(ffp, "%d", (program_word[i]>>j) & 1); //print binary
|
#endif
|
#endif
|
fprintf(ffp, "\",");
|
fprintf(ffp, "\",");
|
fprintf(ffp, "\t-- %03X%\n",i);
|
fprintf(ffp, "\t-- %03X%\n",i);
|
}
|
}
|
|
|
#ifdef DATA_HEX
|
#ifdef DATA_HEX
|
fprintf(ffp, "\tx\"");
|
fprintf(ffp, "\tx\"");
|
fprintf(ffp, "%05X", program_word[i]);
|
fprintf(ffp, "%05X", program_word[i]);
|
#else //DATA_BIN
|
#else //DATA_BIN
|
fprintf(ffp, "\t\"");
|
fprintf(ffp, "\t\"");
|
for(j = WIDTH_INSTRUCTION-1; j >= 0; j--) fprintf(ffp, "%d", (program_word[i]>>j) & 1); //print binary
|
for(j = WIDTH_INSTRUCTION-1; j >= 0; j--) fprintf(ffp, "%d", (program_word[i]>>j) & 1); //print binary
|
#endif
|
#endif
|
fprintf(ffp, "\"");
|
fprintf(ffp, "\"");
|
fprintf(ffp, "\t-- %03X%\n",i);
|
fprintf(ffp, "\t-- %03X%\n",i);
|
|
|
fprintf(ffp, "\t);\n\n");
|
fprintf(ffp, "\t);\n\n");
|
// VHDL : end Initialize the ROM memory
|
// VHDL : end Initialize the ROM memory
|
|
|
fprintf(ffp,"\tsignal iData : std_ulogic_vector(GEN_WIDTH_INST-1 downto 0);\n");
|
fprintf(ffp,"\tsignal iData : std_ulogic_vector(GEN_WIDTH_INST-1 downto 0);\n");
|
fprintf(ffp,"\n");
|
fprintf(ffp,"\n");
|
fprintf(ffp,"begin\n");
|
fprintf(ffp,"begin\n");
|
fprintf(ffp,"\n");
|
fprintf(ffp,"\n");
|
|
|
// VHDL : end Initialize the ROM memory
|
// VHDL : end Initialize the ROM memory
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t-- Process : ROM_Proc \n");
|
fprintf(ffp,"\t-- Process : ROM_Proc \n");
|
fprintf(ffp,"\t-- Description: ROM Memory \n");
|
fprintf(ffp,"\t-- Description: ROM Memory \n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\tROM_Proc : process (Clk_i)\n");
|
fprintf(ffp,"\tROM_Proc : process (Clk_i)\n");
|
fprintf(ffp,"\tbegin\n");
|
fprintf(ffp,"\tbegin\n");
|
fprintf(ffp,"\t\tif ( rising_edge(Clk_i) ) then\n");
|
fprintf(ffp,"\t\tif ( rising_edge(Clk_i) ) then\n");
|
fprintf(ffp,"\t\t\tiData <= rom(to_integer(unsigned(Address_i)))(GEN_WIDTH_INST-1 downto 0);\n");
|
fprintf(ffp,"\t\t\tiData <= rom(to_integer(unsigned(Address_i)))(GEN_WIDTH_INST-1 downto 0);\n");
|
fprintf(ffp,"\t\tend if;\n");
|
fprintf(ffp,"\t\tend if;\n");
|
fprintf(ffp,"\tend process ROM_Proc;\n");
|
fprintf(ffp,"\tend process ROM_Proc;\n");
|
fprintf(ffp,"\n");
|
fprintf(ffp,"\n");
|
|
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t-- Outputs \n");
|
fprintf(ffp,"\t-- Outputs \n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\t--------------------------------------------------------------------------------\n");
|
fprintf(ffp,"\tDout_o <= iData(GEN_WIDTH_INST-1 downto 0);\n");
|
fprintf(ffp,"\tDout_o <= iData(GEN_WIDTH_INST-1 downto 0);\n");
|
|
|
fprintf(ffp,"\n");
|
fprintf(ffp,"\n");
|
fprintf(ffp,"end rtl;\n");
|
fprintf(ffp,"end rtl;\n");
|
|
|
fclose(ffp);
|
fclose(ffp);
|
}
|
}
|
|
|
|
|
#define xtod(c) ((c>='0' && c<='9') ? c-'0' : ((c>='A' && c<='F') ? c-'A'+10 : ((c>='a' && c<='f') ? c-'a'+10 : 0)))
|
#define xtod(c) ((c>='0' && c<='9') ? c-'0' : ((c>='A' && c<='F') ? c-'A'+10 : ((c>='a' && c<='f') ? c-'a'+10 : 0)))
|
|
|
int HextoDec(char *hex)
|
int HextoDec(char *hex)
|
{
|
{
|
if (*hex==0) return 0;
|
if (*hex==0) return 0;
|
return HextoDec(hex-1)*16 + xtod(*hex) ;
|
return HextoDec(hex-1)*16 + xtod(*hex) ;
|
}
|
}
|
|
|
int xstrtoi(char *hex) // hex string to integer
|
int xstrtoi(char *hex) // hex string to integer
|
{
|
{
|
return HextoDec(hex+strlen(hex)-1);
|
return HextoDec(hex+strlen(hex)-1);
|
}
|
}
|
|
|
/*====================================== */
|
/*====================================== */
|
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
{
|
{
|
char *ptr;
|
char *ptr;
|
int i;
|
int i;
|
|
|
if(argc != 2){
|
if(argc != 2){
|
printf("\nCommand line syntax:\n\n %s file%s\n", PROG_NAME, EXTENSION_IN);
|
printf("\nCommand line syntax:\n\n %s file%s\n", PROG_NAME, EXTENSION_IN);
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
strcpy(filename, argv[1]);
|
strcpy(filename, argv[1]);
|
ptr = strstr(filename, EXTENSION_IN);
|
ptr = strstr(filename, EXTENSION_IN);
|
if (ptr == NULL){
|
if (ptr == NULL){
|
printf("\nInvalid file type, use %s extension\n", EXTENSION_IN);
|
printf("\nInvalid file type, use %s extension\n", EXTENSION_IN);
|
exit(1);
|
exit(1);
|
}
|
}
|
*ptr = '\0';
|
*ptr = '\0';
|
strcat(filename,".log");
|
strcat(filename,".log");
|
|
|
// Open the ifp="input file"
|
// Open the ifp="input file"
|
ifp = fopen(argv[1], "r");
|
ifp = fopen(argv[1], "r");
|
if (ifp == NULL){
|
if (ifp == NULL){
|
printf("\nCan not open input file\n");
|
printf("\nCan not open input file\n");
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
// Open the ofp="output file" (log)
|
// Open the ofp="output file" (log)
|
ofp = fopen(filename, "w");
|
ofp = fopen(filename, "w");
|
if (ofp == NULL){
|
if (ofp == NULL){
|
printf("\nCan not open output file\n");
|
printf("\nCan not open output file\n");
|
exit(1);
|
exit(1);
|
}
|
}
|
fprintf(ofp, "ROM Code generation %s logfile\n\n",EXTENSION_IN);
|
fprintf(ofp, "ROM Code generation %s logfile\n\n",EXTENSION_IN);
|
|
|
|
|
printf("Reading input file...\n");
|
printf("Reading input file...\n");
|
fprintf(ofp,"Reading input file...\n");
|
fprintf(ofp,"Reading input file...\n");
|
|
|
// Initialize the "program_word" table
|
// Initialize the "program_word" table
|
for(i = 0; i < PROGRAM_COUNT; i++)
|
for(i = 0; i < PROGRAM_COUNT; i++)
|
program_word[i] = 0xFFFFF;
|
program_word[i] = 0xFFFFF;
|
|
|
// Read the input file
|
// Read the input file
|
while ( fgets(linebuf, 128, ifp) != NULL ) {
|
while ( fgets(linebuf, 128, ifp) != NULL ) {
|
if(line_count >= MAX_LINE_COUNT){
|
if(line_count >= MAX_LINE_COUNT){
|
printf("\nInput exceed maximum line number\n");
|
printf("\nInput exceed maximum line number\n");
|
error_out();
|
goto error;
|
|
//error_out();
|
}
|
}
|
|
|
// Extract the data from In file to program_word
|
// Extract the data from In file to program_word
|
ptr = strstr(linebuf, "\r\n");
|
ptr = strstr(linebuf, "\r\n");
|
*ptr = '\0';
|
*ptr = '\0';
|
|
|
//xtoi(linebuf, &program_word[line_count]);
|
//xtoi(linebuf, &program_word[line_count]);
|
|
|
program_word[line_count] = xstrtoi(linebuf);
|
program_word[line_count] = xstrtoi(linebuf);
|
|
|
//printf("\n%s=>%05X",linebuf,program_word[line_count]);
|
//printf("\n%s=>%05X",linebuf,program_word[line_count]);
|
|
|
line_count++;
|
line_count++;
|
}
|
}
|
|
|
|
error:
|
|
//error_out();
|
|
|
printf("\nWrite output files...\n");
|
printf("\nWrite output files...\n");
|
fprintf(ofp,"Write output files...\n");
|
fprintf(ofp,"Write output files...\n");
|
write_bin();
|
write_bin();
|
write_vhd();
|
write_vhd();
|
|
|
printf("Program completed...\n");
|
printf("Program completed...\n");
|
fprintf(ofp,"Program completed...\n");
|
fprintf(ofp,"Program completed...\n");
|
fclose(ifp);
|
fclose(ifp);
|
fclose(ofp);
|
fclose(ofp);
|
return(0);
|
return(0);
|
}
|
}
|
|
|
|
|