Altera_Forum
Honored Contributor
13 years agodifferent style of coding to reduce logic resources??
I need to optimize my design in area. After setting all the required constraints, I started modifying the source code. I made few changes and see some changes in the resource Utilization.
Can anyone please tell me how this has reduced the logic as i dont see much difference in the code other than coding style has change from 1 case to the other. The code is in verilog. case 1: always @(negedge clk or negedge rst_n) begin if ( rst_n == 0 ) begin intr_reg <= 0; intr_core <= 0; end else begin intr_reg <= { intr_reg[0], intr }; intr_core <= ( ((intr_reg == 2'b01) || (intr_core == 1)) && (intr_ack == 0) ); end end endmodule Case 2: resource utilization has reduced by using the ternary operator wire [ 1: 0] intr_wire; assign intr_wire = { intr_wire[0], intr }; assign intr_core1 =( ((intr_reg == 2'b01) || (intr_core == 1)) && (intr_ack == 0)); always @(negedge clk or negedge rst_n) begin if ( rst_n == 0 ) begin intr_reg <= 0; intr_core <= 0; end else begin intr_reg <= intr_wire; intr_core <= intr_core1; end end endmodule can anyone how this type of coding has reduced resource utilization. Thank You