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 !!!
 

subtract 3

C<= A-B;
 

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 !!!
 

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?
 

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"?
 

subtract 3

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

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.......
 

subtract 3

Nice reply amitgangwar_vlsi.

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

I hope it is well explained.
 

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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…