Morell
Member level 1
Hi,
I'am a hardware engineer and my final project is
implemention of systematic cyclic encoder on a FPGA-Board.
I really need help in writing the code and
I would appriciate if you could help me with this matter.
1- Here are the facts about this problem:
- We need a k bit message which we call U.
- U is the serial input of the encoder.
- GP stands for n-k bit Generator Polynomial.
- GP and U are going to build an N bit codeword which we call V.
- V is the serial output of the encoder.
- n and k are not fixed or constant this means that Generator Polynomial is not constant either
So (This is the major part and is really confusing to me) we have to build the encoder circuit
dynamically.
2- Attached file is the schematic of the encoder
3- Here is my code which I'm Sure is wrong.
4- Please help me with this.
Comments, advices, tips, links, a piece of code, anything!!!!
I would greatly apriciate your response
I'am a hardware engineer and my final project is
implemention of systematic cyclic encoder on a FPGA-Board.
I really need help in writing the code and
I would appriciate if you could help me with this matter.
1- Here are the facts about this problem:
- We need a k bit message which we call U.
- U is the serial input of the encoder.
- GP stands for n-k bit Generator Polynomial.
- GP and U are going to build an N bit codeword which we call V.
- V is the serial output of the encoder.
- n and k are not fixed or constant this means that Generator Polynomial is not constant either
So (This is the major part and is really confusing to me) we have to build the encoder circuit
dynamically.
2- Attached file is the schematic of the encoder
3- Here is my code which I'm Sure is wrong.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 entity OEncoder_1 is Generic (K : integer range 0 to 10 :=4; -- K bits for Message N : integer range 0 to 20 :=7); -- N bits for Codeword Port ( UTemp : in STD_LOGIC; SentU : out STD_LOGIC; Clk : in STD_LOGIC); end OEncoder_1; architecture Behavioral of OEncoder_1 is --Component Declaration Component D_FF Port ( D : in STD_LOGIC; CLK : in STD_LOGIC; Q : out STD_LOGIC; rst : in STD_LOGIC); end Component; --Signal Declaration Signal GP : STD_LOGIC_VECTOR ((N-K) downto 0) :="1101"; -- Generator Polynomial Signal i : integer range 0 to (N-K) := 0; -- Index on GP's Bits Signal j : integer range 0 to (N-K) := 0; -- Index on IOX Signal IOX : STD_LOGIC_VECTOR ((N-K) downto 0) :="0000"; Signal GTemp : STD_LOGIC; Signal Disable : STD_LOGIC := '1'; type Switch is ( SC , OC ); -- Short circuit and Open circuit Signal SW : Switch := SC; begin Process (CLK) Begin if( CLK'event and CLK ='1') then if(i < (N-K)) then if(GP(i) = '1') then U1: D_FF port map(D =>(Gtemp xor IOX(j)) , CLK=>Clk, Q=>IOX(j+1) , rst=>Disable ); else U2: D_FF port map(D => IOX(j) , CLK => CLK , Q =>IOX(j+1) , rst => Disable ); end if; i <= i + 1; j <= j + 1; else if(SW = SC) then Gtemp <= IOX (N-K) xor Utemp; SentU <= Utemp; else -- SW = OC Gtemp <= '0'; SentU <= IOX(j); end if; end if; end if; End Process; end Behavioral;
4- Please help me with this.
Comments, advices, tips, links, a piece of code, anything!!!!
I would greatly apriciate your response