M
Mark Brehob
Hello all,
I'm a teacher who has been teaching students Verilog for a while, but
for various reasons I've had to jump to VHDL for a certain course.
I've been writing a fair bit of simple VHDL stuff (basic DSP
algorithms), and found it both powerful and frustrating. Mostly I'm
trying to figure out if there are better ways to do things and why
VHDL and/or VHDL coders do certain things.
As a note most of my verilog experience is doing synthesizable ASIC
(with some FPGA) while my VHDL stuff is all FPGA based.
#1 Why no process(*) statement similar to always@*?
The vast majority of all process statements are either modeling
combinational logic or something that changes only on clock/reset.
Why doesn't VHDL have a process(*) kind of statement as verilog does
saying "this is combinational logic, update if any of the inputs
change". Having to get the process statement right is painful to
student (add a variable and forget to update the process line) and
further, Xilinx software (at least) just adds things to the process
list anyways with just a warning.
#2 How do I add two values both of which are arbitrary in size?
So say I have one STD_LOGIC_VECTOR that is X bits and one that is Y
bits. Is there a clean way to add them (into something of Z bits for
sake of argument)? I find myself casting to an integer (and back) to
get stuff to work but that's neither pretty nor probably a good
idea.
#3 Is there a good way to index an array with a STD_LOGIC_VECTOR?
Again, I found myself casting back and forth. I suspect here there is
a right way to do this and I'm just missing it.
#4 What's up with all the different ways to check for a rising edge of
a clock?
The code base I inherited uses rising_edge, but that seems to be
fairly uncommon if code I find on the net is any indicator. I think
I've seen three other ways to do it. (Old value was 0 new is one,
current value is 1 and there was a change event, and one other.) Is
there a good reason everyone doesn't just use rising_edge? Is there
something I'm missing?
I had a bunch of other questions, but of course I've forgotten (did my
coding over the weekend and I guess 48 hours ago is enough time to
forget). I'm mostly enjoying it, but as you might expect, it's
bringing back Ada nightmares. At the current time I feel like I'm
jumping through hoops to get around the strict type checking (just
like I recall doing years ago with Ada). C/Verilog people should not
have to deal with strict type checking .
Humm, I guess I'd like thoughts on my coding style, but the students
are finishing "filling in the blanks" on my code, so that will have to
wait until next week.
Thanks in advance,
Mark
I'm a teacher who has been teaching students Verilog for a while, but
for various reasons I've had to jump to VHDL for a certain course.
I've been writing a fair bit of simple VHDL stuff (basic DSP
algorithms), and found it both powerful and frustrating. Mostly I'm
trying to figure out if there are better ways to do things and why
VHDL and/or VHDL coders do certain things.
As a note most of my verilog experience is doing synthesizable ASIC
(with some FPGA) while my VHDL stuff is all FPGA based.
#1 Why no process(*) statement similar to always@*?
The vast majority of all process statements are either modeling
combinational logic or something that changes only on clock/reset.
Why doesn't VHDL have a process(*) kind of statement as verilog does
saying "this is combinational logic, update if any of the inputs
change". Having to get the process statement right is painful to
student (add a variable and forget to update the process line) and
further, Xilinx software (at least) just adds things to the process
list anyways with just a warning.
#2 How do I add two values both of which are arbitrary in size?
So say I have one STD_LOGIC_VECTOR that is X bits and one that is Y
bits. Is there a clean way to add them (into something of Z bits for
sake of argument)? I find myself casting to an integer (and back) to
get stuff to work but that's neither pretty nor probably a good
idea.
#3 Is there a good way to index an array with a STD_LOGIC_VECTOR?
Again, I found myself casting back and forth. I suspect here there is
a right way to do this and I'm just missing it.
#4 What's up with all the different ways to check for a rising edge of
a clock?
The code base I inherited uses rising_edge, but that seems to be
fairly uncommon if code I find on the net is any indicator. I think
I've seen three other ways to do it. (Old value was 0 new is one,
current value is 1 and there was a change event, and one other.) Is
there a good reason everyone doesn't just use rising_edge? Is there
something I'm missing?
I had a bunch of other questions, but of course I've forgotten (did my
coding over the weekend and I guess 48 hours ago is enough time to
forget). I'm mostly enjoying it, but as you might expect, it's
bringing back Ada nightmares. At the current time I feel like I'm
jumping through hoops to get around the strict type checking (just
like I recall doing years ago with Ada). C/Verilog people should not
have to deal with strict type checking .
Humm, I guess I'd like thoughts on my coding style, but the students
are finishing "filling in the blanks" on my code, so that will have to
wait until next week.
Thanks in advance,
Mark