VHDL Code: Testing Equality of Vectors

AI Thread Summary
The discussion centers on a VHDL code snippet where the user attempts to compare specific bits of two 8-bit vectors, checkHR and checkMIN, against 4-bit vectors HRH and HRL. The user encounters an error indicating that the equality operator cannot be used with the operands in the current context. Other participants suggest that the code must be placed within a process and recommend posting the entire process for further analysis. They also request clarification on which variables are signals and which are ports to better diagnose the issue. The conversation emphasizes the importance of context and proper syntax in VHDL coding.
user101
Messages
205
Reaction score
0
Hi all, I have the following code:

if (checkHR(7 downto 4) = HRH) and (checkHR(3 downto 0) = HRL)
and (checkMIN(7 downto 4) = MINH) and (checkMIN(3 downto 0) = MINL) then

SECL <= "0000";
SECH <= "0000";
MINL <= "1000"; -- set to 8888 to notify alarm has been set
MINH <= "1000"; -- set to 8888 to notify alarm has been set
HRL <= "1000"; -- set to 8888 to notify alarm has been set
HRH <= "1000"; -- set to 8888 to notify alarm has been set

where checkHR and checkMIN are 8 bit vectors (7 downto 0)... and SECL, SECH, MINL, MINH, HRL, and HRH are all 4 bit vectors (3 downto 0).

What I'm trying to do is check to see if the first four bits of checkHR is equal to HRH.

Can someone tell me what's wrong? I'm getting the error: Line 74. = can not have such operands in this context.
 
Engineering news on Phys.org
Did you put the code inside a process? You can only use the "if" statement inside a process.
 
Yes, it's in a process.
 
In the portion of code that you posted there is no syntax error. There must be some conflicting code somewhere else. You should post the whole process. Also tell us which of SECL, SECH, MINL, MINH, HRL, HRH, checkHR and checkMIN, are signals and which are ports.
 
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Back
Top