Beginner's problem with very simple Verilog buffer

Guest #2345487
Rate this post
useful
not useful
Hey everyone,

I've got a hopefully easy to solve question.
The following Code is given:

1
module filter
2
  (
3
    input                 clk,
4
    input                 en,
5
    input [31:0]          rawdata,
6
    output [31:0]         filtered_data
7
  );
8
  
9
  reg [31:0]              filtered_data_q;
10

11
  assign filtered_data    = filtered_data_q;
12

13
  // filter + register
14
  always @(posedge clk)
15
    if (en)
16
      // Simple recursive filtering
17
      filtered_data_q <= filtered_data_q * 3 / 4 + rawdata / 4;
18
    else
19
      filtered_data_q <= filtered_data_q;
20
    
21
endmodule

This code synthesizes and simulates perfectly, just as expected.
But once I add a simple(st) buffer, nothing works:

1
  wire    temp;
2
  assign  temp = rawdata;
Additionally, I used 'temp' instead of 'rawdata' for the filter.

The result is that my complete filtered_q register is removed during 
optimization step for the following reason: "Stuck at GND due to stuck 
port data_in"

I also tried
1
  reg temp;
2
  always @ (rawdata)
3
    temp = rawdata;
but that did not change anything.

Any Explanations? Why does this happen?
Guest #2346670
Rate this post
useful
not useful
wire means only 1 bit
wire[31:0] means 32 bits

because verilog doesn't talk and disallow as much as vhdl, it is 
accepted to fed a 32bit vector into a 1 bit(keeping only 1 bit!).

So all other 31 bits are lost and you will never know it.
(maybe there is a warning from synthesis tool, don't know)

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now