Exemplo n.º 1
0
Arquivo: OUT.cs Projeto: KPU-RISC/KPU
        /// <summary>
        /// OUT C
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override Result VisitOUT(LowLevelAssemblyParser.OUTContext context)
        {
            string outputPort = context.out_port_8bit().GetText();
            string opcode     = "1100111";

            if (outputPort == "C")
            {
                opcode += "0";
            }
            else if (outputPort == "D")
            {
                opcode += "1";
            }
            else
            {
                throw new Exception("Invalid Output Port!");
            }

            opcode += " ; OUT ";
            opcode += outputPort;
            assembly.Add(opcode);

            return(base.VisitOUT(context));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="LowLevelAssemblyParser.OUT"/>.
 /// <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 VisitOUT([NotNull] LowLevelAssemblyParser.OUTContext context)
 {
     return(VisitChildren(context));
 }