コード例 #1
0
        /// <summary>
        /// Constructs a SimObject instance for a specific design context.
        /// </summary>
        protected DesignObject(DesignContext context)
        {
            Contract.Requires <ArgumentNullException>(context != null);

            Context = context;
            Init();
        }
コード例 #2
0
        /// <summary>
        /// Currently out of order, see remarks.
        /// </summary>
        /// <remarks>
        /// Because of a compiler bug (see http://stackoverflow.com/questions/14198019/await-array-by-implementing-extension-method-for-array)
        /// await signals[] cannot be compiled.
        /// </remarks>
        public static IAwaitable GetAwaiter(this IInPort[] signals)
        {
            //because of a compiler bug (see http://stackoverflow.com/questions/14198019/await-array-by-implementing-extension-method-for-array)
            //await signals[] cannot be compiled, even though this extension method allows it an intellisense says that "(awaitable) IInPort[]"

            return(new MultiEvent(null, DesignContext.MakeEventList(signals)).GetAwaiter());
        }
コード例 #3
0
        private Process AddClockedThreadInternal(Action func, Func <bool> predicate, params IInPort[] sensitive)
        {
            Process process = new Process(
                this,
                Process.EProcessKind.Threaded,
                func)
            {
                Predicate   = predicate,
                Sensitivity = DesignContext.MakeEventList(sensitive)
            };

            process.Schedule(0);
            return(process);
        }
コード例 #4
0
        /// <summary>
        /// Changes a process sensitivity list.
        /// </summary>
        /// <param name="sensitive">The new sensitivity list</param>
        protected void NextTrigger(params IInPort[] sensitive)
        {
            Process curp = Context.CurrentProcess;

            curp.Sensitivity = DesignContext.MakeEventList(sensitive);
        }
コード例 #5
0
 /// <summary>
 /// Registers a triggered process.
 /// </summary>
 /// <param name="func">The process body</param>
 /// <param name="sensitive">The sensitivity list</param>
 protected void AddProcess(Action func, params IInPort[] sensitive)
 {
     AddProcess(func, DesignContext.MakeEventList(sensitive));
 }
コード例 #6
0
 public static MultiEvent Any(params IInPort[] signals)
 {
     return(Any(DesignContext.MakeEventList(signals)));
 }
コード例 #7
0
 public static PredicatedEvent FallingEdge(In <StdLogic> clk)
 {
     return(new PredicatedEvent(null, new MultiEvent(null, DesignContext.MakeEventList(clk)), clk.FallingEdge));
 }
コード例 #8
0
 /// <summary>
 /// Converts the encoded time to raw ticks with respect to a simulation context.
 /// </summary>
 /// <remarks>
 /// The conversion depends on the time resolution which is specified for the simulation context.
 /// </remarks>
 /// <param name="context">The simulation context</param>
 /// <returns>The time expressed in raw ticks</returns>
 internal long GetTicks(DesignContext context)
 {
     return((long)(ScaleTo(context.Resolution.Unit) / context.Resolution.Value));
 }
コード例 #9
0
 /// <summary>
 /// <c>await signals</c> pauses until one of the specified signals changes its values.
 /// </summary>
 public static IAwaitable GetAwaiter(this IEnumerable <IInPort> signals)
 {
     return(new MultiEvent(null, DesignContext.MakeEventList(signals)).GetAwaiter());
 }