A circuit for transposing a matrix, the circuit comprising: reversal circuitry configured to: receive, for each of one or more diagonals of the matrix, elements of the diagonal of the matrix in a respective first vector, and generate, for each of the one or more diagonals of the matrix, a respective second vector that includes the elements of the diagonal of the matrix in the respective first vector in an order that is a reverse of an order of the elements of the diagonal of the matrix in the respective first vector; counter circuitry configured to: receive an initiate signal; and responsive to receiving the initiate signal, setting a counter to a counter value of N-1 for right-rotation of the respective second vector and setting the counter to a counter value of 1 for left-rotation of the respective second vector based on the received initiate signal; and rotation circuitry comprising a barrel shift circuit that is capable of bit-wise shifting the elements of the respective second vector by a specified number of bits using combinatorial logic, the rotation circuitry configured to: receive the counter value from the counter circuitry being in communication with the rotation circuitry, determine, for each of the one or more diagonals of the matrix and based at least on the counter value, a number of positions by which to rotate the elements of the diagonal of the matrix in the respective second vector, receive, at the barrel shift circuit, for each of the one or more diagonals of the matrix, the respective second vector of elements of the diagonal of the matrix from the reversal circuitry, and generate, by the barrel shift circuit, for each of the one or more diagonals of the matrix using the combinatorial logic, a respective third vector that includes the elements of the diagonal of the matrix in the respective second vector in an order that is a rotation of the elements of the diagonal of the matrix in the respective second vector by the number of positions determined based at least on the counter value. reversal circuitry configured to: receive, for each of one or more diagonals of the matrix, elements of the diagonal of the matrix in a respective first vector, and generate, for each of the one or more diagonals of the matrix, a respective second vector that includes the elements of the diagonal of the matrix in the respective first vector in an order that is a reverse of an order of the elements of the diagonal of the matrix in the respective first vector; receive, for each of one or more diagonals of the matrix, elements of the diagonal of the matrix in a respective first vector, and generate, for each of the one or more diagonals of the matrix, a respective second vector that includes the elements of the diagonal of the matrix in the respective first vector in an order that is a reverse of an order of the elements of the diagonal of the matrix in the respective first vector; counter circuitry configured to: receive an initiate signal; and responsive to receiving the initiate signal, setting a counter to a counter value of N-1 for right-rotation of the respective second vector and setting the counter to a counter value of 1 for left-rotation of the respective second vector based on the received initiate signal; and receive an initiate signal; and responsive to receiving the initiate signal, setting a counter to a counter value of N-1 for right-rotation of the respective second vector and setting the counter to a counter value of 1 for left-rotation of the respective second vector based on the received initiate signal; and rotation circuitry comprising a barrel shift circuit that is capable of bit-wise shifting the elements of the respective second vector by a specified number of bits using combinatorial logic, the rotation circuitry configured to: receive the counter value from the counter circuitry being in communication with the rotation circuitry, determine, for each of the one or more diagonals of the matrix and based at least on the counter value, a number of positions by which to rotate the elements of the diagonal of the matrix in the respective second vector, receive, at the barrel shift circuit, for each of the one or more diagonals of the matrix, the respective second vector of elements of the diagonal of the matrix from the reversal circuitry, and generate, by the barrel shift circuit, for each of the one or more diagonals of the matrix using the combinatorial logic, a respective third vector that includes the elements of the diagonal of the matrix in the respective second vector in an order that is a rotation of the elements of the diagonal of the matrix in the respective second vector by the number of positions determined based at least on the counter value. receive the counter value from the counter circuitry being in communication with the rotation circuitry, determine, for each of the one or more diagonals of the matrix and based at least on the counter value, a number of positions by which to rotate the elements of the diagonal of the matrix in the respective second vector, receive, at the barrel shift circuit, for each of the one or more diagonals of the matrix, the respective second vector of elements of the diagonal of the matrix from the reversal circuitry, and generate, by the barrel shift circuit, for each of the one or more diagonals of the matrix using the combinatorial logic, a respective third vector that includes the elements of the diagonal of the matrix in the respective second vector in an order that is a rotation of the elements of the diagonal of the matrix in the respective second vector by the number of positions determined based at least on the counter value.