|
From: Maciej S. <mac...@ce...> - 2014-10-01 15:56:13
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Steve,
Support for variables in VHDL subprograms is already done [1], together
with suitable tests [2].
Now I would like to take care of 'range and 'reverse_range attributes.
I think these should be easily translatable using $left & $right
system functions. For example:
- ---------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity range_test is
port (inp : in std_logic_vector(8 downto 4);
outp : out std_logic_vector(8 downto 4));
end range_test;
architecture test of range_test is
begin
process(inp) begin
for i in inp'range loop
outp(i) <= not inp(i);
end loop;
end process;
end test;
- ---------------------------------------------
could be converted to:
- ---------------------------------------------
module range_test(input wire logic[8:4] inp,
output logic[8:4] outp);
always @(inp) begin
longint i;
for (i = $left(inp); i >= $right(inp); i = i - 1) begin
outp[i] <= ~(inp[i]);
end
end
endmodule
- ---------------------------------------------
There is also one thing that kept me pondering recently. I am not that
familiar with vvp principles, but it seems that its assembly-like code
format could be translated to the LLVM Intermediate Representation [3].
It is just a general idea, but maybe ivl could output the LLVM IR that
could be interpreted by llvm together with some kind of simulator runtime.
Has anyone else considered it? Do you already see any obstacles that
would made the task impossibly hard?
Regards,
Orson
[1] https://github.com/steveicarus/iverilog/pull/45
[2] https://github.com/orsonmmz/ivtest/tree/subprogram_test
[3] https://idea.popcount.org/2013-07-24-ir-is-better-than-assembly/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBAgAGBQJULCQKAAoJEBRwGu1hpbJ18FMIAJJvzHTTCSGyMkP1XKkczfhv
4a2PVlvTKtli+D4eDSDZz0Movt8ZukrZeEhlS5y7pzjntRdQgwY4UlGlGtL/Rtif
FOO3vKh7LHV2hv20QLtp31XPnn+dlWhT7em5JE2ZC7AR8oTwgQ2axQfgrJoHMlsa
zQfbDcjNK570r0aQuQ3obVuwC/NCIHZEzi6MNl/bQEeJkUJeT76rdK+t4BznrxdJ
2gNmXvb2grxoiAYA77C7H9iPZFCvC0BWTgiOn21orz/Xy5Mp9IWDVq3vkB0vvVch
XG+vIqYqC3o8u2vZ4wqHAxPncFyW4cnK6Sfgg6W2EeZfZ8ztUse91SDQjnWo6AY=
=vuaA
-----END PGP SIGNATURE-----
|