Let's say that I have an array of buses, each one carrying a struct like so:
typedef struct packed {
logic [31:0] piano_concerto_in_d_minor;
logic [31:0] piano_concerto_in_c_minor;
logic [7:0] nationality;
} rachmaninov_t;
//.........
module russian_composers(/* input/output busses go here */);
rachmaninov_t [2] rachs;
rachmaninov_t output;
assign rachs[0] = {32'haaaa5555, 32'h10001000, 8'h33};
assign rachs[1] = {32'h5555aaaa, 32'h80008000, 8'h44};
And I want to bitwise or them together, I would do the following:
assign output = rachs[0] | rachs[1];
//value of output is {32'hffffffff, 32'h90009000, 8'h77}
endmodule
Now, what would I do if I had a parameterized number of rachmaninov_t
structs and I wanted to bitwise-or all of them together like above? I've already tried
assign output = |rachs;
and it doesn't work (which isn't too surprising).
Could I get a generate
block to do this?