Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sum^2 calculation for PCAP module when the pcap_std_dev option is set #68

Merged
merged 26 commits into from
Jun 29, 2022

Conversation

shu-soleil
Copy link
Contributor

No description provided.

@shu-soleil shu-soleil changed the title Add std_dev calculation for PCAP module Add sum^2 calculation for PCAP module when the pcap_std_dev option is set Nov 9, 2021
@shu-soleil shu-soleil requested review from thomascobb and Araneidae and removed request for thomascobb December 2, 2021 09:55
@shu-soleil
Copy link
Contributor Author

make_zpkg (xu5_st1-no-fmc) and make_zpkg (xu5_st1-fmc_acq430) passed locally

@thomascobb
Copy link
Contributor

yes, this is a lack of RAM in the github runners, we are looking at a different solution

garrel and others added 5 commits December 16, 2021 10:33
- pcap_core_wrapper.vhd : define pos_bus_i and extbus_i using PBUSW and EBUSW constants
- pcap.timing.ini : update to the new version of pcap with sum of squared values function
- tests/hdl/regression_tests.tcl
- tests/hdl/single_test.tcl
- pcap.timing.ini : add test to capture Sum^2
- top_defines.vhd : set PCAP_SUPPORTS_STD_DEV to '1' ; define t_mode_group is array(8 downto 0) of ..

	modified:   modules/pcap/pcap.timing.ini
	modified:   tests/hdl/top_defines.vhd
@shu-soleil shu-soleil requested a review from glennchid January 7, 2022 14:18
Copy link
Contributor

@Araneidae Araneidae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request seems to have a lot of unexpected changes, and this is making it harder to review than it ought to be.

Firstly, there is an alarming amount of formatting churn, layout changes, extra unrelated comments, file permission changes, etc.

Secondly, and more importantly, it strikes me that a lot of this pull request involves changes which have nothing to do with simply adding three more capture attributes. I don't feel happy taking this review any further until we understand why these extra changes are in this PR.

In fact most of the files seem to have significant changes which have nothing to do with the sum^2 calculation. Are these changes part of other bug fixes ... or are they errors introduced when merging master ... or something else I'm missing.

Comment on lines +64 to +72
signal enable_r1 : std_logic;
signal trig_r1 : std_logic;
signal gate_r1 : std_logic;
signal bit_bus_r1 : bit_bus_t;
signal pos_bus_r1 : pos_bus_t;

