blob: ee5b3a66dbec9eeb9d237ed6803c5482a8dd2b65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
library IEEE;
use IEEE.numeric_std.all;
entity tb is
end tb;
architecture behavioral of tb is
subtype int31 is integer range -2**(31-1) to 2**(31-1)-1;
type array_7_int31 is array(0 to 6) of int31;
function ASR(v : integer; n : natural ; nv : natural; nres : natural) return integer is
variable tmp : signed(nv downto 0);
variable res : signed(nv downto 0);
begin
tmp := resize(to_signed(v,nv),nv+1);
res := shift_right(tmp,n);
return to_integer(res(nres-1 downto 0));
end;
begin
software_emulation : process
variable test : int31;
variable tmp : int31;
begin
report "Start" severity note;
tmp := 5965232;
-- test := test + ASR(((tmp * 119304647) + 268435456),29,57,31);
-- test := test + ASR(((tmp * 178956971) + 268435456),29,57,31);
test := test + ASR(((tmp * 59652324) + 268435456),29,57,31);
end process;
end behavioral;
|