URL
https://opencores.org/ocsvn/lwrisc/lwrisc/trunk
Subversion Repositories lwrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 6 to Rev 7
- ↔ Reverse comparison
Rev 6 → Rev 7
/trunk/BENCH/test1/alt_mem_set.h
0,0 → 1,4
`define ALT_MEM_WIDTHAD 7 |
`define ALT_MEM_NUMWORDS 128 |
`define MIF_NAME init_file.mif |
|
/trunk/BENCH/test1/test1.c
0,0 → 1,27
#include <16c57.h>//the is no 16f57.h file in the my version of ccs.so using it instered |
|
#byte DISP = 100 |
|
disp_byte(char c){ |
switch (c){ |
case 0:DISP ='0';break; |
case 1:DISP ='1';break; |
case 2:DISP ='2';break; |
case 3:DISP ='3';break; |
case 4:DISP ='4';break; |
case 5:DISP ='5';break; |
case 6:DISP ='6';break; |
case 7:DISP ='7';break; |
case 8:DISP ='8';break; |
case 9:DISP ='9';break; |
} |
} |
|
main(){ |
char i=0,j=0; |
while(1){ |
i=++i%10; |
disp_byte(i); |
} |
} |
|
/trunk/BENCH/test1/Dasm.txt
0,0 → 1,118
0000 : GOTO 101 |
0001 : GOTO 3 |
0002 : GOTO 26 |
0003 : MOVFW 0x0e |
0004 : CLRF 0x09 |
0005 : SUBWFW 0x0d |
0006 : BTFSC STATUS [0] |
0007 : GOTO 11 |
0008 : MOVFW 0x0d |
0009 : MOVWF 0x08 |
0010 : GOTO 23 |
0011 : CLRF 0x08 |
0012 : MOVLW 8 |
0013 : MOVWF 0x0f |
0014 : RLFF 0x0d |
0015 : RLFF 0x08 |
0016 : MOVFW 0x0e |
0017 : SUBWFW 0x08 |
0018 : BTFSC STATUS [0] |
0019 : MOVWF 0x08 |
0020 : RLFF 0x09 |
0021 : DECFSZF 0x0f [7] |
0022 : GOTO 14 |
0023 : BCF STATUS [5] |
0024 : BCF STATUS [6] |
0025 : GOTO 110 |
0026 : MOVFW 0x0d |
0027 : MOVWF 0x08 |
0028 : MOVFF 0x08 |
0029 : BTFSC STATUS [2] |
0030 : GOTO 68 |
0031 : MOVLW 1 |
0032 : SUBWFW 0x08 |
0033 : BTFSC STATUS [2] |
0034 : GOTO 71 |
0035 : MOVLW 2 |
0036 : SUBWFW 0x08 |
0037 : BTFSC STATUS [2] |
0038 : GOTO 74 |
0039 : MOVLW 3 |
0040 : SUBWFW 0x08 |
0041 : BTFSC STATUS [2] |
0042 : GOTO 77 |
0043 : MOVLW 4 |
0044 : SUBWFW 0x08 |
0045 : BTFSC STATUS [2] |
0046 : GOTO 80 |
0047 : MOVLW 5 |
0048 : SUBWFW 0x08 |
0049 : BTFSC STATUS [2] |
0050 : GOTO 83 |
0051 : MOVLW 6 |
0052 : SUBWFW 0x08 |
0053 : BTFSC STATUS [2] |
0054 : GOTO 86 |
0055 : MOVLW 7 |
0056 : SUBWFW 0x08 |
0057 : BTFSC STATUS [2] |
0058 : GOTO 89 |
0059 : MOVLW 8 |
0060 : SUBWFW 0x08 |
0061 : BTFSC STATUS [2] |
0062 : GOTO 92 |
0063 : MOVLW 9 |
0064 : SUBWFW 0x08 |
0065 : BTFSC STATUS [2] |
0066 : GOTO 95 |
0067 : GOTO 98 |
0068 : MOVLW 48 |
0069 : MOVWF 0x1f |
0070 : GOTO 98 |
0071 : MOVLW 49 |
0072 : MOVWF 0x1f |
0073 : GOTO 98 |
0074 : MOVLW 50 |
0075 : MOVWF 0x1f |
0076 : GOTO 98 |
0077 : MOVLW 51 |
0078 : MOVWF 0x1f |
0079 : GOTO 98 |
0080 : MOVLW 52 |
0081 : MOVWF 0x1f |
0082 : GOTO 98 |
0083 : MOVLW 53 |
0084 : MOVWF 0x1f |
0085 : GOTO 98 |
0086 : MOVLW 54 |
0087 : MOVWF 0x1f |
0088 : GOTO 98 |
0089 : MOVLW 55 |
0090 : MOVWF 0x1f |
0091 : GOTO 98 |
0092 : MOVLW 56 |
0093 : MOVWF 0x1f |
0094 : GOTO 98 |
0095 : MOVLW 57 |
0096 : MOVWF 0x1f |
0097 : GOTO 98 |
0098 : BCF STATUS [5] |
0099 : BCF STATUS [6] |
0100 : GOTO 115 |
0101 : CLRF FSR |
0102 : CLRF 0x0b |
0103 : CLRF 0x0c |
0104 : INCFF 0x0b |
0105 : MOVFW 0x0b |
0106 : MOVWF 0x0d |
0107 : MOVLW 10 |
0108 : MOVWF 0x0e |
0109 : GOTO 1 |
0110 : MOVFW 0x08 |
0111 : MOVWF 0x0b |
0112 : MOVFW 0x0b |
0113 : MOVWF 0x0d |
0114 : GOTO 2 |
0115 : GOTO 104 |
0116 : NOP |
2047 : GOTO 0 |
/trunk/BENCH/test1/test1.HEX
0,0 → 1,18
:10000000650A030A1A0A0E0269008D0003060B0A2C |
:100010000D022800170A6800080C2F006D03680302 |
:100020000E028800030628006903EF020E0AA304EB |
:10003000C3046E0A0D02280028024306440A010C7C |
:1000400088004306470A020C880043064A0A030C4C |
:10005000880043064D0A040C88004306500A050C2C |
:1000600088004306530A060C88004306560A070C0C |
:1000700088004306590A080C880043065C0A090CEC |
:10008000880043065F0A620A300C3F00620A310CA6 |
:100090003F00620A320C3F00620A330C3F00620AE2 |
:1000A000340C3F00620A350C3F00620A360C3F00F8 |
:1000B000620A370C3F00620A380C3F00620A390CB2 |
:1000C0003F00620AA304C304730A64006B006C005F |
:1000D000AB020B022D000A0C2E00010A08022B00B5 |
:0A00E0000B022D00020A680A03005B |
:020FFE00000AE7 |
:00000001FF |
;PIC16C57 |
/trunk/BENCH/test1/sim_rom.v
0,0 → 1,278
//This file was created by a tool wrietten with C. |
module sim_rom ( |
address, |
clock, |
q); |
input [10:0] address; |
input clock; |
output [11:0] q; |
|
reg [10:0] address_latched; |
// Instantiate the memory array itself. |
reg [11:0] mem[0:2048-1]; |
initial begin |
mem[0000] = 12'b101001100101; |
mem[0001] = 12'b101000000011; |
mem[0002] = 12'b101000011010; |
mem[0003] = 12'b001000001110; |
mem[0004] = 12'b000001101001; |
mem[0005] = 12'b000010001101; |
mem[0006] = 12'b011000000011; |
mem[0007] = 12'b101000001011; |
mem[0008] = 12'b001000001101; |
mem[0009] = 12'b000000101000; |
mem[0010] = 12'b101000010111; |
mem[0011] = 12'b000001101000; |
mem[0012] = 12'b110000001000; |
mem[0013] = 12'b000000101111; |
mem[0014] = 12'b001101101101; |
mem[0015] = 12'b001101101000; |
mem[0016] = 12'b001000001110; |
mem[0017] = 12'b000010001000; |
mem[0018] = 12'b011000000011; |
mem[0019] = 12'b000000101000; |
mem[0020] = 12'b001101101001; |
mem[0021] = 12'b001011101111; |
mem[0022] = 12'b101000001110; |
mem[0023] = 12'b010010100011; |
mem[0024] = 12'b010011000011; |
mem[0025] = 12'b101001101110; |
mem[0026] = 12'b001000001101; |
mem[0027] = 12'b000000101000; |
mem[0028] = 12'b001000101000; |
mem[0029] = 12'b011001000011; |
mem[0030] = 12'b101001000100; |
mem[0031] = 12'b110000000001; |
mem[0032] = 12'b000010001000; |
mem[0033] = 12'b011001000011; |
mem[0034] = 12'b101001000111; |
mem[0035] = 12'b110000000010; |
mem[0036] = 12'b000010001000; |
mem[0037] = 12'b011001000011; |
mem[0038] = 12'b101001001010; |
mem[0039] = 12'b110000000011; |
mem[0040] = 12'b000010001000; |
mem[0041] = 12'b011001000011; |
mem[0042] = 12'b101001001101; |
mem[0043] = 12'b110000000100; |
mem[0044] = 12'b000010001000; |
mem[0045] = 12'b011001000011; |
mem[0046] = 12'b101001010000; |
mem[0047] = 12'b110000000101; |
mem[0048] = 12'b000010001000; |
mem[0049] = 12'b011001000011; |
mem[0050] = 12'b101001010011; |
mem[0051] = 12'b110000000110; |
mem[0052] = 12'b000010001000; |
mem[0053] = 12'b011001000011; |
mem[0054] = 12'b101001010110; |
mem[0055] = 12'b110000000111; |
mem[0056] = 12'b000010001000; |
mem[0057] = 12'b011001000011; |
mem[0058] = 12'b101001011001; |
mem[0059] = 12'b110000001000; |
mem[0060] = 12'b000010001000; |
mem[0061] = 12'b011001000011; |
mem[0062] = 12'b101001011100; |
mem[0063] = 12'b110000001001; |
mem[0064] = 12'b000010001000; |
mem[0065] = 12'b011001000011; |
mem[0066] = 12'b101001011111; |
mem[0067] = 12'b101001100010; |
mem[0068] = 12'b110000110000; |
mem[0069] = 12'b000000111111; |
mem[0070] = 12'b101001100010; |
mem[0071] = 12'b110000110001; |
mem[0072] = 12'b000000111111; |
mem[0073] = 12'b101001100010; |
mem[0074] = 12'b110000110010; |
mem[0075] = 12'b000000111111; |
mem[0076] = 12'b101001100010; |
mem[0077] = 12'b110000110011; |
mem[0078] = 12'b000000111111; |
mem[0079] = 12'b101001100010; |
mem[0080] = 12'b110000110100; |
mem[0081] = 12'b000000111111; |
mem[0082] = 12'b101001100010; |
mem[0083] = 12'b110000110101; |
mem[0084] = 12'b000000111111; |
mem[0085] = 12'b101001100010; |
mem[0086] = 12'b110000110110; |
mem[0087] = 12'b000000111111; |
mem[0088] = 12'b101001100010; |
mem[0089] = 12'b110000110111; |
mem[0090] = 12'b000000111111; |
mem[0091] = 12'b101001100010; |
mem[0092] = 12'b110000111000; |
mem[0093] = 12'b000000111111; |
mem[0094] = 12'b101001100010; |
mem[0095] = 12'b110000111001; |
mem[0096] = 12'b000000111111; |
mem[0097] = 12'b101001100010; |
mem[0098] = 12'b010010100011; |
mem[0099] = 12'b010011000011; |
mem[0100] = 12'b101001110011; |
mem[0101] = 12'b000001100100; |
mem[0102] = 12'b000001101011; |
mem[0103] = 12'b000001101100; |
mem[0104] = 12'b001010101011; |
mem[0105] = 12'b001000001011; |
mem[0106] = 12'b000000101101; |
mem[0107] = 12'b110000001010; |
mem[0108] = 12'b000000101110; |
mem[0109] = 12'b101000000001; |
mem[0110] = 12'b001000001000; |
mem[0111] = 12'b000000101011; |
mem[0112] = 12'b001000001011; |
mem[0113] = 12'b000000101101; |
mem[0114] = 12'b101000000010; |
mem[0115] = 12'b101001101000; |
mem[0116] = 12'b000000000011; |
mem[2047] = 12'b101000000000; |
end |
// Latch address |
always @(posedge clock) |
address_latched <= address; |
|
// READ |
assign q = mem[address_latched]; |
|
endmodule |
|
/* |
0000: GOTO 101 |
0001: GOTO 3 |
0002: GOTO 26 |
0003: MOVFW 0x0e |
0004: CLRF 0x09 |
0005: SUBWFW 0x0d |
0006: BTFSC STATUS [0] |
0007: GOTO 11 |
0008: MOVFW 0x0d |
0009: MOVWF 0x08 |
0010: GOTO 23 |
0011: CLRF 0x08 |
0012: MOVLW 8 |
0013: MOVWF 0x0f |
0014: RLFF 0x0d |
0015: RLFF 0x08 |
0016: MOVFW 0x0e |
0017: SUBWFW 0x08 |
0018: BTFSC STATUS [0] |
0019: MOVWF 0x08 |
0020: RLFF 0x09 |
0021: DECFSZF 0x0f [7] |
0022: GOTO 14 |
0023: BCF STATUS [5] |
0024: BCF STATUS [6] |
0025: GOTO 110 |
0026: MOVFW 0x0d |
0027: MOVWF 0x08 |
0028: MOVFF 0x08 |
0029: BTFSC STATUS [2] |
0030: GOTO 68 |
0031: MOVLW 1 |
0032: SUBWFW 0x08 |
0033: BTFSC STATUS [2] |
0034: GOTO 71 |
0035: MOVLW 2 |
0036: SUBWFW 0x08 |
0037: BTFSC STATUS [2] |
0038: GOTO 74 |
0039: MOVLW 3 |
0040: SUBWFW 0x08 |
0041: BTFSC STATUS [2] |
0042: GOTO 77 |
0043: MOVLW 4 |
0044: SUBWFW 0x08 |
0045: BTFSC STATUS [2] |
0046: GOTO 80 |
0047: MOVLW 5 |
0048: SUBWFW 0x08 |
0049: BTFSC STATUS [2] |
0050: GOTO 83 |
0051: MOVLW 6 |
0052: SUBWFW 0x08 |
0053: BTFSC STATUS [2] |
0054: GOTO 86 |
0055: MOVLW 7 |
0056: SUBWFW 0x08 |
0057: BTFSC STATUS [2] |
0058: GOTO 89 |
0059: MOVLW 8 |
0060: SUBWFW 0x08 |
0061: BTFSC STATUS [2] |
0062: GOTO 92 |
0063: MOVLW 9 |
0064: SUBWFW 0x08 |
0065: BTFSC STATUS [2] |
0066: GOTO 95 |
0067: GOTO 98 |
0068: MOVLW 48 |
0069: MOVWF 0x1f |
0070: GOTO 98 |
0071: MOVLW 49 |
0072: MOVWF 0x1f |
0073: GOTO 98 |
0074: MOVLW 50 |
0075: MOVWF 0x1f |
0076: GOTO 98 |
0077: MOVLW 51 |
0078: MOVWF 0x1f |
0079: GOTO 98 |
0080: MOVLW 52 |
0081: MOVWF 0x1f |
0082: GOTO 98 |
0083: MOVLW 53 |
0084: MOVWF 0x1f |
0085: GOTO 98 |
0086: MOVLW 54 |
0087: MOVWF 0x1f |
0088: GOTO 98 |
0089: MOVLW 55 |
0090: MOVWF 0x1f |
0091: GOTO 98 |
0092: MOVLW 56 |
0093: MOVWF 0x1f |
0094: GOTO 98 |
0095: MOVLW 57 |
0096: MOVWF 0x1f |
0097: GOTO 98 |
0098: BCF STATUS [5] |
0099: BCF STATUS [6] |
0100: GOTO 115 |
0101: CLRF FSR |
0102: CLRF 0x0b |
0103: CLRF 0x0c |
0104: INCFF 0x0b |
0105: MOVFW 0x0b |
0106: MOVWF 0x0d |
0107: MOVLW 10 |
0108: MOVWF 0x0e |
0109: GOTO 1 |
0110: MOVFW 0x08 |
0111: MOVWF 0x0b |
0112: MOVFW 0x0b |
0113: MOVWF 0x0d |
0114: GOTO 2 |
0115: GOTO 104 |
0116: NOP |
2047: GOTO 0 |
*/ |
/* |
covered instructions: |
|
GOTO |
MOVFW |
CLRF |
SUBWFW |
BTFSC |
MOVWF |
MOVLW |
RLFF |
DECFSZF |
BCF |
MOVFF |
INCFF |
NOP |
*/ |
/trunk/BENCH/test1/tested_instructions.txt
0,0 → 1,14
|
GOTO |
MOVFW |
CLRF |
SUBWFW |
BTFSC |
MOVWF |
MOVLW |
RLFF |
DECFSZF |
BCF |
MOVFF |
INCFF |
NOP |
/trunk/BENCH/test1/init_file.mif
0,0 → 1,126
WIDTH=12; |
DEPTH=2048; |
|
ADDRESS_RADIX=HEX; |
DATA_RADIX=HEX; |
|
CONTENT BEGIN |
0 : A65; |
1 : A03; |
2 : A1A; |
3 : 20E; |
4 : 69; |
5 : 8D; |
6 : 603; |
7 : A0B; |
8 : 20D; |
9 : 28; |
A : A17; |
B : 68; |
C : C08; |
D : 2F; |
E : 36D; |
F : 368; |
10 : 20E; |
11 : 88; |
12 : 603; |
13 : 28; |
14 : 369; |
15 : 2EF; |
16 : A0E; |
17 : 4A3; |
18 : 4C3; |
19 : A6E; |
1A : 20D; |
1B : 28; |
1C : 228; |
1D : 643; |
1E : A44; |
1F : C01; |
20 : 88; |
21 : 643; |
22 : A47; |
23 : C02; |
24 : 88; |
25 : 643; |
26 : A4A; |
27 : C03; |
28 : 88; |
29 : 643; |
2A : A4D; |
2B : C04; |
2C : 88; |
2D : 643; |
2E : A50; |
2F : C05; |
30 : 88; |
31 : 643; |
32 : A53; |
33 : C06; |
34 : 88; |
35 : 643; |
36 : A56; |
37 : C07; |
38 : 88; |
39 : 643; |
3A : A59; |
3B : C08; |
3C : 88; |
3D : 643; |
3E : A5C; |
3F : C09; |
40 : 88; |
41 : 643; |
42 : A5F; |
43 : A62; |
44 : C30; |
45 : 3F; |
46 : A62; |
47 : C31; |
48 : 3F; |
49 : A62; |
4A : C32; |
4B : 3F; |
4C : A62; |
4D : C33; |
4E : 3F; |
4F : A62; |
50 : C34; |
51 : 3F; |
52 : A62; |
53 : C35; |
54 : 3F; |
55 : A62; |
56 : C36; |
57 : 3F; |
58 : A62; |
59 : C37; |
5A : 3F; |
5B : A62; |
5C : C38; |
5D : 3F; |
5E : A62; |
5F : C39; |
60 : 3F; |
61 : A62; |
62 : 4A3; |
63 : 4C3; |
64 : A73; |
65 : 64; |
66 : 6B; |
67 : 6C; |
68 : 2AB; |
69 : 20B; |
6A : 2D; |
6B : C0A; |
6C : 2E; |
6D : A01; |
6E : 208; |
6F : 2B; |
70 : 20B; |
71 : 2D; |
72 : A02; |
73 : A68; |
74 : 3; |
7FF : A00; |
ND; |
/trunk/BENCH/test1/tov.bat
0,0 → 1,7
path; |
path=..\..\ctool |
hexdasm test1.hex |
copy *.mif ..\..\rtl |
copy *.h ..\..\rtl |
copy *.v ..\..\rtl |
copy *.h ..\..\sim |
/trunk/CTOOL/hexdasm.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
trunk/CTOOL/hexdasm.exe
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/CTOOL/hexdasm.c
===================================================================
--- trunk/CTOOL/hexdasm.c (nonexistent)
+++ trunk/CTOOL/hexdasm.c (revision 7)
@@ -0,0 +1,965 @@
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+
+int func1(int in)
+{
+const int table[]={1,2,4,8,16,32,64,128,256,512,1024,2048};
+int i =0;
+if (in>=2048)return -1;
+for(;;i++)
+if ((in>table[i])&&(in=8) goto else
+ if(p!=NULL)
+ strcpy(__hex,p);
+ else
+ {
+ __hex[0]='0' ;
+ __hex[1]='x' ;
+ __hex[2]=hex[t/16];
+ __hex[3]=hex[t%16];
+ __hex[4]=0 ;
+ }
+ return __hex ;
+}
+
+char _temp[100];
+//get file reg adderss from instruction!
+char*gen_ins_fa(char*ins)
+{//gen_ins_in(
+ strcpy(_temp,ins);
+ return bs2hs(&_temp[7]);
+}
+
+//get bit data from instruction!
+unsigned int gen_ins_bd(char*ins)
+{
+//1111_1111_1111
+ unsigned int t=0 ;
+ if(ins[5+1]=='1')t+=1 ;
+ if(ins[4+1]=='1')t+=2 ;
+ if(ins[3+1]=='1')t+=4 ;
+ return t ;
+}
+
+//get goto(and call) address data from instruction!
+unsigned int gen_ins_goto(char*ins)
+{
+//000_111111001
+ unsigned int t=0 ;
+ if(ins[11-0]=='1')t+=1;
+ if(ins[11-1]=='1')t+=2 ;
+ if(ins[11-2]=='1')t+=4;
+ if(ins[11-3]=='1')t+=8 ;
+ if(ins[11-4]=='1')t+=16;//1<<4 ;
+ if(ins[11-5]=='1')t+=32;//1<<5 ;
+ if(ins[11-6]=='1')t+=64;//1<<6 ;
+ if(ins[11-7]=='1')t+=128;//1<<7 ;
+ if(ins[11-8]=='1')t+=256;//1<<8 ;
+ return t ;
+}
+
+//get instant data from instruction!
+unsigned int gen_ins_in(char*ins)
+{
+ unsigned int t=0 ;
+ if(ins[11-0]=='1')t+=1;
+ if(ins[11-1]=='1')t+=2 ;
+ if(ins[11-2]=='1')t+=4;//1<<3 ;
+ if(ins[11-3]=='1')t+=8;//1<<4 ;
+ if(ins[11-4]=='1')t+=16;//1<<4 ;
+ if(ins[11-5]=='1')t+=32;//1<<5 ;
+ if(ins[11-6]=='1')t+=64;//1<<6 ;
+ if(ins[11-7]=='1')t+=128;//1<<7 ;
+ // if(ins[11-8]=='1')t+=1<<8 ;
+ return t ;
+}
+
+
+unsigned int inscmp(char*src,char*dst)
+{
+ unsigned int i ;
+ for(i=0;i<=9;i++)
+ {
+ if(src[i]=='X')continue ;
+ else if(src[i]!=dst[i])return 0 ;
+ }
+ return 1 ;
+}
+
+
+unsigned int str2u12(char*str)
+{
+ unsigned int ret=0 ;
+ unsigned int i ;
+ for(i=0;i<=11;++i)
+ {
+ if(str[i]==0)return ret ;
+ ret=ret*10+str[i]-'0' ;
+ }
+ return ret ;
+}
+/*
+unsigned int getfno(char *ins,unsigned char start,
+unsigned char len)
+{
+unsigned int data = str2u12(ins);
+ unsigned int tmp1=0xffff<