Continue to Site

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.

The comparator function in VHDL

Status
Not open for further replies.

LF_LF

Member level 1
Joined
Nov 15, 2009
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,676
Good morning,everybody.
I am doing a feedback system in DE2 board.Then,i want to construct a set of VHDL code that enable me to compare the incoming signal with the predefined value so that the difference can be used as improvement value to increase or decrease the input in order to make sure device always run at the speed that i want.

I am new to VHDL and altera DE2 board. Can anyone give me a suggestion or recommend me any reference on doing this?

Thank you in advanced.
 

Can you elaborate on the design requirements? Is this part of a feedback loop? If so, what are the specs of the ADC? How many bits of data are being compared?

The more info you can provide, the better the recommendations.

8-bit unsigned comparator:

Code:
-- Unsigned 8-bit greater or equal comparator. 
library ieee; 
use ieee.std_logic_1164.all; 
use ieee.std_logic_unsigned.all; 
entity compar is 
     port(A,B : in std_logic_vector(7 downto 0); 
           cmp : out std_logic); 
end compar; 
architecture behavior of compar is 
   begin 
       cmp <= '1' when A >= B 
       else '0'; 
end behavior;

A possible implementation of a comparator.
 

bigdogguru said:
Can you elaborate on the design requirements? Is this part of a feedback loop? If so, what are the specs of the ADC? How many bits of data are being compared?

The more info you can provide, the better the recommendations.

8-bit unsigned comparator:

Code:
-- Unsigned 8-bit greater or equal comparator. 
library ieee; 
use ieee.std_logic_1164.all; 
use ieee.std_logic_unsigned.all; 
entity compar is 
     port(A,B : in std_logic_vector(7 downto 0); 
           cmp : out std_logic); 
end compar; 
architecture behavior of compar is 
   begin 
       cmp <= '1' when A >= B 
       else '0'; 
end behavior;

A possible implementation of a comparator.

Hi, thanks for your reply.
I am doing the induction motor feedback. The signal from motor to ADC, which is ADS7861 from Texas instrument that i am using. It converts to 16 data out where 12 bits are the valid data. However, i attached only 12 bits data from this stream of data.

The speed is quite high from ADC, max for sample frequency is 500kHz and clock is 8MHz. Well, i am facing problem here too as i am looking for voltage translator to convert 3.3V from altera DE2 board to ADC 5V and vice versa. I tried 3 different translator already but they only apply up to max 200kHz. I have ordered a new ic, HCT family, 74HCT244. I hope this will work for my high speed conversion. Do you think so?

One more is the signal from ADC is in Hex or binary form of data? Can it just use > or < to compare? Will the system work? I thought need to convert and compare.

Then after this i need to send out the data in parallel to other DSP.
Do you use an ADC before? I am not sure is my code is workable as i didn't use the BUSY signal to trigger. According to Datasheet, the signal will be gone after 1ns of next conversion start. The BUSY only down 3 bits before next cycle. I have no idea how to attach data from ADC by using BUSY signal as i need to attach all 12 bits data in around 3 clock cycle.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top