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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.