FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-2004, 06:58 PM
Thomas Womack
Guest
 
Posts: n/a
Default What am I doing wrong here?

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

Reply With Quote
  #2 (permalink)  
Old 10-08-2004, 07:15 PM
John_H
Guest
 
Posts: n/a
Default Re: What am I doing wrong here?

"Thomas Womack" <[email protected]> wrote in message
news:TVh*[email protected]
> 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.


Reply With Quote
  #3 (permalink)  
Old 10-08-2004, 07:32 PM
John_H
Guest
 
Posts: n/a
Default Re: What am I doing wrong here?

"Thomas Womack" <[email protected]> wrote in message
news:TVh*[email protected]
> 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.


Reply With Quote
  #4 (permalink)  
Old 10-09-2004, 07:02 AM
mk
Guest
 
Posts: n/a
Default Re: What am I doing wrong here?

On 08 Oct 2004 17:58:41 +0100 (BST), Thomas Womack
<[email protected]> 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.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:38 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved