UCR started me off with VHDL. It was definately a struggle to learn how to avoid all the little errors. The errors were of course my own fault for not realizing the nature of how hardware logic works. Software does things differently then hardware does it, and I struggled with vhdl until I had learned the differences. In the end, I developed a fondness for the HDL.
After graduation, it was up to me to decide my education. My self taught education. Verilog was the popular HDL in america and it would be a good idea to learn it since that is where everyone is at. I gave it a shot and to my surprise, it was vastly more easy. It probably has more to do with my experience with vhdl then the simplicity of the language. I had already understood hardware so it was easy to learn the new language.
The two languages are essentially two different interfaces with the same thing.
The basic components like AND, REG, and COUNTER were finished with ease. But I discovered a problem when I tried synthesising the counter.
Here is a snippet of code
==========
...
wire [WIDTH-1:0] reg2adder_w, adder2reg_w;
sreg_gen #( .WIDTH(WIDTH))
sreg(
.clock(clock), .reset(reset), .en(enable),
.data_i( adder2reg_w),
.data_o( reg2adder)
);
assign count = reg2adder;
...
=====
end snippit
look at the snippit and tell me if you see a problem.......got it? there is no wire named"reg2adder". It was a typo and verilog responds by giving me warnings. It responds by implicitly creating a wire called "reg2adder" of bitwidth 1. So it gives me warnings telling me that the data_o is 32 bits and it is trying to shove it into reg2adder which is 1 bits. This makes 31 of data_o's bits unconnected!
In VHDL, this would have turned out differently. In VHDL it would have simply said something along the lines of "ERROR:reg2adder not declared". Thats a much easier explanation then the warning I had recieved for verilog .
I've heard that verilog tends to sweep errors under the rug, but I didn't think it would make a mistake on something so simple.....
So the moral of the story is to make sure that you are using the right wire names cause apparently, verilog won't catch it for you.
VHDL one.... Verilog zero....
No comments:
Post a Comment