Severson-Group / AMDC-Firmware

Embedded system code (C and Verilog) which runs the AMDC Hardware
http://docs.amdc.dev/firmware
BSD 3-Clause "New" or "Revised" License
31 stars 5 forks source link

Re-order slv_regs in Timing Manager IP #385

Closed codecubepi closed 4 months ago

codecubepi commented 4 months ago

Abstract

Once my FPGA changes have been merged with @annikaolson 's C code changes back into v1.3-staging, we should probably go in and re-arrange the slv_regs tobe a more logical order.

The current order is:

slv_reg Number Offset Purpose
0 0x00 Auto-trigger Config
1 0x04 Sensor Enable Bits
2 0x08 User Ratio
3 0x0C PWM Sync (High/Low)
4 0x10 Unused
5 0x14 Eddy Times
6 0x18 Eddy Times
7 0x1C ADC and Encoder Times
8 0x20 ISR
9 0x24 Unused
10 0x28 Trigger Timer
11 0x2C AMDS Times
12 0x30 AMDS Times

I think the following would make more sense:

slv_reg Number Offset Purpose
0 0x00 Auto-trigger Config
1 0x04 Sensor Enable Bits
2 0x08 User Ratio
3 0x0C PWM Sync (High/Low)
4 0x10 ISR
5 0x14 Trigger Time
6 0x18 ADC and Encoder Times
7 0x1C AMDS Times
8 0x20 AMDS Times
9 0x24 Eddy Times
10 0x28 Eddy Times

This is because all the configuration registers at the beginning (lower addresses) are unlikely to be deleted or rearranged, and all of the sensor times are at the end, so that future sensors added are just added to the end of the list.

This will require:

https://github.com/Severson-Group/AMDC-Firmware/blob/ffb82a68fb8ad68202e5c96c3ce61c1d4cb02859/sdk/app_cpu1/common/drv/amds.h#L24-L36

codecubepi commented 4 months ago

Hey @codecubepi , while you do this, you may also want to put the enable_bits and anything else in the timing manager IP hierarchy in the same (and following) order, for consistency:

and any new sensor peripherals will follow.

codecubepi commented 4 months ago

I've addressed the FPGA and C code changes in 00b695f.

https://github.com/Severson-Group/AMDC-Firmware/blob/00b695faa2133fb303fec3b7208b70126bdb131c/ip_repo/amdc_timing_manager_1.0/hdl/amdc_timing_manager_v1_0_S00_AXI.v#L527-L537

https://github.com/Severson-Group/AMDC-Firmware/blob/00b695faa2133fb303fec3b7208b70126bdb131c/sdk/app_cpu1/common/drv/timing_manager.h#L22-L52

I'll leave the updates to the README to @annikaolson

npetersen2 commented 4 months ago

@annikaolson will update the README in the upcoming PR she will make

codecubepi commented 4 months ago

Looks good in PR #392 :

I'll close this now.