aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx
Commit message (Collapse)AuthorAgeFilesLines
...
* bcm53xx: use upstream queued patches for R8500 and AC9Rafał Miłecki2016-09-084-43/+37
| | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* build: fix subtarget descriptionsFelix Fietkau2016-09-041-2/+2
| | | | | | Move Target/Description above the target.mk include Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: use the latest 6th version of ILP clock driver patchRafał Miłecki2016-08-262-44/+67
| | | | | | It still wasn't accepted, so don't switch to 0xx prefix yet. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: backport patch adding ARCH_BCM_53573 symbolRafał Miłecki2016-08-233-2/+64
| | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: update copy of ASM entry flushing whole D-cacheRafał Miłecki2016-08-192-30/+45
| | | | | | | | | | | Previous version was based on code from kernel 2.6.22 with Broadcom two trivial modifications. This updates the copy to the version from current kernel and refreshes the patch. This was tested for regressions on Netgear R6250 (BCM4708A0), D-Link DIR-885L (BCM4709C0) and Tenda AC9 (BCM47189B0). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: build Tenda AC9 imageRafał Miłecki2016-08-191-1/+1
| | | | | | | | We finally got kernel booting on this device and LAN ports are working, so it won't "brick" the device. One more big missing thing is WAN port support. It requires fix for BCM53125 to get switch port 5 working. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: switch back to standalone ASM entry flushing cacheRafał Miłecki2016-08-193-86/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Over a year ago in a commit ac96a1665ac7 ("bcm53xx: update Disable MMU and Dcache during decompression") we switched to Florian's patch for workarounding CFE bug. The main difference was using a part of existing __armv7_mmu_cache_flush instead of implementing flushing separately. This worked well for Northstar devices but doesn't work for BCM53573 as these devices simply don't start booting with Florian's patch. It's because of the ldmfd ASM instruction in the __armv7_mmu_cache_flush. So this commit switches back to using standalone implementation. This time instead of copying Broadcom's copy of cache-v7.S, we just make a copy of the original file on our own. Unfortunately we can't cross-dir compile cache-v7.S from ../../mm/ as that one also adds __INITDATA with define_cache_functions v7 which would just trigger > Error: unrecognized/unsupported machine ID (r1 = 0x0000007f). The only real change Broadcom did in copied .S file was modifying mcr instruction to use c6 instead of c14. It isn't clear to me if we really need it, but let's use it for now. By the way we also update commit message of the [PATCH] ARM: BCM5301X: Disable MMU and Dcache during decompression This makes kernel booting on BCM53573 successfully. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: package drivers for Northstar USB PHYsRafał Miłecki2016-08-191-0/+37
| | | | | | | We don't use them yet as we still init PHY in controller driver but they will be needed soon. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: generate proper network config for Tenda AC9Rafał Miłecki2016-08-181-0/+10
| | | | | | | It's a more complex device with 2 interfaces on the SoC, one we can use for LAN and another for WAN. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* kernel: bgmac: backport patch adding platform supportRafał Miłecki2016-08-171-0/+2
| | | | | | It also reworks bcma support by moving specific code to separated file. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: fix warning caused by m25p80 patchRafał Miłecki2016-08-161-5/+2
| | | | | | | | | | It was adding unused variable: drivers/mtd/devices/m25p80.c: In function 'm25p80_write': drivers/mtd/devices/m25p80.c:85:6: warning: unused variable 'i' [-Wunused-variable] int i; ^ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add quick fixes for BCM53573Rafał Miłecki2016-08-151-0/+97
| | | | | | | | It adds and uses ILP clock that requires some other work (in progress) for upstreaming it. Other than that it adds a quick fix for bcma to add serial flash before trying to read SPROM. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add temporary BCM53573 ILP clock driverRafał Miłecki2016-08-151-0/+235
| | | | | | | | It wasn't accepted upstream as there was a discusson on Northstar vs. BCM53573. Once we get a new ARM arch Kconfig entry it should be possible to upstream it. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: prepare for building Tenda AC9 TRX imageRafał Miłecki2016-08-151-0/+8
| | | | | | It'll be enabled when we complete basic support. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: drop target's preinit network support scriptRafał Miłecki2016-08-141-7/+0
| | | | | | We don't need it anymore since the rework of generic preinit script. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: support USB 2.0 controller on BCM53573Rafał Miłecki2016-08-143-9/+171
| | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: backport USB 3.0 controller init patchRafał Miłecki2016-08-143-42/+87
| | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: backport USB 3.0 Northstar PHY driverRafał Miłecki2016-08-142-0/+362
| | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: rename PHY patches to use 07* prefixRafał Miłecki2016-08-142-0/+0
| | | | | | | This is not a strict rule but it matches better this one: 7xx - network / phy driver patches Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add profiles for Buffalo devicesRafał Miłecki2016-08-111-2/+24
| | | | | | | This generates proper images when using CONFIG_TARGET_MULTI_PROFILE and CONFIG_TARGET_PER_DEVICE_ROOTFS. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: include USB modules in images for devices with USB portsRafał Miłecki2016-08-111-9/+16
| | | | | | This allows using USB out of the box. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add profiles for all other (SoftMAC) devicesRafał Miłecki2016-08-111-31/+34
| | | | | | | Thanks to this images for SoftMAC devices don't get brcmfmac anymore and b43 is added for devices with (quite poor) support only. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: convert (disabled) Netgear R8500 image to own profileRafał Miłecki2016-08-111-1/+8
| | | | | | It should be the last device with FullMAC chipset to convert. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add profile with brcmfmac for Netgear R7900Rafał Miłecki2016-08-111-1/+8
| | | | | | | It's one more device with FullMAC that got forgotten in the previous commit. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm53xx: add profiles for devices with FullMAC chipsetsRafał Miłecki2016-08-101-1/+12
| | | | | | | | This allows building images for selected devices with brcmfmac only (without b43 which is for SoftMAC devices). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Jo-Philipp Wich <jo@mein.io>
* image: add a helper variable for getting kernel/rootfs from within image ↵Felix Fietkau2016-07-311-3/+3
| | | | | | Build/* templates Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: enable kernel symbols/drivers needed for BCM53573Rafał Miłecki2016-07-281-2/+7
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: backport DTS patches for USB 2.0 and Tenda AC9Rafał Miłecki2016-07-284-2/+321
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: refresh kernel patchesRafał Miłecki2016-07-282-3/+3
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* kernel: update bcma backporting changes up to 4.8Rafał Miłecki2016-07-201-0/+1
| | | | | | This allows building bcm47xxsflash on ARM. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* image.mk: clean up redundant code related to DEVICE_DTSFelix Fietkau2016-07-151-1/+1
| | | | | | | | It is used by a core build template, so the variable should be initialized and added to DEVICE_VARS in the core. Same for DEVICE_DTS_DIR Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: image: don't suppress "mv" command echoingRafał Miłecki2016-07-141-1/+1
| | | | | | | | We call all commands normally, with standard echoing. It's useful for debugging with V=s. Don't make lzma compression an exception, it's a bit confusing this way. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: simplify image building codeFelix Fietkau2016-07-142-40/+15
| | | | | | Use append-ubi template for ubinize, remove mkfs override Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: remove duplicate template data from the image makefileFelix Fietkau2016-07-141-8/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: update kernel 4.4 to version 4.4.15Hauke Mehrtens2016-07-133-25/+2
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* bcm53xx: fix kernel config after USB2 PHY driver backportFelix Fietkau2016-07-081-4/+5
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: use upstream fix simplifying USB power GPIO usageRafał Miłecki2016-07-073-27/+37
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: backport driver for Northstar's USB 2.0 PHYRafał Miłecki2016-07-072-0/+302
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: backport BCM5301x patches from 2016-07-06Rafał Miłecki2016-07-077-46/+287
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: calculate Seama MD5 using content of kernel partitionRafał Miłecki2016-07-041-1/+1
| | | | | | | We don't want checksum to cover any part of UBI as even its part with SquashFS may be changed due to e.g. flash wearing. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* Revert "bcm53xx: use uncompressed zImages"Rafał Miłecki2016-07-041-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b3be33f135f447d56ef9a5461e7e675d5cc35730. CFE is known to fail in some non-standard cases, e.g. when using kernel or format different that what was tested by Broadcom. This kernel change triggered some problem with booting OpenWrt kernel stored in Seama. As long as Seama checksum was covering enough data, it was working fine. We need to change it however, because calculating MD5 over part of UBI containing SquashFS is unsafe. UBI may move PEBs depending on flash wearing level which would break CFE booting the image. For some reason this kernel change was breaking CFE. Calculating MD5 over 0x47ffc0 B data or less (there is 0x40 B long header) was stopping booting process at: Starting program at 0x00008000 As our kernel is usually 0x3fffc0 B it was affected by this problem. Reverting this change fixes sysupgrade (which already uses kernel size for MD5 calculation) and will allow us to adjust "fixseama" command call on the first boot. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* kernel: Move append-dtb to common image-commandsBen Whitten2016-06-221-9/+3
| | | | | | This build step is used by various targets, move it to a common section. Signed-off-by: Ben Whitten <ben.whitten@gmail.com>
* bcm53xx: backport BCM5301X patches for SRABRafał Miłecki2016-06-205-1/+170
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: properly support sysupgrade using Seama on NAND devicesRafał Miłecki2016-06-201-1/+48
| | | | | | It updates kernel and then formats UBI without loosing erase counters. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* kernel: rename B53 symbols to avoid upstream kernel conflictRafał Miłecki2016-06-201-4/+4
| | | | | | | | | In kernel 4.7 there is upstreamed b53 driver using (mostly?) the same symbols as our b53 does. Change our symbols so both drivers can coexist in kernel tree. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Jonas Gorski <jonas.gorski@gmail.com>
* bcm53xx: use uncompressed zImagesFelix Fietkau2016-06-151-0/+2
| | | | | | The boot loader expects LZMA compressed kernel images Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: refresh kernel configFelix Fietkau2016-06-151-5/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bcm53xx: refresh kernel configRafał Miłecki2016-06-141-5/+0
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: sysupgrade: move TRX specific code to separated functionRafał Miłecki2016-06-131-14/+20
| | | | | | | This will allow adding support for other formats (e.g. Seama) in a clean way. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* bcm53xx: pass datasize to mtd in hexadecimal formatRafał Miłecki2016-06-111-2/+1
| | | | | | This avoids extra calculation in bash script. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
span> Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Mul_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Mul_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Mul_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Mul_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Mul_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Mul_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Div_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Div_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Div_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Div_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Div_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Rem_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Rem_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Rem_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Rem_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Rem_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Rem_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Rem_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Mod_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Mod_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Mod_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Mod_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Mod_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Mod_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Mod_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Eq_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Eq_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Eq_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Ne_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Ne_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Ne_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Ne_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Lt_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Lt_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Lt_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Le_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Le_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Le_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Gt_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Gt_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Gt_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Ge_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Ge_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Ge_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Min_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Min_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Min_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Min_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Min_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Min_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Min_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Max_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Max_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Max_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Max_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Max_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Max_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Max_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Eq_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Eq_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Ne_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ne_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Lt_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Lt_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Le_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Le_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Gt_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Gt_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Match_Ge_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Uns, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Uns_Nat, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Nat_Uns, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Sgn, Arg_Vect_Scal => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Sgn_Int, Arg_Scal_Vect => Iir_Predefined_Ieee_Numeric_Std_Match_Ge_Int_Sgn, Arg_Vect_Log => Iir_Predefined_None, Arg_Log_Vect => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Neg_Patterns : constant Unary_Pattern_Type := (Pkg_Std => (Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Neg_Uns, Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Neg_Sgn), Pkg_Bit => (others => Iir_Predefined_None)); Abs_Patterns : constant Unary_Pattern_Type := (Pkg_Std => (Type_Unsigned => Iir_Predefined_None, Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Abs_Sgn), Pkg_Bit => (others => Iir_Predefined_None)); Not_Patterns : constant Unary_Pattern_Type := (Pkg_Std => (Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Not_Uns, Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Not_Sgn), Pkg_Bit => (others => Iir_Predefined_None)); And_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_And_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_And_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Or_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Or_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Or_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Nand_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Nand_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Nand_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Nor_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Nor_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Nor_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Xor_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Xor_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Xor_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Xnor_Patterns : constant Binary_Pattern_Type := (Pkg_Std => (Type_Unsigned => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Xnor_Uns_Uns, others => Iir_Predefined_None), Type_Signed => (Arg_Vect_Vect => Iir_Predefined_Ieee_Numeric_Std_Xnor_Sgn_Sgn, others => Iir_Predefined_None)), Pkg_Bit => (others => (others => Iir_Predefined_None))); Shl_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Shf_Left_Sgn_Nat, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Shf_Left_Uns_Nat); Shr_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Shf_Right_Sgn_Nat, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Shf_Right_Uns_Nat); Rol_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Rot_Left_Sgn_Nat, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Rot_Left_Uns_Nat); Ror_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Rot_Right_Sgn_Nat, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Rot_Right_Uns_Nat); Sll_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Sll_Sgn_Int, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Sll_Uns_Int); Srl_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Srl_Sgn_Int, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Srl_Uns_Int); Sla_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Sla_Sgn_Int, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Sla_Uns_Int); Sra_Patterns : constant Shift_Pattern_Type := (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Sra_Sgn_Int, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Sra_Uns_Int); Error : exception; procedure Extract_Declarations (Pkg_Decl : Iir_Package_Declaration; Pkg : Pkg_Kind; Unsigned_Type : out Iir; Signed_Type : out Iir) is procedure Classify_Arg (Arg : Iir; Sign : out Sign_Kind; Kind : out Arg_Kind) is Arg_Type : constant Iir := Get_Type (Arg); begin if Arg_Type = Signed_Type then Sign := Type_Signed; Kind := Arg_Vect; elsif Arg_Type = Unsigned_Type then Sign := Type_Unsigned; Kind := Arg_Vect; elsif Arg_Type = Vhdl.Std_Package.Integer_Subtype_Definition then Sign := Type_Signed; Kind := Arg_Scal; elsif Arg_Type = Vhdl.Std_Package.Natural_Subtype_Definition then Sign := Type_Unsigned; Kind := Arg_Scal; elsif Arg_Type = Ieee.Std_Logic_1164.Std_Ulogic_Type then Sign := Type_Log; Kind := Arg_Scal; elsif Arg_Type = Ieee.Std_Logic_1164.Std_Ulogic_Vector_Type then Sign := Type_Suv; Kind := Arg_Vect; elsif Arg_Type = Ieee.Std_Logic_1164.Std_Logic_Type then Sign := Type_Log; Kind := Arg_Scal; elsif Arg_Type = Ieee.Std_Logic_1164.Std_Logic_Vector_Type then Sign := Type_Slv; Kind := Arg_Vect; else raise Error; end if; end Classify_Arg; Decl : Iir; Def : Iir; Arg1, Arg2 : Iir; Arg1_Sign, Arg2_Sign : Sign_Kind; Arg1_Kind, Arg2_Kind : Arg_Kind; procedure Handle_Binary (Pats : Binary_Pattern_Type) is Kind : Args_Kind; Sign : Sign_Kind; begin if Arg1_Sign = Arg2_Sign then Sign := Arg1_Sign; case Arg1_Kind is when Arg_Vect => case Arg2_Kind is when Arg_Vect => Kind := Arg_Vect_Vect; when Arg_Scal => Kind := Arg_Vect_Scal; end case; when Arg_Scal => case Arg2_Kind is when Arg_Vect => Kind := Arg_Scal_Vect; when Arg_Scal => raise Error; end case; end case; elsif Arg1_Kind = Arg_Vect and Arg2_Sign = Type_Log then Sign := Arg1_Sign; Kind := Arg_Vect_Log; elsif Arg1_Sign = Type_Log and Arg2_Kind = Arg_Vect then Sign := Arg2_Sign; Kind := Arg_Log_Vect; else raise Error; end if; Set_Implicit_Definition (Decl, Pats (Pkg, Sign, Kind)); end Handle_Binary; procedure Handle_Unary (Pats : Unary_Pattern_Type) is begin Set_Implicit_Definition (Decl, Pats (Pkg, Arg1_Sign)); end Handle_Unary; procedure Handle_To_Unsigned is begin if Arg1_Kind = Arg_Scal and Arg1_Sign = Type_Unsigned then if Arg2_Kind = Arg_Scal and Arg2_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Touns_Nat_Nat_Uns); elsif Arg2_Kind = Arg_Vect and Arg2_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Touns_Nat_Uns_Uns); else raise Error; end if; else raise Error; end if; end Handle_To_Unsigned; procedure Handle_To_Signed is begin if Arg1_Kind = Arg_Scal and Arg1_Sign = Type_Signed then if Arg2_Kind = Arg_Scal and Arg2_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Tosgn_Int_Nat_Sgn); elsif Arg2_Kind = Arg_Vect and Arg2_Sign = Type_Signed then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Tosgn_Int_Sgn_Sgn); else raise Error; end if; else raise Error; end if; end Handle_To_Signed; procedure Handle_To_Integer is begin if Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Toint_Uns_Nat); elsif Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Signed then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Toint_Sgn_Int); else raise Error; end if; end Handle_To_Integer; procedure Handle_Resize is begin if Arg2_Kind = Arg_Scal and Arg2_Sign = Type_Unsigned then if Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Uns_Nat); elsif Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Signed then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Sgn_Nat); else raise Error; end if; elsif Arg2_Kind = Arg_Vect then if Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Unsigned and Arg2_Sign = Type_Unsigned then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Uns_Uns); elsif Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Signed and Arg2_Sign = Type_Signed then Set_Implicit_Definition (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Sgn_Sgn); else raise Error; end if; else raise Error; end if; end Handle_Resize; procedure Handle_Std_Match is Predefined : Iir_Predefined_Functions; begin if Arg1_Kind /= Arg2_Kind or else Arg1_Sign /= Arg2_Sign then raise Error; end if; if Arg1_Kind = Arg_Scal and Arg1_Sign = Type_Log then Predefined := Iir_Predefined_Ieee_Numeric_Std_Match_Log; elsif Arg1_Kind = Arg_Vect then case Arg1_Sign is when Type_Unsigned => Predefined := Iir_Predefined_Ieee_Numeric_Std_Match_Uns; when Type_Signed => Predefined := Iir_Predefined_Ieee_Numeric_Std_Match_Sgn; when Type_Suv => Predefined := Iir_Predefined_Ieee_Numeric_Std_Match_Suv; when Type_Slv => Predefined := Iir_Predefined_Ieee_Numeric_Std_Match_Slv; when Type_Log => raise Error; end case; else raise Error; end if; Set_Implicit_Definition (Decl, Predefined); end Handle_Std_Match; procedure Handle_To_01 is Predefined : Iir_Predefined_Functions; begin if Arg1_Kind /= Arg_Vect or else Arg2_Kind /= Arg_Scal or else Arg2_Sign /= Type_Log then raise Error; end if; case Arg1_Sign is when Type_Unsigned => Predefined := Iir_Predefined_Ieee_Numeric_Std_To_01_Uns; when Type_Signed => Predefined := Iir_Predefined_Ieee_Numeric_Std_To_01_Sgn; when others => raise Error; end case; Set_Implicit_Definition (Decl, Predefined); end Handle_To_01; procedure Handle_Shift (Pats : Shift_Pattern_Type; Sh_Sign : Sign_Kind) is Res : Iir_Predefined_Functions; begin if Arg1_Kind = Arg_Vect and then Arg2_Kind = Arg_Scal and then Arg2_Sign = Sh_Sign then case Arg1_Sign is when Type_Signed | Type_Unsigned => Res := Pats (Arg1_Sign); when others => Res := Iir_Predefined_None; end case; Set_Implicit_Definition (Decl, Res); end if; end Handle_Shift; begin Decl := Get_Declaration_Chain (Pkg_Decl); -- Skip a potential copyright constant. if Decl /= Null_Iir and then Get_Kind (Decl) = Iir_Kind_Constant_Declaration and then (Get_Base_Type (Get_Type (Decl)) = Vhdl.Std_Package.String_Type_Definition) then Decl := Get_Chain (Decl); end if; -- The first declaration should be type Unsigned or Unresolved_Unsigned if not (Decl /= Null_Iir and then Get_Kind (Decl) = Iir_Kind_Type_Declaration and then (Get_Identifier (Decl) = Name_Unsigned or else Get_Identifier (Decl) = Name_Unresolved_Unsigned)) then raise Error; end if; Def := Get_Type_Definition (Decl); if Get_Kind (Def) /= Iir_Kind_Array_Type_Definition then raise Error; end if; Unsigned_Type := Def; -- The second declaration should be type Signed. Decl := Get_Chain (Decl); Decl := Skip_Implicit (Decl); if not (Decl /= Null_Iir and then Get_Kind (Decl) = Iir_Kind_Type_Declaration and then (Get_Identifier (Decl) = Name_Signed or else Get_Identifier (Decl) = Name_Unresolved_Signed)) then raise Error; end if; Def := Get_Type_Definition (Decl); if Get_Kind (Def) /= Iir_Kind_Array_Type_Definition then raise Error; end if; Signed_Type := Def; -- For vhdl 2008, skip subtypes Decl := Get_Chain (Decl); Decl := Skip_Implicit (Decl); while Is_Valid (Decl) loop exit when Get_Kind (Decl) /= Iir_Kind_Subtype_Declaration; Decl := Get_Chain (Decl); end loop; -- Handle functions. while Is_Valid (Decl) loop case Get_Kind (Decl) is when Iir_Kind_Function_Declaration => Arg1 := Get_Interface_Declaration_Chain (Decl); if Is_Null (Arg1) then raise Error; end if; Classify_Arg (Arg1, Arg1_Sign, Arg1_Kind); Arg2 := Get_Chain (Arg1); if Is_Valid (Arg2) then -- Dyadic function. Classify_Arg (Arg2, Arg2_Sign, Arg2_Kind); case Get_Identifier (Decl) is when Name_Op_Plus => Handle_Binary (Add_Patterns); when Name_Op_Minus => Handle_Binary (Sub_Patterns); when Name_Op_Mul => Handle_Binary (Mul_Patterns); when Name_Op_Div => Handle_Binary (Div_Patterns); when Name_Mod => Handle_Binary (Mod_Patterns); when Name_Rem => Handle_Binary (Rem_Patterns); when Name_Op_Equality => Handle_Binary (Eq_Patterns); when Name_Op_Inequality => Handle_Binary (Ne_Patterns); when Name_Op_Less => Handle_Binary (Lt_Patterns); when Name_Op_Less_Equal => Handle_Binary (Le_Patterns); when Name_Op_Greater => Handle_Binary (Gt_Patterns); when Name_Op_Greater_Equal => Handle_Binary (Ge_Patterns); when Name_Minimum => Handle_Binary (Min_Patterns); when Name_Maximum => Handle_Binary (Max_Patterns); when Name_Op_Match_Equality => Handle_Binary (Match_Eq_Patterns); when Name_Op_Match_Inequality => Handle_Binary (Match_Ne_Patterns); when Name_Op_Match_Less => Handle_Binary (Match_Lt_Patterns); when Name_Op_Match_Less_Equal => Handle_Binary (Match_Le_Patterns); when Name_Op_Match_Greater => Handle_Binary (Match_Gt_Patterns); when Name_Op_Match_Greater_Equal => Handle_Binary (Match_Ge_Patterns); when Name_And => Handle_Binary (And_Patterns); when Name_Or => Handle_Binary (Or_Patterns); when Name_Nand => Handle_Binary (Nand_Patterns); when Name_Nor => Handle_Binary (Nor_Patterns); when Name_Xor => Handle_Binary (Xor_Patterns); when Name_Xnor => Handle_Binary (Xnor_Patterns); when Name_To_Bstring | Name_To_Ostring | Name_To_Hstring => null; when Name_To_Unsigned => Handle_To_Unsigned; when Name_To_Signed => Handle_To_Signed; when Name_Resize => Handle_Resize; when Name_Std_Match => Handle_Std_Match; when Name_Shift_Left => Handle_Shift (Shl_Patterns, Type_Unsigned); when Name_Shift_Right => Handle_Shift (Shr_Patterns, Type_Unsigned); when Name_Sll => Handle_Shift (Sll_Patterns, Type_Signed); when Name_Srl => Handle_Shift (Srl_Patterns, Type_Signed); when Name_Sla => Handle_Shift (Sla_Patterns, Type_Signed); when Name_Sra => Handle_Shift (Sra_Patterns, Type_Signed); when Name_Rotate_Left => Handle_Shift (Rol_Patterns, Type_Unsigned); when Name_Rotate_Right => Handle_Shift (Ror_Patterns, Type_Unsigned); when Name_To_01 => Handle_To_01; when others => null; end case; else -- Monadic function. case Get_Identifier (Decl) is when Name_Op_Minus => Handle_Unary (Neg_Patterns); when Name_Not => Handle_Unary (Not_Patterns); when Name_Abs => Handle_Unary (Abs_Patterns); when Name_To_Integer => Handle_To_Integer; when others => null; end case; end if; when Iir_Kind_Non_Object_Alias_Declaration | Iir_Kind_Procedure_Declaration => null; when others => raise Error; end case; Decl := Get_Chain (Decl); end loop; end Extract_Declarations; procedure Extract_Std_Declarations (Pkg : Iir_Package_Declaration) is begin Numeric_Std_Pkg := Pkg; Extract_Declarations (Pkg, Pkg_Std, Numeric_Std_Unsigned_Type, Numeric_Std_Signed_Type); exception when Error => Error_Msg_Sem (+Pkg, "package ieee.numeric_std is ill-formed"); Numeric_Std_Pkg := Null_Iir; Numeric_Std_Unsigned_Type := Null_Iir; Numeric_Std_Signed_Type := Null_Iir; end Extract_Std_Declarations; end Vhdl.Ieee.Numeric;