Forum Discussion
Verilog/VHDL versus high level functions.
Im new to this, coming from audio programming in MSP/Reaktor and lower level assembler.
So I have to learn a lot about the FPGA stuff as I go along. But two things came to mind. It was hinted that higher and lower level coding and patching would not make as much of a difference as it does using these in computational languages. Is this so? Can I asume an all code project wether Verilog, VHDL or high level are more or less the same speed and size? And since im opting to learn one low level language which one should it be? For not running into trouble grabbing MIDI, buffers (RAM), waveform generation, HD's (sata), DAC's, ADC's and the likes..22 Replies
- Altera_Forum
Honored Contributor
Im in the process of drawing the core peice of FPGA on a peice of paper, and "paralelizing" parts of the design which used to be serial code.
But the thing i'm wondering about is based on the specs 50.000.000/192.000=~<260 logic operators per line is what im going to get "rigt?" Is there a way to guestimate the timings? "bound to be shift operators and flipflofs" Or are there cycle charts maybe? - Altera_Forum
Honored Contributor
What kind of timings are you referring to? Latency can be calculated from how many register states you have. Clock speed is more down to what you have available and what throughput you need.
I'm not sure what you mean by number of logic operators? Is that how much logic there is between registers? - Altera_Forum
Honored Contributor
First off, I love VHDL from what I have seen it's exactly what I need it to be, I really love it. The strict part reminds me of assembler, while the formatting of controlled loops is exactly as I did it before. It's great :D The high frequency thing is awesome too alows me to mold the virtual analog sounding stuff.
So.. is the latency a matter of simply adding operators? (That would be when using the dsp?) But it's hardware "right?" so is there the possibility for more logic operators in one clock, because the electrons travel through a steady state? - Altera_Forum
Honored Contributor
Latency is a matter of pipelining - which is a chain of registers, probably with some logic in between. Registers are inferred from VHDL from a basic template:
So basically you count the number of signal assignments in the chain inside the clocked part of the process to calculate the latency. The less logic (ie gates) between registers and the faster you can run the clock. Remember that control logic (ifs/case etc) will get mapped to gates, so bare this in mind. I highly recommended you stay away from any HDL until you have a good understanding of the basic logic elements. If you dont, and write some "bad" vhdl - it may simulate just fine but will either be terrible or just not compile at all for the FPGA.process(clk, areset) --remove areset if you dont want an async reset begin if areset = '1' then --remove if no reset needed --async reset elsif rising_edge(clk) then --do some stuff end if; end process; - Altera_Forum
Honored Contributor
So..about multiple processes in one peice of code. Do these become serial or paralel by default, or is there a way to tell the compiler this function goes under and this one after?
if areset = '1' then <--I see you do not close the sentence, nor use brackets.. musnt it be: if reset > '0' then A; --? Oh I see its only at the paralel statements, but would it be bad practice to just and A? Oh and one more the '1' brackets what do they mean? - Altera_Forum
Honored Contributor
All Processes are run in parrallel. You need to think in terms of hardware, not code. The clock will arrive at all processes at the same time, so all code is executed in parrallel.
No, you must check for if areset = '1'. This is a binary system - it will either be 1 or 0. Technically, if reset > '0' then will work, as '1' is defined after '0' in the std_logic definition. But it is not a good idea to use it. single quotes '' are used to wrap around character types. std_logic is an enumerated type that uses characters for each state (it has 9 states in total, but only 3 are useful for real hardware ('1', '0' and 'Z'). The rest are just for simulation purposes : ('U', 'X', '-', 'H', 'L' and 'W') - Altera_Forum
Honored Contributor
Ah, so ideally one has to make a series of files discribing a "possibly tightly packed" paralel process.
I see in a binary scenario this would be useless to evaluate like that.. One more :D Is it possible to map functions directly to the output? Without describing the architecture.. - Altera_Forum
Honored Contributor
I think you really really need to get a good book work work through a tutorial. It will explain things better than trying to ask here.
All entities need an architecture - an entity just describes the interface, and architecture describes the behaviour. - Altera_Forum
Honored Contributor
I mean if the interface node declares a variable that you are going to use in code, and the output does the same.
Wouldnt it be better practice even, to map these directly onto the output rather than creating an intermediate variable? - Altera_Forum
Honored Contributor
--- Quote Start --- I mean if the interface node declares a variable that you are going to use in code, and the output does the same. Wouldnt it be better practice even, to map these directly onto the output rather than creating an intermediate variable? --- Quote End --- What do you mean by interface node? do you mean a port? and variables are specific things in VHDL - they are different from signals. Did you mean an intermediate signal?