deepsetan
Advanced Member level 4
- Joined
- May 8, 2013
- Messages
- 119
- Helped
- 6
- Reputation
- 12
- Reaction score
- 5
- Trophy points
- 1,298
- Location
- Malaysia
- Activity points
- 2,137
Hi guys,
How can I modify my FIR filter to have an input and output that have a precision of 3 decimal places. I already constructed floating point computation but I dont know on how to link it with my filter in verilog. This is my code for FIR filter:
- - - Updated - - -
This is my block diagram for floating computation system
How can I modify my FIR filter to have an input and output that have a precision of 3 decimal places. I already constructed floating point computation but I dont know on how to link it with my filter in verilog. This is my code for FIR filter:
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 module FIR_filter #(parameter STAGES = 4) ( input CLK, input RST, input [7:0] Xin, output [7:0] Xin_LED, output reg [7:0] Xout ); reg [7:0] STORE [STAGES-1:0]; reg [15:0] ACC; integer i; always @(negedge RST, negedge CLK) begin if(!RST) for(i = 0; i < STAGES; i = i + 1) STORE[i] <= 0; else begin for(i = 0; i < (STAGES-1); i = i + 1) STORE[i] <= STORE[i+1]; STORE[3] <= Xin; end end always @* begin ACC = 0; for(i = 0; i < STAGES; i = i + 1) ACC = ACC + STORE[i]; Xout = ACC / STAGES; end assign Xin_LED = Xin; endmodule
- - - Updated - - -
This is my block diagram for floating computation system
Last edited by a moderator: