M
MikeWhy
Guest
I'm tired, frustrated, and frankly, maybe don't entirely know what I'm
doing. But what exactly does the type system do for you aside from beat you
over the head constantly?
Set that aside for the moment...
I wrote a recursive function to flatten an array of arrays of bits. It
synthesizes fine. It should; it's only a bunch of wires. Simulation in ISIM,
though, is heavily skewed and offset, apparently trying to simulate some
perceived logic delays.
subtype byte_t is std_logic_vector(7 downto 0);
type byte_array_t is array (natural range <>
of byte_t;
function flatten (foo : byte_array_t) return std_logic_vector;
----------------------------
function flatten (foo : byte_array_t) return std_logic_vector is
begin
if (foo'length = 1) then
return foo(foo'low);
elsif (foo'ascending) then
return foo(foo'low) & flatten(foo(foo'low+1 to foo'high));
else
return foo(foo'high) & flatten(foo(foo'high-1 downto foo'low));
end if;
end function;
----------------------------
I have a matched set for 7-bit and 6-bit words, too. I think I can cut &
paste a few more variants without imploding. It was the simulation that was
the last straw.
It's a bunch of bits. Everything's a bunch of bits. Why oh why can't we have
tools that understand bits?
What am I doing wrong?
doing. But what exactly does the type system do for you aside from beat you
over the head constantly?
Set that aside for the moment...
I wrote a recursive function to flatten an array of arrays of bits. It
synthesizes fine. It should; it's only a bunch of wires. Simulation in ISIM,
though, is heavily skewed and offset, apparently trying to simulate some
perceived logic delays.
subtype byte_t is std_logic_vector(7 downto 0);
type byte_array_t is array (natural range <>
function flatten (foo : byte_array_t) return std_logic_vector;
----------------------------
function flatten (foo : byte_array_t) return std_logic_vector is
begin
if (foo'length = 1) then
return foo(foo'low);
elsif (foo'ascending) then
return foo(foo'low) & flatten(foo(foo'low+1 to foo'high));
else
return foo(foo'high) & flatten(foo(foo'high-1 downto foo'low));
end if;
end function;
----------------------------
I have a matched set for 7-bit and 6-bit words, too. I think I can cut &
paste a few more variants without imploding. It was the simulation that was
the last straw.
It's a bunch of bits. Everything's a bunch of bits. Why oh why can't we have
tools that understand bits?
What am I doing wrong?