aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlibraries/openieee/build_numeric.py68
-rw-r--r--libraries/openieee/v87/numeric_bit-body.vhdl68
-rw-r--r--libraries/openieee/v87/numeric_std-body.vhdl68
-rw-r--r--libraries/openieee/v93/numeric_bit-body.vhdl68
-rw-r--r--libraries/openieee/v93/numeric_std-body.vhdl68
5 files changed, 170 insertions, 170 deletions
diff --git a/libraries/openieee/build_numeric.py b/libraries/openieee/build_numeric.py
index 43bb04b67..fa02580de 100755
--- a/libraries/openieee/build_numeric.py
+++ b/libraries/openieee/build_numeric.py
@@ -779,41 +779,41 @@ def disp_size():
def disp_divmod():
w("""
- -- All index range are normalized (N downto 0).
- -- NUM and QUOT have the same range.
- -- DEM and REMAIN have the same range.
- -- No 'X'.
- procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
- is
- variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
- variable sub : unsigned (dem'range) := (others => '0');
- variable carry, d : """ + logic_type () + """;
- begin
- for i in num'range loop
- -- Shift
- reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
- reg (0) := num (i);
- -- Substract
- carry := '1';
- for j in dem'reverse_range loop
- d := not dem (j);
- sub (j) := compute_sum (carry, reg (j), d);
- carry := compute_carry (carry, reg (j), d);
- end loop;
- carry := compute_carry (carry, reg (reg'left), '1');
- -- Test
- if carry = '0' then
- -- Greater than
- quot (i) := '0';
- else
- quot (i) := '1';
- reg (reg'left) := '0';
- reg (sub'range) := sub;
- end if;
+ -- All index range are normalized (N downto 0).
+ -- NUM and QUOT have the same range.
+ -- DEM and REMAIN have the same range.
+ -- No 'X'.
+ procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
+ is
+ variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
+ variable sub : unsigned (dem'range) := (others => '0');
+ variable carry, d : """ + logic_type () + """;
+ begin
+ for i in num'range loop
+ -- Shift
+ reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
+ reg (0) := num (i);
+ -- Substract
+ carry := '1';
+ for j in dem'reverse_range loop
+ d := not dem (j);
+ sub (j) := compute_sum (carry, reg (j), d);
+ carry := compute_carry (carry, reg (j), d);
end loop;
- remain := reg (dem'range);
- end divmod;
- """)
+ carry := compute_carry (carry, reg (reg'left), '1');
+ -- Test
+ if carry = '0' then
+ -- Greater than
+ quot (i) := '0';
+ else
+ quot (i) := '1';
+ reg (reg'left) := '0';
+ reg (sub'range) := sub;
+ end if;
+ end loop;
+ remain := reg (dem'range);
+ end divmod;
+""")
def disp_vec_vec_udiv(func):
res = """
diff --git a/libraries/openieee/v87/numeric_bit-body.vhdl b/libraries/openieee/v87/numeric_bit-body.vhdl
index 3bdc634ac..63551d264 100644
--- a/libraries/openieee/v87/numeric_bit-body.vhdl
+++ b/libraries/openieee/v87/numeric_bit-body.vhdl
@@ -715,41 +715,41 @@ package body NUMERIC_BIT is
return res;
end has_0x;
- -- All index range are normalized (N downto 0).
- -- NUM and QUOT have the same range.
- -- DEM and REMAIN have the same range.
- -- No 'X'.
- procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
- is
- variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
- variable sub : unsigned (dem'range) := (others => '0');
- variable carry, d : bit;
- begin
- for i in num'range loop
- -- Shift
- reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
- reg (0) := num (i);
- -- Substract
- carry := '1';
- for j in dem'reverse_range loop
- d := not dem (j);
- sub (j) := compute_sum (carry, reg (j), d);
- carry := compute_carry (carry, reg (j), d);
- end loop;
- carry := compute_carry (carry, reg (reg'left), '1');
- -- Test
- if carry = '0' then
- -- Greater than
- quot (i) := '0';
- else
- quot (i) := '1';
- reg (reg'left) := '0';
- reg (sub'range) := sub;
- end if;
+ -- All index range are normalized (N downto 0).
+ -- NUM and QUOT have the same range.
+ -- DEM and REMAIN have the same range.
+ -- No 'X'.
+ procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
+ is
+ variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
+ variable sub : unsigned (dem'range) := (others => '0');
+ variable carry, d : bit;
+ begin
+ for i in num'range loop
+ -- Shift
+ reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
+ reg (0) := num (i);
+ -- Substract
+ carry := '1';
+ for j in dem'reverse_range loop
+ d := not dem (j);
+ sub (j) := compute_sum (carry, reg (j), d);
+ carry := compute_carry (carry, reg (j), d);
end loop;
- remain := reg (dem'range);
- end divmod;
-
+ carry := compute_carry (carry, reg (reg'left), '1');
+ -- Test
+ if carry = '0' then
+ -- Greater than
+ quot (i) := '0';
+ else
+ quot (i) := '1';
+ reg (reg'left) := '0';
+ reg (sub'range) := sub;
+ end if;
+ end loop;
+ remain := reg (dem'range);
+ end divmod;
+
function size_unsigned (n : natural) return natural
is
-- At least one bit (even for 0).
diff --git a/libraries/openieee/v87/numeric_std-body.vhdl b/libraries/openieee/v87/numeric_std-body.vhdl
index c716b19f3..6942bd4e1 100644
--- a/libraries/openieee/v87/numeric_std-body.vhdl
+++ b/libraries/openieee/v87/numeric_std-body.vhdl
@@ -1012,41 +1012,41 @@ package body NUMERIC_STD is
return res;
end has_0x;
- -- All index range are normalized (N downto 0).
- -- NUM and QUOT have the same range.
- -- DEM and REMAIN have the same range.
- -- No 'X'.
- procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
- is
- variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
- variable sub : unsigned (dem'range) := (others => '0');
- variable carry, d : sl_x01;
- begin
- for i in num'range loop
- -- Shift
- reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
- reg (0) := num (i);
- -- Substract
- carry := '1';
- for j in dem'reverse_range loop
- d := not dem (j);
- sub (j) := compute_sum (carry, reg (j), d);
- carry := compute_carry (carry, reg (j), d);
- end loop;
- carry := compute_carry (carry, reg (reg'left), '1');
- -- Test
- if carry = '0' then
- -- Greater than
- quot (i) := '0';
- else
- quot (i) := '1';
- reg (reg'left) := '0';
- reg (sub'range) := sub;
- end if;
+ -- All index range are normalized (N downto 0).
+ -- NUM and QUOT have the same range.
+ -- DEM and REMAIN have the same range.
+ -- No 'X'.
+ procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
+ is
+ variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
+ variable sub : unsigned (dem'range) := (others => '0');
+ variable carry, d : sl_x01;
+ begin
+ for i in num'range loop
+ -- Shift
+ reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
+ reg (0) := num (i);
+ -- Substract
+ carry := '1';
+ for j in dem'reverse_range loop
+ d := not dem (j);
+ sub (j) := compute_sum (carry, reg (j), d);
+ carry := compute_carry (carry, reg (j), d);
end loop;
- remain := reg (dem'range);
- end divmod;
-
+ carry := compute_carry (carry, reg (reg'left), '1');
+ -- Test
+ if carry = '0' then
+ -- Greater than
+ quot (i) := '0';
+ else
+ quot (i) := '1';
+ reg (reg'left) := '0';
+ reg (sub'range) := sub;
+ end if;
+ end loop;
+ remain := reg (dem'range);
+ end divmod;
+
function size_unsigned (n : natural) return natural
is
-- At least one bit (even for 0).
diff --git a/libraries/openieee/v93/numeric_bit-body.vhdl b/libraries/openieee/v93/numeric_bit-body.vhdl
index 869b0d2b2..f9ce50b2b 100644
--- a/libraries/openieee/v93/numeric_bit-body.vhdl
+++ b/libraries/openieee/v93/numeric_bit-body.vhdl
@@ -715,41 +715,41 @@ package body NUMERIC_BIT is
return res;
end has_0x;
- -- All index range are normalized (N downto 0).
- -- NUM and QUOT have the same range.
- -- DEM and REMAIN have the same range.
- -- No 'X'.
- procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
- is
- variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
- variable sub : unsigned (dem'range) := (others => '0');
- variable carry, d : bit;
- begin
- for i in num'range loop
- -- Shift
- reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
- reg (0) := num (i);
- -- Substract
- carry := '1';
- for j in dem'reverse_range loop
- d := not dem (j);
- sub (j) := compute_sum (carry, reg (j), d);
- carry := compute_carry (carry, reg (j), d);
- end loop;
- carry := compute_carry (carry, reg (reg'left), '1');
- -- Test
- if carry = '0' then
- -- Greater than
- quot (i) := '0';
- else
- quot (i) := '1';
- reg (reg'left) := '0';
- reg (sub'range) := sub;
- end if;
+ -- All index range are normalized (N downto 0).
+ -- NUM and QUOT have the same range.
+ -- DEM and REMAIN have the same range.
+ -- No 'X'.
+ procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
+ is
+ variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
+ variable sub : unsigned (dem'range) := (others => '0');
+ variable carry, d : bit;
+ begin
+ for i in num'range loop
+ -- Shift
+ reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
+ reg (0) := num (i);
+ -- Substract
+ carry := '1';
+ for j in dem'reverse_range loop
+ d := not dem (j);
+ sub (j) := compute_sum (carry, reg (j), d);
+ carry := compute_carry (carry, reg (j), d);
end loop;
- remain := reg (dem'range);
- end divmod;
-
+ carry := compute_carry (carry, reg (reg'left), '1');
+ -- Test
+ if carry = '0' then
+ -- Greater than
+ quot (i) := '0';
+ else
+ quot (i) := '1';
+ reg (reg'left) := '0';
+ reg (sub'range) := sub;
+ end if;
+ end loop;
+ remain := reg (dem'range);
+ end divmod;
+
function size_unsigned (n : natural) return natural
is
-- At least one bit (even for 0).
diff --git a/libraries/openieee/v93/numeric_std-body.vhdl b/libraries/openieee/v93/numeric_std-body.vhdl
index 0625a49f0..ba6b510d6 100644
--- a/libraries/openieee/v93/numeric_std-body.vhdl
+++ b/libraries/openieee/v93/numeric_std-body.vhdl
@@ -1012,41 +1012,41 @@ package body NUMERIC_STD is
return res;
end has_0x;
- -- All index range are normalized (N downto 0).
- -- NUM and QUOT have the same range.
- -- DEM and REMAIN have the same range.
- -- No 'X'.
- procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
- is
- variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
- variable sub : unsigned (dem'range) := (others => '0');
- variable carry, d : sl_x01;
- begin
- for i in num'range loop
- -- Shift
- reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
- reg (0) := num (i);
- -- Substract
- carry := '1';
- for j in dem'reverse_range loop
- d := not dem (j);
- sub (j) := compute_sum (carry, reg (j), d);
- carry := compute_carry (carry, reg (j), d);
- end loop;
- carry := compute_carry (carry, reg (reg'left), '1');
- -- Test
- if carry = '0' then
- -- Greater than
- quot (i) := '0';
- else
- quot (i) := '1';
- reg (reg'left) := '0';
- reg (sub'range) := sub;
- end if;
+ -- All index range are normalized (N downto 0).
+ -- NUM and QUOT have the same range.
+ -- DEM and REMAIN have the same range.
+ -- No 'X'.
+ procedure divmod (num, dem : UNSIGNED; quot, remain : out UNSIGNED)
+ is
+ variable reg : unsigned (dem'left + 1 downto 0) := (others => '0');
+ variable sub : unsigned (dem'range) := (others => '0');
+ variable carry, d : sl_x01;
+ begin
+ for i in num'range loop
+ -- Shift
+ reg (reg'left downto 1) := reg (reg'left - 1 downto 0);
+ reg (0) := num (i);
+ -- Substract
+ carry := '1';
+ for j in dem'reverse_range loop
+ d := not dem (j);
+ sub (j) := compute_sum (carry, reg (j), d);
+ carry := compute_carry (carry, reg (j), d);
end loop;
- remain := reg (dem'range);
- end divmod;
-
+ carry := compute_carry (carry, reg (reg'left), '1');
+ -- Test
+ if carry = '0' then
+ -- Greater than
+ quot (i) := '0';
+ else
+ quot (i) := '1';
+ reg (reg'left) := '0';
+ reg (sub'range) := sub;
+ end if;
+ end loop;
+ remain := reg (dem'range);
+ end divmod;
+
function size_unsigned (n : natural) return natural
is
-- At least one bit (even for 0).