Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //variables for HD calculation
- reg [N-1:0] HD [0:2**N-1][0:2**N-1];
- reg [2**N-1:0] i,j;
- reg [N-1:0] summation;
- CALC_HD:
- begin
- for(i=0; i < 2**N;i=i+1)
- for(j=0; j < 2**N;j=j+1)
- begin
- summation = sum(i^j); //function call
- if( summation >= min_hd )
- begin
- HD[i][j] = 1;
- // $display("sum=%b,HD[%2d][%2d]=%2d\n",summation,i,j,HD[i][j]); //for debugging
- end
- else
- HD[i][j] = 0;
- end // for (j=0; j < 2**N;j=j+1)
- next_state = ONE_TIME_SETUP;
- end
- function [N-1:0] sum(input [N-1:0] input_vector);
- integer k;
- reg [N-1:0] temp;
- begin
- temp = 0;
- for(k=0; k < N; k=k+1)
- begin
- temp = temp + input_vector[k];
- end
- sum = temp;
- end
- endfunction // sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement