# LabVIEW

cancel
Showing results 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.

Message 1 of 15
(1,418 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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

Subscribe to our Test Automation user group: UK Test Automation Group
Message 2 of 15
(1,399 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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 LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 3 of 15
(1,392 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

Thanks GerdW.

For completeness, here is one with recommended changes.

Subscribe to our Test Automation user group: UK Test Automation Group
Message 4 of 15
(1,384 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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

Message 5 of 15
(1,375 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

@hawkstringer wrote:

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

Nice one.

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

Subscribe to our Test Automation user group: UK Test Automation Group
Message 6 of 15
(1,369 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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.

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
Message 7 of 15
(1,352 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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:

Message 8 of 15
(1,328 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

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.

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
Message 9 of 15
(1,315 Views)

## Re: Split/divide 1D arrary into columns to calculate parity

Here:

Subscribe to our Test Automation user group: UK Test Automation Group
Message 10 of 15
(1,307 Views)