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

Subversion Repositories plasma_fpu

[/] [plasma_fpu/] [trunk/] [src/] [fpu/] [plasma_fpu.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 __alexs__
-- --------------------------------------------------------------------------
2
-- >>>>>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
3
-- --------------------------------------------------------------------------
4
-- TITLE:       Plasma Coprocessor 1
5
-- AUTHORS:     Maximilian Reuter (maximilian.reuter@fs-etit.de)
6
--              Alex Schoenberger (Alex.Schoenberger@ies.tu-darmstadt.de)
7
-- COMMENT:     This project is based on Plasma CPU core by Steve Rhoads
8
--
9
-- www.ies.tu-darmstadt.de
10
-- TU Darmstadt
11
-- Institute for Integrated Systems
12
-- Merckstr. 25
13
-- 
14
-- 64283 Darmstadt - GERMANY
15
-- --------------------------------------------------------------------------
16
-- PROJECT:       Plasma CPU core with FPU
17
-- FILENAME:      plasma_fpu.vhd
18
-- --------------------------------------------------------------------------
19
-- COPYRIGHT: 
20
--  This project is distributed by GPLv2.0
21
--  Software placed into the public domain by the author.
22
--  Software 'as is' without warranty.  Author liable for nothing.
23
-- --------------------------------------------------------------------------
24
-- DESCRIPTION:
25
--    top of MIPS Coprocessor I - FPU
26
--
27
--    SYNTHESIZABLE
28
--
29
----------------------------------------------------------------------------
30
-- Revision History
31
-- --------------------------------------------------------------------------
32
-- Revision   Date    Author     CHANGES
33
-- 1.0      9/2014    AS         initial
34
-- --------------------------------------------------------------------------
35
library IEEE;
36
  use IEEE.std_logic_1164.ALL;
37
 
38
library PLASMA;
39
  use PLASMA.mips_instruction_set.ALL;
40
  use PLASMA.plasma_pack.ALL;
41
 
42
entity plasma_fpu is
43
    generic(
44
      DEBUG_FLAG              : string  := "OF"
45
    );
46
    port(
47
      -- general
48
      control                 : in  t_main_control;
49
      -- operation and regbank
50
      fpu_reg_addr            : in  t_reg_addr;
51
      fpu_ctrl                : in  t_fpu_ctrl;
52
      -- status
53
      busy                    : out std_logic;
54
      cc_out                  : out std_logic;
55
      -- data muxes
56
      fpu_id_sel              : in  t_fpu_select;
57
      fpu_mem_sel             : in  t_fpu_select;
58
      -- data
59
      -- IF/ID stage
60
      data_to_fpu             : in  t_plasma_word;
61
      data_from_fpu           : out t_plasma_word;
62
      -- MEM stage
63
      data_to_fpu_mem         : in  t_plasma_word
64
    );
65
end entity plasma_fpu;
66
 
67
 
68
 
69
architecture behav_plasma_fpu of plasma_fpu is
70
 
71
  --
72
  -- ALU flags
73
  --
74
  signal alu_cause      : t_fpu_flags;
75
 
76
  --
77
  -- comparator output
78
  --
79
  signal comp_out       : std_logic;
80
 
81
  --
82
  -- data from/to register bank
83
  --
84
  signal reg_rs_out     : t_plasma_dword;
85
  signal reg_rt_out     : t_plasma_dword;
86
  signal reg_data_in    : t_plasma_dword;
87
 
88
  --
89
  -- alu input/output
90
  --
91
  signal fpu_alu_a_in   : t_plasma_dword;
92
  signal fpu_alu_out    : t_plasma_dword;
93
 
94
  --
95
  -- architecture choice
96
  --
97
  for u1_fpu_reg_bank: plasma_fpu_reg_bank    use entity PLASMA.plasma_fpu_reg_bank(structure_plasma_fpu_reg_bank);
98
  for u2_fpu_alu:      plasma_fpu_alu         use entity PLASMA.plasma_fpu_alu(fphdl_plasma_fpu_alu);
99
  for u3_fpu_comp:     plasma_fpu_comparator  use entity PLASMA.plasma_fpu_comparator(behav_plasma_fpu_comparator);
100
 
101
begin
102
  -- ___  ____ ___ ____    _  _ _  _ _  _ ____ ____ 
103
  -- |  \ |__|  |  |__|    |\/| |  |  \/  |___ [__  
104
  -- |__/ |  |  |  |  |    |  | |__| _/\_ |___ ___] 
105
  --
106
  -- IF/ID stage mux
107
  --
108
  with fpu_id_sel select
109
    fpu_alu_a_in      <=  PLASMA_ZERO_WORD & data_to_fpu      when FPU_DATA_CORE,
110
                          reg_rs_out                          when others;
111
 
112
  --
113
  -- MEM stage mux
114
  --
115
  with fpu_mem_sel select
116
    reg_data_in      <=   PLASMA_ZERO_WORD & data_to_fpu_mem  when FPU_DATA_CORE,
117
                          fpu_alu_out                         when others;
118
 
119
  -- ____ ____ _  _ ___  ____ _  _ ____ _  _ ___ ____ 
120
  -- |    |  | |\/| |__] |  | |\ | |___ |\ |  |  [__  
121
  -- |___ |__| |  | |    |__| | \| |___ | \|  |  ___] 
122
  --
123
  -- REGISTER BANK
124
  --
125
  u1_fpu_reg_bank: plasma_fpu_reg_bank
126
    GENERIC MAP( DEBUG_FLAG => DEBUG_FLAG )
127
    PORT MAP(
128
      control         => control,
129
 
130
      reg_addr        => fpu_reg_addr,  fpu_ctrl  => fpu_ctrl,
131
 
132
      alu_cause       => alu_cause,     comp_out  => comp_out,
133
      cc_out          => cc_out,
134
 
135
      reg_dest_new    => reg_data_in,
136
      reg_source_out  => reg_rs_out,    reg_target_out  => reg_rt_out
137
    );
138
 
139
  --
140
  -- ALU
141
  --
142
  u2_fpu_alu: plasma_fpu_alu
143
    PORT MAP(
144
      control         => control,
145
 
146
      alu_a_in        => fpu_alu_a_in,  alu_b_in    => reg_rt_out,
147
 
148
      fpu_ctrl        => fpu_ctrl,      round_mode  => "00",
149
 
150
      cause_e         => open,          cause       => alu_cause,
151
 
152
      alu_out         => fpu_alu_out
153
    );
154
 
155
  --
156
  -- COMPARATOR
157
  --
158
  u3_fpu_comp: plasma_fpu_comparator
159
    PORT MAP(
160
      comp_a_in       => fpu_alu_a_in,  comp_b_in   => reg_rt_out,
161
 
162
      fpu_ctrl        => fpu_ctrl,
163
 
164
      comp_out        => comp_out
165
    );
166
 
167
  -- ____ _  _ ___ ___  _  _ ___ 
168
  -- |  | |  |  |  |__] |  |  |  
169
  -- |__| |__|  |  |    |__|  |  
170
  --
171
  -- data to main core
172
  --
173
  data_from_fpu       <= reg_rs_out(PLASMA_DATA_WIDTH - 1 downto 0);
174
 
175
  --
176
  -- DELAY emulation
177
  --
178
  busy                <= '0';         -- no DELAY emulation
179
 
180
end architecture behav_plasma_fpu;

powered by: WebSVN 2.1.0

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