Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. ########## the PC and condition codes registers #############
  2. register fF { pc:64 = 0; }
  3.  
  4. register dW{
  5. outputA:64 = 0;
  6. outputB:64 = 0;
  7. dstE:4 = REG_NONE;
  8. ifun:4 = 0;
  9. icode:4 = NOP;
  10. valC:64 = 0;
  11. stat:3 = 0;
  12. }
  13.  
  14. ########## Fetch #############
  15. pc = F_pc;
  16.  
  17. wire rA:4, rB:4;
  18. d_icode = i10bytes[4..8];
  19. d_ifun = i10bytes[0..4];
  20. rA = i10bytes[12..16];
  21. rB = i10bytes[8..12];
  22.  
  23. d_valC = [
  24. d_icode in { JXX } : i10bytes[8..72];
  25. 1 : i10bytes[16..80];
  26. ];
  27.  
  28. wire offset:64, valP:64;
  29. offset = [
  30. d_icode in { HALT, NOP, RET } : 1;
  31. d_icode in { RRMOVQ, OPQ, PUSHQ, POPQ } : 2;
  32. d_icode in { JXX, CALL } : 9;
  33. 1 : 10;
  34. ];
  35.  
  36. valP = F_pc + offset;
  37.  
  38. ########## Decode #############
  39.  
  40. # source selection
  41. reg_srcA = [
  42. d_icode in {RRMOVQ} : rA;
  43. 1 : REG_NONE;
  44. ];
  45.  
  46. reg_srcB = [
  47. d_icode in {OPQ} : rB;
  48. 1: REG_NONE;
  49. ];
  50.  
  51. d_outputA = [
  52. reg_srcA == W_dstE: reg_inputE;
  53. 1: reg_outputA;
  54. ];
  55. d_outputB = [
  56. reg_srcB == W_dstE: reg_inputE;
  57. 1: reg_outputB;
  58. ];
  59.  
  60. d_dstE = [
  61. d_icode in {IRMOVQ, RRMOVQ} : rB;
  62. 1 : REG_NONE;
  63. ];
  64.  
  65. d_stat = [
  66. d_icode == HALT : STAT_HLT;
  67. d_icode > 0xb : STAT_INS;
  68. 1 : STAT_AOK;
  69. ];
  70.  
  71. stall_F = (d_stat == STAT_HLT) || (d_stat == STAT_INS);
  72.  
  73. ########## Execute #############
  74.  
  75.  
  76.  
  77. ########## Memory #############
  78.  
  79.  
  80.  
  81.  
  82. ########## Writeback #############
  83.  
  84.  
  85. # destination selection
  86. reg_dstE = W_dstE;
  87.  
  88. reg_inputE = [ # unlike book, we handle the "forwarding" actions (something + 0) here
  89. W_icode == RRMOVQ : W_outputA;
  90. W_icode in {IRMOVQ} : W_valC;
  91. 1: 0xBADBADBAD;
  92. ];
  93.  
  94.  
  95. ########## PC and Status updates #############
  96.  
  97. Stat = W_stat;
  98.  
  99. f_pc = valP;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement