URL
https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk
Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc
Compare Revisions
- This comparison shows the changes necessary to convert path
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk
- from Rev 18 to Rev 19
- ↔ Reverse comparison
Rev 18 → Rev 19
/mpsoc/src_processor/aeMB/compiler/program/prog.tcl
File deleted
mpsoc/src_processor/aeMB/compiler/program/prog.tcl
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/gccrom
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/gccrom (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/gccrom (nonexistent)
@@ -1,42 +0,0 @@
-#!/bin/sh
-# $Id: gccrom,v 1.18 2008-05-01 08:35:04 sybreon Exp $
-
-# Compile using C pre-processor
-ELFFILE="rom"
-XILFLAGS="-mtune=v5.00 -mxl-soft-div -msoft-float -mxl-barrel-shift -mno-xl-soft-mul"
-CXXFLAGS="-O1"
-LNKFLAGS="-Wl,-defsym -Wl,_STACK_SIZE=0x400 -Wl,-defsym -Wl,_HEAP_SIZE=0x400"
-LIBFLAGS=""
-INCFLAGS="-Icc/"
-RAMSIZE="3FFF" #for aeMB ramwith of 12
-
-mb-g++ $XILFLAGS $CXXFLAGS $LNKFLAGS $LIBFLAGS $INCFLAGS -specs=aemb.specs $@ -o $ELFFILE && \
-echo "xgcc=$?" && \
-
-# Create a text listing of the compiled code
-mb-objdump -DSCz $ELFFILE > $ELFFILE.dump && \
-echo "dump=$?" && \
-
-# Convert the ELF file to an SREC file
-mb-objcopy -O srec $ELFFILE $ELFFILE.srec && \
-echo "copy=$?" && \
-
-# Generate a Verilog VMEM file from the SREC file
-srec_cat $ELFFILE.srec -fill 0xFF -within $ELFFILE.srec --range-pad 4 -o out/dump.vmem -vmem 32 && \
-echo "srec=$?" && \
-
-
-# Convert the ELF file to an IHEX file
-mb-objcopy -O ihex $ELFFILE $ELFFILE.ihex && \
-#echo "copy2ihex=$?" && \
-
-# Generate a MIF file from the IHEX file
-ihex/ihex2mif -f $ELFFILE.ihex -e $RAMSIZE -o out/ram0.mif && \
-echo "ihex2mif=$?" && \
-
-# echo the checksum
-MD5=$(sha1sum $ELFFILE | cut -c1-32) && \
-echo "sha1=$MD5" && \
-
-# Cleanup code
-rm $ELFFILE.srec && rm $ELFFILE
mpsoc/src_processor/aeMB/compiler/compile/gccrom
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/Makefile
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/ihex/Makefile (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/ihex/Makefile (nonexistent)
@@ -1,3 +0,0 @@
-#!/bin/sh
-all:
- gcc main.c -o ihex2mif
mpsoc/src_processor/aeMB/compiler/compile/ihex/Makefile
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex.c
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex.c (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex.c (nonexistent)
@@ -1,216 +0,0 @@
-/* Intel HEX read/write functions, Paul Stoffregen, paul@ece.orst.edu */
-/* This code is in the public domain. Please retain my name and */
-/* email address in distributed copies, and let me know about any bugs */
-
-/* I, Paul Stoffregen, give no warranty, expressed or implied for */
-/* this software and/or documentation provided, including, without */
-/* limitation, warranty of merchantability and fitness for a */
-/* particular purpose. */
-
-
-#include
-#include
-#include
-
-/* some ansi prototypes.. maybe ought to make a .h file */
-
-/* this loads an intel hex file into the memory[] array */
-void load_file(char *filename);
-
-/* this writes a part of memory[] to an intel hex file */
-void save_file(char *command);
-
-/* this is used by load_file to get each line of intex hex */
-int parse_hex_line(char *theline, int bytes[], int *addr, int *num, int *code);
-
-/* this does the dirty work of writing an intel hex file */
-/* caution, static buffering is used, so it is necessary */
-/* to call it with end=1 when finsihed to flush the buffer */
-/* and close the file */
-void hexout(FILE *fhex, int byte, int memory_location, int end);
-
-
-extern int memory[65536]; /* the memory is global */
-
-/* parses a line of intel hex code, stores the data in bytes[] */
-/* and the beginning address in addr, and returns a 1 if the */
-/* line was valid, or a 0 if an error occured. The variable */
-/* num gets the number of bytes that were stored into bytes[] */
-
-int parse_hex_line(theline, bytes, addr, num, code)
-char *theline;
-int *addr, *num, *code, bytes[];
-{
- int sum, len, cksum;
- char *ptr;
-
- *num = 0;
- if (theline[0] != ':') return 0;
- if (strlen(theline) < 11) return 0;
- ptr = theline+1;
- if (!sscanf(ptr, "%02x", &len)) return 0;
- ptr += 2;
- if ( strlen(theline) < (11 + (len * 2)) ) return 0;
- if (!sscanf(ptr, "%04x", addr)) return 0;
- ptr += 4;
- /* printf("Line: length=%d Addr=%d\n", len, *addr); */
- if (!sscanf(ptr, "%02x", code)) return 0;
- ptr += 2;
- sum = (len & 255) + ((*addr >> 8) & 255) + (*addr & 255) + (*code & 255);
- while(*num != len) {
- if (!sscanf(ptr, "%02x", &bytes[*num])) return 0;
- ptr += 2;
- sum += bytes[*num] & 255;
- (*num)++;
- if (*num >= 256) return 0;
- }
- if (!sscanf(ptr, "%02x", &cksum)) return 0;
- if ( ((sum & 255) + (cksum & 255)) & 255 ) return 0; /* checksum error */
- return 1;
-}
-
-/* loads an intel hex file into the global memory[] array */
-/* filename is a string of the file to be opened */
-
-void load_file(filename)
-char *filename;
-{
- char line[1000];
- FILE *fin;
- int addr, n, status, bytes[256];
- int i, total=0, lineno=1;
- int minaddr=65536, maxaddr=0;
-
- if (strlen(filename) == 0) {
- printf(" Can't load a file without the filename.");
- printf(" '?' for help\n");
- return;
- }
- fin = fopen(filename, "r");
- if (fin == NULL) {
- printf(" Can't open file '%s' for reading.\n", filename);
- //return;
- exit(1);
- }
- while (!feof(fin) && !ferror(fin)) {
- line[0] = '\0';
- fgets(line, 1000, fin);
- if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0';
- if (line[strlen(line)-1] == '\r') line[strlen(line)-1] = '\0';
- if (parse_hex_line(line, bytes, &addr, &n, &status)) {
- if (status == 0) { /* data */
- for(i=0; i<=(n-1); i++) {
- memory[addr] = bytes[i] & 255;
- total++;
- if (addr < minaddr) minaddr = addr;
- if (addr > maxaddr) maxaddr = addr;
- addr++;
- }
- }
- if (status == 1) { /* end of file */
- fclose(fin);
- printf(" Loaded %d bytes between:", total);
- printf(" %04X to %04X\n", minaddr, maxaddr);
- return;
- }
- if (status == 2) ; /* begin of file */
- } else {
- printf(" Error: '%s', line: %d\n", filename, lineno);
- }
- lineno++;
- }
-}
-
-
-/* the command string format is "S begin end filename" where */
-/* "begin" and "end" are the locations to dump to the intel */
-/* hex file, specified in hexidecimal. */
-
-void save_file(command)
-char *command;
-{
- int begin, end, addr;
- char *ptr, filename[200];
- FILE *fhex;
-
- ptr = command+1;
- while (isspace(*ptr)) ptr++;
- if (*ptr == '\0') {
- printf(" Must specify address range and filename\n");
- return;
- }
- if (sscanf(ptr, "%x%x%s", &begin, &end, filename) < 3) {
- printf(" Invalid addresses or filename,\n");
- printf(" usage: S begin_addr end_addr filename\n");
- printf(" the addresses must be hexidecimal format\n");
- return;
- }
- begin &= 65535;
- end &= 65535;
- if (begin > end) {
- printf(" Begin address must be less than end address.\n");
- return;
- }
- fhex = fopen(filename, "w");
- if (fhex == NULL) {
- printf(" Can't open '%s' for writing.\n", filename);
- return;
- }
- for (addr=begin; addr <= end; addr++)
- hexout(fhex, memory[addr], addr, 0);
- hexout(fhex, 0, 0, 1);
- printf("Memory %04X to %04X written to '%s'\n", begin, end, filename);
-}
-
-
-/* produce intel hex file output... call this routine with */
-/* each byte to output and it's memory location. The file */
-/* pointer fhex must have been opened for writing. After */
-/* all data is written, call with end=1 (normally set to 0) */
-/* so it will flush the data from its static buffer */
-
-#define MAXHEXLINE 32 /* the maximum number of bytes to put in one line */
-
-void hexout(fhex, byte, memory_location, end)
-FILE *fhex; /* the file to put intel hex into */
-int byte, memory_location, end;
-{
- static int byte_buffer[MAXHEXLINE];
- static int last_mem, buffer_pos, buffer_addr;
- static int writing_in_progress=0;
- register int i, sum;
-
- if (!writing_in_progress) {
- /* initial condition setup */
- last_mem = memory_location-1;
- buffer_pos = 0;
- buffer_addr = memory_location;
- writing_in_progress = 1;
- }
-
- if ( (memory_location != (last_mem+1)) || (buffer_pos >= MAXHEXLINE) \
- || ((end) && (buffer_pos > 0)) ) {
- /* it's time to dump the buffer to a line in the file */
- fprintf(fhex, ":%02X%04X00", buffer_pos, buffer_addr);
- sum = buffer_pos + ((buffer_addr>>8)&255) + (buffer_addr&255);
- for (i=0; i < buffer_pos; i++) {
- fprintf(fhex, "%02X", byte_buffer[i]&255);
- sum += byte_buffer[i]&255;
- }
- fprintf(fhex, "%02X\n", (-sum)&255);
- buffer_addr = memory_location;
- buffer_pos = 0;
- }
-
- if (end) {
- fprintf(fhex, ":00000001FF\n"); /* end of file marker */
- fclose(fhex);
- writing_in_progress = 0;
- }
-
- last_mem = memory_location;
- byte_buffer[buffer_pos] = byte & 255;
- buffer_pos++;
-}
-
-
mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex.c
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/out.mif
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/ihex/out.mif (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/ihex/out.mif (nonexistent)
@@ -1,257 +0,0 @@
--- Copyright (C) 1991-2013 Altera Corporation
--- Your use of Altera Corporation's design tools, logic functions
--- and other software and tools, and its AMPP partner logic
--- functions, and any output files from any of the foregoing
--- (including device programming or simulation files), and any
--- associated documentation or information are expressly subject
--- to the terms and conditions of the Altera Program License
--- Subscription Agreement, Altera MegaCore Function License
--- Agreement, or other applicable license agreement, including,
--- without limitation, that your use is for the sole purpose of
--- programming logic devices manufactured by Altera and sold by
--- Altera or its authorized distributors. Please refer to the
--- applicable agreement for further details.
-
--- Quartus II generated Memory Initialization File (.mif)
-
-WIDTH=32;
-DEPTH=8191;
-
-ADDRESS_RADIX=HEX;
-DATA_RADIX=HEX;
-
-CONTENT BEGIN
- 0000 : B8080050;
- 0001 : 00000000;
- 0002 : B808017C;
- 0003 : 00000000;
- 0004 : B808018C;
- [0005..0007] : 00000000;
- 0008 : B8080184;
- [0009..0013] : 00000000;
- 0014 : 31A004C0;
- 0015 : 304003B8;
- 0016 : 30200D30;
- 0017 : B9F40014;
- 0018 : 80000000;
- 0019 : B9F40140;
- 001A : 30A30000;
- 001B : B8000000;
- 001C : 2021FFEC;
- 001D : F9E10000;
- 001E : 20C004C0;
- 001F : 20E004C0;
- 0020 : 06463800;
- 0021 : BC720014;
- 0022 : F8060000;
- 0023 : 20C60004;
- 0024 : 06463800;
- 0025 : BC92FFF4;
- 0026 : 20C004C0;
- 0027 : 20E0053C;
- 0028 : 06463800;
- 0029 : BC720014;
- 002A : F8060000;
- 002B : 20C60004;
- 002C : 06463800;
- 002D : BC92FFF4;
- 002E : B9F400E4;
- 002F : 80000000;
- 0030 : 20C00000;
- 0031 : 20E00000;
- 0032 : B9F40024;
- 0033 : 20A00000;
- 0034 : 32630000;
- 0035 : B9F400C0;
- 0036 : 80000000;
- 0037 : C9E10000;
- 0038 : 30730000;
- 0039 : B60F0008;
- 003A : 20210014;
- 003B : E8A003B8;
- 003C : E8E003C0;
- 003D : E94003C4;
- 003E : B00000F8;
- 003F : 312004C0;
- 0040 : B0001A00;
- 0041 : 31000000;
- 0042 : 30600001;
- 0043 : F8650000;
- 0044 : 10C00000;
- 0045 : E8650000;
- 0046 : 30800002;
- 0047 : 30630001;
- 0048 : F8650000;
- 0049 : 10642000;
- 004A : F88304C0;
- 004B : 30840002;
- 004C : AA44001E;
- 004D : BE32FFF4;
- 004E : 10642000;
- 004F : F90004C0;
- 0050 : F9270000;
- 0051 : BC26FFD0;
- 0052 : E86A0000;
- 0053 : A4C30001;
- 0054 : BC26FFC4;
- 0055 : E86A0000;
- 0056 : A4C30001;
- 0057 : BC26FFB8;
- 0058 : B800FFE8;
- 0059 : B8000008;
- 005A : 80000000;
- 005B : BE25FFFC;
- 005C : 30A5FFFF;
- 005D : B60F0008;
- 005E : 80000000;
- 005F : B6110000;
- 0060 : 80000000;
- 0061 : B6910000;
- 0062 : 80000000;
- 0063 : B62E0000;
- 0064 : 80000000;
- 0065 : B60F0008;
- 0066 : 80000000;
- 0067 : B60F0008;
- 0068 : 80000000;
- 0069 : 3021FFE0;
- 006A : 10C00000;
- 006B : FA61001C;
- 006C : F9E10000;
- 006D : B9F40024;
- 006E : 12650000;
- 006F : E8A003AC;
- 0070 : E8650028;
- 0071 : BC03000C;
- 0072 : 99FC1800;
- 0073 : 80000000;
- 0074 : B9F4FE9C;
- 0075 : 10B30000;
- 0076 : E86003AC;
- 0077 : 3021FFC8;
- 0078 : FB410030;
- 0079 : FB610034;
- 007A : F9E10000;
- 007B : FA61001C;
- 007C : FAC10020;
- 007D : FAE10024;
- 007E : FB010028;
- 007F : FB21002C;
- 0080 : EB030048;
- 0081 : 13650000;
- 0082 : BE180050;
- 0083 : 13460000;
- 0084 : E8780004;
- 0085 : EB380088;
- 0086 : 3263FFFF;
- 0087 : BC53003C;
- 0088 : 64930402;
- 0089 : 30640008;
- 008A : 12D81800;
- 008B : BE060074;
- 008C : 12F92000;
- 008D : BC1900C0;
- 008E : E8770080;
- 008F : 1643D000;
- 0090 : BC1200EC;
- 0091 : 3273FFFF;
- 0092 : 32F7FFFC;
- 0093 : AA53FFFF;
- 0094 : BE32FFE8;
- 0095 : 32D6FFFC;
- 0096 : E9E10000;
- 0097 : EA61001C;
- 0098 : EAC10020;
- 0099 : EAE10024;
- 009A : EB010028;
- 009B : EB21002C;
- 009C : EB410030;
- 009D : EB610034;
- 009E : B60F0008;
- 009F : 30210038;
- 00A0 : E8B70000;
- 00A1 : 99FC3800;
- 00A2 : 80000000;
- 00A3 : 3273FFFF;
- 00A4 : 32F7FFFC;
- 00A5 : AA53FFFF;
- 00A6 : BE12FFC0;
- 00A7 : 32D6FFFC;
- 00A8 : E8780004;
- 00A9 : E8F60000;
- 00AA : 3063FFFF;
- 00AB : 16439800;
- 00AC : BC120074;
- 00AD : F8160000;
- 00AE : BC07FFD4;
- 00AF : BE190058;
- 00B0 : 30800001;
- 00B1 : E8790100;
- 00B2 : 44849C00;
- 00B3 : 84641800;
- 00B4 : BC030044;
- 00B5 : E8790104;
- 00B6 : 84641800;
- 00B7 : BC23FFA4;
- 00B8 : E8D70000;
- 00B9 : 99FC3800;
- 00BA : 10BB0000;
- 00BB : B810FFA4;
- [00BC..00BD] : 3273FFFF;
- 00BE : AA53FFFF;
- 00BF : BE12FF5C;
- 00C0 : 3273FFFF;
- 00C1 : AA53FFFF;
- 00C2 : BE32FFF0;
- 00C3 : 3273FFFF;
- 00C4 : B800FF48;
- 00C5 : 99FC3800;
- 00C6 : 3273FFFF;
- 00C7 : B810FF78;
- 00C8 : 32F7FFFC;
- 00C9 : FA780004;
- 00CA : B800FF90;
- 00CB : E8780004;
- 00CC : E8F60000;
- 00CD : 3063FFFF;
- 00CE : 16439800;
- 00CF : BC120054;
- 00D0 : F8160000;
- 00D1 : BC07FF00;
- 00D2 : BC190038;
- 00D3 : 30800001;
- 00D4 : E8790100;
- 00D5 : 44849C00;
- 00D6 : 84641800;
- 00D7 : BC030024;
- 00D8 : E8790104;
- 00D9 : 84641800;
- 00DA : BC230030;
- 00DB : E8D70000;
- 00DC : 99FC3800;
- 00DD : 10BB0000;
- 00DE : B810FED0;
- 00DF : 3273FFFF;
- 00E0 : 99FC3800;
- 00E1 : 3273FFFF;
- 00E2 : B810FEC4;
- 00E3 : 32F7FFFC;
- 00E4 : FA780004;
- 00E5 : B800FFB0;
- 00E6 : E8B70000;
- 00E7 : 99FC3800;
- 00E8 : 3273FFFF;
- 00E9 : B810FEA8;
- 00EA : 32F7FFFC;
- 00EB : 000003CC;
- 00EC : 43000000;
- 00ED : 00000000;
- 00EE : 41000000;
- 00EF : 40000000;
- 00F0 : 40000004;
- 00F1 : 40000008;
- 00F2 : 000003CC;
- [00F3..00FA] : 00000000;
- 00FB : 000003B0;
- [00FC..1FFE] : 00000000;
-END;
mpsoc/src_processor/aeMB/compiler/compile/ihex/out.mif
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/main.c
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/ihex/main.c (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/ihex/main.c (nonexistent)
@@ -1,121 +0,0 @@
-#include "ihex.c"
-#include
-#include
-
-#define DEFAULT_OUT_FILE_NAME "out.mif"
-#define DEAFULT_END_SIZE "1FFF"
-
-int memory[65536]; /* the memory is global */
-unsigned int end_addr_int;
-FILE * in, * out;
-char *file_name, *end_addr, *out_file_name ;
-
-void usage (void)
-{
- printf("Usage: ./ihex2mif \n");
- printf("\nOptions: \n");
- printf(" -e : end memory address .\n");
- printf(" -f : input ihex file .\n");
-
-}
-
-void processArgs (int argc, char **argv )
-{
- char c;
-
- opterr = 0;
-
- while ((c = getopt (argc, argv, "e:f:o:h")) != -1)
- {
- switch (c)
- {
- case 'e':
- end_addr = optarg;
- break;
- case 'f':
- file_name = optarg;
- break;
- case 'o':
- out_file_name = optarg;
- break;
- case 'h':
- usage();
- exit(1);
- break;
- case '?':
- if (isprint (optopt))
- fprintf (stderr, "Unknown option `-%c'.\n", optopt);
- else
- fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
- default:
- usage();
- exit(1);
- }
- }
-}
-
-void update_out_file(void);
-int main ( int argc, char **argv ){
-
- processArgs (argc,argv );
- if (file_name == NULL) {usage();exit(1);}
- if (end_addr == NULL) end_addr = DEAFULT_END_SIZE;
- if (out_file_name == NULL) out_file_name = DEFAULT_OUT_FILE_NAME;
- //printf("filename=%s & size=%s\n",file_name, end_addr);
- sscanf(end_addr, "%x", &end_addr_int);
- //printf("%u\n", end_addr_int);
- out=fopen(out_file_name,"wb");
- if(out==NULL){printf("Output file cannot be created"); exit(1);}
- load_file(file_name);
- update_out_file();
-
-
- fclose(out);
-
-return 0;
-}
-
-
-void update_out_file(void){
- unsigned int ram_addr=0,zero_count,ram_data,i;
- fprintf(out,"-- Copyright (C) 2013 Alireza Monemi\n\n");
- fprintf(out,"WIDTH=32;\nDEPTH=%d;\nADDRESS_RADIX=HEX;\nDATA_RADIX=HEX;\n\nCONTENT BEGIN\n", (end_addr_int>>2)+1);
- while(ram_addr>2,ram_data);
- }else if (zero_count == 1){
- fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2),0);
- if(ram_data!=0)fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2)+1,ram_data);
-
- }
- else {
- fprintf(out,"\t[%08X..%08X]\t:\t00000000;\n" ,ram_addr>>2, (ram_addr>>2)+ zero_count-1);
- if(ram_data!=0)fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2)+ zero_count,ram_data);
- }
- ram_addr+=(zero_count<<2)+4;
-
-
-
-
- }
- fprintf(out,"END;");
-
-return;
-}
-
mpsoc/src_processor/aeMB/compiler/compile/ihex/main.c
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex2mif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex2mif
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex2mif (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex2mif (nonexistent)
mpsoc/src_processor/aeMB/compiler/compile/ihex/ihex2mif
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/aemb.specs
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/aemb.specs (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/aemb.specs (nonexistent)
@@ -1,178 +0,0 @@
-*asm:
-%{microblaze1} %(target_asm_spec) %(subtarget_asm_spec)
-
-*asm_debug:
-%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}
-
-*asm_final:
-
-
-*asm_options:
-%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}
-
-*invoke_as:
-%{!S:-o %|.s |
- as %(asm_options) %m.s %A }
-
-*cpp:
-%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} %{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} %{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} %{mno-xl-soft-mul: -DHAVE_HW_MUL} %{mxl-multiply-high: -DHAVE_HW_MUL_HIGH} %{mno-xl-soft-div: -DHAVE_HW_DIV} %{mxl-barrel-shift: -DHAVE_HW_BSHIFT} %{mxl-pattern-compare: -DHAVE_HW_PCMP} %{mhard-float: -DHAVE_HW_FPU} %{mxl-float-convert: -DHAVE_HW_FPU_CONVERT} %{mxl-float-sqrt: -DHAVE_HW_FPU_SQRT}
-
-*cpp_options:
-%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps:-fpch-preprocess}
-
-*cpp_debug_options:
-%{d*}
-
-*cpp_unique_options:
-%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}
-
-*trad_capable_cpp:
-cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}
-
-*cc1:
- %{G*} %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} %{save-temps: } %(subtarget_cc1_spec) %{Zxl-blazeit: -mno-xl-soft-mul -mno-xl-soft-div -mxl-barrel-shift -mxl-pattern-compare -mxl-multiply-high}
-
-*cc1_options:
-%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants} %{coverage:-fprofile-arcs -ftest-coverage}
-
-*cc1plus:
-
-
-*link_gcc_c_sequence:
-%G %L %G
-
-*link_ssp:
-%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}
-
-*endfile:
-crtend.o%s crtn.o%s
-
-*link:
-%{shared:-shared} -N -relax %{Zxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} %{!mxl-gp-opt: -G 0} %{!Wl,-T*: %{!T*: -T xilinx.ld%s}}
-
-*lib:
-%{!pg:%{!nostdlib:%{!Zxl-no-libxil:-start-group -lxil -lc_m_bs -lm_m_bs -end-group }}} %{pg:%{!nostdlib:-start-group -lxilprofile -lxil -lc_m_bs -lm_m_bs -end-group }} %{Zxl-no-libxil: %{!nostdlib: -start-group -lc_m_bs -lm_m_bs -end-group }}
-
-*mfwrap:
- %{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main}
-
-*mflib:
-%{fmudflap|fmudflapth: -export-dynamic}
-
-*libgcc:
--lgcc
-
-*startfile:
-%{Zxl-mode-executable : %(startfile_executable) ; Zxl-mode-xmdstub : %(startfile_xmdstub) ; Zxl-mode-bootstrap : %(startfile_bootstrap) ; Zxl-mode-novectors : %(startfile_novectors) ; Zxl-mode-xilkernel : %(startfile_xilkernel) ; : %(startfile_default) } %(startfile_crtinit)
-
-*switches_need_spaces:
-
-
-*cross_compile:
-1
-
-*version:
-4.1.1
-
-*multilib:
-. !mxl-barrel-shift !mno-xl-soft-mul !mxl-multiply-high;bs mxl-barrel-shift !mno-xl-soft-mul !mxl-multiply-high;m !mxl-barrel-shift mno-xl-soft-mul !mxl-multiply-high;m/mh !mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high;bs/m mxl-barrel-shift mno-xl-soft-mul !mxl-multiply-high;bs/m/mh mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high;
-
-*multilib_defaults:
-
-
-*multilib_extra:
-
-
-*multilib_matches:
-mxl-barrel-shift mxl-barrel-shift;mno-xl-soft-mul mno-xl-soft-mul;mxl-multiply-high mxl-multiply-high;
-
-*multilib_exclusions:
-
-
-*multilib_options:
-mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
-
-*linker:
-collect2
-
-*link_libgcc:
-%D
-
-*md_exec_prefix:
-
-
-*md_startfile_prefix:
-
-
-*md_startfile_prefix_1:
-
-
-*startfile_prefix_spec:
-
-
-*sysroot_spec:
---sysroot=%R
-
-*sysroot_suffix_spec:
-
-
-*sysroot_hdrs_suffix_spec:
-
-
-*subtarget_cc1_spec:
-
-
-*subtarget_cpp_spec:
-
-
-*subtarget_cpp_size_spec:
--D__SIZE_TYPE__=unsigned\ int -D__PTRDIFF_TYPE__=int
-
-*microblaze_as_asm_spec:
-%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} %{pipe: %e-pipe is not supported.} %{K} %(subtarget_microblaze_as_asm_spec)
-
-*gas_asm_spec:
-%{v}
-
-*target_asm_spec:
-
-
-*subtarget_microblaze_as_asm_spec:
-%{v}
-
-*subtarget_asm_optimizing_spec:
-
-
-*subtarget_asm_debugging_spec:
-%{g} %{g0} %{g1} %{g2} %{g3} %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3}
-
-*subtarget_asm_spec:
-
-
-*linker_endian_spec:
-
-
-*startfile_executable:
-crt0.o%s crti.o%s crtbegin.o%s
-
-*startfile_xmdstub:
-crt1.o%s crti.o%s crtbegin.o%s
-
-*startfile_bootstrap:
-crt2.o%s crti.o%s crtbegin.o%s
-
-*startfile_novectors:
-crt3.o%s crti.o%s crtbegin.o%s
-
-*startfile_xilkernel:
-crt4.o%s crti.o%s crtbegin.o%s
-
-*startfile_crtinit:
-%{!pg: %{!mno-clearbss: crtinit.o%s} %{mno-clearbss: sim-crtinit.o%s}} %{pg: %{!mno-clearbss: pgcrtinit.o%s} %{mno-clearbss: sim-pgcrtinit.o%s}}
-
-*startfile_default:
-crt0.o%s crti.o%s crtbegin.o%s
-
-*link_command:
-%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %{pie:-pie} %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib) %{fprofile-arcs|fprofile-generate|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}
-
Index: mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crt0.s
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crt0.s (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crt0.s (nonexistent)
@@ -1,100 +0,0 @@
-###################################-*-asm*-
-#
-# Copyright (c) 2001 Xilinx, Inc. All rights reserved.
-#
-# Xilinx, Inc.
-#
-# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
-# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
-# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
-# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
-# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
-# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
-# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
-# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
-# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
-# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# crt0.s
-#
-# Default C run-time initialization for MicroBlaze standalone
-# executables (compiled with -xl-mode-executable or no switches)
-#
-# $Id: crt0.s,v 1.7.2.6 2005/11/15 23:32:53 salindac Exp $
-#
-#######################################
-
-/*
-
- MicroBlaze Vector Map for standalone executables
-
- Address Vector type Label
- ------- ----------- ------
-
- # 0x00 # (-- IMM --)
- # 0x04 # Reset _start1
-
- # 0x08 # (-- IMM --)
- # 0x0c # Software Exception _exception_handler
-
- # 0x10 # (-- IMM --)
- # 0x14 # Hardware Interrupt _interrupt_handler
-
- # 0x18 # (-- IMM --)
- # 0x1C # Breakpoint Exception (-- Don't Care --)
-
- # 0x20 # (-- IMM --)
- # 0x24 # Hardware Exception _hw_exception_handler
-
-*/
-
-
- .globl _start
- .section .vectors.reset, "ax"
- .align 2
-_start:
- brai _start1
-
- .section .vectors.sw_exception, "ax"
- .align 2
-_vector_sw_exception:
- brai _exception_handler
-
- .section .vectors.interrupt, "ax"
- .align 2
-_vector_interrupt:
- brai _interrupt_handler
-
- .section .vectors.hw_exception, "ax"
- .align 2
-_vector_hw_exception:
- brai _hw_exception_handler
-
- .section .text
- .globl _start1
- .align 2
-_start1:
- la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */
- la r2, r0, _SDA2_BASE_
- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */
-
- brlid r15, _crtinit /* Initialize BSS and run program */
- nop
-
- brlid r15, exit /* Call exit with the return value of main */
- addik r5, r3, 0
-
- /* Control does not reach here */
-
-/*
- _exit
- Our simple _exit
-*/
- .globl _exit
- .align 2
- .ent _exit
-_exit:
- bri 0
- .end _exit
-
mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crt0.s
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crtinit.s
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crtinit.s (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crtinit.s (nonexistent)
@@ -1,83 +0,0 @@
-###################################-*-asm*-
-#
-# Copyright (c) 2001 Xilinx, Inc. All rights reserved.
-#
-# Xilinx, Inc.
-#
-# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
-# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
-# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
-# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
-# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
-# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
-# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
-# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
-# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
-# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# crtinit.s
-#
-# Default second stage of C run-time initialization
-#
-# $Id: crtinit.s,v 1.5.2.7 2006/07/05 18:53:54 vasanth Exp $
-#
-#######################################
-
- .globl _crtinit
- .align 2
- .ent _crtinit
-
-_crtinit:
- addi r1, r1, -20 /* Save Link register */
- swi r15, r1, 0
-
- addi r6, r0, __sbss_start /* clear SBSS */
- addi r7, r0, __sbss_end
- rsub r18, r6, r7
- blei r18, .Lendsbss
-
-.Lloopsbss:
- swi r0, r6, 0
- addi r6, r6, 4
- rsub r18, r6, r7
- bgti r18, .Lloopsbss
-.Lendsbss:
-
- addi r6, r0, __bss_start /* clear BSS */
- addi r7, r0, __bss_end
- rsub r18, r6, r7
- blei r18, .Lendbss
-.Lloopbss:
- swi r0, r6, 0
- addi r6, r6, 4
- rsub r18, r6, r7
- bgti r18, .Lloopbss
-.Lendbss:
-
- brlid r15, _program_init /* Initialize the program */
- nop
-
-# brlid r15, __init /* Invoke language initialization functions */
-# nop
-
- addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */
- addi r7, r0, 0
- brlid r15, main /* Execute the program */
- addi r5, r0, 0
-
- addik r19, r3, 0 /* Save return value */
-
-# brlid r15, __fini /* Invoke language cleanup functions */
-# nop
-
- brlid r15, _program_clean /* Cleanup the program */
- nop
-
- lw r15, r1, r0 /* Return back to CRT */
-
- addik r3, r19, 0 /* Restore return value */
- rtsd r15, 8
- addi r1, r1, 20
- .end _crtinit
-
mpsoc/src_processor/aeMB/compiler/compile/custom_crt/crtinit.s
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/program_memories.sh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/program_memories.sh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/program_memories.sh (nonexistent)
@@ -1,4 +0,0 @@
-#!/bin/sh
- cd program
- quartus_stp -t prog.tcl
- cd ..
mpsoc/src_processor/aeMB/compiler/program_memories.sh
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/compile.sh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/compile.sh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/compile.sh (nonexistent)
@@ -1,7 +0,0 @@
-#!/bin/sh
-
- cd compile
- ./gccrom ../main.c
- cp out/ram0.mif ../ram00.mif
- cd ..
-
mpsoc/src_processor/aeMB/compiler/compile.sh
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_processor/aeMB/compiler/aemb/stdio.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/stdio.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/stdio.hh (nonexistent)
@@ -1,77 +0,0 @@
-/* $Id: stdio.hh,v 1.5 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic standard I/O functions
- @file stdio.hh
-
- These functions provide function prototypes for outbyte/inbyte
- which are required by the linker during compile time. These
- functions can be defined anywhere else in code but should not be
- inlined.
- */
-
-#ifndef _AEMB_STDIO_HH
-#define _AEMB_STDIO_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- Default stdout prototype.
- @param c char
-
- This is used to output characters to LCD or UART.
- */
-
- void outbyte(char c);
-
- /**
- Default stdin prototype.
- @return char
-
- This is used to read characters in from UART or keyboard.
- */
-
- char inbyte();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.4 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.3 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.2 2008/04/26 18:05:22 sybreon
- Minor cosmetic changes.
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
-*/
Index: mpsoc/src_processor/aeMB/compiler/aemb/semaphore.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/semaphore.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/semaphore.hh (nonexistent)
@@ -1,103 +0,0 @@
-/* $Id: semaphore.hh,v 1.1 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- General semaphore library
- @file semaphore.hh
- */
-
-#include "thread.hh"
-
-#ifndef _AEMB_SEMAPHORE_HH
-#define _AEMB_SEMAPHORE_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- // TODO: Extend this library to include threading mechanisms such as
- // semaphores, mutexes and such.
-
- /**
- Semaphore struct.
- Presently implemented as software solution but a hardware one may be
- required as the threads are hardware.
- */
-
- typedef int semaphore;
-
- /**
- Software Semaphore Signal.
-
- Increment the semaphore and run. This is a software mechanism.
- */
- inline void aembSignal(volatile semaphore _sem)
- {
- _aembLockMTX();
- _sem++;
- _aembFreeMTX();
- }
-
- /**
- Software Semaphore Wait.
-
- Decrement the semaphore and block if < 0. This is a software
- mechanism.
- */
- inline void aembWait(volatile semaphore _sem)
- {
- _aembLockMTX();
- _sem--;
- _aembFreeMTX();
- while (_sem < 0);
- }
-
- semaphore __mutex_rendezvous0 = 0; ///< internal rendezvous mutex
- semaphore __mutex_rendezvous1 = 1; ///< internal rendezvous mutex
-
- /**
- Implements a simple rendezvous mechanism
- */
- /*
- inline void aembRendezvous()
- {
- if (isThread1())
- {
- wait(__mutex_rendezvous0);
- signal(__mutex_rendezvous1);
- }
- else
- {
- signal(__mutex_rendezvous0);
- wait(__mutex_rendezvous1);
- }
- }
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*
-$log$
-*/
Index: mpsoc/src_processor/aeMB/compiler/aemb/stack.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/stack.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/stack.hh (nonexistent)
@@ -1,145 +0,0 @@
-/* $Id: stack.hh,v 1.8 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic stack related functions
- @file stack.hh
- */
-
-#ifndef _AEMB_STACK_HH
-#define _AEMB_STACK_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- Reads the size of the memory space allocated for the stack in bytes.
- @return size of stack
- */
-
- inline int aembGetStackSize()
- {
- int tmp;
- asm ("la %0, r0, _STACK_SIZE":"=r"(tmp));
- return tmp;
- }
-
- /**
- Reads the end of the memory space allocated for the stack. This is
- where the stack ends.
- @return end of stack
- */
-
- inline int aembGetStackEnd()
- {
- int tmp;
- asm ("la %0, r0, _stack_end":"=r"(tmp));
- return tmp;
- }
-
- /**
- Reads the top of the memory space allocated for the stack. This is
- where the stack starts.
- @return top of stack
- */
-
- inline int aembGetStackTop()
- {
- int tmp;
- asm ("la %0, r0, _stack":"=r"(tmp));
- return tmp;
- }
-
- /**
- Reads register R1 which is the designated stack pointer.
- @return stack pointer
- */
-
- inline int aembGetStack()
- {
- int tmp;
- asm ("addk %0, r0, r1":"=r"(tmp));
- return tmp;
- }
-
- /**
- Sets register R1 to the new stack pointer.
- @param stk new stack pointer
- @return new stack pointer
- */
-
- inline int aembSetStack(int stk)
- {
- asm ("addk r1, r0, %0"::"r"(stk));
- return stk;
- }
-
- /**
- Duplicates the stack
- @param newp new stack pointer
- @param oldp old stack pointer
- @param endp end of the stack
- */
-
- inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp)
- {
- while (oldp < endp)
- {
- // copy the stack content
- *newp = *oldp;
- // this increments 1 word (not 1 byte)
- newp++;
- oldp++;
- }
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.7 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.6 2008/04/27 16:04:42 sybreon
- Minor cosmetic changes.
-
- Revision 1.5 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.4 2008/04/26 18:04:31 sybreon
- Updated software to freeze T0 and run T1.
-
- Revision 1.3 2008/04/23 14:19:39 sybreon
- Fixed minor bugs.
- Initial use of hardware mutex.
-
- Revision 1.2 2008/04/20 16:35:53 sybreon
- Added C/C++ compatible #ifdef statements
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
-*/
Index: mpsoc/src_processor/aeMB/compiler/aemb/thread.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/thread.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/thread.hh (nonexistent)
@@ -1,101 +0,0 @@
-/* $Id: thread.hh,v 1.10 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic thread functions
- @file thread.hh
-
- These functions deal with the various hardware threads. It also
- provides simple mechanisms for toggling semaphores.
- */
-
-#include "msr.hh"
-
-#ifndef _AEMB_THREAD_HH
-#define _AEMB_THREAD_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- Checks to see if currently executing Thread 1
- @return true if is Thread 1
- */
-
- inline int aembIsThread1()
- {
- int rmsr = aembGetMSR();
- return ((rmsr & AEMB_MSR_PHA));
- }
-
- /**
- Checks to see if currently executing Thread 0
- @return true if is Thread 0
- */
-
- inline int aembIsThread0()
- {
- int rmsr = aembGetMSR();
- return (!(rmsr & AEMB_MSR_PHA));
- }
-
- /**
- Checks to see if it is multi-threaded or not.
- @return true if thread capable
- */
- inline int aembIsThreaded()
- {
- int rmsr = aembGetMSR();
- return (rmsr & AEMB_MSR_HTX);
- }
-
- /**
- Hardware Mutex Signal.
- Unlock the hardware mutex, which is unlocked on reset.
- */
- inline void _aembFreeMTX()
- {
- int tmp;
- asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(AEMB_MSR_MTX));
- }
-
- /**
- Hardware Mutex Wait.
-
- Waits until the hardware mutex is unlocked. This should be used
- as part of a larger software mutex mechanism.
- */
- inline void _aembLockMTX()
- {
- int rmsr;
- do
- {
- asm volatile ("msrset %0, %1":"=r"(rmsr):"K"(AEMB_MSR_MTX));
- }
- while (rmsr & AEMB_MSR_MTX);
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Index: mpsoc/src_processor/aeMB/compiler/aemb/core.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/core.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/core.hh (nonexistent)
@@ -1,53 +0,0 @@
-/* $Id: core.hh,v 1.5 2008-05-31 17:02:04 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- General AEMB2 core library
- @file core.hh
- */
-
-#ifdef __MICROBLAZE__
-
-#include "msr.hh"
-#include "stack.hh"
-#include "heap.hh"
-#include "thread.hh"
-#include "hook.hh"
-#include "stdio.hh"
-#include "semaphore.hh"
-
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.4 2008/04/28 20:29:15 sybreon
- Made files C compatible under C++.
-
- Revision 1.3 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.2 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
- */
Index: mpsoc/src_processor/aeMB/compiler/aemb/heap.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/heap.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/heap.hh (nonexistent)
@@ -1,93 +0,0 @@
-/* $Id: heap.hh,v 1.6 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic heap related functions
- @file heap.hh
- */
-
-#ifndef _AEMB_HEAP_HH
-#define _AEMB_HEAP_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- Extracts the heap size from the linker
- @return heap size
- */
-
- inline int aembGetHeapSize()
- {
- int tmp;
- asm ("la %0, r0, _HEAP_SIZE":"=r"(tmp));
- return tmp;
- }
-
- /**
- Extracts the heap end from the linker
- @return heap end
- */
-
- inline int aembGetHeapEnd()
- {
- int tmp;
- asm ("la %0, r0, _heap_end":"=r"(tmp));
- return tmp;
- }
-
- /**
- Extracts the heap top from the linker
- @return heap top
- */
-
- inline int aembGetHeapTop()
- {
- int tmp;
- asm ("la %0, r0, _heap":"=r"(tmp));
- return tmp;
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.5 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.4 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.3 2008/04/26 18:05:22 sybreon
- Minor cosmetic changes.
-
- Revision 1.2 2008/04/20 16:35:53 sybreon
- Added C/C++ compatible #ifdef statements
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
-*/
Index: mpsoc/src_processor/aeMB/compiler/aemb/hook.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/hook.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/hook.hh (nonexistent)
@@ -1,169 +0,0 @@
-/* $Id: hook.hh,v 1.11 2008-04-28 20:31:40 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic begin/end hooks
- @file hook.hh
-
- These routines hook themselves onto parts of the main programme to
- enable the hardware threads to work properly.
- */
-
-#include "stack.hh"
-#include "heap.hh"
-#include "thread.hh"
-
-#ifndef _AEMB_HOOK_HH
-#define _AEMB_HOOK_HH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void _program_init();
- void _program_clean();
-
- // newlib locks
- void __malloc_lock(struct _reent *reent);
- void __malloc_unlock(struct _reent *reent);
- //void __env_lock(struct _reent *reent);
- //void __env_unlock(struct _reent *reent);
-
- /**
- Finalisation hook
-
- This function executes during the shutdown phase after the
- finalisation routine is called. It will merge the changes made
- during initialisation.
- */
-
- void _program_clean()
- {
- _aembLockMTX(); // enter critical section
-
- // unify the stack backwards
- if (aembIsThread0())
- {
- aembSetStack(aembGetStack() + (aembGetStackSize() >> 1));
- }
-
- _aembFreeMTX(); // exit critical section
- }
-
- /**
- Initialisation hook
-
- This function executes during the startup phase before the
- initialisation routine is called. It splits the stack between the
- threads. For now, it will lock up T0 for compatibility purposes.
- */
-
- void _program_init()
- {
- _aembLockMTX(); // enter critical section
-
- // split and shift the stack for thread 1
- if (aembIsThread0()) // main thread
- {
- // NOTE: Dupe the stack otherwise it will FAIL!
- int oldstk = aembGetStack();
- int newstk = aembSetStack(aembGetStack() - (aembGetStackSize() >> 1));
- aembDupStack((unsigned int *)newstk,
- (unsigned int *)oldstk,
- (unsigned int *)aembGetStackTop());
- _aembFreeMTX(); // exit critical section
- while (1) asm volatile ("nop"); // lock thread
- }
-
- _aembFreeMTX(); // exit critical section
- }
-
- /**
- Heap Lock
-
- This function is called during malloc() to lock out the shared
- heap to avoid data corruption.
- */
-
- void __malloc_lock(struct _reent *reent)
- {
- _aembLockMTX();
- }
-
- /**
- Heap Unlock
-
- This function is called during malloc() to indicate that the
- shared heap is now available for another thread.
- */
-
- void __malloc_unlock(struct _reent *reent)
- {
- _aembFreeMTX();
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#ifndef __OPTIMIZE__
-// The main programme needs to be compiled with optimisations turned
-// on (at least -O1). If not, the MUTEX value will be written to the
-// same RAM location, giving both threads the same value.
-OPTIMISATION_REQUIRED OPTIMISATION_REQUIRED
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.10 2008/04/28 20:29:15 sybreon
- Made files C compatible under C++.
-
- Revision 1.9 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.8 2008/04/27 16:04:42 sybreon
- Minor cosmetic changes.
-
- Revision 1.7 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.6 2008/04/26 18:04:31 sybreon
- Updated software to freeze T0 and run T1.
-
- Revision 1.5 2008/04/23 14:19:39 sybreon
- Fixed minor bugs.
- Initial use of hardware mutex.
-
- Revision 1.4 2008/04/20 16:35:53 sybreon
- Added C/C++ compatible #ifdef statements
-
- Revision 1.3 2008/04/12 13:46:02 sybreon
- Added malloc() lock and unlock routines
-
- Revision 1.2 2008/04/11 15:20:31 sybreon
- added static assert hack
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
-*/
Index: mpsoc/src_processor/aeMB/compiler/aemb/msr.hh
===================================================================
--- mpsoc/src_processor/aeMB/compiler/aemb/msr.hh (revision 18)
+++ mpsoc/src_processor/aeMB/compiler/aemb/msr.hh (nonexistent)
@@ -1,171 +0,0 @@
-/* $Id: msr.hh,v 1.9 2008-04-28 20:29:15 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic MSR functions
- @file msr.hh
-
- These functions provide read/write access to the Machine Status
- Register. It also contains the bit definitions of the register.
- */
-
-#ifndef _AEMB_MSR_HH
-#define _AEMB_MSR_HH
-
-// STANDARD BITS
-#define AEMB_MSR_BE (1 << 0) ///< Buslock Enable
-#define AEMB_MSR_IE (1 << 1) ///< Interrupt Enable
-#define AEMB_MSR_C (1 << 2) ///< Arithmetic Carry
-#define AEMB_MSR_BIP (1 << 3) ///< Break in Progress
-#define AEMB_MSR_EE (1 << 8) ///< Exception Enable
-#define AEMB_MSR_EIP (1 << 9) ///< Exception in Progress
-
-#define AEMB_MSR_ITE (1 << 5) ///< Instruction Cache Enable
-#define AEMB_MSR_DZ (1 << 6) ///< Division by Zero
-#define AEMB_MSR_DTE (1 << 7) ///< Data Cache Enable
-
-// CUSTOM BITS
-#define AEMB_MSR_MTX (1 << 4) ///< Hardware Mutex
-#define AEMB_MSR_PHA (1 << 29) ///< Hardware Thread Phase
-#define AEMB_MSR_HTX (1 << 30) ///< Hardware Threads Extension
-#define AEMB_MSR_CC (1 << 31) ///< Carry Copy
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- Read the value of the MSR register
- @return register contents
- */
-
- inline int aembGetMSR()
- {
- int rmsr;
- asm volatile ("mfs %0, rmsr":"=r"(rmsr));
- return rmsr;
- }
-
- /**
- Write a value to the MSR register
- @param rmsr value to write
- */
-
- inline void aembPutMSR(int rmsr)
- {
- asm volatile ("mts rmsr, %0"::"r"(rmsr));
- }
-
- /**
- Read and clear the MSR
- @param rmsk clear mask
- @return msr value
- */
-
- inline int aembClrMSR(const short rmsk)
- {
- int tmp;
- //asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(rmsk):"memory");
- return tmp;
- }
-
- /**
- Read and set the MSR
- @param rmsk set mask
- @return msr value
- */
-
- inline int aembSetMSR(const short rmsk)
- {
- int tmp;
- //asm volatile ("msrset %0, %1":"=r"(tmp):"K"(rmsk):"memory");
- return tmp;
- }
-
- /** Enable global interrupts */
- inline int aembEnableInterrupts()
- {
- int msr;
- asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_IE));
- return msr;
- }
-
- /** Disable global interrupts */
- inline int aembDisableInterrupts()
- {
- int msr;
- asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_IE));
- return msr;
- }
-
- /** Enable global exception */
- inline int aembEnableException()
- {
- int msr;
- asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_EE));
- return msr;
- }
-
- /** Disable global exception */
- inline int aembDisableException()
- {
- int msr;
- asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_EE));
- return msr;
- }
-
- /** Enable data caches */
- inline int aembEnableDataTag()
- {
- int msr;
- asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE));
- return msr;
- }
-
- /** Disable data caches */
- inline int aembDisableDataTag()
- {
- int msr;
- asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE));
- return msr;
- }
-
- /** Enable inst caches */
- inline int aembEnableInstTag()
- {
- int msr;
- asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE));
- return msr;
- }
-
- /** Disable inst caches */
- inline int aembDisableInstTag()
- {
- int msr;
- asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE));
- return msr;
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Index: mpsoc/src_processor/lm32/verilog/src/lm32.v
===================================================================
--- mpsoc/src_processor/lm32/verilog/src/lm32.v (revision 18)
+++ mpsoc/src_processor/lm32/verilog/src/lm32.v (revision 19)
@@ -1,178 +1,178 @@
-
-`include "system_conf.v"
-`include "lm32_include.v"
-
-module lm32 #(
- parameter INTR_NUM=32,
- parameter CFG_PL_MULTIPLY= "ENABLED", //"ENABLED","DISABLED"
- parameter CFG_PL_BARREL_SHIFT= "ENABLED",
- parameter CFG_SIGN_EXTEND="ENABLED",
- parameter CFG_MC_DIVIDE="DISABLED"
-
-)(
- // ----- Inputs -------
- clk_i,
- rst_i,
- interrupt,
- // Instruction Wishbone master
- I_DAT_I,
- I_ACK_I,
- I_ERR_I,
- I_RTY_I,
- I_DAT_O,
- I_ADR_O,
- I_CYC_O,
- I_SEL_O,
- I_STB_O,
- I_WE_O,
- I_CTI_O,
- //I_LOCK_O,
- I_BTE_O,
-
- // Data Wishbone master
- D_DAT_I,
- D_ACK_I,
- D_ERR_I,
- D_RTY_I,
- D_DAT_O,
- D_ADR_O,
- D_CYC_O,
- D_SEL_O,
- D_STB_O,
- D_WE_O,
- D_CTI_O,
- //D_LOCK_O,
- D_BTE_O
-
-);
-
-
-
-input clk_i; // Clock
-input rst_i; // Reset
-
-//`ifdef CFG_INTERRUPTS_ENABLED
-input [`LM32_INTERRUPT_RNG] interrupt; // Interrupt pins
-//`endif
-
-`ifdef CFG_USER_ENABLED
-input [`LM32_WORD_RNG] user_result; // User-defined instruction result
-input user_complete; // Indicates the user-defined instruction result is valid
-`endif
-
-`ifdef CFG_IWB_ENABLED
-input [`LM32_WORD_RNG] I_DAT_I; // Instruction Wishbone interface read data
-input I_ACK_I; // Instruction Wishbone interface acknowledgement
-input I_ERR_I; // Instruction Wishbone interface error
-input I_RTY_I; // Instruction Wishbone interface retry
-`endif
-
-
-
-`ifdef CFG_USER_ENABLED
-output user_valid; // Indicates that user_opcode and user_operand_* are valid
-wire user_valid;
-output [`LM32_USER_OPCODE_RNG] user_opcode; // User-defined instruction opcode
-reg [`LM32_USER_OPCODE_RNG] user_opcode;
-output [`LM32_WORD_RNG] user_operand_0; // First operand for user-defined instruction
-wire [`LM32_WORD_RNG] user_operand_0;
-output [`LM32_WORD_RNG] user_operand_1; // Second operand for user-defined instruction
-wire [`LM32_WORD_RNG] user_operand_1;
-`endif
-
-
-
-
-
-`ifdef CFG_IWB_ENABLED
-output [`LM32_WORD_RNG] I_DAT_O; // Instruction Wishbone interface write data
-wire [`LM32_WORD_RNG] I_DAT_O;
-output [`LM32_WORD_RNG] I_ADR_O; // Instruction Wishbone interface address
-wire [`LM32_WORD_RNG] I_ADR_O;
-output I_CYC_O; // Instruction Wishbone interface cycle
-wire I_CYC_O;
-output [`LM32_BYTE_SELECT_RNG] I_SEL_O; // Instruction Wishbone interface byte select
-wire [`LM32_BYTE_SELECT_RNG] I_SEL_O;
-output I_STB_O; // Instruction Wishbone interface strobe
-wire I_STB_O;
-output I_WE_O; // Instruction Wishbone interface write enable
-wire I_WE_O;
-output [`LM32_CTYPE_RNG] I_CTI_O; // Instruction Wishbone interface cycle type
-wire [`LM32_CTYPE_RNG] I_CTI_O;
-//output I_LOCK_O; // Instruction Wishbone interface lock bus
-//wire I_LOCK_O;
-output [`LM32_BTYPE_RNG] I_BTE_O; // Instruction Wishbone interface burst type
-wire [`LM32_BTYPE_RNG] I_BTE_O;
-`endif
-
-
-input [`LM32_WORD_RNG] D_DAT_I; // Data Wishbone interface read data
-input D_ACK_I; // Data Wishbone interface acknowledgement
-input D_ERR_I; // Data Wishbone interface error
-input D_RTY_I; // Data Wishbone interface retry
-
-
-output [`LM32_WORD_RNG] D_DAT_O; // Data Wishbone interface write data
-wire [`LM32_WORD_RNG] D_DAT_O;
-output [`LM32_WORD_RNG] D_ADR_O; // Data Wishbone interface address
-wire [`LM32_WORD_RNG] D_ADR_O;
-output D_CYC_O; // Data Wishbone interface cycle
-wire D_CYC_O;
-output [`LM32_BYTE_SELECT_RNG] D_SEL_O; // Data Wishbone interface byte select
-wire [`LM32_BYTE_SELECT_RNG] D_SEL_O;
-output D_STB_O; // Data Wishbone interface strobe
-wire D_STB_O;
-output D_WE_O; // Data Wishbone interface write enable
-wire D_WE_O;
-output [`LM32_CTYPE_RNG] D_CTI_O; // Data Wishbone interface cycle type
-wire [`LM32_CTYPE_RNG] D_CTI_O;
-//output D_LOCK_O; // Date Wishbone interface lock bus
-//wire D_LOCK_O;
-output [`LM32_BTYPE_RNG] D_BTE_O; // Data Wishbone interface burst type
-wire [`LM32_BTYPE_RNG] D_BTE_O;
-
-
-wire [31:0] iadr_o,dadr_o;
-
-lm32_top the_lm32_top(
- .clk_i(clk_i),
- .rst_i(rst_i),
- .interrupt_n(~interrupt),
- .I_DAT_I(I_DAT_I),
- .I_ACK_I(I_ACK_I),
- .I_ERR_I(I_ERR_I),
- .I_RTY_I(I_RTY_I),
- .D_DAT_I(D_DAT_I),
- .D_ACK_I(D_ACK_I),
- .D_ERR_I(D_ERR_I),
- .D_RTY_I(D_RTY_I),
- .I_DAT_O(I_DAT_O),
- .I_ADR_O(iadr_o),
- .I_CYC_O(I_CYC_O),
- .I_SEL_O(I_SEL_O),
- .I_STB_O(I_STB_O),
- .I_WE_O(I_WE_O),
- .I_CTI_O(I_CTI_O),
- .I_LOCK_O(),
- .I_BTE_O(I_BTE_O),
- .D_DAT_O(D_DAT_O),
- .D_ADR_O(dadr_o),
- .D_CYC_O(D_CYC_O),
- .D_SEL_O(D_SEL_O),
- .D_STB_O(D_STB_O),
- .D_WE_O(D_WE_O),
- .D_CTI_O(D_CTI_O),
- .D_LOCK_O(),
- .D_BTE_O(D_BTE_O)
-);
-
- assign D_ADR_O= {2'b00,dadr_o[31:2]};
- assign I_ADR_O= {2'b00,iadr_o[31:2]};
- // assign iwb_dat_o = 0;
- // assign iwb_tag_o = 3'b000; // clasic wishbone without burst
- // assign dwb_tag_o = 3'b000; // clasic wishbone without burst
- // assign iwb_adr_o[31:30] = 2'b00;
- // assign dwb_adr_o[31:30] = 2'b00;
-
-endmodule
-
+
+`include "system_conf.v"
+`include "lm32_include.v"
+
+module lm32 #(
+ parameter INTR_NUM=32,
+ parameter CFG_PL_MULTIPLY= "ENABLED", //"ENABLED","DISABLED"
+ parameter CFG_PL_BARREL_SHIFT= "ENABLED",
+ parameter CFG_SIGN_EXTEND="ENABLED",
+ parameter CFG_MC_DIVIDE="DISABLED"
+
+)(
+ // ----- Inputs -------
+ clk_i,
+ rst_i,
+ interrupt,
+ // Instruction Wishbone master
+ I_DAT_I,
+ I_ACK_I,
+ I_ERR_I,
+ I_RTY_I,
+ I_DAT_O,
+ I_ADR_O,
+ I_CYC_O,
+ I_SEL_O,
+ I_STB_O,
+ I_WE_O,
+ I_CTI_O,
+ //I_LOCK_O,
+ I_BTE_O,
+
+ // Data Wishbone master
+ D_DAT_I,
+ D_ACK_I,
+ D_ERR_I,
+ D_RTY_I,
+ D_DAT_O,
+ D_ADR_O,
+ D_CYC_O,
+ D_SEL_O,
+ D_STB_O,
+ D_WE_O,
+ D_CTI_O,
+ //D_LOCK_O,
+ D_BTE_O
+
+);
+
+
+
+input clk_i; // Clock
+input rst_i; // Reset
+
+//`ifdef CFG_INTERRUPTS_ENABLED
+input [`LM32_INTERRUPT_RNG] interrupt; // Interrupt pins
+//`endif
+
+`ifdef CFG_USER_ENABLED
+input [`LM32_WORD_RNG] user_result; // User-defined instruction result
+input user_complete; // Indicates the user-defined instruction result is valid
+`endif
+
+`ifdef CFG_IWB_ENABLED
+input [`LM32_WORD_RNG] I_DAT_I; // Instruction Wishbone interface read data
+input I_ACK_I; // Instruction Wishbone interface acknowledgement
+input I_ERR_I; // Instruction Wishbone interface error
+input I_RTY_I; // Instruction Wishbone interface retry
+`endif
+
+
+
+`ifdef CFG_USER_ENABLED
+output user_valid; // Indicates that user_opcode and user_operand_* are valid
+wire user_valid;
+output [`LM32_USER_OPCODE_RNG] user_opcode; // User-defined instruction opcode
+reg [`LM32_USER_OPCODE_RNG] user_opcode;
+output [`LM32_WORD_RNG] user_operand_0; // First operand for user-defined instruction
+wire [`LM32_WORD_RNG] user_operand_0;
+output [`LM32_WORD_RNG] user_operand_1; // Second operand for user-defined instruction
+wire [`LM32_WORD_RNG] user_operand_1;
+`endif
+
+
+
+
+
+`ifdef CFG_IWB_ENABLED
+output [`LM32_WORD_RNG] I_DAT_O; // Instruction Wishbone interface write data
+wire [`LM32_WORD_RNG] I_DAT_O;
+output [`LM32_WORD_RNG] I_ADR_O; // Instruction Wishbone interface address
+wire [`LM32_WORD_RNG] I_ADR_O;
+output I_CYC_O; // Instruction Wishbone interface cycle
+wire I_CYC_O;
+output [`LM32_BYTE_SELECT_RNG] I_SEL_O; // Instruction Wishbone interface byte select
+wire [`LM32_BYTE_SELECT_RNG] I_SEL_O;
+output I_STB_O; // Instruction Wishbone interface strobe
+wire I_STB_O;
+output I_WE_O; // Instruction Wishbone interface write enable
+wire I_WE_O;
+output [`LM32_CTYPE_RNG] I_CTI_O; // Instruction Wishbone interface cycle type
+wire [`LM32_CTYPE_RNG] I_CTI_O;
+//output I_LOCK_O; // Instruction Wishbone interface lock bus
+//wire I_LOCK_O;
+output [`LM32_BTYPE_RNG] I_BTE_O; // Instruction Wishbone interface burst type
+wire [`LM32_BTYPE_RNG] I_BTE_O;
+`endif
+
+
+input [`LM32_WORD_RNG] D_DAT_I; // Data Wishbone interface read data
+input D_ACK_I; // Data Wishbone interface acknowledgement
+input D_ERR_I; // Data Wishbone interface error
+input D_RTY_I; // Data Wishbone interface retry
+
+
+output [`LM32_WORD_RNG] D_DAT_O; // Data Wishbone interface write data
+wire [`LM32_WORD_RNG] D_DAT_O;
+output [`LM32_WORD_RNG] D_ADR_O; // Data Wishbone interface address
+wire [`LM32_WORD_RNG] D_ADR_O;
+output D_CYC_O; // Data Wishbone interface cycle
+wire D_CYC_O;
+output [`LM32_BYTE_SELECT_RNG] D_SEL_O; // Data Wishbone interface byte select
+wire [`LM32_BYTE_SELECT_RNG] D_SEL_O;
+output D_STB_O; // Data Wishbone interface strobe
+wire D_STB_O;
+output D_WE_O; // Data Wishbone interface write enable
+wire D_WE_O;
+output [`LM32_CTYPE_RNG] D_CTI_O; // Data Wishbone interface cycle type
+wire [`LM32_CTYPE_RNG] D_CTI_O;
+//output D_LOCK_O; // Date Wishbone interface lock bus
+//wire D_LOCK_O;
+output [`LM32_BTYPE_RNG] D_BTE_O; // Data Wishbone interface burst type
+wire [`LM32_BTYPE_RNG] D_BTE_O;
+
+
+wire [31:0] iadr_o,dadr_o;
+
+lm32_top the_lm32_top(
+ .clk_i(clk_i),
+ .rst_i(rst_i),
+ .interrupt_n(~interrupt),
+ .I_DAT_I(I_DAT_I),
+ .I_ACK_I(I_ACK_I),
+ .I_ERR_I(I_ERR_I),
+ .I_RTY_I(I_RTY_I),
+ .D_DAT_I(D_DAT_I),
+ .D_ACK_I(D_ACK_I),
+ .D_ERR_I(D_ERR_I),
+ .D_RTY_I(D_RTY_I),
+ .I_DAT_O(I_DAT_O),
+ .I_ADR_O(iadr_o),
+ .I_CYC_O(I_CYC_O),
+ .I_SEL_O(I_SEL_O),
+ .I_STB_O(I_STB_O),
+ .I_WE_O(I_WE_O),
+ .I_CTI_O(I_CTI_O),
+ .I_LOCK_O(),
+ .I_BTE_O(I_BTE_O),
+ .D_DAT_O(D_DAT_O),
+ .D_ADR_O(dadr_o),
+ .D_CYC_O(D_CYC_O),
+ .D_SEL_O(D_SEL_O),
+ .D_STB_O(D_STB_O),
+ .D_WE_O(D_WE_O),
+ .D_CTI_O(D_CTI_O),
+ .D_LOCK_O(),
+ .D_BTE_O(D_BTE_O)
+);
+
+ assign D_ADR_O= {2'b00,dadr_o[31:2]};
+ assign I_ADR_O= {2'b00,iadr_o[31:2]};
+ // assign iwb_dat_o = 0;
+ // assign iwb_tag_o = 3'b000; // clasic wishbone without burst
+ // assign dwb_tag_o = 3'b000; // clasic wishbone without burst
+ // assign iwb_adr_o[31:30] = 2'b00;
+ // assign dwb_adr_o[31:30] = 2'b00;
+
+endmodule
+
Index: mpsoc/src_processor/lm32/verilog/src/lm32_interrupt.v
===================================================================
--- mpsoc/src_processor/lm32/verilog/src/lm32_interrupt.v (revision 18)
+++ mpsoc/src_processor/lm32/verilog/src/lm32_interrupt.v (revision 19)
@@ -20,7 +20,7 @@
// Dependencies : lm32_include.v
// Version : 6.1.17
// =============================================================================
-
+
`include "system_conf.v"
`include "lm32_include.v"
@@ -138,7 +138,7 @@
// };
wire ip_csr_read_data = ip;
wire im_csr_read_data = im;
-// XXX JB XXX
+// XXX JB XXX
// generate
// if (interrupts > 1)
// begin
@@ -160,7 +160,7 @@
default: csr_read_data = {`LM32_WORD_WIDTH{1'bx}};
endcase
end
-// XXX JB XXX
+// XXX JB XXX
// end
// else
// begin
@@ -188,7 +188,7 @@
// Sequential Logic
/////////////////////////////////////////////////////
-// XXX JB XXX
+// XXX JB XXX
//generate
// if (interrupts > 1)
// begin
/mpsoc/src_processor/lm32/verilog/src/lm32_dp_ram.v
1,41 → 1,41
module lm32_dp_ram( |
clk_i, |
rst_i, |
we_i, |
waddr_i, |
wdata_i, |
raddr_i, |
rdata_o); |
|
parameter addr_width = 32; |
parameter addr_depth = 1024; |
parameter data_width = 8; |
|
input clk_i; |
input rst_i; |
input we_i; |
input [addr_width-1:0] waddr_i; |
input [data_width-1:0] wdata_i; |
input [addr_width-1:0] raddr_i; |
output [data_width-1:0] rdata_o; |
|
reg [data_width-1:0] ram[addr_depth-1:0]; |
|
reg [addr_width-1:0] raddr_r; |
assign rdata_o = ram[raddr_r]; |
|
integer i; |
initial begin |
for (i=0;i<addr_depth-1;i=i+1) |
ram[i] = 0; |
end |
|
always @ (posedge clk_i) |
begin |
if (we_i) |
ram[waddr_i] <= wdata_i; |
raddr_r <= raddr_i; |
end |
|
endmodule |
|
module lm32_dp_ram( |
clk_i, |
rst_i, |
we_i, |
waddr_i, |
wdata_i, |
raddr_i, |
rdata_o); |
|
parameter addr_width = 32; |
parameter addr_depth = 1024; |
parameter data_width = 8; |
|
input clk_i; |
input rst_i; |
input we_i; |
input [addr_width-1:0] waddr_i; |
input [data_width-1:0] wdata_i; |
input [addr_width-1:0] raddr_i; |
output [data_width-1:0] rdata_o; |
|
reg [data_width-1:0] ram[addr_depth-1:0]; |
|
reg [addr_width-1:0] raddr_r; |
assign rdata_o = ram[raddr_r]; |
|
integer i; |
initial begin |
for (i=0;i<addr_depth-1;i=i+1) |
ram[i] = 0; |
end |
|
always @ (posedge clk_i) |
begin |
if (we_i) |
ram[waddr_i] <= wdata_i; |
raddr_r <= raddr_i; |
end |
|
endmodule |
|
/mpsoc/src_c/injection ratio/Makefile
File deleted
mpsoc/src_c/injection ratio/Makefile
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_c/injection ratio/traffic
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: mpsoc/src_c/injection ratio/traffic
===================================================================
--- mpsoc/src_c/injection ratio/traffic (revision 18)
+++ mpsoc/src_c/injection ratio/traffic (nonexistent)
mpsoc/src_c/injection ratio/traffic
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: mpsoc/src_c/injection ratio/main.c
===================================================================
--- mpsoc/src_c/injection ratio/main.c (revision 18)
+++ mpsoc/src_c/injection ratio/main.c (nonexistent)
@@ -1,53 +0,0 @@
-#include
-
-#define MAX_VAL 4
-#define POINT_NUM 6
-#define INITIAL_RATIO 5
-char ratio;
-struct{
- char ratio;
- double avg_latency;
- char valid[POINT_NUM+1]
-} injection_data;
-
-struct injection_data [POINT_NUM];
-
-int main (){
-
- int i;
- for(i=0;ivalid=0;
-
- }
-
-
-
-}
-
-
-
-
-int injection_ratio(){
- double avg_latency;
- if(injection_data[0]->valid==0) {
- injection_data[0]->ratio=INITIAL_RATIO;
- injection_data[0]->avg_latency = run_sim();
- injection_data[0]->valid=1;
- }
- else {
-
-
-
- }
-
-
-
-
-
-
-
-}
-
-
-
-for (i=0;i<
mpsoc/src_c/injection ratio/main.c
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: mpsoc/src_c/ihex2mif/main.c
===================================================================
--- mpsoc/src_c/ihex2mif/main.c (nonexistent)
+++ mpsoc/src_c/ihex2mif/main.c (revision 19)
@@ -0,0 +1,121 @@
+#include "ihex.c"
+#include
+#include
+
+#define DEFAULT_OUT_FILE_NAME "out.mif"
+#define DEAFULT_END_SIZE "1FFF"
+
+int memory[65536]; /* the memory is global */
+unsigned int end_addr_int;
+FILE * in, * out;
+char *file_name, *end_addr, *out_file_name ;
+
+void usage (void)
+{
+ printf("Usage: ./ihex2mif \n");
+ printf("\nOptions: \n");
+ printf(" -e : end memory address .\n");
+ printf(" -f : input ihex file .\n");
+
+}
+
+void processArgs (int argc, char **argv )
+{
+ char c;
+
+ opterr = 0;
+
+ while ((c = getopt (argc, argv, "e:f:o:h")) != -1)
+ {
+ switch (c)
+ {
+ case 'e':
+ end_addr = optarg;
+ break;
+ case 'f':
+ file_name = optarg;
+ break;
+ case 'o':
+ out_file_name = optarg;
+ break;
+ case 'h':
+ usage();
+ exit(1);
+ break;
+ case '?':
+ if (isprint (optopt))
+ fprintf (stderr, "Unknown option `-%c'.\n", optopt);
+ else
+ fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
+ default:
+ usage();
+ exit(1);
+ }
+ }
+}
+
+void update_out_file(void);
+int main ( int argc, char **argv ){
+
+ processArgs (argc,argv );
+ if (file_name == NULL) {usage();exit(1);}
+ if (end_addr == NULL) end_addr = DEAFULT_END_SIZE;
+ if (out_file_name == NULL) out_file_name = DEFAULT_OUT_FILE_NAME;
+ //printf("filename=%s & size=%s\n",file_name, end_addr);
+ sscanf(end_addr, "%x", &end_addr_int);
+ //printf("%u\n", end_addr_int);
+ out=fopen(out_file_name,"wb");
+ if(out==NULL){printf("Output file cannot be created"); exit(1);}
+ load_file(file_name);
+ update_out_file();
+
+
+ fclose(out);
+
+return 0;
+}
+
+
+void update_out_file(void){
+ unsigned int ram_addr=0,zero_count,ram_data,i;
+ fprintf(out,"-- Copyright (C) 2013 Alireza Monemi\n\n");
+ fprintf(out,"WIDTH=32;\nDEPTH=%d;\nADDRESS_RADIX=HEX;\nDATA_RADIX=HEX;\n\nCONTENT BEGIN\n", (end_addr_int>>2)+1);
+ while(ram_addr>2,ram_data);
+ }else if (zero_count == 1){
+ fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2),0);
+ if(ram_data!=0)fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2)+1,ram_data);
+
+ }
+ else {
+ fprintf(out,"\t[%08X..%08X]\t:\t00000000;\n" ,ram_addr>>2, (ram_addr>>2)+ zero_count-1);
+ if(ram_data!=0)fprintf(out,"\t%08X\t:\t%08X;\n" , (ram_addr>>2)+ zero_count,ram_data);
+ }
+ ram_addr+=(zero_count<<2)+4;
+
+
+
+
+ }
+ fprintf(out,"END;");
+
+return;
+}
+
mpsoc/src_c/ihex2mif/main.c
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: mpsoc/src_c/ihex2mif/Makefile
===================================================================
--- mpsoc/src_c/ihex2mif/Makefile (nonexistent)
+++ mpsoc/src_c/ihex2mif/Makefile (revision 19)
@@ -0,0 +1,3 @@
+#!/bin/sh
+all:
+ gcc main.c -o ihex2mif
mpsoc/src_c/ihex2mif/Makefile
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: mpsoc/src_c/ihex2mif/ihex.c
===================================================================
--- mpsoc/src_c/ihex2mif/ihex.c (nonexistent)
+++ mpsoc/src_c/ihex2mif/ihex.c (revision 19)
@@ -0,0 +1,216 @@
+/* Intel HEX read/write functions, Paul Stoffregen, paul@ece.orst.edu */
+/* This code is in the public domain. Please retain my name and */
+/* email address in distributed copies, and let me know about any bugs */
+
+/* I, Paul Stoffregen, give no warranty, expressed or implied for */
+/* this software and/or documentation provided, including, without */
+/* limitation, warranty of merchantability and fitness for a */
+/* particular purpose. */
+
+
+#include
+#include
+#include
+
+/* some ansi prototypes.. maybe ought to make a .h file */
+
+/* this loads an intel hex file into the memory[] array */
+void load_file(char *filename);
+
+/* this writes a part of memory[] to an intel hex file */
+void save_file(char *command);
+
+/* this is used by load_file to get each line of intex hex */
+int parse_hex_line(char *theline, int bytes[], int *addr, int *num, int *code);
+
+/* this does the dirty work of writing an intel hex file */
+/* caution, static buffering is used, so it is necessary */
+/* to call it with end=1 when finsihed to flush the buffer */
+/* and close the file */
+void hexout(FILE *fhex, int byte, int memory_location, int end);
+
+
+extern int memory[65536]; /* the memory is global */
+
+/* parses a line of intel hex code, stores the data in bytes[] */
+/* and the beginning address in addr, and returns a 1 if the */
+/* line was valid, or a 0 if an error occured. The variable */
+/* num gets the number of bytes that were stored into bytes[] */
+
+int parse_hex_line(theline, bytes, addr, num, code)
+char *theline;
+int *addr, *num, *code, bytes[];
+{
+ int sum, len, cksum;
+ char *ptr;
+
+ *num = 0;
+ if (theline[0] != ':') return 0;
+ if (strlen(theline) < 11) return 0;
+ ptr = theline+1;
+ if (!sscanf(ptr, "%02x", &len)) return 0;
+ ptr += 2;
+ if ( strlen(theline) < (11 + (len * 2)) ) return 0;
+ if (!sscanf(ptr, "%04x", addr)) return 0;
+ ptr += 4;
+ /* printf("Line: length=%d Addr=%d\n", len, *addr); */
+ if (!sscanf(ptr, "%02x", code)) return 0;
+ ptr += 2;
+ sum = (len & 255) + ((*addr >> 8) & 255) + (*addr & 255) + (*code & 255);
+ while(*num != len) {
+ if (!sscanf(ptr, "%02x", &bytes[*num])) return 0;
+ ptr += 2;
+ sum += bytes[*num] & 255;
+ (*num)++;
+ if (*num >= 256) return 0;
+ }
+ if (!sscanf(ptr, "%02x", &cksum)) return 0;
+ if ( ((sum & 255) + (cksum & 255)) & 255 ) return 0; /* checksum error */
+ return 1;
+}
+
+/* loads an intel hex file into the global memory[] array */
+/* filename is a string of the file to be opened */
+
+void load_file(filename)
+char *filename;
+{
+ char line[1000];
+ FILE *fin;
+ int addr, n, status, bytes[256];
+ int i, total=0, lineno=1;
+ int minaddr=65536, maxaddr=0;
+
+ if (strlen(filename) == 0) {
+ printf(" Can't load a file without the filename.");
+ printf(" '?' for help\n");
+ return;
+ }
+ fin = fopen(filename, "r");
+ if (fin == NULL) {
+ printf(" Can't open file '%s' for reading.\n", filename);
+ //return;
+ exit(1);
+ }
+ while (!feof(fin) && !ferror(fin)) {
+ line[0] = '\0';
+ fgets(line, 1000, fin);
+ if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0';
+ if (line[strlen(line)-1] == '\r') line[strlen(line)-1] = '\0';
+ if (parse_hex_line(line, bytes, &addr, &n, &status)) {
+ if (status == 0) { /* data */
+ for(i=0; i<=(n-1); i++) {
+ memory[addr] = bytes[i] & 255;
+ total++;
+ if (addr < minaddr) minaddr = addr;
+ if (addr > maxaddr) maxaddr = addr;
+ addr++;
+ }
+ }
+ if (status == 1) { /* end of file */
+ fclose(fin);
+ printf(" Loaded %d bytes between:", total);
+ printf(" %04X to %04X\n", minaddr, maxaddr);
+ return;
+ }
+ if (status == 2) ; /* begin of file */
+ } else {
+ printf(" Error: '%s', line: %d\n", filename, lineno);
+ }
+ lineno++;
+ }
+}
+
+
+/* the command string format is "S begin end filename" where */
+/* "begin" and "end" are the locations to dump to the intel */
+/* hex file, specified in hexidecimal. */
+
+void save_file(command)
+char *command;
+{
+ int begin, end, addr;
+ char *ptr, filename[200];
+ FILE *fhex;
+
+ ptr = command+1;
+ while (isspace(*ptr)) ptr++;
+ if (*ptr == '\0') {
+ printf(" Must specify address range and filename\n");
+ return;
+ }
+ if (sscanf(ptr, "%x%x%s", &begin, &end, filename) < 3) {
+ printf(" Invalid addresses or filename,\n");
+ printf(" usage: S begin_addr end_addr filename\n");
+ printf(" the addresses must be hexidecimal format\n");
+ return;
+ }
+ begin &= 65535;
+ end &= 65535;
+ if (begin > end) {
+ printf(" Begin address must be less than end address.\n");
+ return;
+ }
+ fhex = fopen(filename, "w");
+ if (fhex == NULL) {
+ printf(" Can't open '%s' for writing.\n", filename);
+ return;
+ }
+ for (addr=begin; addr <= end; addr++)
+ hexout(fhex, memory[addr], addr, 0);
+ hexout(fhex, 0, 0, 1);
+ printf("Memory %04X to %04X written to '%s'\n", begin, end, filename);
+}
+
+
+/* produce intel hex file output... call this routine with */
+/* each byte to output and it's memory location. The file */
+/* pointer fhex must have been opened for writing. After */
+/* all data is written, call with end=1 (normally set to 0) */
+/* so it will flush the data from its static buffer */
+
+#define MAXHEXLINE 32 /* the maximum number of bytes to put in one line */
+
+void hexout(fhex, byte, memory_location, end)
+FILE *fhex; /* the file to put intel hex into */
+int byte, memory_location, end;
+{
+ static int byte_buffer[MAXHEXLINE];
+ static int last_mem, buffer_pos, buffer_addr;
+ static int writing_in_progress=0;
+ register int i, sum;
+
+ if (!writing_in_progress) {
+ /* initial condition setup */
+ last_mem = memory_location-1;
+ buffer_pos = 0;
+ buffer_addr = memory_location;
+ writing_in_progress = 1;
+ }
+
+ if ( (memory_location != (last_mem+1)) || (buffer_pos >= MAXHEXLINE) \
+ || ((end) && (buffer_pos > 0)) ) {
+ /* it's time to dump the buffer to a line in the file */
+ fprintf(fhex, ":%02X%04X00", buffer_pos, buffer_addr);
+ sum = buffer_pos + ((buffer_addr>>8)&255) + (buffer_addr&255);
+ for (i=0; i < buffer_pos; i++) {
+ fprintf(fhex, "%02X", byte_buffer[i]&255);
+ sum += byte_buffer[i]&255;
+ }
+ fprintf(fhex, "%02X\n", (-sum)&255);
+ buffer_addr = memory_location;
+ buffer_pos = 0;
+ }
+
+ if (end) {
+ fprintf(fhex, ":00000001FF\n"); /* end of file marker */
+ fclose(fhex);
+ writing_in_progress = 0;
+ }
+
+ last_mem = memory_location;
+ byte_buffer[buffer_pos] = byte & 255;
+ buffer_pos++;
+}
+
+
mpsoc/src_c/ihex2mif/ihex.c
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property