I agree Andy - making this into a function makes the code cleaner and is preferred if I would use this more than once.
Re: Best way to get an array of vectors into a vector?
May 13, 2012
1 Replies
Carl,
I would encourage you and others to think about what "use this code more than once" means...
Anyone reviewing the code? Anyone maintaining the code? In this context, "anyone" can be even be you, 6 weeks, 6 months or 6 years after you wrote it. For myself, I could include "6 days" too!
Clean code is easier to understand for everyone. Good comments help, but well written code, with appropriately named entities, functions, procedures, variables, and signals, helps a lot more.
For example byte_vector may be too general a name in some cases. Is the byte vector organized as little endian or big endian? Are both kinds used in the same environment? perhaps big_endian and/or little_endian are better names for the type. The to_unsigned() function could be overridden for each type appropriately. And naturally, to_big_endian(), etc. written as well.
Something to think about...
OK, I'm stepping off my soapbox now...
Andy
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required