Each line is 32 chars in size. I have to read each line, and in a loop I have to set a 32 bit register according to the character encountered. This is what I wrote:
The problem is that I get an error saying part-select must be constant. Now how do I solve this problem?
I should tell you that I am an absolute beginner in Verilog and know only 'Hello world' as of now.
Well, the "part-select must be constant" is actually pretty descriptive. You are trying to do a bit select on a bit vector. You do this bit select from bit number A to bit number B. But these A and B values must be a constant value (as opposed to a runtime variable like the i
integer). As permute suggested, you may want to look into readmemb. See for example: Modeling Memories And FSM Part - I
Also, thanks for actually using code / syntax tags on a first post! You'd be amazed at how few people use that. Regarding the "[" etc stuff ... did that creep in after you entered it? Looks a bit weird...
Also, thanks for actually using code / syntax tags on a first post! You'd be amazed at how few people use that. Regarding the "[" etc stuff ... did that creep in after you entered it? Looks a bit weird...
Yeah the square brackets got converted into #91 and #93 automagically.
Thanks permute and mrflibble. I'll try figuring out readmemb usage. I am good at C, C++ and Java but never ever worked with Verilog.
Funny, sounds like it's a bit buggy then. Because when I typed "[" and did a Preview Post, I noticed it changed it to a bracket. Must be a feature of the syntax tag...