From a9360a465f646254cfbf9fb9bb2e73f485c240ca Mon Sep 17 00:00:00 2001 From: hneemann Date: Wed, 14 Dec 2016 20:14:32 +0100 Subject: [PATCH] new DataField converter writes hex numbers --- src/main/dig/processor/ProcessorIntr.dig | 357 +++++++++--------- .../core/memory/DataFieldConverter.java | 4 +- .../core/memory/DataFieldConverterTest.java | 16 +- 3 files changed, 184 insertions(+), 193 deletions(-) diff --git a/src/main/dig/processor/ProcessorIntr.dig b/src/main/dig/processor/ProcessorIntr.dig index 9b25bf315..8488da966 100644 --- a/src/main/dig/processor/ProcessorIntr.dig +++ b/src/main/dig/processor/ProcessorIntr.dig @@ -165,9 +165,9 @@ Single-Cycle CPU. Data - 39339,4608,32782,26864,32800,4608,29680,36746,4608,32782,26864,5130,29680,28658,18432, -18944,32797,26656,18944,32797,26656,18432,18944,32797,26656,18944,32797,26656,27151, -528,10271,15386,25091,32816,5648,28162,32823,5648,29681,27138,0,0,0,0,0,0,0,0,0,0, + 99ab,1200,800e,68f0,8020,1200,73f0,8f8a,1200,800e,68f0,140a,73f0,6ff2,4800,4a00,801d, +6820,4a00,801d,6820,4800,4a00,801d,6820,4a00,801d,6820,6a0f,210,281f,3c1a,6203,8030, +1610,6e02,8037,1610,73f1,6a02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -266,10 +266,9 @@ Single-Cycle CPU. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30912,8417,19692,8417,19680, -31744,22017,22208,15552,25602,5313,5120,29532,15360,25607,16064,32768,15296,25608, -5121,21008,28165,16576,15553,25602,5120,21008,21004,19982,6369,20174,6369,29196,30913, -27148 +0,0,0,0,0,0,0,0,0,0,0,0,78c0,20e1,4cec,20e1,4ce0,7c00,5601,56c0,3cc0,6402,14c1,1400, +735c,3c00,6407,3ec0,8000,3bc0,6408,1401,5210,6e05,40c0,3cc1,6402,1400,5210,520c,4e0e, +18e1,4ece,18e1,720c,78c1,6a0c lastDataFile @@ -345,7 +344,7 @@ Single-Cycle CPU. 16 - + Tunnel @@ -707,7 +706,7 @@ Single-Cycle CPU. st - + Tunnel @@ -721,7 +720,7 @@ Single-Cycle CPU. ld - + Tunnel @@ -797,7 +796,7 @@ Single-Cycle CPU. C - + /home/hneemann/Dokumente/Java/digital/src/main/dig/processor/Intr.dig @@ -947,20 +946,6 @@ Single-Cycle CPU. - - Tunnel - - - rotation - - - - NetName - A - - - - Tunnel @@ -973,7 +958,7 @@ Single-Cycle CPU. D - + Tunnel @@ -1022,69 +1007,8 @@ Single-Cycle CPU. /home/hneemann/Dokumente/Java/digital/src/main/dig/processor/Terminal.dig - - - - Tunnel - - - rotation - - - - NetName - ioW - - - - - - Tunnel - - - rotation - - - - NetName - D - - - - Tunnel - - - rotation - - - - NetName - A - - - - - - Tunnel - - - rotation - - - - NetName - C - - - - - - /home/hneemann/Dokumente/Java/digital/src/main/dig/processor/GPO.dig - - - Tunnel @@ -1097,7 +1021,7 @@ Single-Cycle CPU. ioW - + Tunnel @@ -1111,7 +1035,7 @@ Single-Cycle CPU. D - + Tunnel @@ -1125,7 +1049,7 @@ Single-Cycle CPU. A - + Tunnel @@ -1139,87 +1063,148 @@ Single-Cycle CPU. C - + + + + /home/hneemann/Dokumente/Java/digital/src/main/dig/processor/GPO.dig + + + + + Tunnel + + + rotation + + + + NetName + ioW + + + + + + Tunnel + + + rotation + + + + NetName + D + + + + + + Tunnel + + + rotation + + + + NetName + A + + + + + + Tunnel + + + rotation + + + + NetName + C + + + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + LED - + Counter @@ -1250,71 +1235,81 @@ Single-Cycle CPU. + + Tunnel + + + NetName + A + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -1326,7 +1321,7 @@ Single-Cycle CPU. - + @@ -1337,8 +1332,8 @@ Single-Cycle CPU. - - + + @@ -1377,8 +1372,8 @@ Single-Cycle CPU. - - + + @@ -1428,13 +1423,9 @@ Single-Cycle CPU. - - - - - + @@ -1457,20 +1448,24 @@ Single-Cycle CPU. - - + + + + + + - - + + - - + + @@ -1481,8 +1476,8 @@ Single-Cycle CPU. - - + + @@ -1509,8 +1504,8 @@ Single-Cycle CPU. - - + + @@ -1545,8 +1540,8 @@ Single-Cycle CPU. - - + + @@ -1569,8 +1564,8 @@ Single-Cycle CPU. - - + + @@ -1589,8 +1584,8 @@ Single-Cycle CPU. - - + + @@ -1637,8 +1632,8 @@ Single-Cycle CPU. - - + + @@ -1657,8 +1652,8 @@ Single-Cycle CPU. - - + + @@ -1697,8 +1692,8 @@ Single-Cycle CPU. - - + + @@ -1712,10 +1707,6 @@ Single-Cycle CPU. - - - - @@ -1748,6 +1739,14 @@ Single-Cycle CPU. + + + + + + + + @@ -1840,14 +1839,6 @@ Single-Cycle CPU. - - - - - - - - diff --git a/src/main/java/de/neemann/digital/core/memory/DataFieldConverter.java b/src/main/java/de/neemann/digital/core/memory/DataFieldConverter.java index baddf32ce..f0a1c19bb 100644 --- a/src/main/java/de/neemann/digital/core/memory/DataFieldConverter.java +++ b/src/main/java/de/neemann/digital/core/memory/DataFieldConverter.java @@ -38,7 +38,7 @@ public class DataFieldConverter implements Converter { pos = 0; } - final String s = Long.toString(d); + final String s = Long.toHexString(d); data.append(s); pos += s.length(); } @@ -68,7 +68,7 @@ public class DataFieldConverter implements Converter { StringTokenizer st = new StringTokenizer(reader.getValue(), ","); int i = 0; while (st.hasMoreTokens()) { - df.setData(i, Long.parseLong(st.nextToken().trim())); + df.setData(i, Long.parseLong(st.nextToken().trim(),16)); i++; } return df; diff --git a/src/test/java/de/neemann/digital/core/memory/DataFieldConverterTest.java b/src/test/java/de/neemann/digital/core/memory/DataFieldConverterTest.java index b9e4b3ebd..01eea9017 100644 --- a/src/test/java/de/neemann/digital/core/memory/DataFieldConverterTest.java +++ b/src/test/java/de/neemann/digital/core/memory/DataFieldConverterTest.java @@ -90,19 +90,19 @@ public class DataFieldConverterTest extends TestCase { XStream xStream = getxStream(); String xml = xStream.toXML(d); - assertEquals("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,\n" + - "31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,\n" + - "58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,\n" + - "85,86,87,88,89,90,91,92,93,94,95,96,97,98,99", xml); + assertEquals("0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,10,11,12,13,14,15,16,17,18,19,1a,1b,1c,1d,1e,1f,20,\n" + + "21,22,23,24,25,26,27,28,29,2a,2b,2c,2d,2e,2f,30,31,32,33,34,35,36,37,38,39,3a,3b,\n" + + "3c,3d,3e,3f,40,41,42,43,44,45,46,47,48,49,4a,4b,4c,4d,4e,4f,50,51,52,53,54,55,56,\n" + + "57,58,59,5a,5b,5c,5d,5e,5f,60,61,62,63", xml); } public void testUnmarshalMuch() throws Exception { XStream xStream = getxStream(); - DataField df = (DataField) xStream.fromXML("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30\n" + - ",31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57\n" + - ",58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84\n" + - ",85,86,87,88,89,90,91,92,93,94,95,96,97,98,99"); + DataField df = (DataField) xStream.fromXML("0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,10,11,12,13,14,15,16,17,18,19,1a,1b,1c,1d,1e,1f,20,\n" + + "21,22,23,24,25,26,27,28,29,2a,2b,2c,2d,2e,2f,30,31,32,33,34,35,36,37,38,39,3a,3b,\n" + + "3c,3d,3e,3f,40,41,42,43,44,45,46,47,48,49,4a,4b,4c,4d,4e,4f,50,51,52,53,54,55,56,\n" + + "57,58,59,5a,5b,5c,5d,5e,5f,60,61,62,63"); assertEquals(1000, df.size()); for (int i = 0; i < 100; i++)