Changeset 178 for trunk/3DEES/amplitude.v
- Timestamp:
- Dec 20, 2013, 10:10:03 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/3DEES/amplitude.v
r155 r178 5 5 ( 6 6 input wire clock, frame, reset, 7 input wire [width-1:0] cfg_data, 7 input wire [width-1:0] min_data, 8 input wire [width-1:0] max_data, 8 9 input wire [width-1:0] inp_data, 9 10 output wire [width-1:0] out_data, 10 output wire 11 output wire [1:0] out_flag 11 12 ); 12 13 … … 20 21 wire int_comp_wire; 21 22 reg int_comp_reg, int_comp_next; 23 24 reg [5:0] int_cntr_reg, int_cntr_next; 22 25 23 26 assign int_comp_wire = (inp_data_reg[1] < inp_data); … … 35 38 int_flag_reg <= 1'b0; 36 39 int_comp_reg <= 1'b0; 40 int_cntr_reg <= 6'd0; 37 41 end 38 42 else … … 46 50 int_flag_reg <= int_flag_next; 47 51 int_comp_reg <= int_comp_next; 52 int_cntr_reg <= int_cntr_next; 48 53 end 49 54 end … … 59 64 int_flag_next = int_flag_reg; 60 65 int_comp_next = int_comp_reg; 66 int_cntr_next = int_cntr_reg; 61 67 62 68 case (int_case_reg) … … 71 77 out_flag_next = 1'b0; 72 78 // minimum 73 if ((~int_comp_reg) & (int_comp_wire) )79 if ((~int_comp_reg) & (int_comp_wire) & int_cntr_reg[5]) 74 80 begin 75 81 int_mini_next = inp_data_reg[0]; 76 82 int_flag_next = 1'b1; 77 83 end 78 // maximum 84 // maximum after minimum 79 85 else if ((int_comp_reg) & (~int_comp_wire) & (int_flag_reg)) 80 86 begin … … 83 89 int_case_next = 1'b1; 84 90 end 91 else if (~int_cntr_reg[5]) 92 begin 93 int_cntr_next = int_cntr_reg + 6'd1; 94 end 85 95 end 86 96 end … … 88 98 1: 89 99 begin 90 out_flag_next = (out_data_reg >= cfg_data); 100 if (out_data_reg > min_data) 101 begin 102 int_cntr_next = 6'b0; 103 // out_flag_next = 1'b1; 104 out_flag_next = (inp_data_reg[1] < max_data); 105 end 91 106 int_case_next = 1'b0; 92 107 end … … 96 111 97 112 assign out_data = out_data_reg; 98 assign out_flag = out_flag_reg;113 assign out_flag = {~int_cntr_reg[5], out_flag_reg}; 99 114 100 115 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.