OpenCores
Issue List
GHDL simulate #3
Closed strijar opened this issue over 14 years ago
strijar commented over 14 years ago

I tried to run the simulation in ghdl and got an error:

mblite/core_Pkg.vhd:402:33: object subtype is not locally static mblite/core_Pkg.vhd:410:33: object subtype is not locally static mblite/core_Pkg.vhd:422:33: object subtype is not locally static mblite/core_Pkg.vhd:430:33: object subtype is not locally static

Patch the file and start to work normally

--- core_Pkg.vhd.orig 2009-11-17 08:52:40.000000000 +0300 +++ core_Pkg.vhd 2009-10-28 22:24:35.000000000 +0300 @@ -399,19 +399,25 @@ -- Little endian decoding CASE size IS WHEN byte =>

  •                CASE address(1 DOWNTO 0) IS
  •                    WHEN "00"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/4 - 1 DOWNTO 0);
  •                    WHEN "01"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO CFG_DMEM_WIDTH/4);
  •                    WHEN "10"   => RETURN "000000000000000000000000" & data(3*CFG_DMEM_WIDTH/4 - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                    WHEN "11"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO 3*CFG_DMEM_WIDTH/4);
  •                    WHEN OTHERS => RETURN "00000000000000000000000000000000";
  •                END CASE;
  •                if address(1 downto 0) = "00" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/4 - 1 DOWNTO 0);
  •                elsif address(1 downto 0) = "01" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO CFG_DMEM_WIDTH/4);
  •                elsif address(1 downto 0) = "10" then
  •                    RETURN "000000000000000000000000" & data(3*CFG_DMEM_WIDTH/4 - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                elsif address(1 downto 0) = "11" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO 3*CFG_DMEM_WIDTH/4);
  •                else
  •                    RETURN "00000000000000000000000000000000";
  •                end if;
               WHEN halfword => 
  •                CASE address(1 DOWNTO 0) IS
  •                    WHEN "00"   => RETURN "0000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO 0);
  •                    WHEN "10"   => RETURN "0000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                    WHEN OTHERS => RETURN "00000000000000000000000000000000";
  •                END CASE;
  •                if address(1 DOWNTO 0) = "00" then
  •                    RETURN "0000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO 0);
  •                elsif address(1 DOWNTO 0) = "10" then
  •                    RETURN "0000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                else
  •                    RETURN "00000000000000000000000000000000";
  •                end if;
                 WHEN OTHERS =>
                     RETURN data;
             END CASE;
    @@ -419,19 +425,25 @@ -- Big endian decoding CASE size IS WHEN byte =>
  •                CASE address(1 DOWNTO 0) IS
  •                    WHEN "00"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO 3*CFG_DMEM_WIDTH/4);
  •                    WHEN "01"   => RETURN "000000000000000000000000" & data(3*CFG_DMEM_WIDTH/4 - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                    WHEN "10"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO CFG_DMEM_WIDTH/4);
  •                    WHEN "11"   => RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/4 - 1 DOWNTO 0);
  •                    WHEN OTHERS => RETURN "00000000000000000000000000000000";
  •                END CASE;
  •                if address(1 DOWNTO 0) = "00" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO 3*CFG_DMEM_WIDTH/4);
  •                elsif address(1 DOWNTO 0) = "01" then
  •                    RETURN "000000000000000000000000" & data(3*CFG_DMEM_WIDTH/4 - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                elsif address(1 DOWNTO 0) = "10" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO CFG_DMEM_WIDTH/4);
  •                elsif address(1 DOWNTO 0) = "11" then
  •                    RETURN "000000000000000000000000" & data(CFG_DMEM_WIDTH/4 - 1 DOWNTO 0);
  •                else
  •                    RETURN "00000000000000000000000000000000";
  •                end if;
               WHEN halfword => 
  •                CASE address(1 DOWNTO 0) IS
  •                    WHEN "00"   => RETURN "0000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                    WHEN "10"   => RETURN "0000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO 0);
  •                    WHEN OTHERS => RETURN "00000000000000000000000000000000";
  •                END CASE;
  •                if address(1 DOWNTO 0) = "00" then
  •                    RETURN "0000000000000000" & data(CFG_DMEM_WIDTH - 1 DOWNTO CFG_DMEM_WIDTH/2);
  •                elsif address(1 DOWNTO 0) = "10" then
  •                    RETURN "0000000000000000" & data(CFG_DMEM_WIDTH/2 - 1 DOWNTO 0);
  •                else
  •                    RETURN "00000000000000000000000000000000";
  •                end if;
               WHEN OTHERS =>
                   RETURN data;
           END CASE;
takar commented over 14 years ago

Thanks for the contribution! Could you assemble an example (or complete) Makefile / list of actions for compiling and simulating MB-Lite using GHDL? Other users could benefit from this, and besides I can add the GHDL to my library of automated tests...

If the test with your contribution passes, I will put your version into the repository. I think that support for various tools is very important!

strijar commented over 14 years ago

I sent files by e-mail

stony commented about 14 years ago

I can confirm the bug and the changes helped! Did something similar on my own.

takar commented about 14 years ago

After thinking for a while about this issue it was decided that this will not be fixed in the official distribution. The reason is that the original structure is syntactically better than the solution with if-statements. If-statements describe a priority encoder, while a case statements describe a multiplexor. We intend to infer a multiplexor, hence the code won't be changed.

Consequently this issue is regarded as a GHDL-bug.

takar closed this about 14 years ago
strijar commented over 11 years ago

There is a compromise:

<pre> --- core_Pkg.vhd.orig 2012-10-16 16:07:44.872002178 +0400 +++ core_Pkg.vhd 2012-10-16 16:09:06.532001930 +0400 @@ -393,10 +393,13 @@ -- This function aligns the memory load operation (Big endian decoding). function align_mem_load (data : std_logic_vector; size : transfer_size; address : std_logic_vector ) return std_logic_vector is + variable addr : std_logic_vector(1 downto 0); begin + addr := address(1 downto 0); + case size is - when byte => - case address(1 downto 0) is + when byte => + case addr is when "00" => return C_24_ZEROS & data(31 downto 24); when "01" => return C_24_ZEROS & data(23 downto 16); when "10" => return C_24_ZEROS & data(15 downto 8); @@ -404,7 +407,7 @@ when others => return C_32_ZEROS; end case; when halfword => - case address(1 downto 0) is + case addr is when "00" => return C_16_ZEROS & data(31 downto 16); when "10" => return C_16_ZEROS & data(15 downto 0); when others => return C_32_ZEROS; </pre>

Assignee
No one
Labels
Bug