Mon, 7 Oct 2013, 03:18
My students, I decided to send my answer to all of you since it is only a few lines (less than one minute reading) and some of you may have been curious. A student writes: > Hello Dr. Patt, > > I'd like to ask why the LC3 has no OR opcode? It seems like it would be a > pretty common instruction to use (seeing how there's also a NOT and AND > instruction available), and the back of the book even shows that there is > one space reserved for a potential new opcode. I know you can produce the > same results with NAND logic, but it seems like that would be much less > efficient than having a hard-coded OR gate. Is that OR isn't needed that > much in everyday programming as NOT and AND? Thank you in advance for your > time. > > <<name withheld to protect the student who misses OR>> You are right. OR would be useful, like AND and NOT. And, if I had a hundred opcodes like most real computers, I would have included OR and XOR also. But I only have 16 possible, and I wanted to leave one reserved for the future. So I left out OR, since as you point out I can get it with AND and NOT. I also left out Subtract, which I would also have added if I had 100 opcodes. But with 15, I felt I did not really need it. My objective was to come up with a set of opcodes that would all fit on one page, and that you the student could easily remember them all by the end of the semester. Good luck on the midterm. Yale Patt