Subject: Re: New proposal for ROM definitions in functions and tasks
From: Stefen Boyd (stefen@boyd.com)
Date: Fri Nov 02 2001 - 14:53:53 PST
At 04:37 PM 11/2/2001 -0500, VhdlCohen@aol.com wrote:
>Attached is a proposal for ROMs defined in tasks and functions.
Ben,
Here's my comments:
1) In your example for 5.6.2:
(* synthesis, rom_block = "ROM_CELL XYZ01" *)
reg [3:0] rom[0:7] /* syn_romstyle = block_rom /;
I would leave off the comment after the rom definition... or
at least make sure the closing '*/' is given to end it. The
'*' is missing in your example.
2) All the examples using tasks or functions are
flawed with poor simulation performance. Every
time the task or function is called, either
initial value assignments are made or the $readmem
is performed. Even if we had allowed declaration
initializations of variables in tasks and functions,
we didn't add declaration initializations for arrays
(yet).
However, I see no reason that the rom's reg
declaration must be at the module level scope.
If you wanted to put it inside a function:
module rom_array_function (z, q, a, b);
output [3:0] z, q;
input [2:0] a, b;
reg [3:0] z;
wire [3:0] q;
function [3:0] lookup;
input [3:0] i;
(* synthesis, rom_block = "ROM_CELL XYZ01" *)
reg [3:0] rom[0:7];
begin
lookup = rom[i];
end
endfunction // lookup
initial begin
lookup.rom[0] = 4'b1011;
lookup.rom[1] = 4'b0001;
lookup.rom[2] = 4'b0011;
lookup.rom[3] = 4'b0010;
lookup.rom[4] = 4'b1110;
lookup.rom[5] = 4'b0111;
lookup.rom[6] = 4'b0101;
lookup.rom[7] = 4'b0100;
end
always @ (a) z = lookup(a);
assign q = lookup(b);
endmodule
--------------------
Stefen Boyd Boyd Technology, Inc.
stefen@BoydTechInc.com (408)739-BOYD
www.BoydTechInc.com (408)739-1402 (fax)
This archive was generated by hypermail 2b28 : Fri Nov 02 2001 - 14:59:16 PST