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));
        }