Advertisement
Sinux1

MyCU.ucode

Oct 25th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. // sdm
  2. // Wk 8 Lab
  3. // 10/24/19
  4. //
  5. // ==========FETCH==========
  6. fetch0: a_sel=7, b_sel=7, alu_sel=AND, r6_write, mar_sel=LOAD;
  7. fetch1: a_sel=6, c_in, alu_sel=ADDA, r7_write, ir0_sel=LOAD, read, if wait then goto fetch1 endif;
  8.  
  9. fetch2: a_sel=7, b_sel=7, alu_sel=AND, r6_write, mar_sel=LOAD;
  10. fetch3: a_sel=6, c_in, alu_sel=ADDA, r7_write, ir1_sel=LOAD, read, if wait then goto fetch3 endif;
  11.  
  12. // =========OPCODES=========
  13. // 0) LOAD
  14. // 1) ADD
  15. // 2) STORE
  16. // 3) STOP (HALT)
  17.  
  18. goto opcode[IR_OPCODE];
  19. opcode[0]: result_sel=IR_CONST8, r0_write, goto opcode0.1;
  20. opcode[1]: result_sel=IR_CONST8, r0_write, goto opcode1.1;
  21. opcode[2]: result_sel=IR_CONST8, r0_write, goto opcode2.1;
  22. opcode[3]: goto opcode[3];
  23.  
  24.  
  25. opcode0.1: a_sel=0, b_sel=0, alu_sel=AND, mar_sel=LOAD; read, mdr_sel=LOAD_MEM; goto fetch0;
  26. opcode1.1: result_sel=mdr, r1_write; a_sel=0, b_sel=1, alu_sel=ADD, mdr_sel=LOAD_ALU; goto fetch0;
  27. opcode2.1: a_sel=0, b_sel=0, alu_sel=AND, mar_sel=LOAD; write; goto fetch0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement