Hi all,
I'm building a quarter wave lookup table for sin/cos.
I know in VHDL, that it is possible in design rtl to write a behavioral function and then reference that function to set the values of a ROM.
Is that possible in verilog? If so, how might I go about doing it?
If it's not possible, are there any alternative ways I could use behavioral calculations to initialize my lookup table without pre-building with .hex files or scripts?
The idea is to make the whole thing parameterizable.
Thanks,
Stephen
On Monday, January 13, 2020 at 5:03:42 PM UTC-7, silve...@gmail.com wrote:populate a wire or parameter which acts as a ROM. It will probably have to be flattened into a vector:
Hi all,
I'm building a quarter wave lookup table for sin/cos.
I know in VHDL, that it is possible in design rtl to write a behavioral function and then reference that function to set the values of a ROM.
Is that possible in verilog? If so, how might I go about doing it?
If it's not possible, are there any alternative ways I could use behavioral calculations to initialize my lookup table without pre-building with .hex files or scripts?
The idea is to make the whole thing parameterizable.
Thanks,That is possible, but many synthesizers won't do this well or at all. It's probably easier to use a different program to generate a ROM in a case statement or to put data in a file which you can read in using $readmemh. I have used a function to
Stephen
parameter X = 7; // Some function input
wire [128*8-1:0] tbl = gen_tbl(X); // 128-byte table flattened into vector
...
function [128*8-1:0] gen_tbl
(input integer X); // some parameter
integer ii; // loop variable
begin
for (ii=0; ii<128-1; ii=ii+1)
gen_tbl[ii*8+:8]=$some_function(ii);
end
endfunction
Hi all,
I'm building a quarter wave lookup table for sin/cos.
I know in VHDL, that it is possible in design rtl to write a behavioral function and then reference that function to set the values of a ROM.
Is that possible in verilog? If so, how might I go about doing it?
If it's not possible, are there any alternative ways I could use behavioral calculations to initialize my lookup table without pre-building with .hex files or scripts?
The idea is to make the whole thing parameterizable.
Thanks,
Stephen
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 113 |
Nodes: | 8 (1 / 7) |
Uptime: | 56:49:44 |
Calls: | 2,471 |
Files: | 8,638 |
Messages: | 1,898,016 |