Umut
Umut

Reputation: 509

How can i write code for divisibility in VHDL?

How can i write VHDL code for 4-digit binary numbers so that it outputs 1 only when the 4-digit number is divisible by 3 or 4 using only NOR gates? Thanks for any help.

Upvotes: 0

Views: 961

Answers (3)

Emman
Emman

Reputation: 1244

One best way I guess was to manually derive the equations from truth table through karnaugh map you will get a combination of AND and OR gate convert all that to NOR gate using standard technique after that you can go for implementing the same using gate level modelling.

Upvotes: 1

user1818839
user1818839

Reputation:

1) List the numbers (3,4 etc) for which the output is to be 1.
2) Write down the binary representation of each of these numbers, 0011, 0100, etc
3) Write down the expression for the output as the logical OR of these terms :
Output <= 0011 + 0100 + ... This is the expression for your output in SOP (Sum of Products) form.
4) Optionally, (but worth doing because it reduces the size of the problem you are dealing with) minimise this expression using standard techniques such as drawing the Karnaugh map, and combining adjacent terms to simplify the expression.
5) Use De Morgan's rules to transform the simplified SOP expression into POS (Product of Sum) form.
6) You can now implement the POS form as two levels of NOR gate.

Upvotes: 1

user2099996
user2099996

Reputation: 134

The answer is yes. Because you can build any logic with only NAND and NOR.

Upvotes: 1

Related Questions