Set on less that operation??
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Set on less that operation??

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Computer Architecture
Author Message
Paminu
Guest





Posted: Mon Aug 01, 2005 4:15 pm    Post subject: Set on less that operation?? Reply with quote

I am trying to make an ALU that does SLT correct. But if I wan't to do -7<6
I get:

1001 - 0110 = 1001 + 1010 = 0011

And the signbit of the result is 0 but it should be 1. How do I make SLT
work correct? My first idea was to shift the result left by two but I am
not sure this will work.
Back to top
Joe Pfeiffer
Guest





Posted: Mon Aug 01, 2005 4:15 pm    Post subject: Re: Set on less that operation?? Reply with quote

Paminu <jadajada@asd.com> writes:

Quote:
I am trying to make an ALU that does SLT correct. But if I wan't to do -7<6
I get:

1001 - 0110 = 1001 + 1010 = 0011

And the signbit of the result is 0 but it should be 1. How do I make SLT
work correct? My first idea was to shift the result left by two but I am
not sure this will work.

Think about the overflow bit.
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
skype: jjpfeifferjr
Back to top
Grumble
Guest





Posted: Mon Aug 01, 2005 4:15 pm    Post subject: Re: Set on less that operation?? Reply with quote

Paminu wrote:
Quote:
I am trying to make an ALU that does SLT correct. But if I wan't to do -7<6
I get:

1001 - 0110 = 1001 + 1010 = 0011

And the signbit of the result is 0 but it should be 1. How do I make SLT
work correct? My first idea was to shift the result left by two but I am
not sure this will work.

You seem to be using 4-bit two's complement.

Values which can be represented = -8 to 7

You tried to compute 6+7=13 => overflow

13 is congruent to -3 (modulo 16)

Why don't you use 5 bits to hold the sum?
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Computer Architecture All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB