D
Dave Smith
Guest
Hello all -
I have a question regarding said topic in the subject line. I am
trying to use a previously created VHDL module (an 8-bit divider) in a
larger state machine architecture and I'm having some problems with
syntax. I have declared the module as a component as such:
component div8
port(
diva,divb : in std_logic_vector(7 downto 0);
div0 : out std_logic_vector(7 downto 0);
divq : out std_logic_vector(7 downto 0));
end component;
The state machine is based around a case statement that jumps to the
state that calls the divider whenever a control value is set to "%10".
Here are the lines of the state machine that deal with this:
variable divina,divinb,divoutq,divoutr : std_logic_vector(7 downto 0);
....
case ctrl is
....
--Divider unit
--Two 8-bit inputs, one 8-bit quotient and one 8-bit remainder
when "10" =>
divina := ina;
divinb := inb;
div8(divina,divinb,divoutr,divoutq);
outa <= divoutq;
outb <= divoutr;
As you can see, I'm calling the div8 module in the same manner as a
procedure (mapping the input/output variables through the parameter
list). I don't get any syntax errors when I do this, but the output is
VERY wrong also.
Is this even legal? How do you call a component from within a state
machine? Do I need to make the inputs signals instead of variables?
Thanks in advance for any insights, I can provide more code if
necessary!
I have a question regarding said topic in the subject line. I am
trying to use a previously created VHDL module (an 8-bit divider) in a
larger state machine architecture and I'm having some problems with
syntax. I have declared the module as a component as such:
component div8
port(
diva,divb : in std_logic_vector(7 downto 0);
div0 : out std_logic_vector(7 downto 0);
divq : out std_logic_vector(7 downto 0));
end component;
The state machine is based around a case statement that jumps to the
state that calls the divider whenever a control value is set to "%10".
Here are the lines of the state machine that deal with this:
variable divina,divinb,divoutq,divoutr : std_logic_vector(7 downto 0);
....
case ctrl is
....
--Divider unit
--Two 8-bit inputs, one 8-bit quotient and one 8-bit remainder
when "10" =>
divina := ina;
divinb := inb;
div8(divina,divinb,divoutr,divoutq);
outa <= divoutq;
outb <= divoutr;
As you can see, I'm calling the div8 module in the same manner as a
procedure (mapping the input/output variables through the parameter
list). I don't get any syntax errors when I do this, but the output is
VERY wrong also.
Is this even legal? How do you call a component from within a state
machine? Do I need to make the inputs signals instead of variables?
Thanks in advance for any insights, I can provide more code if
necessary!