Please register or login. There are 0 registered and 928 anonymous users currently online. Current bandwidth usage: 326.30 kbit/s December 16 - 09:33am EST 
Hardware Analysis
      
Forums Product Prices
  Contents 
 
 

  Latest Topics 
 

More >>
 

    
 
 

  You Are Here: 
 
/ Forums / Programming /
 

  Programming/Coding Systems 
 
 Author 
 Date Written 
 Tools 
John Edwin Nov 27, 2012, 10:12am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List Replies: 7 - Views: 1941
Hi Guys,
I have a quick question on the above subject;my kid brother has asked me a question i dont seem to understand;the question goes like this:
Q: Formulate a coding system to represent the following commands/operations using a 5-bit byte.
-Add
-Subtract
-Multiply
-Evaluate
-Display Result;

I have no clue what this question is asking me to do.Any help will be greatly appreciated;

John


Want to enjoy fewer advertisements and more features? Click here to become a Hardware Analysis registered user.
Bungle Nov 28, 2012, 01:30am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Nov 28, 2012, 01:31am EST

 
>> Re: Programming/Coding Systems
John Edwin said:
Hi Guys,
I have a quick question on the above subject;my kid brother has asked me a question i dont seem to understand;the question goes like this:
Q: Formulate a coding system to represent the following commands/operations using a 5-bit byte.
-Add
-Subtract
-Multiply
-Evaluate
-Display Result;

I have no clue what this question is asking me to do.Any help will be greatly appreciated;

John


00001 = Add
00010 = Subtract
00100 = Multiply
01000 = Evaluate
10000 = Display

Thats my guess as to what the assignment is asking for.

Core i7 4770K @ 4.4GHz | Corsair H110 | Gigabyte GA-Z87X-UD5H | 32GB 1866MHz Corsair Vengeance
2x EVGA GTX 780 SLI | 256GB OCZ Vector SSD | 4TB Hitachi 7K4000
Corsair AX1200 PSU | Corsair 650D | Windows 7 Ultimate x64
John Edwin Nov 28, 2012, 03:04am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: Programming/Coding Systems
Thanks MrBungle
How did you arrive at these codes?Any explanation you can give?

Rhort Nov 28, 2012, 04:15am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Nov 28, 2012, 04:25am EST

 
>> .
Surely, if it’s a live system:

00000 > Default State used as Display (ie If there’s nothing else happening, just display the current value)
00001 > Evaluate (smallest value because it’ll probably be used the most after ‘Display’)
00011 > Add
00100 > Subtract
00101 > Multiply
00111 > Divide (missed out of the question for some reason)
01000 > Parity Check for display
01001 > Parity Check for Evaluate
01011 > Parity Check for Addition
01100 > Parity Check for Subtraction
01101 > Parity Check for Multiplication
01111 > Parity Check for Division (if we’re going to include that)
10000 > Error Trap for display (displayed off screen etc)
10001 > Error Trap for Evaluate (Div0 etc)
10011 > Error Trap for Addition
10100 > Error Trap for Subtraction
10101 > Error Trap for Multiplication
10111 > Error Trap for Division
11000-11111 > General Error traps (i.e if it doesn’t fit anywhere else, it goes here and your coding can display error message)

That makes full use of all five bytes.

_________________________________________________________________________________
~ The manual said "Requires Windows '95 or better" ...so I installed Linux!
John Edwin Nov 28, 2012, 05:30am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Nov 28, 2012, 05:31am EST

 
>> Re: Programming/Coding Systems
Rhort said:
Surely, if it’s a live system:

00000 > Default State used as Display (ie If there’s nothing else happening, just display the current value)
00001 > Evaluate (smallest value because it’ll probably be used the most after ‘Display’)
00011 > Add
00100 > Subtract
00101 > Multiply
00111 > Divide (missed out of the question for some reason)
01000 > Parity Check for display
01001 > Parity Check for Evaluate
01011 > Parity Check for Addition
01100 > Parity Check for Subtraction
01101 > Parity Check for Multiplication
01111 > Parity Check for Division (if we’re going to include that)
10000 > Error Trap for display (displayed off screen etc)
10001 > Error Trap for Evaluate (Div0 etc)
10011 > Error Trap for Addition
10100 > Error Trap for Subtraction
10101 > Error Trap for Multiplication
10111 > Error Trap for Division
11000-11111 > General Error traps (i.e if it doesn’t fit anywhere else, it goes here and your coding can display error message)

That makes full use of all five bytes.


Well....This shows how much you guys understand this stuff;i can see you have different bit codes from the previous post;Some explanation would really help,how have you come up with these codes,are these known binary conventions for operators like add,subtract,Multiply,Evaluate and Display Result?Would like to know how pls assist with any reference where this is explained or shade abit of light
Thanks;

Rhort Nov 28, 2012, 02:40pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> .
Okay, what I got from the way the question is phrased, “Formulate a coding system…” was that they want to see systems designed (i.e. there isn’t one already), and this has probably been done for two reasons:

1. So that there is no one right answer; everyone in the class will probably come up with something different, or at least it will be a bit suspicious if several people come up with *EXACTLY* the same system
2. So students can’t simply Google it ;)

What is seems they’re looking for is a system that will allow you to assign a unique flag to each action, as required, using only a five bit binary coding system, presumably so that the entire system of up to 31 variables requires less than 20 bytes bits of memory. This essentially can be accomplished in any way you like, as long as you include all the system states they’re looking for. I was just trying to see how many I could think of off the top of my head, but in essence, the order is irrelevant, as long as you include them all; the reason I did them in the way I did is so that you can trap errors with bit 1 (i.e. all the codes with a 1 in the first bit are errors), parity check on bit 2 (i.e. all the codes with a 1 in the second bit for the parity checks), and the other three bits for the variants of the operators (i.e. addition states all end ‘011’, subtraction states all end ‘100’, etc), but, as I mentioned before, that’s just one way, and there are many other ways of doing it to achieve what they seem to be looking for.

Not sure how well I’ve explained that, but in summary (to answer your direct questions):

- how have you come up with these codes

I simply tried to include a unique code for each of the flags needed (plus ‘division’ which I added myself just for completeness)

- are these known binary conventions for operators like add, subtract, Multiply, Evaluate and Display Result?

Not that I know of; those codes could be in any order as long as there’s a unique code for each one.

- Would like to know how pls assist with any reference where this is explained or shade abit of light

Don’t think there’s really a reference for this, my answer is only based on logic. As I mentioned before, the question has probably been put in the way it has so as to remove the chance of someone searching the internet for a quick solution.

_________________________________________________________________________________
~ The manual said "Requires Windows '95 or better" ...so I installed Linux!
Bungle Nov 28, 2012, 04:15pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Nov 28, 2012, 04:16pm EST

 
>> Re: Programming/Coding Systems
John Edwin said:
Thanks MrBungle
How did you arrive at these codes?Any explanation you can give?


The question said to "Formulate" a system so I did... I wasn't going off of an existing system if thats what you're asking, my guess is that the question is just wanting the student to come up with 5 different binary values and assign them to a command. Rhort's system looks to be far more roubust and is likely closer to how one might work in the real world but unless this is a college level hardware design class you'll probably be ok with a simple answer.

Core i7 4770K @ 4.4GHz | Corsair H110 | Gigabyte GA-Z87X-UD5H | 32GB 1866MHz Corsair Vengeance
2x EVGA GTX 780 SLI | 256GB OCZ Vector SSD | 4TB Hitachi 7K4000
Corsair AX1200 PSU | Corsair 650D | Windows 7 Ultimate x64
Rhort Nov 30, 2012, 11:30am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> .
Probably the best way to judge what sort of answer you’re going to need is to look at the other questions (if there are any); if they’re mostly one sentence answers, then that would suggest a simpler solution is required for this question, but if this is the only question, or the others seem to require a much more detailed response, then you’ll need something more in-depth.

The main thing that made me think this required a more beefy solution was the mention of a ‘5 bit’ system; in order to have those five operations that were mentioned, it could be done in 3 bits, i.e:

001 > Add
010 > Subtract
011 > Multiply
100 > Evaluate
101 > Display Result

With a bit to spare; perhaps that’s where ‘Divide’ is supposed to go, and the tutor is waiting to see who will notice it’s missing?

_________________________________________________________________________________
~ The manual said "Requires Windows '95 or better" ...so I installed Linux!

Write a Reply >>


 

    
 
 

  Topic Tools 
 
RSS UpdatesRSS Updates
 

  Related Articles 
 
 

  Newsletter 
 
A weekly newsletter featuring an editorial and a roundup of the latest articles, news and other interesting topics.

Please enter your email address below and click Subscribe.