我是一个新手,刚编译一个乘法器程序,可总是有问题,不知怎么改,vhdl程序如下: library IEEE; use IEEE.Std_logic_1164.all; ENTITY booth_multiplier IS GENERIC(k POSITIVE := 7); PORT(multiplicand, multiplier : IN BIT_VECTOR(k DOWNTO 0); clock : IN BIT; product : INOUT BIT_VECTOR((2*k + 1) DOWNTO 0)); END booth_multiplier; ARCHITECTURE structural OF booth_multiplier IS SIGNAL mdreg, adderout, carries, augend, tcbuffout : BIT_VECTOR(k DOWNTO 0); SIGNAL mrreg : BIT_VECTOR((k + 1) DOWNTO 0); SIGNAL adder_ovfl : BIT; SIGNAL comp ,clr_mr ,load_mr ,shift_mr ,clr_md ,load_md ,clr_pp ,load_pp ,shift_pp : BIT; SIGNAL boostate : NATURAL RANGE 0 TO 2*(k + 1); BEGIN PROCESS BEGIN WAIT UNTIL (clock'EVENT AND clock = '1'); IF clr_md = '1' THEN mdreg <= (OTHERS => '0'); ELSIF load_md = '1' THEN mdreg <= multiplicand; ELSE mdreg <= mdreg; END IF; IF clr_mr = '1' THEN mrreg <= (OTHERS => '0'); ELSIF load_mr = '1' THEN mrreg((k + 1) DOWNTO 1) <= multiplier; mrreg(0) <= '0'; ELSIF shift_mr = '1' THEN mrreg <= mrreg SRL 1; ELSE mrreg <= mrreg; END IF; IF clr_pp = '1' THEN product <= (OTHERS => '0'); ELSIF load_pp = '1' THEN product((2*k + 1) DOWNTO (k + 1)) <= adderout; product(k DOWNTO 0) <= product(k DOWNTO 0); ELSIF shift_pp = '1' THEN product <= product SRA 1; ELSE product <= product; END IF; END PROCESS; augend <= product((2*k+1) DOWNTO (k+1)); addgen : FOR i IN adderout'RANGE GENERATE lsadder : IF i = 0 GENERATE adderout(i) <= tcbuffout(i) XOR augend(i) XOR comp; carries(i) <= (tcbuffout(i) AND augend(i)) OR (tcbuffout(i) AND comp) OR (comp AND augend(i)); END GENERATE; otheradder : IF i /= 0 GENERATE adderout(i) <= tcbuffout(i) XOR augend(i) XOR carries(i-1); carries(i) <= (tcbuffout(i) AND augend(i)) OR (tcbuffout(i) AND carries(i-1)) OR (carries(i-1) AND augend(i)); END GENERATE; END GENERATE; adder_ovfl <= carries(k-1) XOR carries(k); tcbuffout <= NOT mdreg WHEN (comp = '1') ELSE mdreg; PROCESS BEGIN WAIT UNTIL (clock'EVENT AND clock = '1'); IF boostate < 2*(k + 1) THEN boostate <= boostate + 1; ELSE boostate <= 0; END IF; END PROCESS; PROCESS(boostate) BEGIN comp <= '0'; clr_mr <= '0'; load_mr <= '0'; shift_mr <= '0'; clr_md <= '0'; load_md <= '0'; clr_pp <= '0'; load_pp <= '0'; shift_pp <= '0'; IF boostate = 0 THEN load_mr <= '1'; load_md <= '1'; clr_pp <= '1'; ELSIF boostate MOD 2 = 0 THEN shift_mr <= '1'; shift_pp <= '1'; ELSE --boostate = 1,3,5,7...... IF mrreg(0) = mrreg(1) THEN NULL; --refresh pp ELSE load_pp <= '1'; END IF; comp <= mrreg(1); END IF; END PROCESS; END structural; 用max plus2编译显示错误如下: Error:Unkown problem in e:\myproject\booth_multiplier.vhd[%SynPrep-A-UnexpectedCase,UnexpectedCase:"Unexpected value for tOpClass"in iEvalOperation at line 640 of file readexpr.c.] |