public DefaultSynthesisContext(DesignContext simCtx, IProject project, ICodeGenerator codeGen) { ModelContext = simCtx; Project = project; CodeGen = codeGen; _componentSet = ModelContext.Components.Select(cd => cd.Descriptor); }
/// <summary> /// Is called to create the item used by the CreateComponentTool. /// </summary> protected virtual DesignItem CreateItemWithPosition(DesignContext context, Point position) { var item = CreateItem(context); item.Position = position; return(item); }
public void Refine(DesignContext context, IProject targetProject) { ComponentDescriptor cd = (ComponentDescriptor)_pd.Owner; Component rtl = cd.Instance; // Remove synthesizing process cd.RemoveChild(_pd); if (_planProp != null) { var owner = (ComponentDescriptor)_pd.Owner; _plan = _planProp.GetValue(owner.Instance, new object[0]) as HLSPlan; if (_plan == null) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("HLS error: declaring type {0} with property {1} does not return an appropriate HLS plan", _pd.Method.DeclaringType.Name, _planProp); throw new InvalidOperationException(sb.ToString()); } } else { _plan = HLSPlan.CopyPlan(_pd.GetDesign().GetHLSPlan()); } _plan.Execute(context, rtl, _pd, targetProject); }
public static void RunTest() { DesignContext.Reset(); FixedPointSettings.GlobalDefaultRadix = 10; var tb = new Test_SinCosLUT_Testbench(7, 8, 9, 0); DesignContext.Instance.Elaborate(); DesignContext.Instance.Simulate(new Time(1.0, ETimeUnit.us)); DesignContext.Stop(); //XilinxIntegration.RegisterIPCores(DesignContext.Instance.Descriptor); DesignContext.Instance.CompleteAnalysis(); // Now convert the design to VHDL and embed it into a Xilinx ISE project XilinxProject project = new XilinxProject(@".\hdl_out_Test_SinCosLUT_Testbench", "Test_SinCosLUT_Testbench"); project.PutProperty(EXilinxProjectProperties.DeviceFamily, EDeviceFamily.Virtex6); project.PutProperty(EXilinxProjectProperties.Device, EDevice.xc6vlx240t); project.PutProperty(EXilinxProjectProperties.Package, EPackage.ff1156); project.PutProperty(EXilinxProjectProperties.SpeedGrade, ESpeedGrade._2); project.PutProperty(EXilinxProjectProperties.PreferredLanguage, EHDL.VHDL); project.SetVHDLProfile(); project.TwinProject = new ModelsimProject(@".\hdl_out_Test_SinCosLUT_Testbench", "Test_SinCosLUT_Testbench"); VHDLGenerator codeGen = new VHDLGenerator(); SynthesisEngine.Create(DesignContext.Instance, project).Synthesize(tb, codeGen); project.Save(); }
public static void GenerateFloatingPointCores() { var ise = ISEDetector.DetectMostRecentISEInstallation(); DesignContext.Reset(); var fpu = new FPUWrapper(ise.VersionTag); DesignContext.Instance.Elaborate(); var fpga = new XC6VLX240T_FF1156(); fpga.SpeedGrade = ESpeedGrade._2; fpga.TopLevelComponent = fpu; var proj = fpga.Synthesize("c:\\temp\\fputest", "fpu", null, EFlowStep.HDLGen | EFlowStep.IPCores); var flow = proj.ConfigureFlow(fpu); flow.TRCE.ReportUnconstrainedPaths = true; flow.Start( EFlowStep.XST | EFlowStep.NGDBuild | EFlowStep.Map | EFlowStep.PAR | EFlowStep.TRCE); proj.AwaitRunningToolsToFinish(); PerformanceRecord designRec; ResourceRecord deviceRec; flow.ParseResourceRecords(out designRec, out deviceRec); }
/// <summary> /// Initializes a new instance of the ViewModelLocator class. /// </summary> public ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); if (ViewModelBase.IsInDesignModeStatic) { _designContext = new DesignContext(); } else { _context = new UnitOfWork(new InventoryManagerEntities()); SimpleIoc.Default.Register <IUnitOfWork>(() => _context); SimpleIoc.Default.Register <ViewModelLocator>(() => this); SimpleIoc.Default.Register <MainViewModel>(); SimpleIoc.Default.Register <StoresListViewModel>(); SimpleIoc.Default.Register <ProductListViewModel>(); SimpleIoc.Default.Register <EditStoreViewModel>(); SimpleIoc.Default.Register <EditProductViewModel>(); SimpleIoc.Default.Register <NewPurchaseViewModel>(); SimpleIoc.Default.Register <NewSaleViewModel>(); SimpleIoc.Default.Register <SalesHistoryViewModel>(() => new SalesHistoryViewModel(new UnitOfWork(new InventoryManagerEntities()))); SimpleIoc.Default.Register <PurchaseHistoryViewModel>(() => new PurchaseHistoryViewModel(new UnitOfWork(new InventoryManagerEntities()))); } SimpleIoc.Default.Register <SettingsViewModel>(); SimpleIoc.Default.Register <AboutViewModel>(); SimpleIoc.Default.Register <StoreDetailViewModel>(); SimpleIoc.Default.Register <ProductDetailViewModel>(); }
internal void InitializeExtensionServer(DesignContext context) { Debug.Assert(this._context == null); Debug.Assert(context != null); this._context = context; OnInitialized(); }
public static void RunTest() { DesignContext.Reset(); TestHLS_CordicSqrt_Testbench tb = new TestHLS_CordicSqrt_Testbench(); DesignContext.Instance.Elaborate(); DesignContext.Instance.Simulate(new Time(100.0, ETimeUnit.us)); DesignContext.Stop(); XilinxIntegration.RegisterIPCores(DesignContext.Instance.Descriptor); DesignContext.Instance.CompleteAnalysis(); // Now convert the design to VHDL and embed it into a Xilinx ISE project var docproj = new DocumentationProject(@".\hdl_out_TestHLSSqrt_Cordic\doc"); var project = new XilinxProject(@".\hdl_out_TestHLSSqrt_Cordic", "TestHLSSqrt_Cordic"); project.ISEVersion = EISEVersion._13_2; project.PutProperty(EXilinxProjectProperties.DeviceFamily, EDeviceFamily.Virtex6); project.PutProperty(EXilinxProjectProperties.Device, EDevice.xc6vlx240t); project.PutProperty(EXilinxProjectProperties.Package, EPackage.ff1156); project.PutProperty(EXilinxProjectProperties.SpeedGrade, ESpeedGrade._2); project.PutProperty(EXilinxProjectProperties.PreferredLanguage, EHDL.VHDL); project.SetVHDLProfile(); //project.SkipIPCoreSynthesis = true; VHDLGenerator codeGen = new VHDLGenerator(); SynthesisEngine.Create(DesignContext.Instance, project).Synthesize(tb, codeGen); SynthesisEngine.Create(DesignContext.Instance, docproj).Synthesize(new DocumentationGenerator()); project.Save(); docproj.Save(); }
public virtual bool Validate(Mobile from) { #region SA if (from.Race == Race.Gargoyle) { from.SendLocalizedMessage(1112281); // gargs can't mount return(false); } #endregion if (Parent == null) { from.SayTo(from, 1010095); // This must be on your person to use. return(false); } if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null)) { // CheckIsUsableBy sends the message return(false); } if (!BaseMount.CheckMountAllowed(from, true)) { // CheckMountAllowed sends the message return(false); } if (from.Mounted) { from.SendLocalizedMessage(1005583); // Please dismount first. return(false); } if (from.IsBodyMod && !from.Body.IsHuman) { from.SendLocalizedMessage(1061628); // You can't do that while polymorphed. return(false); } if (from.HasTrade) { from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time return(false); } if ((from.Followers + FollowerSlots) > from.FollowersMax) { from.SendLocalizedMessage(1049679); // You have too many followers to summon your mount. return(false); } if (!DesignContext.Check(from)) { // Check sends the message return(false); } return(true); }
public static void RunTest() { DesignContext.Reset(); TestHLS_PortAccess_Testbench tb = new TestHLS_PortAccess_Testbench(); DesignContext.Instance.Elaborate(); DesignContext.Instance.Simulate(new Time(1.0, ETimeUnit.us)); DesignContext.Stop(); DesignContext.Instance.CompleteAnalysis(); // Now convert the design to VHDL and embed it into a Xilinx ISE project XilinxProject project = new XilinxProject(@".\hdl_out_TestHLS_PortAccess", "TestHLS_PortAccess"); project.PutProperty(EXilinxProjectProperties.DeviceFamily, EDeviceFamily.Virtex6); project.PutProperty(EXilinxProjectProperties.Device, EDevice.xc6vlx240t); project.PutProperty(EXilinxProjectProperties.Package, EPackage.ff1156); project.PutProperty(EXilinxProjectProperties.SpeedGrade, ESpeedGrade._2); project.PutProperty(EXilinxProjectProperties.PreferredLanguage, EHDL.VHDL); project.SetVHDLProfile(); project.SkipIPCoreSynthesis = true; VHDLGenerator codeGen = new VHDLGenerator(); SynthesisEngine.Create(DesignContext.Instance, project).Synthesize(tb, codeGen); project.Save(); }
protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context, params String[] additionalXmlns) { string canvasStartTag = "<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " + "xmlns:t=\"" + DesignerTestsNamespace + "\""; foreach(string ns in additionalXmlns) { canvasStartTag += " " + ns; } expectedXaml = canvasStartTag + ">\n" + expectedXaml.Trim(); expectedXaml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" + expectedXaml.Replace("\r", "").Replace("\n", "\n ") + "\n</Canvas>"; StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; context.Save(xmlWriter); string actualXaml = stringWriter.ToString().Replace("\r", "");; if (expectedXaml != actualXaml) { Debug.WriteLine("expected xaml:"); Debug.WriteLine(expectedXaml); Debug.WriteLine("actual xaml:"); Debug.WriteLine(actualXaml); } Assert.AreEqual(expectedXaml, actualXaml); }
public static void Cast_OnCommand(CommandEventArgs e) { if (e.Length == 1) { if (!DesignContext.Check(e.Mobile)) { return; // They are customizing } Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null); if (spell != null) { spell.Cast(); } else { e.Mobile.SendMessage("That spell was not found."); } } else { e.Mobile.SendMessage("Format: Cast <name>"); } }
/// <summary> /// Is called to create the item used by the CreateComponentTool. /// </summary> protected virtual DesignItem CreateItem(DesignContext context) { ChangeGroup = context.RootItem.OpenGroup("Add Control"); var item = CreateItem(context, componentType); return(item); }
public virtual void Delete(DesignContext designContext) { if (designContext != null) { ModelTools.DeleteComponents(designContext.Services.Selection.SelectedItems); } }
public static void RunTest() { DesignContext.Reset(); TestHLS_CFlow2_Testbench tb = new TestHLS_CFlow2_Testbench(); DesignContext.Instance.Elaborate(); DesignContext.Instance.Simulate(new Time(100.0, ETimeUnit.us)); DesignContext.Stop(); XilinxIntegration.RegisterIPCores(DesignContext.Instance.Descriptor); DesignContext.Instance.CompleteAnalysis(); XC6VLX75T_FF484 fpga = new XC6VLX75T_FF484() { SpeedGrade = ESpeedGrade._2, TopLevelComponent = tb.DUT }; fpga.Testbenches.Add(tb); fpga.Synthesize(@".\hdl_out_TestHLS_CFlow2", "TestHLS_CFlow2"); var eng = SynthesisEngine.Create( DesignContext.Instance, new DocumentationProject(@".\hdl_out_TestHLS_CFlow2\doc")); eng.Synthesize(new DocumentationGenerator()); }
protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context) { expectedXaml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" + ("<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " + "xmlns:t=\"" + DesignerTestsNamespace + "\">\n" + expectedXaml.Trim()) .Replace("\r", "").Replace("\n", "\n ") + "\n</Canvas>"; StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; context.Save(xmlWriter); string actualXaml = stringWriter.ToString().Replace("\r", "");; if (expectedXaml != actualXaml) { Debug.WriteLine("expected xaml:"); Debug.WriteLine(expectedXaml); Debug.WriteLine("actual xaml:"); Debug.WriteLine(actualXaml); } Assert.AreEqual(expectedXaml, actualXaml); }
public static void RunTest() { DesignContext.Reset(); TestDesign1 td1 = new TestDesign1(3, 4); FixedPointSettings.GlobalOverflowMode = EOverflowMode.Wrap; DesignContext.Instance.Elaborate(); DesignContext.Instance.Simulate(20 * TestDesign1.ClockPeriod); // Now convert the design to VHDL and embed it into a Xilinx ISE project XilinxProject project = new XilinxProject(@".\hdl_TestDesign1", "TestDesign1"); project.PutProperty(EXilinxProjectProperties.DeviceFamily, EDeviceFamily.Spartan3); project.PutProperty(EXilinxProjectProperties.Device, EDevice.xc3s1500l); project.PutProperty(EXilinxProjectProperties.Package, EPackage.fg676); project.PutProperty(EXilinxProjectProperties.SpeedGrade, ESpeedGrade._4); project.PutProperty(EXilinxProjectProperties.PreferredLanguage, EHDL.VHDL); VHDLGenerator codeGen = new VHDLGenerator(); SynthesisEngine.Create(DesignContext.Instance, project).Synthesize(codeGen);; project.Save(); DesignContext.Reset(); }
void InitializeDesigner(DesignContext context) { _designContext = context; _designPanel.Context = context; _designPanel.ClearContextMenu(); if (context.RootItem != null) { _sceneContainer.Child = context.RootItem.View; } context.Services.RunWhenAvailable <UndoService>( undoService => undoService.UndoStackChanged += delegate { CommandManager.InvalidateRequerySuggested(); } ); context.Services.Selection.SelectionChanged += delegate { CommandManager.InvalidateRequerySuggested(); }; context.Services.AddService(typeof(IKeyBindingService), new DesignerKeyBindings(this)); _focusNav = new FocusNavigator(this); _focusNav.Start(); OnPropertyChanged("DesignContext"); }
public override bool CheckVendorAccess(Mobile m) { if (m == null || m.Deleted) { return(false); } if (m.AccessLevel >= AccessLevel.GameMaster) { return(true); } if (!Trading || !DesignContext.Check(m)) { return(false); } var races = RequiredRaces; if (races != null && races.Length > 0 && (m.Race == null || !races.Contains(m.Race))) { return(false); } return(base.CheckVendorAccess(m)); }
private static void EventSink_OpenSpellbookRequest(OpenSpellbookRequestEventArgs e) { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } SpellbookType type; switch (e.Type) { default: case 1: type = SpellbookType.Regular; break; case 2: type = SpellbookType.Necromancer; break; case 3: type = SpellbookType.Paladin; break; case 4: type = SpellbookType.Ninja; break; case 5: type = SpellbookType.Samurai; break; case 6: type = SpellbookType.Arcanist; break; case 7: type = SpellbookType.Mystic; break; } Spellbook book = Spellbook.Find(from, -1, type); if (book != null) { book.DisplayTo(from); } }
private async void BusMasterProcess() { Request.Next = '0'; await Tick; do { DesignContext.WriteLine(DesignContext.Instance.CurTime + ": " + _deviceNum + " request"); Request.Next = '1'; do { await Tick; } while (Grant.Cur != '1'); DesignContext.WriteLine(DesignContext.Instance.CurTime + ": " + _deviceNum + " grant"); for (int i = 0; i < _busyTime; i++) { await Tick; } DesignContext.WriteLine(DesignContext.Instance.CurTime + ": " + _deviceNum + " release"); Request.Next = '0'; for (int i = 0; i < _idleTime; i++) { await Tick; } } while (true); }
private static void Targeted_Spell(TargetedSpellEventArgs e) { try { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } Spellbook book = null; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Mobile to = World.FindMobile(e.Target.Serial); Item toI = World.FindItem(e.Target.Serial); Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (to != null) { spell.InstantTarget = to; } else if (toI != null) { spell.InstantTarget = toI as IDamageableItem; } if (spell != null) { spell.Cast(); } else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID)) { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } } catch { } }
public virtual bool CanDelete(DesignContext designContext) { if (designContext != null) { return(ModelTools.CanDeleteComponents(designContext.Services.Selection.SelectedItems)); } return(false); }
public FSMTransformer(DesignContext ctx, CodeDescriptor code, object instance, object[] arguments) { System.Diagnostics.Debug.Assert(arguments.Length == 1); _context = ctx; _code = code; _instance = instance; _arguments = arguments; }
public FSMTransformerTemplate(DesignContext ctx, CodeDescriptor code, object instance, object[] arguments) { _context = ctx; _code = code; _instance = instance; _arguments = arguments; _methodCode = MethodCode.Create(_code.Method); }
public DefaultSynthesisContext(DesignContext simCtx, IProject project, IComponentDescriptor top, ICodeGenerator codeGen) { ModelContext = simCtx; Project = project; CodeGen = codeGen; _componentSet = top.GetAllAncestors(); }
public DefaultSynthesisContext(DesignContext simCtx, IProject project, IEnumerable <IComponentDescriptor> componentSet, ICodeGenerator codeGen) { ModelContext = simCtx; Project = project; CodeGen = codeGen; _componentSet = componentSet; }
public HLSState(HLSPlan plan, DesignContext design, Component host, ProcessDescriptor proc, IProject proj) { _plan = plan; _design = design; _host = host; _proc = proc; _proj = proj; }
private DesignItem[] CreateItems(DesignContext context, DragEventArgs e) { var item = context.Services.Component.RegisterComponentForDesigner(new Image()); item.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(100.0); item.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(100.0); return(new[] { item }); }
public void AddToSite(DesignContext site) { this.site = site; foreach (Grammar g in grammars) { g.site = site; } }
DesignItem CreateItem(DesignContext context, Type componentType) { object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null); DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance); changeGroup = item.OpenGroup("Draw Polyline"); context.Services.ExtensionManager.ApplyDefaultInitializers(item); return item; }
DesignItem CreateItem(DesignContext context, Type componentType) { object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null); DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance); changeGroup = item.OpenGroup("Draw Polyline"); context.Services.ExtensionManager.ApplyDefaultInitializers(item); return(item); }
public DefaultToolService(DesignContext context) { _currentTool = this.PointerTool; context.Services.RunWhenAvailable<IDesignPanel>( delegate(IDesignPanel designPanel) { _designPanel = designPanel; _currentTool.Activate(designPanel); }); }
internal ExtensionManager(DesignContext context) { Debug.Assert(context != null); this._context = context; context.Services.RunWhenAvailable<IComponentService>( delegate(IComponentService componentService) { componentService.ComponentRegistered += OnComponentRegistered; }); }
protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context, params String[] additionalXmlns) { string canvasStartTag = "<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" " + "xmlns:t=\"" + DesignerTestsNamespace + "\""; foreach(string ns in additionalXmlns) { canvasStartTag += " " + ns; } expectedXaml = canvasStartTag + ">\n" + expectedXaml.Trim(); expectedXaml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" + expectedXaml.Replace("\r", "").Replace("\n", "\n ") + "\n</Canvas>"; AssertDesignerOutput(expectedXaml, context); }
protected void AssertCanvasDesignerOutput(string expectedXaml, DesignContext context) { expectedXaml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" + ("<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">\n" + expectedXaml.Trim()) .Replace("\r", "").Replace("\n", "\n ") + "\n</Canvas>"; StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; context.Save(xmlWriter); string actualXaml = stringWriter.ToString().Replace("\r", "");; if (expectedXaml != actualXaml) { Debug.WriteLine("expected xaml:"); Debug.WriteLine(expectedXaml); Debug.WriteLine("actual xaml:"); Debug.WriteLine(actualXaml); } Assert.AreEqual(expectedXaml, actualXaml); }
public DefaultViewService(DesignContext context) { this.context = context; }
public DefaultErrorService(DesignContext context) { this.services = context.Services; }
public override void ApplyTo(DesignContext design) { foreach (ComponentDescriptor cd in design.Components.Select(c => c.Descriptor)) { Dictionary<object, IEnumerable<SignalArgumentDescriptor>> map = new Dictionary<object, IEnumerable<SignalArgumentDescriptor>>(); foreach (MethodDescriptor md in cd.GetMethods()) { IEnumerable<SignalArgumentDescriptor> addArgs = InspectMethod(md); //map[md.Implementation] = addArgs; map[md.Method] = addArgs; } foreach (MethodDescriptor md in cd.GetMethods()) { AdaptCalls(md, map); } foreach (ProcessDescriptor pd in cd.GetProcesses()) { AdaptCalls(pd, map); } } }
public void Initialize(IProject project, DesignContext context) { SubprogramsDontDriveSignals sdds = new SubprogramsDontDriveSignals(); sdds.ApplyTo(context); foreach (VHDLib lib in _stdLibraries) { foreach (VHDPkg pkg in lib.Packages) { if (pkg.FileContent == null) continue; string fname = MakeVHDSourceFileName(pkg.Name); string path = project.AddFile(fname); FileStream fs = new FileStream(path, FileMode.Create); fs.Write(pkg.FileContent, 0, pkg.FileContent.Length); fs.Close(); } } }
internal MockFocusNavigator(DesignContext context) { _context = context; }
public void Intialize(DesignContext context) { Debug.Assert(context.RootItem!=null); this._rootItem=context.RootItem; _rootItem.AddBehavior(typeof(IRootPlacementBehavior),this); }
private SynthesisEngine(DesignContext ctx, IProject project) { _ctx = ctx; _project = project; _ctx.RunRefinements(_project); }
public override bool IsWrittenInCurrentContext(DesignContext context) { return IsWrittenFunc(context); }
public override bool IsReadInCurrentContext(DesignContext context) { return IsReadFunc(context); }
/// <summary> /// Is called to create the item used by the CreateComponentTool. /// </summary> protected virtual DesignItem CreateItem(DesignContext context) { object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null); DesignItem item = context.Services.Component.RegisterComponentForDesigner(newInstance); changeGroup = item.OpenGroup("Drop Control"); context.Services.Component.SetDefaultPropertyValues(item); context.Services.ExtensionManager.ApplyDefaultInitializers(item); return item; }
/// <summary> /// Constructs an instance /// </summary> /// <param name="ctx">underlying design context</param> /// <param name="code">code descriptor of async method to decompile</param> /// <param name="instance">assumed instance on which the method is called</param> /// <param name="arguments">sample instances of method arguments</param> public AsyncMethodDecompiler(DesignContext ctx, CodeDescriptor code, object instance, object[] arguments) { _context = ctx; _code = code; _instance = instance; _arguments = arguments; ImplStyle = code.AsyncMethod.HasCustomOrInjectedAttribute<TransformIntoFSM>() ? EAsyncImplStyle.FSM : EAsyncImplStyle.Sequential; }
/// <summary> /// Executes the HLS design flow. /// </summary> /// <param name="design">the design</param> /// <param name="host">the hosting component</param> /// <param name="proc">the process being subject to HLS</param> /// <param name="targetProject">the target project</param> /// <remarks>Inside the hosting component, the process will be replaced by the synthesized hardware.</remarks> public void Execute(DesignContext design, Component host, ProcessDescriptor proc, IProject targetProject) { Contract.Requires<ArgumentNullException>(design != null); Contract.Requires<ArgumentNullException>(host != null); Contract.Requires<ArgumentNullException>(proc != null); Contract.Requires<ArgumentNullException>(targetProject != null); design.CurrentProcess = proc.Instance; var clk = proc.Sensitivity[0]; SignalBase clkI; var sdClk = clk as SignalDescriptor; if (sdClk == null) clkI = ((SignalDescriptor)((PortDescriptor)clk).BoundSignal).Instance; else clkI = sdClk.Instance; var state = new HLSState(this, design, host, proc, targetProject); proc.AddAttribute(state); if (_beginHLS != null) _beginHLS(state); var dpb = new DefaultDatapathBuilder(host, clkI, proc.Name); state.InterconnectBuilder = InterconnectBuilder.Create(host, dpb.ICBinder); state.ControlpathBuilder = ControlPathBuilder.Create(host, dpb.FUBinder); state.ControlpathBuilder.PersonalizePlan(this); do { XILSFunction fnasm; if (!proc.HasAttribute<XILSFunction>()) { var func = proc.Implementation; IEnumerable<Function> inlinedFunctions; func = func.InlineCalls(out inlinedFunctions); if (ConvertFieldsToLocals) { Variable[] newLocals; func = func.ConvertFieldsToLocals(out newLocals); } state.PreprocessedFunction = func; fnasm = state.PreprocessedFunction.Compile(DefaultInstructionSet.Instance); } else { fnasm = proc.QueryAttribute<XILSFunction>(); } fnasm.SanityCheck(); state.XILSInput = fnasm; IList<XILSInstr> instrs = state.XILSInput.Instructions.ToList(); foreach (var rw in XILSTransformations) { instrs = rw.Rewrite(instrs); fnasm = new XILSFunction(fnasm.Name, fnasm.Arguments, fnasm.Locals, instrs.ToArray()); fnasm.SanityCheck(); } state.XILSTransformed = fnasm; XIL3Function fnasm3 = fnasm.ToXIL3(); state.XIL3Input = fnasm3; foreach (IXIL3Rewriter rw in XIL3Transformations) { fnasm3 = rw.Rewrite(fnasm3); fnasm3.SanityCheck(); } state.XIL3Transformed = fnasm3; state.NotifyProgress(EHLSProgress.Compiled); } while (state._repeat); if (state._cancel) return; SchedulingConstraints constraints; do { var xmm = new XILMapperManager(); foreach (var dpu in Enumerable.Reverse(XILMappers)) xmm.AddMapper(dpu); DesignContext.Push(); var xilsa = new XILSchedulingAdapter(state.XIL3Transformed, xmm, host, targetProject); if (AllocationPolicy != null) xilsa.Allocator.Policy = AllocationPolicy.Create(); if (_onFUCreated != null) xilsa.Allocator.OnFUAllocation += _onFUCreated; state.SchedulingAdapter = xilsa; state.NotifyProgress(EHLSProgress.AboutToSchedule); constraints = SchedulingConstraints; if (constraints == null) { if (proc.Implementation != null) constraints = proc.Implementation.QueryAttribute<SchedulingConstraints>(); if (constraints == null) constraints = new SchedulingConstraints(); } state.Constraints = constraints; if (constraints.MinimizeNumberOfFUs) { foreach (var instr in state.XIL3Transformed.Instructions) { xilsa.SetMaxFUAllocation(xilsa.IClass[instr], 1); } } Scheduler.Schedule(xilsa.CFG, constraints, xilsa); DesignContext.Pop(); state.NotifyProgress(EHLSProgress.Scheduled); } while (state._repeat); ComputeCStepsForBranchTargets(state.SchedulingAdapter); do { state.ControlpathBuilder.PrepareAllocation(state.SchedulingAdapter.ComputeCStepCount()); var flowSpec = state.SchedulingAdapter.Allocate(dpb); state.RawFlows = flowSpec; var realFlow = new FlowMatrix(); state.InterconnectBuilder.CreateInterconnect(flowSpec, realFlow); state.RealFlows = realFlow; state.NotifyProgress(EHLSProgress.InterconnectCreated); } while (state._repeat); if (state._cancel) return; Debug.Assert(state.RealFlows.FlowSources.All(sr => sr.Desc.Owner != null)); Debug.Assert(state.RealFlows.FlowTargets.All(sr => sr.Desc.Owner != null)); do { state.ControlpathBuilder.CreateControlpath(state.RealFlows, proc.Name); foreach (var prof in constraints.Profilers) prof.ExtractFrom(state.XIL3Transformed, state.SchedulingAdapter); state.NotifyProgress(EHLSProgress.ControlpathCreated); } while (state._repeat); if (state._cancel) return; }
/// <summary> /// Constructs a SysDOM method body for the given code descriptor. /// </summary> /// <param name="ctx">design context</param> /// <param name="code">code descriptor of tagged method</param> /// <param name="instance">instance on which method is called (null for static methods)</param> /// <param name="arguments">method argument samples</param> /// <returns>custom decompilation result</returns> public abstract IDecompilationResult Rewrite(DesignContext ctx, CodeDescriptor code, object instance, object[] arguments);
internal FixedPointSettings(DesignContext context) { _localOverflowMode = context.AllocPLS(); _localDefaultRadix = context.AllocPLS(); _localArithSizingMode = context.AllocPLS(); }
public DefaultSynthesisContext(DesignContext simCtx, IProject project, IEnumerable<IComponentDescriptor> componentSet, ICodeGenerator codeGen) { ModelContext = simCtx; Project = project; CodeGen = codeGen; _componentSet = componentSet; }
public void Initialize(IProject project, DesignContext context) { }
/// <summary> /// Applies this transformation to a particular design. /// </summary> /// <param name="design">Design context to which the transformation should be applied.</param> public abstract void ApplyTo(DesignContext design);
protected void AssertDesignerOutput(string expectedXaml, DesignContext context) { StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; context.Save(xmlWriter); string actualXaml = stringWriter.ToString().Replace("\r", "");; if (expectedXaml != actualXaml) { Debug.WriteLine("expected xaml:"); Debug.WriteLine(expectedXaml); Debug.WriteLine("actual xaml:"); Debug.WriteLine(actualXaml); } Assert.AreEqual(expectedXaml, actualXaml); }
/// <summary> /// Creates a new synthesis engine. /// </summary> /// <param name="ctx">the design to generate</param> /// <param name="project">the target project generator</param> /// <returns>the newly created synthesis engine</returns> public static SynthesisEngine Create(DesignContext ctx, IProject project) { return new SynthesisEngine(ctx, project); }