mc8051_core_struc.vhd
上传用户:sztwq510
上传日期:2007-04-20
资源大小:209k
文件大小:11k
源码类别:

VHDL/FPGA/Verilog

开发平台:

Matlab

  1. -------------------------------------------------------------------------------
  2. --                                                                           --
  3. --          X       X   XXXXXX    XXXXXX    XXXXXX    XXXXXX      X          --
  4. --          XX     XX  X      X  X      X  X      X  X           XX          --
  5. --          X X   X X  X         X      X  X      X  X          X X          --
  6. --          X  X X  X  X         X      X  X      X  X         X  X          --
  7. --          X   X   X  X          XXXXXX   X      X   XXXXXX      X          --
  8. --          X       X  X         X      X  X      X         X     X          --
  9. --          X       X  X         X      X  X      X         X     X          --
  10. --          X       X  X      X  X      X  X      X         X     X          --
  11. --          X       X   XXXXXX    XXXXXX    XXXXXX    XXXXXX      X          --
  12. --                                                                           --
  13. --                                                                           --
  14. --                       O R E G A N O   S Y S T E M S                       --
  15. --                                                                           --
  16. --                            Design & Consulting                            --
  17. --                                                                           --
  18. -------------------------------------------------------------------------------
  19. --                                                                           --
  20. --         Web:           http://www.oregano.at/                             --
  21. --                                                                           --
  22. --         Contact:       mc8051@oregano.at                                  --
  23. --                                                                           --
  24. -------------------------------------------------------------------------------
  25. --                                                                           --
  26. --  MC8051 - VHDL 8051 Microcontroller IP Core                               --
  27. --  Copyright (C) 2001 OREGANO SYSTEMS                                       --
  28. --                                                                           --
  29. --  This library is free software; you can redistribute it and/or            --
  30. --  modify it under the terms of the GNU Lesser General Public               --
  31. --  License as published by the Free Software Foundation; either             --
  32. --  version 2.1 of the License, or (at your option) any later version.       --
  33. --                                                                           --
  34. --  This library is distributed in the hope that it will be useful,          --
  35. --  but WITHOUT ANY WARRANTY; without even the implied warranty of           --
  36. --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        --
  37. --  Lesser General Public License for more details.                          --
  38. --                                                                           --
  39. --  Full details of the license can be found in the file LGPL.TXT.           --
  40. --                                                                           --
  41. --  You should have received a copy of the GNU Lesser General Public         --
  42. --  License along with this library; if not, write to the Free Software      --
  43. --  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  --
  44. --                                                                           --
  45. -------------------------------------------------------------------------------
  46. --
  47. --
  48. --         Author:                 Helmut Mayrhofer
  49. --
  50. --         Filename:               mc8051_core_struc.vhd
  51. --
  52. --         Date of Creation:       Mon Aug  9 12:14:48 1999
  53. --
  54. --         Version:                $Revision: 1.9 $
  55. --
  56. --         Date of Latest Version: $Date: 2002/01/07 12:17:45 $
  57. --
  58. --
  59. --         Description: Connect the mc8051_control and mc8051_alu modules.
  60. --                      Generate and connect a certain number of mc8051_tmrctr
  61. --                      and mc8051_siu units.
  62. --
  63. --
  64. --
  65. --
  66. -------------------------------------------------------------------------------
  67. architecture struc of mc8051_core is
  68.   -- signals connecting the control unit with the rest
  69.       
  70.   signal s_reg_data:     std_logic_vector(7 downto 0);    -- data for ALU
  71.   signal s_cy :          std_logic_vector(1 downto 0);    -- Carry Flag
  72.   signal s_ov :          std_logic;                       -- Overflow Flag
  73.   signal s_alu_cmd:      std_logic_vector (5 downto 0);   -- ALU operationscode
  74.   signal s_alu_data0:    std_logic_vector (7 downto 0);   -- ALU result
  75.   signal s_alu_data1:    std_logic_vector (7 downto 0);   -- 2nd ALU result
  76.   signal s_acc:          std_logic_vector (7 downto 0);   -- ACC register 
  77.   signal s_cyb:          std_logic_vector (1 downto 0);   -- CY result of ALU 
  78.   signal s_ovb:          std_logic;                       -- OV result of ALU 
  79.   signal s_reset:        std_logic;                       -- reset signal
  80.   signal s_clk:          std_logic;                       -- clock signal
  81.   
  82.   -- signals to and from the SIUs
  83.   
  84.   signal s_all_trans    : std_logic_vector(C_IMPL_N_SIU-1 downto 0);
  85.   signal s_all_scon     : std_logic_vector(6*C_IMPL_N_SIU-1 downto 0);
  86.   signal s_all_sbuf     : std_logic_vector(8*C_IMPL_N_SIU-1 downto 0);
  87.   signal s_all_smod     : std_logic_vector(C_IMPL_N_SIU-1 downto 0);
  88.   signal s_all_scon_out : std_logic_vector(3*C_IMPL_N_SIU-1 downto 0);
  89.   signal s_all_sbuf_out : std_logic_vector(8*C_IMPL_N_SIU-1 downto 0);
  90.         
  91.   -- signals to and from the timer/counters
  92.   
  93.   signal s_all_tcon_tr0 : std_logic_vector(C_IMPL_N_TMR-1 downto 0);
  94.   signal s_all_tcon_tr1 : std_logic_vector(C_IMPL_N_TMR-1 downto 0);
  95.   signal s_all_tmod     : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  96.   signal s_all_reload   : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  97.   signal s_all_wt       : std_logic_vector(2*C_IMPL_N_TMR-1 downto 0);
  98.   signal s_all_wt_en    : std_logic_vector(C_IMPL_N_TMR-1 downto 0);
  99.   signal s_all_tf0      : std_logic_vector(C_IMPL_N_TMR-1 downto 0);
  100.   signal s_all_tf1      : std_logic_vector(C_IMPL_N_TMR-1 downto 0);
  101.   signal s_all_tl0      : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  102.   signal s_all_th0      : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  103.   signal s_all_tl1      : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  104.   signal s_all_th1      : std_logic_vector(8*C_IMPL_N_TMR-1 downto 0);
  105.    
  106. begin                 -- architecture structural
  107.     
  108.   i_mc8051_control : mc8051_control
  109.     port map(pc_o           => rom_adr_o,
  110.              rom_data_i     => rom_data_i,
  111.              ram_data_o     => ram_data_o,
  112.              ram_data_i     => ram_data_i,
  113.              ram_adr_o      => ram_adr_o,
  114.              reg_data_o     => s_reg_data,
  115.              ram_wr_o       => ram_wr_o,
  116.              cy_o           => s_cy,
  117.              ov_o           => s_ov,
  118.              ram_en_o       => ram_en_o,
  119.              alu_cmd_o      => s_alu_cmd,
  120.              aludata_i      => s_alu_data0,
  121.              aludatb_i      => s_alu_data1,
  122.              acc_o          => s_acc,
  123.              new_cy_i       => s_cyb,
  124.              new_ov_i       => s_ovb,
  125.              reset          => reset,
  126.              clk            => clk,
  127.              int0_i         => int0_i,
  128.              int1_i         => int1_i,
  129.              p0_i           => p0_i,
  130.              p1_i           => p1_i,
  131.              p2_i           => p2_i,
  132.              p3_i           => p3_i,
  133.              p0_o           => p0_o,
  134.              p1_o           => p1_o,
  135.              p2_o           => p2_o,
  136.              p3_o           => p3_o,
  137.              all_trans_o    => s_all_trans,
  138.              all_scon_o     => s_all_scon,
  139.              all_sbuf_o     => s_all_sbuf,
  140.              all_smod_o     => s_all_smod,
  141.              all_scon_i     => s_all_scon_out,
  142.              all_sbuf_i     => s_all_sbuf_out,
  143.              all_tcon_tr0_o => s_all_tcon_tr0,
  144.              all_tcon_tr1_o => s_all_tcon_tr1,
  145.              all_tmod_o     => s_all_tmod,
  146.              all_reload_o   => s_all_reload,
  147.              all_wt_o       => s_all_wt,
  148.              all_wt_en_o    => s_all_wt_en,
  149.              all_tf0_i      => s_all_tf0,
  150.              all_tf1_i      => s_all_tf1,
  151.              all_tl0_i      => s_all_tl0,
  152.              all_tl1_i      => s_all_tl1,
  153.              all_th0_i      => s_all_th0,
  154.              all_th1_i      => s_all_th1,
  155.              adrx_o         => adrx_o,
  156.              datax_o        => datax_o,
  157.              wrx_o          => wrx_o,
  158.              datax_i        => datax_i);
  159.   
  160.     
  161.   i_mc8051_alu : mc8051_alu
  162.     generic map (DWIDTH   => 8)
  163.     port map(rom_data_i => rom_data_i,    -- inputs to mc8051_alu
  164.              ram_data_i => s_reg_data,
  165.              acc_i      => s_acc,
  166.              cmd_i      => s_alu_cmd,
  167.              cy_i       => s_cy,
  168.              ov_i       => s_ov,
  169.              
  170.              result_a_o => s_alu_data0,   -- outputs of mc8051_alu
  171.              result_b_o => s_alu_data1,
  172.              new_cy_o   => s_cyb,
  173.              new_ov_o   => s_ovb);
  174.   gen_mc8051_siu : for i in c_impl_n_siu-1 downto 0 generate
  175.     i_mc8051_siu : mc8051_siu
  176.       port map (clk       => clk,        -- SIUs inputs
  177.                 reset     => reset,
  178.                 tf_i      => s_all_tf1(i),
  179.                 trans_i   => s_all_trans(i),
  180.                 rxd_i     => all_rxd_i(i),
  181.                 scon_i    => s_all_scon((6*i)+5 downto i*6),
  182.                 sbuf_i    => s_all_sbuf((8*i)+7 downto i*8),
  183.                 smod_i    => s_all_smod(i),
  184.                                          -- SIUs outputs
  185.                 sbuf_o    => s_all_sbuf_out((8*i)+7 downto i*8),
  186.                 scon_o    => s_all_scon_out((3*i)+2 downto i*3),
  187.                 rxdwr_o   => all_rxdwr_o(i),
  188.                 rxd_o     => all_rxd_o(i),
  189.                 txd_o     => all_txd_o(i));
  190.   end generate;
  191.   gen_mc8051_tmrctr : for i in c_impl_n_tmr-1 downto 0 generate
  192.     i_mc8051_tmrctr : mc8051_tmrctr
  193.       port map (clk        => clk,       -- tmr_ctr inputs
  194.                 reset      => reset,
  195.                 int0_i     => int0_i(i),
  196.                 int1_i     => int1_i(i), 
  197.                 t0_i       => all_t0_i(i),
  198.                 t1_i       => all_t1_i(i), 
  199.                 tmod_i     => s_all_tmod((8*i)+7 downto i*8),
  200.                 tcon_tr0_i => s_all_tcon_tr0(i),
  201.                 tcon_tr1_i => s_all_tcon_tr1(i),
  202.                 reload_i   => s_all_reload((8*i)+7 downto i*8),
  203.                 wt_en_i    => s_all_wt_en(i),
  204.                 wt_i       => s_all_wt((2*i)+1 downto i*2),
  205.                                          -- tmr_ctr outputs
  206.                 th0_o      => s_all_th0((8*i)+7 downto i*8),
  207.                 tl0_o      => s_all_tl0((8*i)+7 downto i*8),
  208.                 th1_o      => s_all_th1((8*i)+7 downto i*8),
  209.                 tl1_o      => s_all_tl1((8*i)+7 downto i*8),
  210.                 tf0_o      => s_all_tf0(i),
  211.                 tf1_o      => s_all_tf1(i));
  212.   end generate;
  213.   
  214. end struc;