K
Kot
Guest
I'm using Synplify for Actel ProASIC.
I was writing a portion of design where I just have to
put some registers that acts like some memory to CPU.
It did not work and after simplifying some section of code
to see if the synthesis tool is doing what it is supposed to do,
I found this -- look at the codes in "mypak".
when the constants are defined using plain literal, it synthesize
with no problem. But when the constant values are defined
using function provided by 1164 package then it does not work.
Is it a bug? or I misunderstood VHDL?
-- emailing your knowledge/opinion directly to me is more welcome ;-)
Jihwan
jihwan2@hotmail.com
library ieee;
use ieee.std_logic_1164.all;
package mypak is
subtype addrword is std_logic_vector(3 downto 0);
subtype appword is std_logic;
-- it works this way
--constant aa_reg1 : addrword := "0010";
--constant aa_reg2 : addrword := "0101";
--constant aa_reg3 : addrword := "1010";
-- but not in this way. why?
constant aa_reg1 : addrword := to_x01(x"2");
constant aa_reg2 : addrword := to_x01(x"5");
constant aa_reg3 : addrword := to_x01(x"a");
end package mypak;
library ieee;
use ieee.std_logic_1164.all;
use work.mypak.all;
entity test is
port(
ad : in addrword;
nce : in std_logic;
nwr : in std_logic;
da : inout appword;
q1 : out appword;
q2 : out appword;
q3 : out appword
);
end entity test;
architecture a1 of test is
signal reg1, reg2, reg3 : appword;
begin
q1 <= reg1;
q2 <= reg2;
q3 <= reg3;
process (nce, nwr, ad)
begin
if nce = '0' then
if rising_edge(nwr) then
if ad = aa_reg1 then
reg1 <= da;
elsif ad = aa_reg2 then
reg2 <= da;
elsif ad = aa_reg3 then
reg3 <= da;
end if;
end if;
end if;
end process;
end architecture a1;
I was writing a portion of design where I just have to
put some registers that acts like some memory to CPU.
It did not work and after simplifying some section of code
to see if the synthesis tool is doing what it is supposed to do,
I found this -- look at the codes in "mypak".
when the constants are defined using plain literal, it synthesize
with no problem. But when the constant values are defined
using function provided by 1164 package then it does not work.
Is it a bug? or I misunderstood VHDL?
-- emailing your knowledge/opinion directly to me is more welcome ;-)
Jihwan
jihwan2@hotmail.com
library ieee;
use ieee.std_logic_1164.all;
package mypak is
subtype addrword is std_logic_vector(3 downto 0);
subtype appword is std_logic;
-- it works this way
--constant aa_reg1 : addrword := "0010";
--constant aa_reg2 : addrword := "0101";
--constant aa_reg3 : addrword := "1010";
-- but not in this way. why?
constant aa_reg1 : addrword := to_x01(x"2");
constant aa_reg2 : addrword := to_x01(x"5");
constant aa_reg3 : addrword := to_x01(x"a");
end package mypak;
library ieee;
use ieee.std_logic_1164.all;
use work.mypak.all;
entity test is
port(
ad : in addrword;
nce : in std_logic;
nwr : in std_logic;
da : inout appword;
q1 : out appword;
q2 : out appword;
q3 : out appword
);
end entity test;
architecture a1 of test is
signal reg1, reg2, reg3 : appword;
begin
q1 <= reg1;
q2 <= reg2;
q3 <= reg3;
process (nce, nwr, ad)
begin
if nce = '0' then
if rising_edge(nwr) then
if ad = aa_reg1 then
reg1 <= da;
elsif ad = aa_reg2 then
reg2 <= da;
elsif ad = aa_reg3 then
reg3 <= da;
end if;
end if;
end if;
end process;
end architecture a1;