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

Subversion Repositories cowgirl

[/] [cowgirl/] [trunk/] [cowgirl.vhdl] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 thebeekeep
-- here's the whole thing
2
 
3
-- on 22 mar i did something strange.  i took the pc off the clock and made it
4
-- transition on the signal next_instr from the control unit.  that way, the
5
-- states will get the correct instruction
6
 
7
library ieee;
8
use ieee.std_logic_1164.all;
9
 
10
entity cowgirl is
11
 
12
  port (
13
    clk    : in  std_logic;                       -- system clock
14
    reset  : in  std_logic;                       -- system reset
15
    to_ram : out std_logic_vector(15 downto 0));   -- write to RAM
16
end cowgirl;
17
 
18
architecture cowgirl_arch of cowgirl is
19
 
20
  component alu
21
    port (
22
      a       : in std_logic_vector(15 downto 0);
23
      b       : in std_logic_vector(15 downto 0);
24
      a_or_l  : in std_logic;
25
      op      : in std_logic_vector(2 downto 0);
26
      o       : out std_logic_vector(15 downto 0));
27
  end component;
28
 
29
  component pc
30
    port (
31
      reset : in  std_logic;
32
      clk   : in  std_logic;
33
      load  : in  std_logic;
34
      d     : in  std_logic_vector(15 downto 0);
35
      c     : out std_logic_vector(15 downto 0));
36
  end component;
37
 
38
  component registers
39
    port (
40
      d      : in  std_logic_vector(15 downto 0);
41
      clk    : in  std_logic;
42
      addr_a : in  std_logic_vector(2 downto 0);
43
      addr_b : in  std_logic_vector(2 downto 0);
44
      wr_en  : in  std_logic;
45
      a_o    : out std_logic_vector(15 downto 0);
46
      b_o    : out std_logic_vector(15 downto 0));
47
  end component;
48
 
49
  component shifter
50
    port (
51
      n_shift : in  std_logic_vector(7 downto 0);
52
      sh_type : in  std_logic_vector(1 downto 0);
53
      data    : in  std_logic_vector(15 downto 0);
54
      o       : out std_logic_vector(15 downto 0));
55
  end component;
56
 
57
  component control
58
    port (
59
      instr     : in  std_logic_vector(15 downto 0);
60
      clk       : in  std_logic;
61
      reset     : in  std_logic;
62
      mem_ready : in  std_logic;
63
      a_or_l    : out std_logic;
64
      op        : out std_logic_vector(2 downto 0);
65
      addr_a    : out std_logic_vector(2 downto 0);
66
      addr_b    : out std_logic_vector(2 downto 0);
67
      reg_addr  : out std_logic_vector(2 downto 0);
68
      to_regs   : out std_logic_vector(15 downto 0);
69
      to_pc     : out std_logic_vector(15 downto 0);
70
      load_pc   : out std_logic;
71
      reg_wr    : out std_logic;
72
      alu_or_imm: out std_logic;
73
      next_instr: out std_logic;
74
      curr_state: out std_logic_vector(15 downto 0));
75
  end component;
76
 
77
  component mux_2_1
78
    port (
79
      a   : in  std_logic_vector(15 downto 0);
80
      b   : in  std_logic_vector(15 downto 0);
81
      sel : in  std_logic;
82
      o   : out std_logic_vector(15 downto 0));
83
  end component;
84
 
85
  component prog_rom
86
    port (
87
      input  : in  std_logic_vector(15 downto 0);
88
      output : out std_logic_vector(15 downto 0));
89
  end component;
90
 
91
  -- here are my internal signals
92
  signal reg_a_out, reg_b_out, alu_out, pc_to_rom, rom_out, immediate, reg_val : std_logic_vector(15 downto 0);
93
  signal control_to_pc, curr_state : std_logic_vector(15 downto 0);
94
  signal address_a, address_b, alu_opcode, reg_wr_addr : std_logic_vector(2 downto 0);
95
  signal write_regs, a_or_l, load_pc, mem_ready, alu_or_imm, pc_clock : std_logic;
96
 
97
 
98
begin  -- cowgirl_arch
99
 
100
  regs: registers
101
    port map (d => reg_val, clk => clk, addr_a => address_a, addr_b => address_b, wr_en => write_regs, a_o => reg_a_out, b_o => reg_b_out);
102
  abacus: alu
103
    port map (reg_a_out, reg_b_out, a_or_l, alu_opcode, alu_out);
104
  program_counter: pc
105
    port map (reset, pc_clock, load_pc, reg_a_out, pc_to_rom);
106
  program_rom: prog_rom
107
    port map (pc_to_rom, rom_out);
108
  reg_mux: mux_2_1
109
    port map (alu_out, immediate, alu_or_imm, reg_val);
110
  brain: control
111
    port map (rom_out, clk, reset, mem_ready, a_or_l, alu_opcode, address_a, address_b, reg_wr_addr, immediate, control_to_pc, load_pc, write_regs, alu_or_imm, pc_clock, curr_state);
112
 
113
end cowgirl_arch;

powered by: WebSVN 2.1.0

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