LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Split/divide 1D arrary into columns to calculate parity

I think is is possible but not sure what the best practice would be to achieve the solution

 

 

Basically I carried out a number of operations to produce a 1D arrary of 50 bits.

I want to split that arrary and/or calulate the parity based the bits if they were split into 5 columns 10 rows and then carry out parity check on those 10 rows indiviually.

 

the pic below shows the example based on the first 15 bits but needs to be all 50 for the actual code its just to show the kind of result I want to achieve I just dont have a clue the best way to go about.  I thought about indexing every 5th bit but I have to be honest not sure how to code that or if thats the best way to go about it.

 

array_split_plus_parity-check.png

0 Kudos
Message 1 of 15
(2,711 Views)

I am sure someone will come up with a better approach, here is mine:

parity.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 2 of 15
(2,692 Views)

Hi ace,

 

- you can replace Quot&Rem by an AND function (AND with 1).

- you can move the QR (or AND) and the "<>0" comparison out of the loop due to polymorphism…

 

😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 15
(2,685 Views)

Thanks GerdW.

For completeness, here is one with recommended changes.

parity1.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 4 of 15
(2,677 Views)

Sorry peops!  I forgot to mention -  I am using FPGA compact rio,  I cant use 2D arrarys.

 

Thats why my head is about to explode Smiley Happy

0 Kudos
Message 5 of 15
(2,668 Views)

@hawkstringer wrote:

Sorry peops!  I forgot to mention -  I am using FPGA compact rio,  I cant use 2D arrarys.

 

Thats why my head is about to explode Smiley Happy


Nice one.

 

As it is FPGA, your array size will remain fixed. You could use a decimate 1-d array with 5 outputs.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 6 of 15
(2,662 Views)

Also, since you are in FPGA, you probably want to go slightly different route for calculating your parity for the sake of saving resources.

 

Use a FOR loop with an XOR in it.  Save the parity on a shift register and autoindex your boolean values.  So you are XORing your parity with each value and storing the result back in the shift register.  Since you are dealing with odd parity, initialize your shift register to TRUE.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 15
(2,645 Views)

Thanks so far. I have created the For Loop, but its is not giving me the correct parity.  I am not concered at this point whether the parity bit is true or false but this is not giving me the result I need:

 

parity_for_loop.PNG

0 Kudos
Message 8 of 15
(2,621 Views)

Your example in the first post is showing parity on the COLUMS, not the row.  So you actually need to split things up into 10 to do the parity, not 5.  I'll try to get something put together soon that should work for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 15
(2,608 Views)

Here:

parity2.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 10 of 15
(2,600 Views)