Skip to content

MisaghM/Computer-Aided-Design-Projects

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computer Aided Design Projects

Introduction

In all of the projects, a $5\times 5\times 64$ matrix is encoded to another $5\times 5\times 64$ matrix using different methods.
The encodings are implemented completely in hardware.
The $(i,\ j)$ indices for a matrix slice are as follows:

(3, 2) (4, 2) (0, 2) (1, 2) (2, 2)
(3, 1) (4, 1) (0, 1) (1, 1) (2, 1)
(3, 0) (4, 0) (0, 0) (1, 0) (2, 0)
(3, 4) (4, 4) (0, 4) (1, 4) (2, 4)
(3, 3) (4, 3) (0, 3) (1, 3) (2, 3)

CA1: Permutation

In this part, the encoding is done using the following formula:

$$\forall i,\ j \in [0,4]\ \forall k \in [0, 63]: a[i][j][k] = a[j][(2i+3j)\ %\ 5][k]$$

This means that in each slice, the bits are mapped to a different location in the slice.

Midterm: ColParity

In this part, the encoding is done using the following formula:

$$\forall i,\ j \in [0,4]\ \forall k \in [0, 63]: a[i][j][k] = a[i][j][k] \oplus a[(i-1)\ %\ 5][0..4][k] \oplus a[(i+1)\ %\ 5][0..4][(k+1)\ %\ 64]$$

This means that each bit of the matrix becomes the XOR of itself, the bit's left column, and its right column in the previous slice.

CA2: Encoder

Here, 5 different encodings are applied serially to the input 24 times.

ColParity

This part is the same function implemented in Midterm.

Rotate

The following formula is used for encoding:

$$\forall i,\ j \in [0,4]\ \forall k \in [0, 63]: a[i][j][k] = a[i][j][(k-\frac{(t+1)(t+2)}{2})\ %\ 64]$$

The number $t$ starts from 0 and goes up to 23. On each increment, an $(x,\ y)$ pair is calculated using the following formula:

$$\begin{pmatrix} 0 & 1 \ 2 & 3\end{pmatrix}^t\begin{pmatrix} 1 \ 0\end{pmatrix} \mod 5 = \begin{pmatrix} x \ y\end{pmatrix}$$

The $(x,\ y)$ pair shows which lane of the matrix should be shifted $\frac{(t+1)(t+2)}{2}$ times.

Permute

This part is the same function implemented in CA1.

Revaluate

The following formula is used for encoding:

$$\forall i,\ j \in [0,4]\ \forall k \in [0, 63]: a[i][j][k] = a[i][j][k] \oplus (\lnot a[(i+1)\ %\ 5][j][k]\ &\ a[(i+2)\ %\ 5][j][k])$$

AddRc

The following formula is used for encoding:

$$\forall k \in [0,\ 63]: a[0][0][k] = a[0][0][k] \oplus RC[t][k]$$

Where the $RC$ values are presented in the following table:

RC[0] RC[1] RC[2] RC[3]
0x0000000000000001 0x0000000000008082 0x800000000000808A 0x8000000080008000
RC[4] RC[5] RC[6] RC[7]
0x000000000000808B 0x0000000080000001 0x8000000080008081 0x8000000000008009
RC[8] RC[9] RC[10] RC[11]
0x000000000000008A 0x0000000000000088 0x0000000080008009 0x000000008000000A
RC[12] RC[13] RC[14] RC[15]
0x000000008000808B 0x800000000000008B 0x8000000000008089 0x8000000000008003
RC[16] RC[17] RC[18] RC[19]
0x8000000000008002 0x8000000000000080 0x000000000000800A 0x800000008000000A
RC[20] RC[21] RC[22] RC[23]
0x8000000080008081 0x8000000000008080 0x0000000080000001 0x8000000080008008

And $t$ is the iteration number where the function is being executed. (the encoder module executes the 5 functions 24 times)

About

Applying encoding functions over a 3D matrix in hardware.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Verilog 83.4%
  • Tcl 7.1%
  • SystemVerilog 5.7%
  • Python 3.8%