OpenCores
URL https://opencores.org/ocsvn/light8080/light8080/trunk

Subversion Repositories light8080

[/] [light8080/] [trunk/] [vhdl/] [light8080.vhdl] - Diff between revs 49 and 54

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 49 Rev 54
Line 1... Line 1...
--##############################################################################
--##############################################################################
-- light8080 : Intel 8080 binary compatible core
-- light8080 : Intel 8080 binary compatible core
--##############################################################################
--##############################################################################
 
-- v1.2    (08 jul 2010) Fix: XOR operations were not clearing CY,ACY.
-- v1.1    (20 sep 2008) Microcode bug in INR fixed.
-- v1.1    (20 sep 2008) Microcode bug in INR fixed.
-- v1.0    (05 nov 2007) First release. Jose A. Ruiz.
-- v1.0    (05 nov 2007) First release. Jose A. Ruiz.
--
--
-- This file and all the light8080 project files are freeware (See COPYING.TXT)
-- This file and all the light8080 project files are freeware (See COPYING.TXT)
--##############################################################################
--##############################################################################
Line 725... Line 726...
signal do_cy_op :     std_logic; -- ALU explicit CY operation (CPC, etc.)
signal do_cy_op :     std_logic; -- ALU explicit CY operation (CPC, etc.)
signal do_cy_op_d :   std_logic; -- do_cy_op, pipelined
signal do_cy_op_d :   std_logic; -- do_cy_op, pipelined
signal do_cpc :       std_logic; -- ALU operation is CPC
signal do_cpc :       std_logic; -- ALU operation is CPC
signal do_cpc_d :     std_logic; -- do_cpc, pipelined
signal do_cpc_d :     std_logic; -- do_cpc, pipelined
signal do_daa :       std_logic; -- ALU operation is DAA
signal do_daa :       std_logic; -- ALU operation is DAA
 
signal do_xor :       std_logic; -- ALU operation is some XOR (clears CY)
signal flag_ac :      std_logic; -- new computed half carry flag
signal flag_ac :      std_logic; -- new computed half carry flag
-- flag_aux_cy: new computed half carry flag (used in 16-bit ops)
-- flag_aux_cy: new computed half carry flag (used in 16-bit ops)
signal flag_aux_cy :  std_logic;
signal flag_aux_cy :  std_logic;
signal load_psw :     std_logic; -- load F register
signal load_psw :     std_logic; -- load F register
 
 
Line 1120... Line 1122...
flag_pattern <=  ucode_field2(9 downto 8);
flag_pattern <=  ucode_field2(9 downto 8);
use_aux_cy <= ucode_field2(19);
use_aux_cy <= ucode_field2(19);
do_cpc <= ucode_field2(23);
do_cpc <= ucode_field2(23);
do_cy_op <= ucode_field2(24);
do_cy_op <= ucode_field2(24);
do_daa <= '1' when ucode_field2(5 downto 2) = "1010" else '0';
do_daa <= '1' when ucode_field2(5 downto 2) = "1010" else '0';
 
do_xor <= '1' when ucode_field2(5 downto 0) = "000101" else '0';
 
 
aux_cy_in <= reg_aux_cy when set_aux_cy = '0' else '1';
aux_cy_in <= reg_aux_cy when set_aux_cy = '0' else '1';
 
 
-- carry input selection: normal or aux (for 16 bit increments)?
-- carry input selection: normal or aux (for 16 bit increments)?
cy_in <= flag_reg(0) when use_aux_cy = '0' else aux_cy_in;
cy_in <= flag_reg(0) when use_aux_cy = '0' else aux_cy_in;
Line 1225... Line 1228...
 
 
flag_s <= alu_output(7);
flag_s <= alu_output(7);
flag_p <= not(alu_output(7) xor alu_output(6) xor alu_output(5) xor alu_output(4) xor
flag_p <= not(alu_output(7) xor alu_output(6) xor alu_output(5) xor alu_output(4) xor
         alu_output(3) xor alu_output(2) xor alu_output(1) xor alu_output(0));
         alu_output(3) xor alu_output(2) xor alu_output(1) xor alu_output(0));
flag_z <= '1' when alu_output=X"00" else '0';
flag_z <= '1' when alu_output=X"00" else '0';
flag_ac <= (arith_op1(4) xor arith_op2_sgn(4) xor alu_output(4));
-- FIXED 08/JUL/2010: XOR was  not clearing AC as it should
 
--flag_ac <= (arith_op1(4) xor arith_op2_sgn(4) xor alu_output(4));
flag_cy_1 <= cy_arith when use_logic = '1' else cy_shifter;
flag_ac <= (arith_op1(4) xor arith_op2_sgn(4) xor alu_output(4)) and not do_xor;
 
 
 
-- FIXED 08/JUL/2010: XOR was not clearing CY as it should
 
--flag_cy_1 <= cy_arith when use_logic = '1' else cy_shifter;
 
flag_cy_1 <=  '0'       when do_xor='1' else
 
              cy_arith  when use_logic = '1' and do_xor='0' else
 
              cy_shifter;
flag_cy_2 <= not flag_reg(0) when do_cpc='0' else '1'; -- cmc, stc
flag_cy_2 <= not flag_reg(0) when do_cpc='0' else '1'; -- cmc, stc
flag_cy <= flag_cy_1 when do_cy_op='0' else flag_cy_2;
flag_cy <= flag_cy_1 when do_cy_op='0' else flag_cy_2;
 
 
flag_aux_cy <= cy_adder;
flag_aux_cy <= cy_adder;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.