malikkhaled
Junior Member level 1
- Joined
- Jan 14, 2010
- Messages
- 19
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- sweden
- Activity points
- 1,447
here i post my code for multiplying two 256 bit numbers mod P(254 bit number). i instantiate two module one is "amulb" and other is "add_sub". s1 and s2 are signals that holds the intermediate result and and v1 and v2 are two variables. This module will perform multiplication in 256 clock cycles. but i am getting errors in generate command, anyone here could help me.
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 [syntax=asp]p1:process (clk) variable v1,v2: std_logic_vector(k3 downto 0); begin if reset='1' then s1 <=(others=> '0'); s2<= a; else if clk'event and clk='1' then gen2:for i in k3 to 0 generate --begin ---------- mux--------------- u<= s2 when b(i)='1' else s1; ------------ instantiation------- uu1:amulb port map (u,'1',v1); uu2:add_sub port map(s1,s2,cin,v2,c1); ------------ mux---------------- s1<= v1 when b(i)='1' else v2; s2<= v2 when b(i)='1' else v1; end generate; end if; end process; end Behavioral;