diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-11-13 18:36:31 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-11-13 18:36:31 +0100 |
commit | cc0ea4be71cfb321f85d8195328f1db3a0fbb427 (patch) | |
tree | 191361df844f37ba95e5cf3211f24d9713b721de /libraries | |
parent | 29693dc550ad3f33e8fba23256640e849818b749 (diff) | |
download | ghdl-cc0ea4be71cfb321f85d8195328f1db3a0fbb427.tar.gz ghdl-cc0ea4be71cfb321f85d8195328f1db3a0fbb427.tar.bz2 ghdl-cc0ea4be71cfb321f85d8195328f1db3a0fbb427.zip |
libraries/openieee: reformating.
Diffstat (limited to 'libraries')
-rwxr-xr-x | libraries/openieee/build_numeric.py | 68 | ||||
-rw-r--r-- | libraries/openieee/v87/numeric_bit-body.vhdl | 68 | ||||
-rw-r--r-- | libraries/openieee/v87/numeric_std-body.vhdl | 68 | ||||
-rw-r--r-- | libraries/openieee/v93/numeric_bit-body.vhdl | 68 | ||||
-rw-r--r-- | libraries/openieee/v93/numeric_std-body.vhdl | 68 |
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). |