summaryrefslogtreecommitdiffstats
path: root/zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java
diff options
context:
space:
mode:
Diffstat (limited to 'zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java')
-rw-r--r--zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java b/zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java
new file mode 100644
index 0000000..f641595
--- /dev/null
+++ b/zpu/sw/simulator/com/zylin/zpu/simulator/tools/MakeDRAM.java
@@ -0,0 +1,39 @@
+
+package com.zylin.zpu.simulator.tools;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public class MakeDRAM
+{
+ public static void main(String[] args) throws IOException
+ {
+ new MakeDRAM().run(args[0]);
+ }
+
+ private void run(String string) throws IOException
+ {
+ FileInputStream file=new FileInputStream(string);
+
+ int i=0;
+ while (file.available()>4)
+ {
+ byte[] tmp=new byte[4];
+ file.read(tmp);
+ int word=0;
+ for (int j=0; j<4; j++)
+ {
+ word|=((int)(tmp[j])&0xff)<<((3-j)*8);
+ }
+ String str=Integer.toHexString(word);
+ while (str.length()<8)
+ {
+ str="0"+str;
+ }
+
+ System.out.println(str);
+ i++;
+ }
+ }
+
+}
OpenPOWER on IntegriCloud