Want to understand the logic of a code

Discussion in 'VHDL' started by lkp, Jul 25, 2013.

  1. lkp

    lkp Guest

    library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.std_logic_arith.all;
    use IEEE.std_logic_unsigned.all;
    --use work.my_package.all;
    entity square_163_7_6_3 is
    port (
    a: in std_logic_vector(162 downto 0);
    z: out std_logic_vector(162 downto 0)
    );
    end square_163_7_6_3;

    architecture circuit of square_163_7_6_3 is

    signal s, t, u, s_plus_t: std_logic_vector(162 downto 0);
    signal xor1, xor2: std_logic;

    begin

    vector_s: for i in 0 to 80 generate s(2*i) <= a(i); s(2*i + 1) <= a(i+82); end generate;
    s(162) <= a(81);

    vector_t1: for j in 0 to 6 generate t(j) <= '0'; end generate;
    t(7) <= a(82);
    vector_t2: for i in 4 to 80 generate t(2*i) <= a(i+78); t(2*i + 1) <= a(i+79); end generate;
    t(162) <= a(159);

    xor1 <= a(160) xor a(161); xor2 <= a(161) xor a(162);
    u(0) <= a(160); u(1) <= a(160) xor a(162); u(2) <= a(161); u(3) <= xor1;
    u(4) <= a(82) xor a(160); u(5) <= xor2; u(6) <= a(83) xor xor1;
    u(7) <= '0'; u(8) <= a(84) xor xor1; u(9) <= '0'; u(10) <= a(85) xor xor2;
    u(11) <= '0'; u(12) <= a(86) xor a(162);
    u(13) <= '0';
    vector_u: for i in 7 to 80 generate u(2*i) <= a(i+80); u(2*i + 1) <= '0'; end generate;
    u(162) <= a(161);

    xor_gates1: for j in 0 to 162 generate s_plus_t(j) <= s(j) xor t(j); end generate;
    xor_gates2: for j in 0 to 162 generate z(j) <= s_plus_t(j) xor u(j); end generate;

    end circuit;

    ---------------------------------------
    Hi, I want to understand the logic of the code. I want to design the same code for 193-bit. Could anyone please make me understand, how the code is working? :)

    Thank you!
    lkp, Jul 25, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. usao
    Replies:
    1
    Views:
    723
    Allan Herriman
    Apr 14, 2004
  2. Replies:
    0
    Views:
    704
  3. Replies:
    0
    Views:
    368
  4. spike
    Replies:
    8
    Views:
    1,439
    Steve Holden
    Feb 9, 2010
  5. Savas Ates
    Replies:
    1
    Views:
    108
    Steven Burn
    Jul 31, 2004
Loading...

Share This Page