Inheritance: IXmlSerializable
 public static DevicePartSpeed FindDeviceByName(string query)
 {
     // Load Device Manager
     DeviceManager manager = new DeviceManager();
     manager.Load();
     return FindDeviceByName(manager, query);
 }
        public override void Execute()
        {
            base.Execute();

            if (!string.IsNullOrEmpty(OutputPath))
            {
                XilinxProjectFile prj = new XilinxProjectFile(Program.Repository);
                if (XilinxHelper.GetCurrentXilinxToolchain() != null)
                {
                    prj.Version = XilinxHelper.GetCurrentXilinxToolchain().Version as XilinxVersion;
                }

                if (!string.IsNullOrEmpty(DeviceQueryString))
                {
                    DeviceManager manager = new DeviceManager();
                    manager.Load();

                    prj.Device = GetPart(manager, DeviceQueryString);
                    if (prj.Device == null)
                    {
                        Logger.Instance.WriteError("Could not found a device to match the string '{0}'", DeviceQueryString);
                        return;
                    }
                    else
                    {
                        Logger.Instance.WriteVerbose("Selected device '{0}'", prj.Device.Name);
                    }
                }

                if (!string.IsNullOrEmpty(UserConstraintsFile))
                {
                    prj.UserConstraintsFile = Path.GetFullPath(UserConstraintsFile);
                    Logger.Instance.WriteVerbose("Including the user constaints located at '{0}'", prj.UserConstraintsFile);
                }

                foreach (string core in Cores)
                {
                    Logger.Instance.WriteVerbose("Selecting Core: {0}", core);
                    prj.AddAllInLibrary(prj.Environment.GetLibrary(core));
                }

                Logger.Instance.WriteVerbose("Generating...");
                File.WriteAllText(OutputPath, prj.ToString());
                Logger.Instance.WriteVerbose("Generated!");
            }
            else
            {
                Logger.Instance.WriteError("Output Path not specified, terminating...");
                return;
            }
        }
        public static DevicePartSpeed FindDeviceByName(DeviceManager manager, string query)
        {
            DevicePartSpeed device = null;
            IEnumerable<object> parts = manager.FindPart(query);
            object firstPart = parts.FirstOrDefault();
            Logger.Instance.WriteVerbose("Found {0} matching device(s)", parts.Count());

            if (firstPart == null || !(firstPart is DevicePartSpeed))
            {
                return null;
            }
            device = firstPart as DevicePartSpeed;

            return device;
        }
Exemple #4
0
        public static object FindDevice(DeviceManager manager, string query)
        {
            IEnumerable<object> parts = manager.FindPart(query);
            Logger.Instance.WriteDebug("Found {0} matching parts", parts.Count());

            Device topDevice = null;
            DevicePart topDevicePart = null;
            DevicePartSpeed topDevicePartSpeed = null;
            foreach (object o in parts)
            {
                if (o is Device)
                {
                    topDevice = o as Device;
                }
                else if (o is DevicePart)
                {
                    topDevicePart = o as DevicePart;
                }
                else if (o is DevicePartSpeed)
                {
                    topDevicePartSpeed = o as DevicePartSpeed;
                    // pick the first one of these
                    break;
                }
            }

            if (topDevicePartSpeed != null)
            {
                return topDevicePartSpeed;
            }
            if (topDevicePart != null)
            {
                return topDevicePart;
            }
            if (topDevice != null)
            {
                return topDevice;
            }
            return null;
        }
 internal DeviceManufacture(DeviceManager manager)
     : this(manager, null)
 {
 }
 public DeviceManufacture(DeviceManager manager, string name)
 {
     Manager = manager;
     Families = new List<DeviceFamily>();
     Name = name;
 }
 public ToolchainManager()
 {
     Toolchains = new HashSet<IToolchain>();
     Devices = new DeviceManager();
 }
        public void LoadDevices(DeviceManager manager)
        {
            foreach (ToolchainReference reference in manager.CachedToolchains)
            {
                if (reference.Match(this))
                {
                    // Already Loaded
                    Logger.Instance.WriteDebug("DeviceManager has already cached device information for toolchain ('{0}')", this.Version);
                    return;
                }
            }

            manager.CachedToolchains.Add(new ToolchainReference(this));
            // Toolchain has not been loaded
            Logger.Instance.WriteDebug("Loading device information for toolchain ('{0}')", Version);
            DeviceManufacture xilinx = manager.CreateManufacture("Xilinx");
            Logger.Instance.WriteVerbose("Loading Xilinx {0} Part Library (this may take several minutes)", Version);
            foreach (string family in XilinxPartGen.LoadFamilyList())
            {
                Logger.Instance.WriteDebug("Loading Xilinx Part for the '{0}' family", family);
                xilinx.Families.Add(XilinxPartGen.LoadFamily(this, xilinx, family));
            }

            manager.Save();
        }
        private static DevicePartSpeed GetPart(DeviceManager manager, string query)
        {
            object o = DeviceHelper.FindDevice(manager, query);

            Device device = o as Device;
            if (device != null)
            {
                if (device.Parts.Count != 0)
                {
                    Logger.Instance.WriteWarning("Found device, unable to match with package specifier, selecting default package '{0}'", device.Parts[0].Package.Name);
                    o = device.Parts[0];
                }
            }

            DevicePart part = o as DevicePart;
            if (part != null)
            {
                if (part.Speeds.Count != 0)
                {
                    Logger.Instance.WriteWarning("Found device, unable to match with speed specifier, selecting default speed '{0}'", part.Speeds[0].Speed.Name);
                    o = part.Speeds[0];
                }
            }

            return (o as DevicePartSpeed);
        }
        public override void Execute()
        {
            base.Execute();

            DeviceManager manager = new DeviceManager();
            manager.Load();
            XilinxHelper.GetCurrentXilinxToolchain().LoadDevices(manager);

            // Search the entire tree to get information on the device/part/package/family/etc.
            // currently supporting search by device name, and full device name
            // e.g. xc3s100e
            // e.g. xc3s100evq100
            // e.g. xc3s100evq100-5 or xc3s100e-5vq100

            IEnumerable<object> parts = manager.FindPart(Query);
            Logger.Instance.WriteVerbose("Found {0} matching object(s)", parts.Count());

            foreach (object o in parts)
            {
                if (o is Device)
                {
                    DisplayDevice(o as Device, true, true);
                }
                else if (o is DevicePart)
                {
                    DisplayDevicePart(o as DevicePart, true, true);
                }
                else if (o is DevicePartSpeed)
                {
                    DisplayDevicePartSpeed(o as DevicePartSpeed, true, true);
                }
            }

            //DisplayManufacture(manager.Manufacturers.FirstOrDefault(), true, true);
        }