Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. struct R{
  2.  
  3. unsigned int opcode: 6;
  4. unsigned int rs: 5;
  5. unsigned int rt: 5;
  6. unsigned int rd: 5;
  7. unsigned int shamt: 5;
  8. unsigned int funct: 6;
  9.  
  10.  
  11. };
  12.  
  13. struct R test = {32,0,11,21,19,0}
  14.  
  15. FILE *fp = fopen("./result", "rb");
  16. fwrite(&test,sizeof(test),1,result);
  17.  
  18. 00000000: 00100000 01011000 01110101 00000010
  19.  
  20. 00000000: 00100000 10100000 01110011 00000001
  21.  
  22. struct R{
  23.  
  24. char opcode[6];
  25. char rs[5];
  26. char rt[5];
  27. char rd[5];
  28. char shamt[5];
  29. char funct[6];
  30.  
  31.  
  32. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement