Commits

Eric Johnson committed 2c6c9f4

initial addition of content

  • Participants

Comments (0)

Files changed (36)

hw/001/ch_1_2.odt

Binary file added.

hw/002/ch_2_3.odt

Binary file added.

hw/003/ch_3.odt

Binary file added.

hw/004/ch_4.odt

Binary file added.

hw/005/ch_5.odt

Binary file added.

hw/006/bigger_number.bin

+0000 0000 0000 0000
+0010 001 000001100	;ld r1 <- off 10
+0010 010 000001100	;ld r2 <- off 10
+0001 000 000 1 11111	;and r0 <- r0 -1
+1001 010 010 111111	;not r2 <- r2
+0001 010 010 1 00001	;add r2 <- r2 1
+0001 010 001 000 010	;add r2 <- r1 r2
+0000 110 000000010	;brnz 2
+0101 000 000 1 00001	;and r0 <- r0 1
+0000 001 000000011	;brp 3
+0101 010 010 000 010	;and r2 <- r2 r2
+0000 100 000000001	;brn 1
+0101 000 000 1 00000	;and r0 <- r0 0
+1111 0000 00100101	;halt
+0000 0100 0000 0011	;ld into r1
+0000 0000 0000 0011	;ld into r2

hw/006/bigger_number.obj

Binary file added.

hw/006/ch_6.odt

Binary file added.

hw/006/increment.bin

+0011 0000 1111 0100	; set pc at 0x30f4
+0010 010 000001011	; load r2 with 0x3100
+0010 001 000001011	; load r1 with 0x3101
+1001 010 010 111111	; negate r2
+0001 010 010 1 00010	; add 2 to r2 as including endpoint
+0001 000 010 000 001	; add r1 to r2
+0110 010 001 000000	; load r2 data at addr r1
+0001 010 010 1 00001	; add 1 to r2
+0111 010 001 000000	; store r2 into r1
+0001 001 001 1 11111	; add -1 to r1
+0001 000 000 1 11111	; add -1 to r0
+0000 001 111111010	; if p jump to 0x3005
+1111 0000 0010 0101	; halt
+0011 0001 0000 0010	; 0x3102
+0011 0001 0000 0110	; 0x3106
+0000 0000 0000 0001	; 1
+0000 0000 0000 1000	; 8
+1111 1111 1111 1111	; -1
+1111 1111 1111 1100	; -4
+0000 0000 0000 0000	; 0

hw/008/ch_8.odt

Binary file added.

hw/008/ch_8_9.odt

Binary file added.

hw/009/ch_10_11_12_13.odt

Binary file added.

labs/001/description.txt

+Write a program that takes a hexadecimal number which it interprets to be a IEEE single precision floating point value and prints it out as 2 to the exponent times the sum of powers of 2. The input value should be a command line parameter. Use of the program should look like this:
+
+    F:\371\lab1> java Fexpand 3e900000
+
+    3e900000 ==> 2^-2(1 + 2^-3)
+
+Use only integer (bitwise and shift) operations. Do not use floating point variables in any of the intermediate steps. Do not use Strings where you can avoid it. Avoid arrays. Avoid Math.pow(...).
+
+For this lab, no writeup is required. Hand this lab in by emailing your code to me (so I can run it).
+

labs/001/floatlab/.classpath

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

labs/001/floatlab/.project

+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>floatlab</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

labs/001/floatlab/src/Fexpand.java

+public class Fexpand {
+	public static void main(String[] args) {
+		if (args.length == 1) {
+			if (args[0] == "/?") {
+				printUsage();
+				return;
+			} else if (args[0].length() == 8) {
+				long x;
+				try {
+					x = Long.decode("0x" + args[0]);
+				} catch (Exception ex) {
+					printRequestValid();
+					return;
+				}
+				
+				//determining fraction string
+				String fraction = (x & 1) == 1 ? "2^-23)" : ")";
+				int idx = -22;
+				x >>= 1;
+				while (idx < 0) {
+					if ((x & 1) == 1) 
+						fraction = "2^" + idx + " + " + fraction;
+					idx += 1;
+					x >>= 1;
+				}
+				fraction = "(1 + " + fraction;
+				
+				//determining exponent string
+				String exponent = "2^" + ((x & Long.decode("0xff")) - 127) + " * ";
+				x >>= 8;
+				
+				//determining sign string
+				String sign = (x & 1) == 1 ? "(-1) * " : "";
+		
+				System.out.println("n ==> " + sign + exponent + fraction );
+			} else {
+				printRequestValid();
+				return;
+			}
+		} else { 
+			printUsage();
+			return;
+		}
+	}
+	
+	private static void printUsage() {
+		System.out.println("This expands a 32-bit hex IEEE representation.");
+		System.out.println("Usage: ");
+		System.out.println("/? for Help");
+		System.out.println("Enter in a 32-bit hex IEEE representation (as eight characters) to expand.");
+	}
+	
+	private static void printRequestValid() {
+		System.out.println("Please enter in a 32-bit hex IEEE representation (as eight characters) to expand.");
+	}
+}

labs/002/analog_oscilloscope_serial_port_lab.odt

Binary file added.

labs/002/scope.ppt

Binary file added.

labs/003/analyzer.ppt

Binary file added.

labs/003/logical_analyzer_parallel_port_lab.odt

Binary file added.

labs/004/latch_lab.odt

Binary file added.

labs/005/bus_lab.odt

Binary file added.

labs/005/buslab.java

+import java.lang.Thread;
+
+public class Bus2 {
+	private static final short DATAPORT = 0x378;
+	private static final short STATUSPORT = 0x379;
+	private static final short CONTROLPORT = 0x37A;
+	private static final ioPort lpt = new ioPort();
+
+	/**
+	* @param args
+	*/	
+	public static void main(String[] args) throws Exception {
+		sendMessage();
+		receiveMessage();
+	}
+
+	//this sends 10 0xAAs to the bus
+	public static void sendMessage() throws Exception {
+		int portVal;
+
+		//must set bit 5 of the control port to 1 first
+		//must read in bus request to see if it is 1
+		//bit 0 and 1 of control port must be set high to
+		//disable tri-state buffers and to be able to read in values
+		//from the bus_req, snd_clk, and rcv_clk.
+		portVal = lpt.Inp32(CONTROLPORT);
+		lpt.Out32(CONTROLPORT, (short) (portVal | 0x23));
+		
+		//bus_req can be read from bit 3 of the status port
+		//snd_clk can be read from bit 4 of the status port
+		//rcv_clk can be read from bit 5 of the status port
+		portVal = lpt.Inp32(STATUSPORT);	
+		int bus_req = portVal & 0x04;
+		int snd_clk = portVal & 0x10;
+		int rcv_clk = portVal & 0x20;
+
+		//read bus request in while loop
+		while (bus_req == 0) {
+			portVal = lpt.Inp32(STATUSPORT);	
+			int bus_req = portVal & 0x04;
+			int snd_clk = portVal & 0x10;
+			int rcv_clk = portVal & 0x20;
+		}
+
+		//once bus request is high, clear bus_req to low so
+		//we can send
+		
+		//in order to set bus_req low we must clear bit 0 of 
+		//control port to low
+		//that way, ground from pin 2 feeds in
+		//also, at the same time, bit 5, the direction bit
+		//must be cleared of the control port
+		portVal = lpt.Inp32(CONTROLPORT);
+		lpt.Out32(CONTROLPORT, (short) (portVal & 0xDE)); 
+
+		int count = 0;
+		int next_rcv_clk = rcv_clk;
+		while (count < 10) {
+			lpt.Out32(DATAPORT, (short) (0xAA));
+			portVal = lpt.Inp32(CONTROLPORT);
+			if (snd_clk == 0) {
+				lpt.Out32(CONTROLPORT, (short) (portVal | 0x10));
+			} else {
+				lpt.Out32(CONTROLPORT, (short) (portVal & 0xEF));
+			}
+			count += 1;
+			while (next_rcv_clk == rcv_clk) {
+				portVal = lpt.Inp32(STATUSPORT);
+				next_rcv_clk = portVal & 0x20;
+			}
+			rcv_clk = next_rcv_clk;
+		}
+
+		//set the bus_req high
+		//set 0 of the control port high
+		//set bit 5 of the control port high
+		portVal = lpt.Inp32(CONTROLPORT);
+		lpt.Out32(CONTROLPORT, (short) (portVal | 0x23));
+	}
+	
+	//this listens to the bus printing to console
+	public static void receiveMessage() throws Exception {
+		int portVal;
+
+		portVal = lpt.Inp32(CONTROLPORT);
+		lpt.Out32(CONTROLPORT, (short) (portVal | 0x23));
+
+		while ( 1 == 1 ) {
+			portVal = lpt.Inp32(STATUSPORT);
+			int bus_req = portVal & 0x04;
+			int snd_clk = portVal & 0x10;
+			int rcv_clk = portVal & 0x20;
+			if (bus_req == 0) {
+				portVal = lpt.Inp32(DATAPORT);
+				System.out.println(portVal);
+				if (rcv_clk == 0) {
+					lpt.Out32(CONTROLPORT, (short) (portVal | 0x20)); 
+				} else {
+					lpt.Out32(CONTROLPORT, (short) (portVal & 0xDF));
+				}
+				int next_snd_clk = snd_clk;
+				while ((bus_req == 0) && (next_send_clk == snd_clk)) {
+					portVal = lpt.Inp32(STATUSPORT);
+					bus_req = portVal & 0x04;
+					next_snd_clk = portVal & 0x10;
+					rcv_clk = portVal & 0x20;
+					
+				}
+			}
+		}
+
+		portVal = lpt.Inp32(CONTROLPORT);
+		lpt.Out32(CONTROLPORT, (short) (portVal | 0x23));
+	}
+}

lec/PattPatelCh01.ppt

Binary file added.

lec/PattPatelCh02.ppt

Binary file added.

lec/PattPatelCh03.ppt

Binary file added.

lec/ch1-3test05-06q1.doc

Binary file added.

lec/ch1-3test05-06q2.doc

Binary file added.

lec/ch1-3test05-06q3.doc

Binary file added.

lec/ch1-3test06-07q1.doc

Binary file added.

lec/ch1-3test06-07q2.doc

Binary file added.

lec/ch2-3probs.ppt

Binary file added.

lec/digitalreview.ppt

Binary file added.

lec/intro.ppt

Binary file added.

tools/LC3_unix.pdf

Binary file added.

tools/lc3tools.tar.gz

Binary file added.