ParaNut SystemC Model
A SystemC Model of the ParaNut architecture
debug_rom.h
Go to the documentation of this file.
1 /*************************************************************************
2 
3  This file is part of the ParaNut project.
4 
5  Copyright (C) 2019-2020 Alexander Bahle <alexander.bahle@hs-augsburg.de>
6  Hochschule Augsburg, University of Applied Sciences
7 
8  Description:
9  This file contains the instructions contained in the Debug Modules
10  Debug Rom
11 
12  Redistribution and use in source and binary forms, with or without modification,
13  are permitted provided that the following conditions are met:
14 
15  1. Redistributions of source code must retain the above copyright notice, this
16  list of conditions and the following disclaimer.
17 
18  2. Redistributions in binary form must reproduce the above copyright notice,
19  this list of conditions and the following disclaimer in the documentation and/or
20  other materials provided with the distribution.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33  *************************************************************************/
34 
35 const unsigned char debug_rom_bin[] = {
36  0x6f, 0x00, 0xc0, 0x00, // 0x00 jal zero, _entry
37  0x6f, 0x00, 0x80, 0x03, // 0x04 jal zero, _resume
38  0x6f, 0x00, 0x40, 0x04, // 0x08 jal zero, _exception
39  // _entry:
40  0x0f, 0x00, 0xf0, 0x0f, // 0x0c fence
41  0x73, 0x10, 0x24, 0x7b, // 0x10 csrw CSR_DSCRATCH, s0
42  // entry_loop:
43  0x73, 0x24, 0x40, 0xf1, // 0x14 csrr s0, CSR_MHARTID
44  0x23, 0x20, 0x80, 0x30, // 0x18 sw s0, HALTED(zero)
45  0x03, 0x44, 0x04, 0x10, // 0x1c lbu s0, FLAGS(s0)
46  0x13, 0x74, 0x34, 0x00, // 0x20 andi s0, s0, (1 << FLAG_GO) | (1 << FLAG_RESUME)
47  0xe3, 0x08, 0x04, 0xfe, // 0x24 beqz s0, entry_loop
48 
49  0x13, 0x74, 0x14, 0x00, // 0x28 andi s0, s0, (1 << FLAG_GO)
50  0x63, 0x08, 0x04, 0x00, // 0x2c beqz s0, _resume
51 
52  0x73, 0x24, 0x20, 0x7b, // 0x30 csrr s0, CSR_DSCRATCH
53  0x23, 0x22, 0x00, 0x30, // 0x34 sw zero, GOING(zero)
54  0x67, 0x00, 0x00, 0x20, // 0x38 jalr zero, zero, 0x200
55  // _resume:
56  0x73, 0x24, 0x40, 0xf1, // 0x3c csrr s0, CSR_MHARTID
57  0x23, 0x24, 0x80, 0x30, // 0x40 sw s0, RESUMING(zero)
58  0x73, 0x24, 0x20, 0x7b, // 0x44 csrr s0, CSR_DSCRATCH
59  0x73, 0x00, 0x20, 0x7b, // 0x48 dret
60  // _exception:
61  0x23, 0x26, 0x00, 0x30, // 0x4c sw zero, EXCEPTION(zero)
62  0x73, 0x00, 0x10, 0x00 // 0x50 ebreak
63 };
64 unsigned int debug_rom_bin_len = 84;
65 
66 const unsigned int debug_rom[] = {
67  0x00c0006f, // 0x00 jal zero, _entry
68  0x0380006f, // 0x04 jal zero, _resume
69  0x0440006f, // 0x08 jal zero, _exception
70  // _entry:
71  0x0ff0000f, // 0x0c fence
72  0x7b241073, // 0x10 csrw CSR_DSCRATCH, s0
73  // entry_loop:
74  0xf1402473, // 0x14 csrr s0, CSR_MHARTID
75  0x30802023, // 0x18 sw s0, HALTED(zero)
76  0x10044403, // 0x1c lbu s0, FLAGS(s0)
77  0x00347413, // 0x20 andi s0, s0, (1 << FLAG_GO) | (1 << FLAG_RESUME)
78  0xfe0408e3, // 0x24 beqz s0, entry_loop
79 
80  0x00147413, // 0x28 andi s0, s0, (1 << FLAG_GO)
81  0x00040863, // 0x2c beqz s0, _resume
82 
83  0x7b202473, // 0x30 csrr s0, CSR_DSCRATCH
84  0x30002223, // 0x34 sw zero, GOING(zero)
85  0x20000067, // 0x38 jalr zero, zero, 0x200
86  // _resume:
87  0xf1402473, // 0x3c csrr s0, CSR_MHARTID
88  0x30802423, // 0x40 sw s0, RESUMING(zero)
89  0x7b202473, // 0x44 csrr s0, CSR_DSCRATCH
90  0x7b200073, // 0x48 dret
91  // _exception:
92  0x30002623, // 0x4c sw zero, EXCEPTION(zero)
93  0x00100073, // 0x50 ebreak
94 };
unsigned int debug_rom_bin_len
Definition: debug_rom.h:64
const unsigned int debug_rom[]
Definition: debug_rom.h:66
const unsigned char debug_rom_bin[]
Definition: debug_rom.h:35