Saturday, 15 January 2011
VHDL Code for 4 Bit Comparator
The vhdl coding for a 4 bit comparator is as follows:-
Its a behavioural type of modelling.....
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
USE ieee.std_logic_arith.all ;
ENTITY compare IS
PORT ( A, B : IN SIGNED(3 DOWNTO 0) ;
AeqB, AgtB, AltB : OUT STD_LOGIC ) ;
END compare ;
ARCHITECTURE Behavior OF compare IS
BEGIN
AeqB <= '1' WHEN A = B ELSE '0' ;
AgtB <= '1' WHEN A > B ELSE '0' ;
AltB <= '1' WHEN A < B ELSE '0' ;
END Behavior ;
Labels:
4 bit comparator,
coding,
comparator,
Elect. amp; Comm.,
VHDL
Subscribe to:
Post Comments (Atom)
[...] 2.VHDL code for 4 bit comparator [...]
ReplyDelete[...] 1.VHDL Code for 4 bit comparator [...]
ReplyDeletevery usefull
ReplyDeletethanx abhijit, you can subscibe us too for more such useful posts!!
ReplyDeletethanks you..:)
ReplyDeletethis is very gud....but i want foe 8bit comparator......:-/
ReplyDeleteThank you for giving imp information...
ReplyDeleteJust take (7 downto 0 ) instead of (3 downto 0). :-)
ReplyDeleteIs there a code on here for the 4-bit comparator, but with a structural coding instead of behavioural?
ReplyDeletenot working
ReplyDeletey any error ??
ReplyDeletethanks.....
ReplyDelete:) Happy reading bro!!
ReplyDeletegud 1
ReplyDeletei want vhdl code which generate 16 bit output as a pulse in step order
ReplyDeleteI do agree with all the ideas you have offered to your post.
ReplyDeleteThey are really convincing and can certainly work.
Still, the posts are too quick for starters.
May you please prolong them a little from subsequent time?
Thank you for the post.
is this using altera quartus 2 software?
ReplyDeleteGenerate a PWM signal with 50% duty cycle produce the VHDL code of a 4 bit comparator. The module should have two 4 bit inputs which have to be compared, and one 1 bit output.(the result of the comparision ) set the coparator threshold value (the value to be compared with) at 1000 binary.
ReplyDeleteDesign the top module that connects the modules created at stage 1 and 2 such that the counter will be clocked at the frequency of 2 HZ and the comparator will compare the counter output with 1000 binary pre set value.
Please help me this.
:) thanks
ReplyDeleteplease send me structural modeling vhdl code
ReplyDeleteUSE ieee.std_logic_arith.all ; which statement is using this library? Is it necessary to take this library just in this particular code? Thanks in advance!
ReplyDeleteits simple and easy but we have to make use of process statement in behavioral modelling ,if process is not used will this work?
ReplyDelete