⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instruction.java

📁 Java Op Processor java vhdl processor
💻 JAVA
字号:
package com.jopdesign.tools;import java.util.*;public class Instruction {	String name;	public int opcode;	public boolean hasOpd;	public boolean isJmp;	final static int INSTLEN = 16;	private Instruction(String s, int oc, boolean opd, boolean jp) {		name = s;		opcode = oc;		hasOpd = opd;		isJmp = jp;	}	public String toString() {		return name;	}	private static Instruction[] ia = new Instruction[] 	{////	'pop' instructions//		new Instruction("pop", 0x00, false, false),		new Instruction("and", 0x01, false, false),		new Instruction("or",  0x02, false, false),		new Instruction("xor", 0x03, false, false),		new Instruction("add", 0x04, false, false),		new Instruction("sub", 0x05, false, false),//	'direct' IO	3 bits//		new Instruction("stioa", 0x08+0, false, false), not used anymore	//		new Instruction("stiod", 0x08+1, false, false),		new Instruction("stmra", 0x08+2, false, false),		new Instruction("stmwa", 0x08+3, false, false),		new Instruction("stmwd", 0x08+4, false, false),		new Instruction("stmul", 0x08+5, false, false),		// one instruction free		new Instruction("stbcrd", 0x08+7, false, false),//	st (vp)	3 bits		new Instruction("st0", 0x10+0, false, false),		new Instruction("st1", 0x10+1, false, false),		new Instruction("st2", 0x10+2, false, false),		new Instruction("st3", 0x10+3, false, false),		new Instruction("st",  0x10+4, false, false),		new Instruction("stmi",  0x10+5, false, false),		new Instruction("stvp", 0x18, false, false),		new Instruction("stjpc", 0x19, false, false),		new Instruction("star", 0x1a, false, false),		new Instruction("stsp", 0x1b, false, false),//	shift		new Instruction("ushr", 0x1c, false, false),		new Instruction("shl", 0x1d, false, false),		new Instruction("shr", 0x1e, false, false),		//new Instruction("shift reserved", 0x1f, false, false),//	5 bits		new Instruction("stm", 0x20, true, false),		new Instruction("bz", 0x40, true, true),		new Instruction("bnz", 0x60, true, true),////	'no sp change' instructions//		new Instruction("nop", 0x80, false, false),		new Instruction("wait", 0x81, false, false),		new Instruction("jbr", 0x82, false, false),////	'push' instructions////	5 bits		new Instruction("ldm", 0xa0, true, false),		new Instruction("ldi", 0xc0, true, false),//	'direct' IO	3 bits//		new Instruction("ldiod", 0xe0+1, false, false), no used anymore		new Instruction("ldmrd", 0xe0+2, false, false),		new Instruction("ldmul", 0xe0+5, false, false),		new Instruction("ldbcstart", 0xe0+7, false, false),//	ld (vp)	3 bits		new Instruction("ld0", 0xe8+0, false, false),		new Instruction("ld1", 0xe8+1, false, false),		new Instruction("ld2", 0xe8+2, false, false),		new Instruction("ld3", 0xe8+3, false, false),		new Instruction("ld",  0xe8+4, false, false),		new Instruction("ldmi",  0xe8+5, false, false),//	2 bits		new Instruction("ldsp", 0xf0+0, false, false),		new Instruction("ldvp", 0xf0+1, false, false),		new Instruction("ldjpc", 0xf0+2, false, false),//	ld opd 2 bits		new Instruction("ld_opd_8u", 0xf4+0, false, false),		new Instruction("ld_opd_8s", 0xf4+1, false, false),		new Instruction("ld_opd_16u", 0xf4+2, false, false),		new Instruction("ld_opd_16s", 0xf4+3, false, false),		new Instruction("dup", 0xf8, false, false),	};	public static Map map = new HashMap();	static {		for (int i=0; i<ia.length; ++i) {			map.put(ia[i].name, ia[i]);		}	}	public static Instruction get(String s) {		return (Instruction) map.get(s);	}	public static void printVhdl() {		for (int i=0; i<ia.length; ++i) {			Instruction ins = ia[i];			System.out.print("\t\t\twhen \"");			if (ins.hasOpd) {				System.out.print(Jopa.bin(ins.opcode>>>5, 3));				System.out.print("-----");			} else {				System.out.print(Jopa.bin(ins.opcode, 8));			}			System.out.print("\" =>\t\t\t\t-- ");			System.out.print(ins.name);			System.out.println();		}	}	public static void printCsv() {		for (int i=0; i<ia.length; ++i) {			Instruction ins = ia[i];			System.out.print(ins.name);			System.out.print(";;{");			if (ins.hasOpd) {				System.out.print(Jopa.bin(ins.opcode>>>5, 3));				System.out.print("-----");			} else {				System.out.print(Jopa.bin(ins.opcode, 8));			}			System.out.println("}");		}	}	public static void main(String[] args) {		// printVhdl();		printCsv();	}}		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -