Ejemplo n.º 1
0
        public override string ToString()
        {
            // this is non-synthesizable method, anything can be done here
            var dump   = new StringBuilder();
            var disasm = new Disassembler();

            dump.AppendLine($"RISC-V Dump:");
            dump.AppendLine($"PC: 0x{State.PC}");
            dump.AppendLine($"State: {State.State}");
            dump.AppendLine($"Instruction: 0x{State.Instruction:X8}");
            dump.AppendLine($"Disassembled: {disasm.Single(State.PC, State.Instruction)}");
            dump.AppendLine($"OpCode: {ID.OpTypeCode}");
            dump.AppendLine($"HaltCode: {State.HaltCode}");

            dump.AppendLine($"=== REGS ===");
            Regs
            .State
            .x
            .Select((r, idx) => $"x{idx}".PadRight(3) + $": 0x{r:X8}")
            .ForEach(l => dump.AppendLine(l));

            dump.AppendLine($"=== CSR ===");
            for (int idx = 0; idx < State.CSR.Length; idx++)
            {
                dump.AppendLine($"[{(SupportedCSRAddr)idx}]".PadRight(15) + $": 0x{State.CSR[idx]:X8}");
            }

            return(dump.ToString());
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            // this is non-synthesizable method, anything can be done here
            var dump   = new StringBuilder();
            var disasm = new Disassembler();

            dump.AppendLine($"RISC-V Dump:");
            dump.AppendLine($"PC: 0x{State.PC}");
            dump.AppendLine($"State: {State.State}");
            dump.AppendLine($"Instruction: 0x{State.Instruction:X8}");
            dump.AppendLine($"Disassembled: {disasm.Single(State.PC, State.Instruction)}");
            dump.AppendLine($"OpCode: {ID.OpTypeCode}");
            dump.AppendLine($"=== REGS ===");
            Regs
            .State
            .x
            .Select((r, idx) => $"x{idx}".PadRight(3) + $": 0x{r:X8}")
            .ForEach(l => dump.AppendLine(l));

            return(dump.ToString());
        }