| 
 | 
 
 楼主 |
发表于 2014-1-22 10:24:53
|
显示全部楼层
 
 
 
MC8051 和 stdlib.vhd 文件对应的是 
 
mc8051_p.vhd。因为要裁减MC8051,只执行一两个命令就可以了,该文件需要大量裁减。 
 
先初步裁减一下 
首先, 
*************************************************************** 
--Description: Collection of constants, types, and components. 
 
------------------------------------------------------------------------------- 
library IEEE;  
use IEEE.std_logic_1164.all;  
use IEEE.std_logic_arith.all;  
 
package mc8051_p is 
 
********************************************************* 
熟悉的开场, 
 
继续, 
删除 
  ----------------------------------------------------------------------------- 
  -- Set data width of mc8051_alu (no other than 8 supported at the moment!) 
  -- Default: 8 
  constant C_DWIDTH : integer := 8; 
  ----------------------------------------------------------------------------- 
类似这样的语句,目前不需要alu,命令只有ori 或者 move d #data。所以乘法等都不需要。 
 
*************************************** 
--暂时只保留 
constant MOV_D_DATA    : std_logic_vector(7 downto 0) := "01110101"; 
constant ORL_D_DATA    : std_logic_vector(7 downto 0) := "01000011"; 
******************************************* 
到时再根据难度,选择简单易懂的指令, 
先留意一下,等到fsm mem时再理解。 
 
继续, 
************************** 
  type t_state is (STARTUP, 
                   FETCH, 
                   EXEC1, 
                   EXEC2, 
                   EXEC3); 
************************* 
不需要裁减, 
继续, 
这一个指令集合需要裁减,只用1、2个。 
************************ 
type t_instr_category is (IC_MOV_D_DATA, IC_ORL_D_DATA); 
************************************************** 
 
然后,很多模块,大多数不会用到,只保留 
************************************ 
component control_fsm 
port ( state_i     : in t_state;    -- actual state 
。。。。。 
end component; 
 
  component control_mem 
    port (pc_o           : out std_logic_vector(15 downto 0); 
。。。。。 
  end component; 
************************************ 
 
模块的输入和输出好多,因为只运行一个指令,肯定有很多用不到,可以大量裁减。只是从字面上无法辨认出哪些输入和输出不会用到,还需要结合fsm和 mem具体内容来裁减。 
这里是裁减的重点。 
 
同样,还有 
**************************** 
  component mc8051_control 
    port (pc_o           : out std_logic_vector(15 downto 0); 
。。。。。 
end component; 
 
  component mc8051_core 
    port (clk         : in  std_logic; 
。。。。。 
end component; 
 
  component mc8051_top 
    port (clk         : in  std_logic; 
。。。。。 
end component; 
 
********************************* 
上面三个模块的裁减同样依赖于fsm和mem的裁减结果。 
 
最后,ROM模块 
******************************** 
  ----------------------------------------------------------------------------- 
  -- START: Component declarations for simulation models 
  ----------------------------------------------------------------------------- 
  component mc8051_rom 
    port (clk        : in  std_logic; 
          reset      : in  std_logic; 
          rom_data_o : out std_logic_vector(7 downto 0);  
          rom_adr_i  : in  std_logic_vector(15 downto 0)); 
     
  end component; 
  ----------------------------------------------------------------------------- 
  -- END: Component declarations for simulation models 
  ----------------------------------------------------------------------------- 
end mc8051_p; 
**************************************** 
 
该文件还剩下component无法裁减,需要确定fsm和mem模块的输入输出后,才可以进行裁减。 |   
 
 
 
 |