Ejemplo n.º 1
0
Archivo: IN.cs Proyecto: KPU-RISC/KPU
        /// <summary>
        /// IN A
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override Result VisitIN(LowLevelAssemblyParser.INContext context)
        {
            string inputPort = context.port_8bit().GetText();
            string opcode    = "1100110";

            if (inputPort == "A")
            {
                opcode += "0";
            }
            else if (inputPort == "B")
            {
                opcode += "1";
            }
            else
            {
                throw new Exception("Invalid Input Port!");
            }

            opcode += " ; IN " + inputPort;
            assembly.Add(opcode);

            return(base.VisitIN(context));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="LowLevelAssemblyParser.IN"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitIN([NotNull] LowLevelAssemblyParser.INContext context)
 {
     return(VisitChildren(context));
 }