How to extract the opcode and the data form the instruction

Reply

Join Date: Oct 2006
Posts: 3
Reputation: sciconf is an unknown quantity at this point 
Solved Threads: 0
sciconf sciconf is offline Offline
Newbie Poster

How to extract the opcode and the data form the instruction

 
0
  #1
Oct 2nd, 2006
How to extract the opcode and the data form the instruction? "instruction" is inst below in decimal. For some values of "??", I should be able to extract the opCode and data???

opCode = inst >>??;
data = inst & ??;

It is done on a x86 processor using C.
It is 16 bit in total.

Starting from 0 from the right to left.
11th to 15th bit is OpCode.

0 to 9th bit is Data.


Is there a shortcut using hexadecimal notation?
Last edited by sciconf; Oct 2nd, 2006 at 11:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: How to extract the opcode and the data form the instruction

 
1
  #2
Oct 10th, 2006
Something like

  1. ( opc >> 11 ) & 0x3f; // 6 bits
  2. opc & 0x3ff; // 10 bits
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC