[Open SoC Debug] CDM-OR1K implementation

Philipp Wagner philipp.wagner at tum.de
Fri May 25 10:07:42 CEST 2018

On 05/25/2018 09:52 AM, SHIVAM AGGARWAL wrote:
> 1. I mapped the SPRs based on their group number and register index. So, 
> SPR belonging to group 1 and index 5 will have register address 
> [0000][1000][0000][0101] i.e. 0x0805. Now, in the CDM address space it 
> will be mapped to address [1000][1000][0000][0101] i.e. 0x8805 and the 
> value of CORE_REG_UPPER will be 0. Am I missing something?
 > 2. When GDB requests for a register read/write, the address of the
 > register will be one translated into CDM module. We will then use the
 > above formula to figure out the SPR. Is that correct?

Group and register ID are just parts of the register address (group is 
spr_addr[15:11] and ID is spr_addr[10:0]. However, none of this really 
matters. The separation of the address into group and ID are semantics 
specific to or1k. With the mapping scheme I've proposed we don't need to 
care about the semantics, we only care about the address.

So within the "OSD-GDB Server Bridge" you need to do a mapping from SPR 
address to OSD/CDM register address.

core_reg_upper_val = spr_addr[16]
cdm_reg_addr = 0x8000 + spr_addr[14:0]

To access a SPR through OSD you now use the following algorithm:

1. Write the value core_reg_upper_val to the register CORE_REG_UPPER 
(CORE_REG_UPPER might represent address 0x201 for example).

2. Write/read from the OSD register cdm_reg_addr. You get back or write 
the SPR value that GDB instructed you to read/write.

You can skip step 1 if you know core_reg_upper_val is already present in 
the CORE_REG_UPPER register.

> Noted. I will open an issue in the osd-doc repo. Then, I will create a 
> Pull Request for updating the specification.
> Major changes involved:
> 1. The register map in Programmer Interface: Control Registers
> 2. Description of debug stall event packet. Payload word 'reason' to be 
> changed to 'stall'. Value of the payload word is determined by 
> du_stall_o signal.
> 3. We should also update the image with the one you have created above. 
> The image is very descriptive and illustrative.

Hopefully a better drawing of that one. Please try to use Inkscape, that 
makes editing the images in SVG format much easier as it retains the shapes.


More information about the OpenSoCDebug mailing list