# scheme作业 – Computer Processors (COMP1212/XJCO1212)

### Computer Processors (COMP1212/XJCO1212)

scheme作业 – 这个题目属于一个scheme的代写任务, 涵盖了scheme等程序代做方面

``````Computer Processors (COMP1212/XJCO1212)
``````

You should follow the instructions below on how to prepare your submission. Late sub- missions are not accepted without mitigating circumstances. Feedback on late submissions may not be provided within 3 weeks of submission.

WeightingThis piece of summative coursework is worth 25% of the module grade.

The Feistel cipher is a symmetric block cipher encryption framework which is the basis of many modern day encryption algorithms. In this coursework you will implement a Feistel cipher system as a hardware component and as a software implementation. In a Feistel cipher the plaintext,P, to be encrypted is split into two equal size partsL 0 and R 0 such thatP =L 0 R 0. A functionF is applied to one half of the plaintext, combined with a key, and the result is XORd with the other half of the plaintext. Feistel ciphers often employ multiple rounds of this scheme. In general the scheme works as follows, for alli= 0,… , n,

``````Li+1=Ri
Ri+1=LiF(Ri, Ki)
``````

To decrypt an encrypted message using this cipher we can apply the same procedure in reverse. Fori=n, n 1 ,… ,0,

``````Ri=Li+
Li=Ri+1F(Li+1, Ki)
``````

For this coursework we are interested in the 16-bit Feistel cipher which uses 4 rounds. The functionF(A, B) =AB. The keys are derived from a single 8-bit keyK 0 such that,

``````K 0 =b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0
K 1 =b 6 b 5 b 4 b 3 b 2 b 1 b 0 b 7
K 2 =b 5 b 4 b 3 b 2 b 1 b 0 b 7 b 6
K 3 =b 4 b 3 b 2 b 1 b 0 b 7 b 6 b 5
``````

#### 1

1. Produce an implementation, in HDL, of the described Feistel encryption scheme. The chip should have the following preamble.
``````CHIP FeistelEncryption {
IN plaintext[16], key[8];
OUT ciphertext[16];
``````
``````PARTS:
``````

#### }

1. Write a program in HACK assembly, without using symbols, that implements the described Feistel encryption system. The initial key,K 0 , will be stored in RAM[1], and the 16-bit plaintext will be stored in RAM[2]. The result of the encryption should be stored in RAM[0]. Your solution should be submitted in a file called FeistelEncryption.asm. You may use any RAM locations not specified in the description for intermediate variables.
``````Question 1 is worth10 marks, and Question 2 is worth15 marks.
``````