EmbDev.net

Forum: FPGA, VHDL & Verilog what's problem this top&design


von frowerwolrd (Guest)


Rate this post
useful
not useful
1
module diceroll(
2
  input    wire           CLK,
3
  input    wire           RST,
4
  input    wire           roll,
5
  output   wire   [2:0]   dice1,
6
  output   wire   [2:0]   dice2
7
);
8
  
9
  reg [7:0] lfsr1;
10
  reg [4:0] lfsr2;
11
  wire [7:0] temp1;
12
  wire [4:0] temp2;
13
  
14
  assign temp1 = lfsr1 % 6 + 1;
15
  assign temp2 = lfsr2 % 6 + 1;
16
  assign dice1 = (roll) ? temp1[2:0] : 3'b000;
17
  assign dice2 = (roll) ? temp2[2:0] : 3'b000;  
18
19
  always @ (posedge CLK or posedge RST)
20
    begin
21
      if(RST)
22
        lfsr1 <= 8'b00000001;
23
      else
24
        begin
25
          lfsr1[0] <= lfsr1[3] ^ lfsr1[4] ^ lfsr1[5] ^ lfsr1[7];
26
          lfsr1[1] <= lfsr1[0];
27
          lfsr1[2] <= lfsr1[1];
28
          lfsr1[3] <= lfsr1[2];
29
          lfsr1[4] <= lfsr1[3];
30
          lfsr1[5] <= lfsr1[4];
31
          lfsr1[6] <= lfsr1[5];
32
          lfsr1[7] <= lfsr1[6];
33
        end
34
    end
35
  
36
  always @ (posedge CLK or posedge RST)
37
    begin
38
      if(RST)
39
        lfsr2 <= 5'b00001;
40
      else
41
        begin
42
          lfsr2[0] <= lfsr2[4] ^ lfsr2[2];
43
          lfsr2[1] <= lfsr2[0];
44
          lfsr2[2] <= lfsr2[1];
45
          lfsr2[3] <= lfsr2[2];
46
          lfsr2[4] <= lfsr2[3];
47
        end
48
    end
49
  
50
endmodule
51
52
module dice_top (
53
    input   wire            CLK,
54
    input   wire            RST,
55
    input   wire            Rb,
56
    output  reg     [2:0]   dice1,
57
    output  reg     [2:0]   dice2,
58
    output  reg             win,
59
    output  reg             lose
60
61
);
62
    wire    [2:0]   a;
63
    wire    [2:0]   b;
64
    wire            roll;
65
    wire            win_w;
66
    wire            lose_w;
67
68
    always @*
69
    begin
70
        dice1<=a;
71
        dice2<=b;
72
        win<=win_w;
73
        lose<=lose_w;
74
    end
75
    
76
    DICE    top  (
77
        .CLK        (CLK),
78
        .RST        (RST),
79
        .dice1      (a),
80
        .dice2      (b),
81
        .Rb         (Rb),
82
        .win        (win_w),
83
        .lose       (lose_w),
84
        .roll       (roll)
85
    );
86
            
87
    diceroll      dice(
88
        .CLK        (CLK),
89
        .RST        (RST),
90
        .roll       (roll),
91
        .dice1      (a),
92
        .dice2      (b)
93
    );
94
95
endmodule
Error-[URMI] Unresolved modules
testbench.sv, 27
"DICE top( .RST (RST),  .CLK (CLK));"
  Module definition of above instance is not found in the design.

1 error

I DO NOT known..

: Edited by Moderator
von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
frowerwolrd wrote:
> Module definition of above instance is not found in the design.
I'm not the Verilog man, but the toolchain seems to be right: there is 
no "module top". So try a "dice_top" instead the "top"...


And try that:
1
[c]
2
   Verilog Code
3
[/c]
You'll get syntax highlight for free...

: Edited by Moderator
von Lattice User (Guest)


Rate this post
useful
not useful
Lothar M. wrote:
> frowerwolrd wrote:
>> Module definition of above instance is not found in the design.
> I'm not the Verilog man, but the toolchain seems to be right: there is
> no "module top". So try a "dice_top" instead the "top"...
>

In Verilog the order is module name followed by instance name. The 
missing module is named DICE, a simple name change won't help here.
Keep in mind Verilog is case sensitive.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.