Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How to implement two compliment circuits using sequential circuit?

Status
Not open for further replies.

MSRA

Full Member level 2
Joined
Nov 18, 2006
Messages
130
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,296
Location
NED Pakistan
Activity points
2,207
How to impliment 2's compliment circuit using sequential circuit...?
 

dineshbabumm

Advanced Member level 4
Joined
Dec 7, 2005
Messages
101
Helped
9
Reputation
18
Reaction score
2
Trophy points
1,298
Activity points
2,052
2's compliment

A simple logic wil be to implement it directly as we do in straight forward hand calculations..

First complement every bit using an inverter and feed it to shift registers(if you want 4 bit,then use 4 shift registers..).. Now they wil be storing the 1's complement in them.. Feed it to an adder with the 1's complement as one input and 1 as another input.. The adder result wil be your 2's complement!
 

MSRA

Full Member level 2
Joined
Nov 18, 2006
Messages
130
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,296
Location
NED Pakistan
Activity points
2,207
2's compliment

is it the whole sequential procedur.....?
 

A.Anand Srinivasan

Advanced Member level 5
Joined
Oct 15, 2005
Messages
1,804
Helped
257
Reputation
514
Reaction score
39
Trophy points
1,328
Location
India
Activity points
10,680
Re: 2's compliment

ya that is the required sequential circuit... 2's compliment is just 1's compliment plus 1....
 

dineshbabumm

Advanced Member level 4
Joined
Dec 7, 2005
Messages
101
Helped
9
Reputation
18
Reaction score
2
Trophy points
1,298
Activity points
2,052
Re: 2's compliment

MSRA said:
is it the whole sequential procedur.....?

Yes it is the whole sequential procedure..
 

cydi

Full Member level 3
Joined
Dec 12, 2006
Messages
165
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,298
Activity points
2,004
2's compliment

If you are talking about an ADC output, then the matter is different. If you want to find the rep for any number, for seq circuits, the way to go is compliment all and add one...
 

Kral

Advanced Member level 4
Joined
Mar 28, 2005
Messages
1,326
Helped
280
Reputation
558
Reaction score
85
Trophy points
1,328
Location
USA
Activity points
13,417
Re: 2's compliment

MSRA,
One way:
Shift the original number LSB first. The bits are unaltered until the bit after the first "1" is encountered. All subsequent bits are complemented.
Regards,
Kral
 

suru

Full Member level 3
Joined
Aug 31, 2007
Messages
157
Helped
4
Reputation
14
Reaction score
1
Trophy points
1,298
Activity points
1,934
2's compliment

first invert and then use adder circuit to add 1.
 

alam.tauqueer

Full Member level 2
Joined
Jun 19, 2007
Messages
128
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Activity points
2,005
2's compliment

1). Start shifting from LSB bits unaltered until the first "1" is encountered.
2).All subsequent bits are complemented.
 

suru

Full Member level 3
Joined
Aug 31, 2007
Messages
157
Helped
4
Reputation
14
Reaction score
1
Trophy points
1,298
Activity points
1,934
2's compliment

through VHDL coding also can be done.
simple code.

signal x;std_logic;
begin
x<= not y;
x<=X+'1';
 

rakesh_vnit

Member level 3
Joined
Sep 4, 2007
Messages
54
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
india
Activity points
1,714
Re: 2's compliment

as it is a sequential input...u cant take 1's complement n then add 1...
so follow this..

1. start from LSB go left until u encounter 1, leave all the inputs as it is...
2. complement all the bits after the first one...

it will give u 2's complement...while workin sequentially...
 

roahan_ramesh

Newbie level 5
Joined
Jul 4, 2007
Messages
9
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,283
Location
Chennai, India
Activity points
1,339
Re: 2's compliment

One way to do it is the following :

1. Using an X-OR gate (it is a controlled inverter) pass logic 1 into one pin and the data (say pin B) in the other if you want to invert the data. If you pass logic 0 then no inversion occurs.
2. Then using an adder circuit using add 1 to the output from the X-OR gates and apply 0 to the other input (say pin A)
3. This way you will have an adder/subtractor circuit.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top