Forum: FPGA, VHDL & Co. Generics - Parameters


von Martin W. (exwim)


Lesenswert?

Hallo!

Ich habe ein Verilog-Modul, welches auch Parameter enthält:

*****************
module m (inputs, outputs, ...);

parameter WIDTH    = 32;
*****************

Dieses Modul soll nun in VHDL instanziert werden.
**************
m1: m
port map (inputs, outputs)
**************

Kann mir jemand bitte erklären, wie ich dem Verilog Modul einen anderen 
Wert für diesen Parameter geben kann? Das sollte doch mit einer generic 
map gehn, oder hab ich da was falsch verstanden?

Danke für die Hilfe,
MW

von HubiHubi (Gast)


Lesenswert?


von HubiHubi (Gast)


Lesenswert?

sorry falsches Fenster

von fpgakuechle (Gast)


Lesenswert?

generic map ist vhdl, in verilog macht man das wohl mit defparam.

Also beispiel die instanzierung eines brams in vhdl und v (aus xilinx 
Library guide):


vhdl:
1
RAM16X1D_inst : RAM16X1D
2
-- The following generic INIT declaration is only necessary
3
-- if you wish to change the initial
4
-- contents of the RAM to anything other than all zero's.
5
generic map (
6
  INIT: bit-vector := X"0000")
7
port map (
8
 DPO => DPO, -- Port A 1-bit data output
9
 SPO => SPO, -- Port B 1-bit data output
10
 A0 => A0, -- Port A address[0] input bit
11
 A1 => A1, -- Port A address[1] input bit
12
 A2 => A2, -- Port A address[2] input bit
13
 A3 => A3, -- Port A address[3] input bit
14
 D => D, -- Port A 1-bit data input
15
 DPRA0 => DPRA0, -- Port B address[0] input bit
16
 DPRA1 => DPRA1, -- Port B address[1] input bit
17
 DPRA2 => DPRA2, -- Port B address[2] input bit
18
 DPRA3 => DPRA3, -- Port B address[3] input bit
19
 WCLK => WCLK, -- Port A write clock input
20
 WE => WE -- Port A write enable input
21
);


verilog:

RAM16X1D RAM16X1D_inst (
.DPO(DPO), // Port A 1-bit data output
.SPO(SPO), // Port B 1-bit data output
.A0(A0), // Port A address[0] input bit
.A1(A1), // Port A address[1] input bit
.A2(A2), // Port A address[2] input bit
.A3(A3), // Port A address[3] input bit
.D(D), // Port A 1-bit data input
.DPRA0(DPRA0), // Port B address[0] input bit
.DPRA1(DPRA1), // Port B address[1] input bit
.DPRA2(DPRA2), // Port B address[2] input bit
.DPRA3(DPRA3), // Port B address[3] input bit
.WCLK(WCLK), // Port A write clock input
.WE(WE) // Port A write enable input
);
// The following defparam INIT declaration is only necessary if you
// wish to change the initial contents of the RAM to anything other
// than all zero's. If the instance name for the RAM is is changes,
// that change needs to be reflected in the defparam statement.
defparam RAM16X1D_inst.INIT = 16'h0000;

Man beachte die zuweisung an INIT!

Ob man einem in verilog definierten parameter in vhdl einen wert 
zuweisen kann, ist mir unbekannt.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.