Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

How to subtract a binary A by 3 (A-3)?

Status
Not open for further replies.

levan8421

Newbie level 3
Joined
Oct 12, 2007
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
please tell me how to subtract a binary A by 3 (A-3) in the best way ( except the way that using a subtract block from FA to have the result)
thanks a lot !!!
 

Iouri

Advanced Member level 2
Joined
Aug 17, 2005
Messages
682
Helped
87
Reputation
174
Reaction score
8
Trophy points
1,298
Activity points
4,814
subtract 3

C<= A-B;
 

levan8421

Newbie level 3
Joined
Oct 12, 2007
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
subtract 3

@Iouri: can you make ur reply clearer? i mean if there's any rule that i can make A-3 insteads of using a subtract block
Thanks !!!
 

Old Nick

Advanced Member level 1
Joined
Sep 14, 2007
Messages
480
Helped
68
Reputation
136
Reaction score
18
Trophy points
1,298
Activity points
4,243
Re: subtract 3

Are you talking about programming A-3 (A being a binary number of n bits and 3 being 00....011) in a HDL?
Is the subtract block you're talking about, something like a Xilinx coregen block?
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
637
Reputation
1,272
Reaction score
88
Trophy points
1,328
Location
USA
Activity points
33,183
subtract 3

As Iouri suggested, the '-' operator in HDL (such as Verilog or VHDL) is easy to use, and usually generates well-optimized logic for your target device. The results will probably be as small and fast as anything you create yourself.

What is "FA"?
 

BlackOps

Full Member level 5
Joined
Jan 1, 2005
Messages
280
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,298
Location
AZERBAIJAN
Activity points
2,496
subtract 3

maybe FA is full adder? but i think full adder doesnt have subtract block, it just adds A with complement of 3...
 

amitgangwar_vlsi

Member level 5
Joined
Jul 6, 2007
Messages
88
Helped
10
Reputation
20
Reaction score
2
Trophy points
1,288
Location
Pune,India
Activity points
1,913
Re: subtract 3

you can do A + 1's complement of B + 1 if A > B
it will give output = A-B
in ur case B is 3 (0011), so take 1's complement of it and follow the process....
that you can do using full adder.......
 

Joined
Sep 3, 2007
Messages
853
Helped
66
Reputation
132
Reaction score
16
Trophy points
1,298
Activity points
0
subtract 3

Nice reply amitgangwar_vlsi.

in fact:
3=0011
-3=1101=(1+3')
A-3=A+(-3).

I hope it is well explained.
 

bigrice911

Member level 3
Joined
Apr 27, 2004
Messages
65
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
500
subtract 3

learn a little bit verilog or system-verilog, let syn or sim tool to do the job, you can just "-" to write your code.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top