What am I doing wrong here?

T

Thomas Womack

Guest
Have a look at http://www.chiark.greenend.org.uk/~twomack/poly.v

With XST, BinDisp (derived from code posted on this newsgroup, as you
will all recognise) synthesises fine. But synthesising PolyMul8 gives
me "unknown token PolyMulF" errors, and I can't see why.

It's probably self-evident, but I've looked at a couple of manuals,
which just say "<module name> <identifier of this instance> ({<parameters>})
is the syntax for instantiation", and that's what I'm doing. PolyMulF
is defined in the same file as PolyMul8, but then BCD27Seg is in the same
file as BinDisp and that's not causing a compile error.

Tom
 
"Thomas Womack" <twomack@chiark.greenend.org.uk> wrote in message
news:TVh*qhBwq@news.chiark.greenend.org.uk...
Have a look at http://www.chiark.greenend.org.uk/~twomack/poly.v

With XST, BinDisp (derived from code posted on this newsgroup, as you
will all recognise) synthesises fine. But synthesising PolyMul8 gives
me "unknown token PolyMulF" errors, and I can't see why.

It's probably self-evident, but I've looked at a couple of manuals,
which just say "<module name> <identifier of this instance
({<parameters>})
is the syntax for instantiation", and that's what I'm doing. PolyMulF
is defined in the same file as PolyMul8, but then BCD27Seg is in the same
file as BinDisp and that's not causing a compile error.

Tom
I've had tools complain about names because of something unrelated - a
missing endmodule, for instance. If you have a separate tool
(simulator/synth/lint) to give a second opinion on your compile, you might
gain better insight.

A problem that hits me on occasion is writing PolyMulF as PolyMu1F or
Po1yMulF or Po1yMu1F or P0lyMulF or PolyMulf...
I hope you get my point here.
 
On 08 Oct 2004 17:58:41 +0100 (BST), Thomas Womack
<twomack@chiark.greenend.org.uk> wrote:

Have a look at http://www.chiark.greenend.org.uk/~twomack/poly.v

With XST, BinDisp (derived from code posted on this newsgroup, as you
will all recognise) synthesises fine. But synthesising PolyMul8 gives
me "unknown token PolyMulF" errors, and I can't see why.

It's probably self-evident, but I've looked at a couple of manuals,
which just say "<module name> <identifier of this instance> ({<parameters>})
is the syntax for instantiation", and that's what I'm doing. PolyMulF
is defined in the same file as PolyMul8, but then BCD27Seg is in the same
file as BinDisp and that's not causing a compile error.

Tom
Another poster has it right. In PolyMul8, you have to move the
PolyMulF instantiations outside the always block and make the
sensitivity list include a0, a1, a2, a3 instead of u and v.
 
"Thomas Womack" <twomack@chiark.greenend.org.uk> wrote in message
news:TVh*qhBwq@news.chiark.greenend.org.uk...
Have a look at http://www.chiark.greenend.org.uk/~twomack/poly.v

With XST, BinDisp (derived from code posted on this newsgroup, as you
will all recognise) synthesises fine. But synthesising PolyMul8 gives
me "unknown token PolyMulF" errors, and I can't see why.

It's probably self-evident, but I've looked at a couple of manuals,
which just say "<module name> <identifier of this instance
({<parameters>})
is the syntax for instantiation", and that's what I'm doing. PolyMulF
is defined in the same file as PolyMul8, but then BCD27Seg is in the same
file as BinDisp and that's not causing a compile error.

Tom
I noticed the link a bit late. You have always blocks with module
instantiations? I don't think that's what you need. Tasks or Functions
might be what you want. A module is instantiated to exist in a higher level
module as an entity, not as an execution-selected operation. Tasks and
functions can be performed haphazardly with some restrictions on global and
local variables, recursivity, and such.

My guess is - since this is same cycle operation - you can get best use out
of a function. The PolyMulf may, for instance, look like

function [6:0] PolyMulF;
input [3:0] u;
input [3:0] v;
reg [6:0] w;
always @(u or v)
begin
w[3:0] = u[3:0] & {4{v[0]}};
w[4:1] = w[4:1] ^ ({4{v[1]}} & u[3:0]);
w[5:2] = w[5:2] ^ ({4{v[2]}} & u[3:0]);
w[6:3] = w[6:3] ^ ({4{v[3]}} & u[3:0]);
end
assign PolyMulf = w;
endfunction

module PolyMul8(u,v,w);
input [7:0] u;
input [7:0] v;
output [14:0] w;

reg [14:0] w;
reg [6:0] a0,a1,a2,a3,a4;
always @(u or v)
begin
a0 = PolyMulF(u[3:0], v[3:0]);
a1 = PolyMulF(u[3:0], v[7:4]);
a2 = PolyMulF(u[7:4], v[3:0]);
a3 = PolyMulF(u[7:4], v[7:4]);
a4 = a1^a2;
w = {a3[6], a3[5], a3[4], a3[3], a3[2]^a4[6], a3[1]^a4[5], a3[0]^a4[4],
a4[3], a0[6]^a4[2], a0[5]^a4[1], a0[4]^a4[0], a0[3], a0[2], a0[1], a0[0]};
end

endmodule

Though it looks like the PolyMul8 may be a function as well but the concept
should be there.
 

Welcome to EDABoard.com

Sponsor

Back
Top