Projects >> jop >>23c7d930dc9529e414322a005169a19cbb5bf371

Chunk
Conflicting content
	public JmpType jType;
	StackType sType;

<<<<<<< HEAD
	/** Length of instruction without opd and nxt */
=======
	/**
	 * Instruction length without nxt and opd
	 */
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
	final static int INSTLEN = 10;

	private Instruction(String s, int oc, int ops, JmpType jp, StackType st) {
Solution content
	public JmpType jType;
	StackType sType;

	/** Length of instruction without opd and nxt */
	final static int INSTLEN = 10;
	private Instruction(String s, int oc, int ops, JmpType jp, StackType st) {
File
Instruction.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
	}

	public boolean isStackConsumer() {
<<<<<<< HEAD
		return sType == StackType.POP;
=======
		return opcode < (0x80<<(INSTLEN-8));
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
	}

	public boolean isStackProducer() {
Solution content
	}

	public boolean isStackConsumer() {
		return sType == StackType.POP;
	}

	public boolean isStackProducer() {
File
Instruction.java
Developer's decision
Version 1
Kind of conflict
Attribute
Return statement
Chunk
Conflicting content
	}

	public boolean isStackProducer() {
<<<<<<< HEAD
		return sType == StackType.PUSH;
=======
		return opcode >= (0xa0<<(INSTLEN-8));
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
	}

	public boolean noStackUse() {
Solution content
	}

	public boolean isStackProducer() {
		return sType == StackType.PUSH;
	}

	public boolean noStackUse() {
File
Instruction.java
Developer's decision
Version 1
Kind of conflict
Attribute
Return statement
Chunk
Conflicting content
		
		return sType == StackType.NOP;
	}

<<<<<<< HEAD
	private static Instruction[] ia = new Instruction[] {

			//
			// 'pop' instructions
			//

			new Instruction("pop", 0x000, 0, JmpType.NOP, StackType.POP),
			new Instruction("and", 0x001, 0, JmpType.NOP, StackType.POP),
			new Instruction("or",  0x002, 0, JmpType.NOP, StackType.POP),
			new Instruction("xor", 0x003, 0, JmpType.NOP, StackType.POP),
			new Instruction("add", 0x004, 0, JmpType.NOP, StackType.POP),
			new Instruction("sub", 0x005, 0, JmpType.NOP, StackType.POP),

			// st (vp) 3 bits
			new Instruction("st0", 0x010 + 0, 0, JmpType.NOP, StackType.POP),
			new Instruction("st1", 0x010 + 1, 0, JmpType.NOP, StackType.POP),
			new Instruction("st2", 0x010 + 2, 0, JmpType.NOP, StackType.POP),
			new Instruction("st3", 0x010 + 3, 0, JmpType.NOP, StackType.POP),
			new Instruction("st",  0x010 + 4, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmi", 0x010 + 5, 0, JmpType.NOP, StackType.POP),

			new Instruction("stvp", 0x018, 0, JmpType.NOP, StackType.POP),
			new Instruction("stjpc", 0x019, 0, JmpType.NOP, StackType.POP),
			new Instruction("star", 0x01a, 0, JmpType.NOP, StackType.POP),
			new Instruction("stsp", 0x01b, 0, JmpType.NOP, StackType.POP),

			// shift
			new Instruction("ushr", 0x01c, 0, JmpType.NOP, StackType.POP),
			new Instruction("shl", 0x01d, 0, JmpType.NOP, StackType.POP),
			new Instruction("shr", 0x01e, 0, JmpType.NOP, StackType.POP),
			// new Instruction("shift reserved", 0x1f, 0, JmpType.NOP, StackType.POP),

			// 5 bits: 0x20-0x3f
			new Instruction("stm", 0x020, 5, JmpType.NOP, StackType.POP),

			// MMU 4 bit subfield selects function (pop type)
			new Instruction("stmul", 0x040 + 0, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmwa", 0x040 + 1, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmra", 0x040 + 2, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmwd", 0x040 + 3, 0, JmpType.NOP, StackType.POP),
			// array instructions
			new Instruction("stald", 0x040 + 4, 0, JmpType.NOP, StackType.POP),
			new Instruction("stast", 0x040 + 5, 0, JmpType.NOP, StackType.POP),
			// getfield/putfield
			new Instruction("stgf",  0x040 + 6, 0, JmpType.NOP, StackType.POP),
			new Instruction("stpf",  0x040 + 7, 0, JmpType.NOP, StackType.POP),
			// magic copying
			new Instruction("stcp",  0x040 + 8, 0, JmpType.NOP, StackType.POP),
			// bytecode read
			new Instruction("stbcrd", 0x040 + 9, 0, JmpType.NOP, StackType.POP),
			// store TOS to MMU index register for jopsys_*field
			new Instruction("stidx", 0x040 + 0xa, 0, JmpType.NOP, StackType.POP),
			// putstatic
			new Instruction("stps", 0x040 + 0xb, 0, JmpType.NOP, StackType.POP),

			//
			// 'push' instructions
			//

			// 5 bits: 0xa0-0xbf
			new Instruction("ldm", 0x0a0, 5, JmpType.NOP, StackType.PUSH),
			// 5 bits: 0xc0-0xdf
			new Instruction("ldi", 0x0c0, 5, JmpType.NOP, StackType.PUSH),

			// MMU 4 bit subfield selects function (push type)
			new Instruction("ldmrd", 0x0e0 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldmul", 0x0e0 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldbcstart", 0x0e0 + 2, 0, JmpType.NOP, StackType.PUSH),

			// ld (vp) 3 bits
			new Instruction("ld0", 0x0e8 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld1", 0x0e8 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld2", 0x0e8 + 2, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld3", 0x0e8 + 3, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld", 0x0e8 + 4, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldmi", 0x0e8 + 5, 0, JmpType.NOP, StackType.PUSH),

			// 2 bits
			new Instruction("ldsp", 0x0f0 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldvp", 0x0f0 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldjpc", 0x0f0 + 2, 0, JmpType.NOP, StackType.PUSH),

			// ld opd 2 bits
			new Instruction("ld_opd_8u", 0x0f4 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_8s", 0x0f4 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_16u", 0x0f4 + 2, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_16s", 0x0f4 + 3, 0, JmpType.NOP, StackType.PUSH),

			new Instruction("dup", 0x0f8, 0, JmpType.NOP, StackType.PUSH),

			//
			// 'no SP change' instructions
			//
			new Instruction("nop", 0x100, 0, JmpType.NOP, StackType.NOP),
			new Instruction("wait", 0x101, 0, JmpType.NOP, StackType.NOP),
			new Instruction("jbr", 0x102, 0, JmpType.NOP, StackType.NOP),
			
			// no SP change instructions for MMU
			// 4 bit subfield selects function (pop type)

			// getstatic
			new Instruction("stgs", 0x110 + 0x0, 0, JmpType.NOP, StackType.NOP),


			// branches
			new Instruction("bz", 0x180, 6, JmpType.BR, StackType.POP),
			new Instruction("bnz", 0x1c0, 6, JmpType.BR, StackType.POP),
			new Instruction("jmp", 0x200, 9, JmpType.JMP, StackType.NOP),
		};

	public static Map map = new HashMap();
	public static Map imap = new TreeMap();
=======

	private static Instruction[] ia = new Instruction[] 
	{

//
//	'pop' instructions
//
		new Instruction("pop", 0x00<<2, false, false),
		new Instruction("and", 0x01<<2, false, false),
		new Instruction("or",  0x02<<2, false, false),
		new Instruction("xor", 0x03<<2, false, false),
		new Instruction("add", 0x04<<2, false, false),
		new Instruction("sub", 0x05<<2, false, false),

//	extension 'address' selects function 4 bits

		// multiplication
		new Instruction("stmul", 0x06<<2, false, false),

		new Instruction("stmwa", 0x07<<2, false, false),

		new Instruction("stmra", (0x08+0)<<2, false, false),
		// cache hint for read from the class info (e.g. mtab)
		new Instruction("stmra_cinfo", ((0x08+0)<<2)+1, false, false),
		
		
		new Instruction("stmwd", (0x08+1)<<2, false, false),
		// array instructions
		new Instruction("stald", (0x08+2)<<2, false, false),
		new Instruction("stast", (0x08+3)<<2, false, false),
		// getfield/putfield
		new Instruction("stgf",  (0x08+4)<<2, false, false),
		new Instruction("stpf",  (0x08+5)<<2, false, false),
		// magic copying
		new Instruction("stcp",  (0x08+6)<<2, false, false),
		// bytecode read
		new Instruction("stbcrd",(0x08+7)<<2, false, false),

//	st (vp)	3 bits
		new Instruction("st0",   (0x10+0)<<2, false, false),
		new Instruction("st1",   (0x10+1)<<2, false, false),
		new Instruction("st2",   (0x10+2)<<2, false, false),
		new Instruction("st3",   (0x10+3)<<2, false, false),
		new Instruction("st",    (0x10+4)<<2, false, false),
		new Instruction("stmi",  (0x10+5)<<2, false, false),

		new Instruction("stvp",  0x18<<2, false, false),
		new Instruction("stjpc", 0x19<<2, false, false),
		new Instruction("star",  0x1a<<2, false, false),
		new Instruction("stsp",  0x1b<<2, false, false),

//	shift
		new Instruction("ushr", 0x1c<<2, false, false),
		new Instruction("shl", 0x1d<<2, false, false),
		new Instruction("shr", 0x1e<<2, false, false),
		//new Instruction("shift reserved", 0x1f<<2, false, false),

//	5 bits
		new Instruction("stm", 0x20<<2, true, false),

		new Instruction("bz", 0x40<<2, true, true),
		new Instruction("bnz", 0x60<<2, true, true),
//
//	'no sp change' instructions
//
		new Instruction("nop", 0x80<<2, false, false),
		new Instruction("wait", 0x81<<2, false, false),

		new Instruction("jbr", 0x82<<2, false, false),

//
//	'push' instructions
//

//	5 bits
		new Instruction("ldm", 0xa0<<2, true, false),

		new Instruction("ldi", 0xc0<<2, true, false),

//		extension 'address' selects function 4 bits
		new Instruction("ldmrd", (0xe0+0)<<2, false, false),
		new Instruction("ldmul", (0xe0+6)<<2, false, false),
		new Instruction("ldbcstart", (0xe0+7)<<2, false, false),

//	ld (vp)	3 bits
		new Instruction("ld0", (0xe8+0)<<2, false, false),
		new Instruction("ld1", (0xe8+1)<<2, false, false),
		new Instruction("ld2", (0xe8+2)<<2, false, false),
		new Instruction("ld3", (0xe8+3)<<2, false, false),
		new Instruction("ld",  (0xe8+4)<<2, false, false),
		new Instruction("ldmi",  (0xe8+5)<<2, false, false),

//	2 bits
		new Instruction("ldsp", (0xf0+0)<<2, false, false),
		new Instruction("ldvp", (0xf0+1)<<2, false, false),
		new Instruction("ldjpc", (0xf0+2)<<2, false, false),

//	ld opd 2 bits
		new Instruction("ld_opd_8u", (0xf4+0)<<2, false, false),
		new Instruction("ld_opd_8s", (0xf4+1)<<2, false, false),
		new Instruction("ld_opd_16u", (0xf4+2)<<2, false, false),
		new Instruction("ld_opd_16s", (0xf4+3)<<2, false, false),

		new Instruction("dup", (0xf8)<<2, false, false),
	};

	public static Map map = new HashMap();
	public static Map imap = new TreeMap();
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc

	static {
		for (int i = 0; i < ia.length; ++i) {
Solution content
		return sType == StackType.NOP;
	}

	private static Instruction[] ia = new Instruction[] {

			//
			// 'pop' instructions
			//

			new Instruction("pop", 0x000, 0, JmpType.NOP, StackType.POP),
			new Instruction("and", 0x001, 0, JmpType.NOP, StackType.POP),
			new Instruction("or",  0x002, 0, JmpType.NOP, StackType.POP),
			new Instruction("xor", 0x003, 0, JmpType.NOP, StackType.POP),
			new Instruction("add", 0x004, 0, JmpType.NOP, StackType.POP),
			new Instruction("sub", 0x005, 0, JmpType.NOP, StackType.POP),

			// st (vp) 3 bits
			new Instruction("st0", 0x010 + 0, 0, JmpType.NOP, StackType.POP),
			new Instruction("st1", 0x010 + 1, 0, JmpType.NOP, StackType.POP),
			new Instruction("st2", 0x010 + 2, 0, JmpType.NOP, StackType.POP),
			new Instruction("st3", 0x010 + 3, 0, JmpType.NOP, StackType.POP),
			new Instruction("st",  0x010 + 4, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmi", 0x010 + 5, 0, JmpType.NOP, StackType.POP),

			new Instruction("stvp", 0x018, 0, JmpType.NOP, StackType.POP),
			new Instruction("stjpc", 0x019, 0, JmpType.NOP, StackType.POP),
			new Instruction("star", 0x01a, 0, JmpType.NOP, StackType.POP),
			new Instruction("stsp", 0x01b, 0, JmpType.NOP, StackType.POP),

			// shift
			new Instruction("ushr", 0x01c, 0, JmpType.NOP, StackType.POP),
			new Instruction("shl", 0x01d, 0, JmpType.NOP, StackType.POP),
			new Instruction("shr", 0x01e, 0, JmpType.NOP, StackType.POP),
			// new Instruction("shift reserved", 0x1f, 0, JmpType.NOP, StackType.POP),

			// 5 bits: 0x20-0x3f
			new Instruction("stm", 0x020, 5, JmpType.NOP, StackType.POP),

			// MMU 4 bit subfield selects function (pop type)
			new Instruction("stmul", 0x040 + 0, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmwa", 0x040 + 1, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmra", 0x040 + 2, 0, JmpType.NOP, StackType.POP),
			new Instruction("stmwd", 0x040 + 3, 0, JmpType.NOP, StackType.POP),
			// array instructions
			new Instruction("stald", 0x040 + 4, 0, JmpType.NOP, StackType.POP),
			new Instruction("stast", 0x040 + 5, 0, JmpType.NOP, StackType.POP),
			// getfield/putfield
			new Instruction("stgf",  0x040 + 6, 0, JmpType.NOP, StackType.POP),
			new Instruction("stpf",  0x040 + 7, 0, JmpType.NOP, StackType.POP),
			// magic copying
			new Instruction("stcp",  0x040 + 8, 0, JmpType.NOP, StackType.POP),
			// bytecode read
			new Instruction("stbcrd", 0x040 + 9, 0, JmpType.NOP, StackType.POP),
			// store TOS to MMU index register for jopsys_*field
			new Instruction("stidx", 0x040 + 0xa, 0, JmpType.NOP, StackType.POP),
			// putstatic
			new Instruction("stps", 0x040 + 0xb, 0, JmpType.NOP, StackType.POP),

			//
			// 'push' instructions
			//

			// 5 bits: 0xa0-0xbf
			new Instruction("ldm", 0x0a0, 5, JmpType.NOP, StackType.PUSH),
			// 5 bits: 0xc0-0xdf
			new Instruction("ldi", 0x0c0, 5, JmpType.NOP, StackType.PUSH),

			// MMU 4 bit subfield selects function (push type)
			new Instruction("ldmrd", 0x0e0 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldmul", 0x0e0 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldbcstart", 0x0e0 + 2, 0, JmpType.NOP, StackType.PUSH),

			// ld (vp) 3 bits
			new Instruction("ld0", 0x0e8 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld1", 0x0e8 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld2", 0x0e8 + 2, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld3", 0x0e8 + 3, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld", 0x0e8 + 4, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldmi", 0x0e8 + 5, 0, JmpType.NOP, StackType.PUSH),

			// 2 bits
			new Instruction("ldsp", 0x0f0 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldvp", 0x0f0 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ldjpc", 0x0f0 + 2, 0, JmpType.NOP, StackType.PUSH),

			// ld opd 2 bits
			new Instruction("ld_opd_8u", 0x0f4 + 0, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_8s", 0x0f4 + 1, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_16u", 0x0f4 + 2, 0, JmpType.NOP, StackType.PUSH),
			new Instruction("ld_opd_16s", 0x0f4 + 3, 0, JmpType.NOP, StackType.PUSH),

			new Instruction("dup", 0x0f8, 0, JmpType.NOP, StackType.PUSH),

			//
			// 'no SP change' instructions
			//
			new Instruction("nop", 0x100, 0, JmpType.NOP, StackType.NOP),
			new Instruction("wait", 0x101, 0, JmpType.NOP, StackType.NOP),
			new Instruction("jbr", 0x102, 0, JmpType.NOP, StackType.NOP),
			
			// no SP change instructions for MMU
			// 4 bit subfield selects function (pop type)

			// getstatic
			new Instruction("stgs", 0x110 + 0x0, 0, JmpType.NOP, StackType.NOP),


			// branches
			new Instruction("bz", 0x180, 6, JmpType.BR, StackType.POP),
			new Instruction("bnz", 0x1c0, 6, JmpType.BR, StackType.POP),
			new Instruction("jmp", 0x200, 9, JmpType.JMP, StackType.NOP),
		};

	public static Map map = new HashMap();
	public static Map imap = new TreeMap();

	static {
		for (int i = 0; i < ia.length; ++i) {
File
Instruction.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
			Instruction ins = ia[i];

			System.out.print("\t\t\twhen \"");
<<<<<<< HEAD
			System.out.print(Jopa.bin(ins.opcode >>> ins.opdSize, INSTLEN
					- ins.opdSize));
			for (int j = 0; j < ins.opdSize; ++j) {
				System.out.print("-");
=======
			// TODO: changed to 10+2 bits
			if (ins.hasOpd) {
				System.out.print(Jopa.bin(ins.opcode>>>5, 3));
				System.out.print("-----");
			} else {
				System.out.print(Jopa.bin(ins.opcode, 8));
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
			}
			System.out.print("\" =>\t\t\t-- ");
			System.out.print(ins.name);
Solution content
			Instruction ins = ia[i];

			System.out.print("\t\t\twhen \"");
			System.out.print(Jopa.bin(ins.opcode >>> ins.opdSize, INSTLEN
					- ins.opdSize));
			for (int j = 0; j < ins.opdSize; ++j) {
				System.out.print("-");
			}
			System.out.print("\" =>\t\t\t-- ");
			System.out.print(ins.name);
File
Instruction.java
Developer's decision
Version 1
Kind of conflict
Comment
For statement
If statement
Method invocation
Chunk
Conflicting content
	private String fname;
	static final int ADDRBITS = 11;
<<<<<<< HEAD
	/** length of microcode instruction including nxt and opd */	
	static final int DATABITS = Instruction.INSTLEN+2;
=======
	/** length of microcode instruction including nxt and opd */
	static final int DATABITS = Instruction.INSTLEN+2;
//	static final int BRBITS = 10;
	static final int BRBITS = ADDRBITS;
	static final int OPDBITS = 5;
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
	static final int CONST_ADDR = 32;
	static final int VER_ADDR = 64-2;
	static final int RAM_LEN = 256;
Solution content
	private String fname;
	static final int ADDRBITS = 11;
	/** length of microcode instruction including nxt and opd */	
	static final int DATABITS = Instruction.INSTLEN+2;
	static final int CONST_ADDR = 32;
	static final int VER_ADDR = 64-2;
	static final int RAM_LEN = 256;
File
Jopa.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
			line += "\n";
			line += "begin\n";
			line += "\n";
<<<<<<< HEAD
			line += "\t[0..1ff] : 080;	-- nop TODO: new instruction\n\n";
=======
			line += "\t[0..1ff] : 080;	-- nop -- TODO: new instruction format\n\n";
>>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc

			rom.write( line );
Solution content
			line += "\n";
			line += "begin\n";
			line += "\n";
			line += "\t[0..1ff] : 080;	-- nop TODO: new instruction\n\n";

			rom.write( line );
File
Jopa.java
Developer's decision
Version 1
Kind of conflict
Variable
Chunk
Conflicting content
						if (opVal>mask || opVal<0) {
							error(in, "operand wrong: "+opVal);
						}
<<<<<<< HEAD
						opcode |= opVal & mask;		// use operand
					}

					if (l.nxt) opcode |= 0x2<>>>>>> c8638bace4f53b8a7a348f07af012563022a21bc
					romData[romLen] = opcode;
					++romLen;
					line += hex(pc, 4)+" : "+hex(opcode, 3)+";\t";
Solution content
						if (opVal>mask || opVal<0) {
							error(in, "operand wrong: "+opVal);
						}
						opcode |= opVal & mask;		// use operand
					}

					if (l.nxt) opcode |= 0x2<
File
Jopa.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Variable