-- Block parameters pipeline registers
signal TRIG_EDGE_r1 : std_logic_vector(1 downto 0);
signal SHIFT_SUM_r1 : std_logic_vector(5 downto 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor coding style question: I don't understand why these intermediate signals have been declared? Why not just assign directly to the outputs?

To me this just makes the code even more verbose than it needs to be.

modules/pcap/hdl/pcap_buffer.vhd Outdated Show resolved Hide resolved
modules/pcap/hdl/pcap_core.vhd Outdated Show resolved Hide resolved
modules/pcap/hdl/pcap_frame.vhd Show resolved Hide resolved
@shu-soleil
Copy link
Contributor Author

I'll try to reply and make needed corrections. Our service provider Thierry is not working on this project anymore but he is still here and can answer questions if necessary.

@Araneidae
Copy link
Contributor

To help with managing this review, I think I'll try and flag everything that catches my eye as not part of this pull request, I'll make a separate review entry for this. The problem is there are a lot of changes here, and probably most of them, maybe all of them, are doing something import ... but if they belong here it's not in this pull request!

I presume that this pull request should be adding the three extra sum of squares fields and nothing else. However, let's not lose all the other changes -- if they need to be done, let's make separate PRs for them and get them all in. I'm just trying to get this into a state where I can review it!

Copy link
Contributor

@Araneidae Araneidae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've gone through all of the files. It strikes me that most of the changes are either fixes that are not part of this PR (there are some important looking and subtle changes), or are style changes.

If there are bug fixes in here that are needed for this PR and aren't already in master, can we please have a separate PR for them. Otherwise it's impossible to review this PR. I'm reviewing the changes as a whole rather than the 22 individual commits, which I don't think are structured for individual review.

Comment on lines 24 to 28
# Set project properties
if {[info exists BOARD_PART]} {
set_property "board_part" $BOARD_PART [current_project]
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see board_part used anywhere else in this PR, so this looks like an orphan change.

modules/pcap/hdl/pcap_buffer.vhd Show resolved Hide resolved
@@ -54,21 +54,23 @@ end pcap_core;
architecture rtl of pcap_core is


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of the changes in this file are part of this PR, are they?

pos_bus(i) <= pos_bus_i(i*32+31 downto i*32);
end loop;
end process;

process(extbus_i) begin
ext_bus: for i in 0 to 11 loop
ext_bus: for i in 0 to EBUSW-1 loop
extbus(i) <= extbus_i(i*32+31 downto i*32);
end loop;
end process;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes here are sound, but I'd rather have a style PR for this kind of thing. Not part of this PR, please.

Comment on lines 323 to 324
if (fifo_count = 0) then
pcap_fsm <= IRQ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Significant functional change, but definitely not part of this PR.

Comment on lines +194 to +219

-- Mode 6 / 7 / 8 : Sum^2 Low / Middle / High
ps_sum_squared_val: process(clk_i)
begin
if rising_edge(clk_i) then

-- Output the result
if trig_r1 = '1' then
-- Mode 6 Sum^2 byte 0
sum_sq_0_o <= std_logic_vector(sum_data_sq(31+(to_integer(unsigned(SHIFT_SUM))) downto (to_integer(unsigned(SHIFT_SUM)))));
-- Mode 7 Sum^2 byte 1
sum_sq_1_o <= std_logic_vector(sum_data_sq(63+(to_integer(unsigned(SHIFT_SUM))) downto 32+(to_integer(unsigned(SHIFT_SUM)))));
-- Mode 8 Sum^2 byte 2
sum_sq_2_o <= std_logic_vector(sum_data_sq(95+(to_integer(unsigned(SHIFT_SUM))) downto 64+(to_integer(unsigned(SHIFT_SUM)))));
end if;

-- Clear sum on disable or trigger with no gate high
if (enable_r1 = '0') or (trig_r1 = '1' and gate_r1 = '0') then
sum_data_sq <= (others => '0');
-- Set sum to current value on trigger with gate high
elsif (trig_r1 = '1' and gate_r1 = '1') then
sum_data_sq <= resize(value_sq_r1,sum_data_sq'length);
-- Sum the received data whilst gate high
elsif (gate_i = '1') then
sum_data <= sum_data + signed(value_i);
elsif (gate_r1 = '1') then
--sum_data_sq <= sum_data_sq + value_sq_r1;
sum_data_sq <= sum_data_sq + resize(value_sq_r1,sum_data_sq'length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At long last. The actual core of the change.

Rather a shame that all of the controlling signals around it have changed name, making review difficult.

Again, this file has so many other distracting changes that need to be pulled out into a separate PR, please!

Comment on lines 213 to 235
pcap_bus_delay_inst : entity work.pcap_bus_delay
port map (
clk_i => clk_i,
-- Block parameters inputs
TRIG_EDGE_i => TRIG_EDGE_reg(1 downto 0),
SHIFT_SUM_i => SHIFT_SUM_reg(5 downto 0),
-- Block inputs
enable_i => enable_from_bus,
trig_i => gate_from_bus,
gate_i => trig_from_bus,
bit_bus_i => bit_bus_i,
pos_bus_i => pos_bus_i,
-- Block parameters outputs
TRIG_EDGE_o => TRIG_EDGE,
SHIFT_SUM_o => SHIFT_SUM,
-- Block outputs
enable_o => enable_i_dyd,
trig_o => trig_i_dyd,
gate_o => gate_i_dyd,
bit_bus_o => bit_bus_i_dyd,
pos_bus_o => pos_bus_i_dyd
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we need this for timing closure (personally I'd have just written a clocked process here instead, but never mind) ... but none of the other changes are helpful.

I'd be delighted to have a style cleanup PR ... but not as part of this one.

@@ -42,7 +42,7 @@ set test_passed are;
set test_failed are;

foreach module [lrange $argv $MODULES_IND end] {
source $BUILD_DIR/hdl_timing/$module/$module.tcl
source $BUILD_DIR/hdl_timing/$module/$module.tcl
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes in this file look like churn or style changes.

@@ -18,14 +18,12 @@ create_project single_test single_test -force -part $FPGA_PART
if {$argc > $MODULES_IND} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this file is part of this PR

type t_mode_group is array (5 downto 0) of std_logic_vector(31 downto 0);
type t_mode is array (31 downto 0) of t_mode_group;
-- Presence of PCAP_STD_DEV functionality
constant PCAP_SUPPORTS_STD_DEV : std_logic := '1';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be the only change in this file for this PR, please.

@EmilioPeJu
Copy link
Contributor

I have merged master because I fixed an issue related to this, the options field in the target file was not working due to a bug in the code that processes it

@Araneidae
Copy link
Contributor

Corresponding PandABlocks-server issue #13 now closed with push of tag 3.0a2.

@Araneidae Araneidae merged commit 2dc5f16 into master Jun 29, 2022
@Araneidae Araneidae deleted the featurePCAPStdDev branch June 29, 2022 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants