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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [riverlib/] [river_cfg.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
-----------------------------------------------------------------------------
2
--! @file
3
--! @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
--! @author    Sergey Khabarov - sergeykhbr@gmail.com
5
--! @brief     "River" CPU internal configuration parameters that don't 
6
--!            depend of external bus.
7
-----------------------------------------------------------------------------
8
 
9
--! Standard library.
10
library ieee;
11
use ieee.std_logic_1164.all;
12
use ieee.numeric_std.all;
13
library commonlib;
14
use commonlib.types_common.all;
15
 
16
--! @brief   Library global parameters.
17
package river_cfg is
18
 
19
  --! Architecture size difinition.
20
  constant RISCV_ARCH : integer := 64;
21
 
22
  --! @name System bus parameters
23
  --! @brief Constants specify AXI bus global settigns
24
  --! @{
25
 
26
  --! @brief   Address bus bit-size.
27
  constant BUS_ADDR_WIDTH : integer := 32;
28
  --! @brief   Data bus bit-size.
29
  constant BUS_DATA_WIDTH : integer := 64;
30
  --! @brief   Num of data bytes per transaction.
31
  constant BUS_DATA_BYTES : integer := BUS_DATA_WIDTH / 8;
32
  --! @}
33
 
34
  --! @name   Encoded Memory operation size values
35
  --! @{
36
 
37
  constant MEMOP_8B : std_logic_vector(1 downto 0) := "11";
38
  constant MEMOP_4B : std_logic_vector(1 downto 0) := "10";
39
  constant MEMOP_2B : std_logic_vector(1 downto 0) := "01";
40
  constant MEMOP_1B : std_logic_vector(1 downto 0) := "00";
41
  --! @}
42
 
43
  constant RESET_VECTOR : std_logic_vector(BUS_ADDR_WIDTH-1 downto 0) := X"00000040";
44
  constant DBG_FETCH_TRACE_SIZE : integer := 4;
45
 
46
  --! Number of elements each 2*CFG_ADDR_WIDTH in stack trace buffer, 0 = disabled
47
  constant CFG_STACK_TRACE_BUF_SIZE : integer := 32;
48
 
49
  --! @name   Integer Registers specified by ISA
50
  --! @{
51
    constant Reg_Zero : integer := 0;
52
    constant Reg_ra : integer := 1;       -- [1] Return address
53
    constant Reg_sp : integer := 2;       -- [2] Stack pointer
54
    constant Reg_gp : integer := 3;       -- [3] Global pointer
55
    constant Reg_tp : integer := 4;       -- [4] Thread pointer
56
    constant Reg_t0 : integer := 5;       -- [5] Temporaries 0 s3
57
    constant Reg_t1 : integer := 6;       -- [6] Temporaries 1 s4
58
    constant Reg_t2 : integer := 7;       -- [7] Temporaries 2 s5
59
    constant Reg_s0 : integer := 8;       -- [8] s0/fp Saved register/frame pointer
60
    constant Reg_s1 : integer := 9;       -- [9] Saved register 1
61
    constant Reg_a0 : integer := 10;      -- [10] Function argumentes 0
62
    constant Reg_a1 : integer := 11;      -- [11] Function argumentes 1
63
    constant Reg_a2 : integer := 12;      -- [12] Function argumentes 2
64
    constant Reg_a3 : integer := 13;      -- [13] Function argumentes 3
65
    constant Reg_a4 : integer := 14;      -- [14] Function argumentes 4
66
    constant Reg_a5 : integer := 15;      -- [15] Function argumentes 5
67
    constant Reg_a6 : integer := 16;      -- [16] Function argumentes 6
68
    constant Reg_a7 : integer := 17;      -- [17] Function argumentes 7
69
    constant Reg_s2 : integer := 18;      -- [18] Saved register 2
70
    constant Reg_s3 : integer := 19;      -- [19] Saved register 3
71
    constant Reg_s4 : integer := 20;      -- [20] Saved register 4
72
    constant Reg_s5 : integer := 21;      -- [21] Saved register 5
73
    constant Reg_s6 : integer := 22;      -- [22] Saved register 6
74
    constant Reg_s7 : integer := 23;      -- [23] Saved register 7
75
    constant Reg_s8 : integer := 24;      -- [24] Saved register 8
76
    constant Reg_s9 : integer := 25;      -- [25] Saved register 9
77
    constant Reg_s10 : integer := 26;     -- [26] Saved register 10
78
    constant Reg_s11 : integer := 27;     -- [27] Saved register 11
79
    constant Reg_t3 : integer := 28;      -- [28] 
80
    constant Reg_t4 : integer := 29;      -- [29] 
81
    constant Reg_t5 : integer := 30;      -- [30] 
82
    constant Reg_t6 : integer := 31;      -- [31] 
83
    constant Reg_Total : integer := 32;
84
  --! @}
85
 
86
  --! @name   Instruction formats specified by ISA specification
87
  --! @{
88
  constant ISA_R_type : integer := 0;
89
  constant ISA_I_type : integer := 1;
90
  constant ISA_S_type : integer := 2;
91
  constant ISA_SB_type : integer := 3;
92
  constant ISA_U_type : integer := 4;
93
  constant ISA_UJ_type : integer := 5;
94
  constant ISA_Total : integer := 6;
95
  --! @}
96
 
97
 
98
  --! @name   Implemented instruction list and its indexes
99
  --! @{
100
  constant Instr_ADD : integer := 0;
101
  constant Instr_ADDI : integer := 1;
102
  constant Instr_ADDIW : integer := 2;
103
  constant Instr_ADDW : integer := 3;
104
  constant Instr_AND : integer := 4;
105
  constant Instr_ANDI : integer := 5;
106
  constant Instr_AUIPC : integer := 6;
107
  constant Instr_BEQ : integer := 7;
108
  constant Instr_BGE : integer := 8;
109
  constant Instr_BGEU : integer := 9;
110
  constant Instr_BLT : integer := 10;
111
  constant Instr_BLTU : integer := 11;
112
  constant Instr_BNE : integer := 12;
113
  constant Instr_JAL : integer := 13;
114
  constant Instr_JALR : integer := 14;
115
  constant Instr_LB : integer := 15;
116
  constant Instr_LH : integer := 16;
117
  constant Instr_LW : integer := 17;
118
  constant Instr_LD : integer := 18;
119
  constant Instr_LBU : integer := 19;
120
  constant Instr_LHU : integer := 20;
121
  constant Instr_LWU : integer := 21;
122
  constant Instr_LUI : integer := 22;
123
  constant Instr_OR : integer := 23;
124
  constant Instr_ORI : integer := 24;
125
  constant Instr_SLLI : integer := 25;
126
  constant Instr_SLT : integer := 26;
127
  constant Instr_SLTI : integer := 27;
128
  constant Instr_SLTU : integer := 28;
129
  constant Instr_SLTIU : integer := 29;
130
  constant Instr_SLL : integer := 30;
131
  constant Instr_SLLW : integer := 31;
132
  constant Instr_SLLIW : integer := 32;
133
  constant Instr_SRA : integer := 33;
134
  constant Instr_SRAW : integer := 34;
135
  constant Instr_SRAI : integer := 35;
136
  constant Instr_SRAIW : integer := 36;
137
  constant Instr_SRL : integer := 37;
138
  constant Instr_SRLI : integer := 38;
139
  constant Instr_SRLIW : integer := 39;
140
  constant Instr_SRLW : integer := 40;
141
  constant Instr_SB : integer := 41;
142
  constant Instr_SH : integer := 42;
143
  constant Instr_SW : integer := 43;
144
  constant Instr_SD : integer := 44;
145
  constant Instr_SUB : integer := 45;
146
  constant Instr_SUBW : integer := 46;
147
  constant Instr_XOR : integer := 47;
148
  constant Instr_XORI : integer := 48;
149
  constant Instr_CSRRW : integer := 49;
150
  constant Instr_CSRRS : integer := 50;
151
  constant Instr_CSRRC : integer := 51;
152
  constant Instr_CSRRWI : integer := 52;
153
  constant Instr_CSRRCI : integer := 53;
154
  constant Instr_CSRRSI : integer := 54;
155
  constant Instr_URET : integer := 55;
156
  constant Instr_SRET : integer := 56;
157
  constant Instr_HRET : integer := 57;
158
  constant Instr_MRET : integer := 58;
159
  constant Instr_FENCE : integer := 59;
160
  constant Instr_FENCE_I : integer := 60;
161
  constant Instr_DIV : integer := 61;
162
  constant Instr_DIVU : integer := 62;
163
  constant Instr_DIVW : integer := 63;
164
  constant Instr_DIVUW : integer := 64;
165
  constant Instr_MUL : integer := 65;
166
  constant Instr_MULW : integer := 66;
167
  constant Instr_REM : integer := 67;
168
  constant Instr_REMU : integer := 68;
169
  constant Instr_REMW : integer := 69;
170
  constant Instr_REMUW : integer := 70;
171
  constant Instr_ECALL : integer := 71;
172
  constant Instr_EBREAK : integer := 72;
173
  constant Instr_Total : integer := 73;
174
  --! @}
175
 
176
  --! @name PRV bits possible values:
177
  --!
178
  --! @{
179
  --! User-mode
180
  constant PRV_U : std_logic_vector(1 downto 0) := "00";
181
  --! super-visor mode
182
  constant PRV_S : std_logic_vector(1 downto 0) := "01";
183
  --! hyper-visor mode
184
  constant PRV_H : std_logic_vector(1 downto 0) := "10";
185
  --! machine mode
186
  constant PRV_M : std_logic_vector(1 downto 0) := "11";
187
  --! @}
188
 
189
 
190
  --! @name CSR registers.
191
  --!
192
  --! @{
193
 
194
  -- ISA and extensions supported.
195
  constant CSR_misa              : std_logic_vector(11 downto 0) := X"f10";
196
  -- Vendor ID.
197
  constant CSR_mvendorid         : std_logic_vector(11 downto 0) := X"f11";
198
  -- Architecture ID.
199
  constant CSR_marchid           : std_logic_vector(11 downto 0) := X"f12";
200
  -- Vendor ID.
201
  constant CSR_mimplementationid : std_logic_vector(11 downto 0) := X"f13";
202
  -- Thread id (the same as core).
203
  constant CSR_mhartid           : std_logic_vector(11 downto 0) := X"f14";
204
  -- Machine wall-clock time
205
  constant CSR_mtime         : std_logic_vector(11 downto 0) := X"701";
206
  -- Software reset.
207
  constant CSR_mreset        : std_logic_vector(11 downto 0) := X"782";
208
 
209
  -- machine mode status read/write register.
210
  constant CSR_mstatus       : std_logic_vector(11 downto 0) := X"300";
211
  -- Machine exception delegation
212
  constant CSR_medeleg       : std_logic_vector(11 downto 0) := X"302";
213
  -- Machine interrupt delegation
214
  constant CSR_mideleg       : std_logic_vector(11 downto 0) := X"303";
215
  -- Machine interrupt enable
216
  constant CSR_mie           : std_logic_vector(11 downto 0) := X"304";
217
  -- The base address of the M-mode trap vector.
218
  constant CSR_mtvec         : std_logic_vector(11 downto 0) := X"305";
219
  -- Machine wall-clock timer compare value.
220
  constant CSR_mtimecmp      : std_logic_vector(11 downto 0) := X"321";
221
  -- Scratch register for machine trap handlers.
222
  constant CSR_mscratch      : std_logic_vector(11 downto 0) := X"340";
223
  -- Exception program counters.
224
  constant CSR_uepc          : std_logic_vector(11 downto 0) := X"041";
225
  constant CSR_sepc          : std_logic_vector(11 downto 0) := X"141";
226
  constant CSR_hepc          : std_logic_vector(11 downto 0) := X"241";
227
  constant CSR_mepc          : std_logic_vector(11 downto 0) := X"341";
228
  -- Machine trap cause
229
  constant CSR_mcause        : std_logic_vector(11 downto 0) := X"342";
230
  -- Machine bad address.
231
  constant CSR_mbadaddr      : std_logic_vector(11 downto 0) := X"343";
232
  -- Machine interrupt pending
233
  constant CSR_mip           : std_logic_vector(11 downto 0) := X"344";
234
  --! @}
235
 
236
  --! @name   Exceptions
237
  --! @{
238
  -- Instruction address misaligned
239
  constant EXCEPTION_InstrMisalign   : std_logic_vector(3 downto 0) := X"0";
240
  -- Instruction access fault
241
  constant EXCEPTION_InstrFault      : std_logic_vector(3 downto 0) := X"1";
242
  -- Illegal instruction
243
  constant EXCEPTION_InstrIllegal    : std_logic_vector(3 downto 0) := X"2";
244
  -- Breakpoint
245
  constant EXCEPTION_Breakpoint      : std_logic_vector(3 downto 0) := X"3";
246
  -- Load address misaligned
247
  constant EXCEPTION_LoadMisalign    : std_logic_vector(3 downto 0) := X"4";
248
  -- Load access fault
249
  constant EXCEPTION_LoadFault       : std_logic_vector(3 downto 0) := X"5";
250
  -- Store/AMO address misaligned
251
  constant EXCEPTION_StoreMisalign   : std_logic_vector(3 downto 0) := X"6";
252
  -- Store/AMO access fault
253
  constant EXCEPTION_StoreFault      : std_logic_vector(3 downto 0) := X"7";
254
  -- Environment call from U-mode
255
  constant EXCEPTION_CallFromUmode   : std_logic_vector(3 downto 0) := X"8";
256
  -- Environment call from S-mode
257
  constant EXCEPTION_CallFromSmode   : std_logic_vector(3 downto 0) := X"9";
258
  -- Environment call from H-mode
259
  constant EXCEPTION_CallFromHmode   : std_logic_vector(3 downto 0) := X"A";
260
  -- Environment call from M-mode
261
  constant EXCEPTION_CallFromMmode   : std_logic_vector(3 downto 0) := X"B";
262
  --! @}
263
 
264
  --! @name   Interrupts
265
  --! @{
266
  -- User software interrupt
267
  constant INTERRUPT_USoftware       : std_logic_vector(3 downto 0) := X"0";
268
  -- Superuser software interrupt
269
  constant INTERRUPT_SSoftware       : std_logic_vector(3 downto 0) := X"1";
270
  -- Hypervisor software itnerrupt
271
  constant INTERRUPT_HSoftware       : std_logic_vector(3 downto 0) := X"2";
272
  -- Machine software interrupt
273
  constant INTERRUPT_MSoftware       : std_logic_vector(3 downto 0) := X"3";
274
  -- User timer interrupt
275
  constant INTERRUPT_UTimer          : std_logic_vector(3 downto 0) := X"4";
276
  -- Superuser timer interrupt
277
  constant INTERRUPT_STimer          : std_logic_vector(3 downto 0) := X"5";
278
  -- Hypervisor timer interrupt
279
  constant INTERRUPT_HTimer          : std_logic_vector(3 downto 0) := X"6";
280
  -- Machine timer interrupt
281
  constant INTERRUPT_MTimer          : std_logic_vector(3 downto 0) := X"7";
282
  -- User external interrupt
283
  constant INTERRUPT_UExternal       : std_logic_vector(3 downto 0) := X"8";
284
  -- Superuser external interrupt
285
  constant INTERRUPT_SExternal       : std_logic_vector(3 downto 0) := X"9";
286
  -- Hypervisor external interrupt
287
  constant INTERRUPT_HExternal       : std_logic_vector(3 downto 0) := X"A";
288
  -- Machine external interrupt (from PLIC)
289
  constant INTERRUPT_MExternal       : std_logic_vector(3 downto 0) := X"B";
290
  --! @}
291
 
292
 
293
  --! @param[in] i_clk             CPU clock
294
  --! @param[in] i_nrst            Reset. Active LOW.
295
  --! @param[in] i_req_mem_fire    Memory request was accepted
296
  --! @param[in] i_resp_mem_valid  Memory response from ICache is valid
297
  --! @param[in] i_resp_mem_addr   Memory response address
298
  --! @param[in] i_resp_mem_data   Memory response value
299
  --! @param[in] i_f_predic_miss   Fetch modul detects deviation between predicted and valid pc.
300
  --! @param[in] i_e_npc           Valid instruction value awaited by 'Executor'
301
  --! @param[in] i_ra              Return address register value
302
  --! @param[out] o_npc_predic     Predicted next instruction address
303
  component BranchPredictor is
304
  port (
305
    i_clk : in std_logic;
306
    i_nrst : in std_logic;
307
    i_req_mem_fire : in std_logic;
308
    i_resp_mem_valid : in std_logic;
309
    i_resp_mem_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
310
    i_resp_mem_data : in std_logic_vector(31 downto 0);
311
    i_f_predic_miss : in std_logic;
312
    i_e_npc : in std_logic_vector(31 downto 0);
313
    i_ra : in std_logic_vector(RISCV_ARCH-1 downto 0);
314
    o_npc_predict : out std_logic_vector(31 downto 0)
315
  );
316
  end component;
317
 
318
  --! @param[in] i_clk          CPU clock
319
  --! @param[in] i_nrst         Reset. Active LOW.
320
  --! @param[in] i_xret         XRet instruction signals mode switching
321
  --! @param[in] i_addr         CSR address, if xret=1 switch mode accordingly
322
  --! @param[in] i_wena         Write enable
323
  --! @param[in] i_wdata        CSR writing value
324
  --! @param[out] o_rdata       CSR read value
325
  --! @param[in] i_break_mode   Behaviour on EBREAK instruction: 0 = halt; 1 = generate trap
326
  --! @param[in] i_breakpoint   Breakpoint (Trap or not depends of mode)
327
  --! @param[in] i_trap_ena     Trap pulse
328
  --! @param[in] i_trap_code    bit[4] : 1=interrupt; 0=exception; bits[3:0]=code
329
  --! @param[in] i_trap_pc      trap on pc
330
  --! @param[out] o_ie          Interrupt enable bit
331
  --! @param[out] o_mode        CPU mode
332
  --! @param[out] o_mtvec       Interrupt descriptors table
333
  --! @param[in] i_dport_ena    Debug port request is enabled
334
  --! @param[in] i_dport_write  Debug port Write enable
335
  --! @param[in] i_dport_addr   Debug port CSR address
336
  --! @param[in] i_dport_wdata  Debug port CSR writing value
337
  --! @param[out] o_dport_rdata Debug port CSR read value
338
  component CsrRegs is
339
  port (
340
    i_clk : in std_logic;
341
    i_nrst : in std_logic;
342
    i_xret : in std_logic;
343
    i_addr : in std_logic_vector(11 downto 0);
344
    i_wena : in std_logic;
345
    i_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
346
    o_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
347
    i_break_mode : in std_logic;
348
    i_breakpoint : in std_logic;
349
    i_trap_ena : in std_logic;
350
    i_trap_code : in std_logic_vector(4 downto 0);
351
    i_trap_pc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
352
    o_ie : out std_logic;
353
    o_mode : out std_logic_vector(1 downto 0);
354
    o_mtvec : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
355
    i_dport_ena : in std_logic;
356
    i_dport_write : in std_logic;
357
    i_dport_addr : in std_logic_vector(11 downto 0);
358
    i_dport_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
359
    o_dport_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0)
360
  );
361
  end component;
362
 
363
  --! @param[in] i_clk CPU clock
364
  --! @param[in] i_nrst Reset. Active LOW.
365
  --! @param[in] i_any_hold Hold pipeline by any reason
366
  --! @param[in] i_f_valid Fetch input valid
367
  --! @param[in] i_f_pc Fetched pc
368
  --! @param[in] i_f_instr Fetched instruction value
369
  --! @param[out] o_valid Current output values are valid
370
  --! @param[out] o_pc Current instruction pointer value
371
  --! @param[out] o_instr Current instruction value
372
  --! @param[out] o_memop_store Store to memory operation
373
  --! @param[out] o_memop_load Load from memoru operation
374
  --! @param[out] o_memop_sign_ext Load memory value with sign extending
375
  --! @param[out] o_memop_size Memory transaction size
376
  --! @param[out] o_rv32 32-bits instruction
377
  --! @param[out] o_compressed 16-bits instruction (C-extension)
378
  --! @param[out] o_insigned_op Unsigned operands
379
  --! @param[out] o_isa_type Instruction format accordingly with ISA
380
  --! @param[out] o_instr_vec One bit per decoded instruction bus
381
  --! @param[out] o_exception Unimplemented instruction
382
  component InstrDecoder is
383
  port (
384
    i_clk  : in std_logic;
385
    i_nrst : in std_logic;
386
    i_any_hold : in std_logic;
387
    i_f_valid : in std_logic;
388
    i_f_pc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
389
    i_f_instr : in std_logic_vector(31 downto 0);
390
    o_valid : out std_logic;
391
    o_pc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
392
    o_instr : out std_logic_vector(31 downto 0);
393
    o_memop_store : out std_logic;
394
    o_memop_load : out std_logic;
395
    o_memop_sign_ext : out std_logic;
396
    o_memop_size : out std_logic_vector(1 downto 0);
397
    o_rv32 : out std_logic;
398
    o_compressed : out std_logic;
399
    o_unsigned_op : out std_logic;
400
    o_isa_type : out std_logic_vector(ISA_Total-1 downto 0);
401
    o_instr_vec : out std_logic_vector(Instr_Total-1 downto 0);
402
    o_exception : out std_logic
403
  );
404
  end component;
405
 
406
 
407
  --! @param[in] i_clk  
408
  --! @param[in] i_nrst Reset active LOW
409
  --! @param[in] i_pipeline_hold Hold execution by any reason
410
  --! @param[in] i_d_valid Decoded instruction is valid
411
  --! @param[in] i_d_pc Instruction pointer on decoded instruction
412
  --! @param[in] i_d_instr Decoded instruction value
413
  --! @param[in] i_wb_done write back done (Used to clear hazardness)
414
  --! @param[in] i_memop_store Store to memory operation
415
  --! @param[in] i_memop_load Load from memoru operation
416
  --! @param[in] i_memop_sign_ext Load memory value with sign extending
417
  --! @param[in] i_memop_size Memory transaction size
418
  --! @param[in] i_unsigned_op Unsigned operands
419
  --! @param[in] i_rv32 32-bits instruction
420
  --! @param[in] i_compressed 16-bits instruction (C-extension)
421
  --! @param[in] i_isa_type Type of the instruction's structure (ISA spec.)
422
  --! @param[in] i_ivec One pulse per supported instruction.
423
  --! @param[in] i_ie Interrupt enable bit
424
  --! @param[in] i_mtvec Interrupt descriptor table
425
  --! @param[in] i_mode Current processor mode
426
  --! @param[in] i_break_mode        Behaviour on EBREAK instruction: 0 = halt; 1 = generate trap
427
  --! @param[in] i_unsup_exception   Unsupported instruction exception
428
  --! @param[in] i_ext_irq           External interrupt from PLIC (todo: timer & software interrupts)
429
  --! @param[in] i_dport_npc_write   Write npc value from debug port
430
  --! @param[in] i_dport_npc         Debug port npc value to write
431
  --! @param[out] o_radr1 Integer register index 1
432
  --! @param[in] i_rdata1 Integer register value 1
433
  --! @param[out] o_radr2 Integer register index 2
434
  --! @param[in] i_rdata2 Integer register value 2
435
  --! @param[out] o_res_addr Address to store result of the instruction (0=do not store)
436
  --! @param[out] o_res_data Value to store
437
  --! @param[out] o_pipeline_hold Hold pipeline while 'writeback' not done or multi-clock instruction.
438
  --! @param[out] o_xret XRET instruction: MRET, URET or other.
439
  --! @param[out] o_csr_addr CSR address. 0 if not a CSR instruction with xret signals mode switching
440
  --! @param[out] o_csr_wena Write new CSR value
441
  --! @param[in] i_csr_rdata CSR current value
442
  --! @param[out] o_csr_wdata CSR new value
443
  --! @param[out] o_trap_ena Trap occurs  pulse
444
  --! @param[out] o_trap_code bit[4] : 1=interrupt; 0=exception; bits[3:0]=code
445
  --! @param[out] o_trap_pc trap on pc
446
  --! @param[out] o_memop_sign_ext Load data with sign extending
447
  --! @param[out] o_memop_load Load data instruction
448
  --! @param[out] o_memop_store Store data instruction
449
  --! @param[out] o_memop_size 0=1bytes; 1=2bytes; 2=4bytes; 3=8bytes
450
  --! @param[out] o_memop_addr  Memory access address
451
  --! @param[out] o_valid       Output is valid
452
  --! @param[out] o_pc          Valid instruction pointer
453
  --! @param[out] o_npc         Next instruction pointer. Next decoded pc must match to this value or will be ignored.
454
  --! @param[out] o_instr       Valid instruction value
455
  --! @param[out] o_breakpoint  ebreak instruction
456
  --! @param[out] o_call        CALL pseudo instruction detected
457
  --! @param[out] o_ret         RET pseudoinstruction detected
458
  component InstrExecute is
459
  port (
460
    i_clk  : in std_logic;
461
    i_nrst : in std_logic;
462
    i_pipeline_hold : in std_logic;
463
    i_d_valid : in std_logic;
464
    i_d_pc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
465
    i_d_instr : in std_logic_vector(31 downto 0);
466
    i_wb_done : in std_logic;
467
    i_memop_store : in std_logic;
468
    i_memop_load : in std_logic;
469
    i_memop_sign_ext : in std_logic;
470
    i_memop_size : in std_logic_vector(1 downto 0);
471
    i_unsigned_op : in std_logic;
472
    i_rv32 : in std_logic;
473
    i_compressed : in std_logic;
474
    i_isa_type : in std_logic_vector(ISA_Total-1 downto 0);
475
    i_ivec : in std_logic_vector(Instr_Total-1 downto 0);
476
    i_ie : in std_logic;
477
    i_mtvec : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
478
    i_mode : in std_logic_vector(1 downto 0);
479
    i_break_mode : in std_logic;
480
    i_unsup_exception : in std_logic;
481
    i_ext_irq : in std_logic;
482
    i_dport_npc_write : in std_logic;
483
    i_dport_npc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
484
    o_radr1 : out std_logic_vector(4 downto 0);
485
    i_rdata1 : in std_logic_vector(RISCV_ARCH-1 downto 0);
486
    o_radr2 : out std_logic_vector(4 downto 0);
487
    i_rdata2 : in std_logic_vector(RISCV_ARCH-1 downto 0);
488
    o_res_addr : out std_logic_vector(4 downto 0);
489
    o_res_data : out std_logic_vector(RISCV_ARCH-1 downto 0);
490
    o_pipeline_hold : out std_logic;
491
    o_xret : out std_logic;
492
    o_csr_addr : out std_logic_vector(11 downto 0);
493
    o_csr_wena : out std_logic;
494
    i_csr_rdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
495
    o_csr_wdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
496
    o_trap_ena : out std_logic;
497
    o_trap_code : out std_logic_vector(4 downto 0);
498
    o_trap_pc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
499
    o_memop_sign_ext : out std_logic;
500
    o_memop_load : out std_logic;
501
    o_memop_store : out std_logic;
502
    o_memop_size : out std_logic_vector(1 downto 0);
503
    o_memop_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
504
    o_valid : out std_logic;
505
    o_pc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
506
    o_npc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
507
    o_instr : out std_logic_vector(31 downto 0);
508
    o_breakpoint : out std_logic;
509
    o_call : out std_logic;
510
    o_ret : out std_logic
511
  );
512
  end component;
513
 
514
  --! @param[in] i_clk
515
  --! @param[in] i_nrst
516
  --! @param[in] i_pipeline_hold
517
  --! @param[in] i_mem_ready
518
  --! @param[out] o_mem_addr_valid
519
  --! @param[out] o_mem_addr
520
  --! @param[in] i_mem_data_valid
521
  --! @param[in] i_mem_data_addr
522
  --! @param[in] i_mem_data
523
  --! @param[out] o_mem_ready
524
  --! @param[in] i_e_npc
525
  --! @param[in] i_predict_npc
526
  --! @param[out] o_predict_miss
527
  --! @param[out] o_mem_req_fire    Used by branch predictor to form new npc value
528
  --! @param[out] o_valid
529
  --! @param[out] o_pc
530
  --! @param[out] o_instr
531
  --! @param[out] o_hold            Hold due no response from icache yet
532
  --! @param[in] i_br_fetch_valid   Fetch injection address/instr are valid
533
  --! @param[in] i_br_address_fetch Fetch injection address to skip ebreak instruciton only once
534
  --! @param[in] i_br_instr_fetch   Real instruction value that was replaced by ebreak
535
  --! @param[out] o_instr_buf
536
  component InstrFetch is
537
  port (
538
    i_clk  : in std_logic;
539
    i_nrst : in std_logic;
540
    i_pipeline_hold : in std_logic;
541
    i_mem_req_ready : in std_logic;
542
    o_mem_addr_valid : out std_logic;
543
    o_mem_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
544
    i_mem_data_valid : in std_logic;
545
    i_mem_data_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
546
    i_mem_data : in std_logic_vector(31 downto 0);
547
    o_mem_resp_ready : out std_logic;
548
    i_e_npc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
549
    i_predict_npc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
550
    o_predict_miss : out std_logic;
551
 
552
    o_mem_req_fire : out std_logic;
553
    o_valid : out std_logic;
554
    o_pc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
555
    o_instr : out std_logic_vector(31 downto 0);
556
    o_hold : out std_logic;
557
    i_br_fetch_valid : in std_logic;
558
    i_br_address_fetch : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
559
    i_br_instr_fetch : in std_logic_vector(31 downto 0);
560
    o_instr_buf : out std_logic_vector(DBG_FETCH_TRACE_SIZE*64-1 downto 0)
561
  );
562
  end component;
563
 
564
  --! @param[in] i_clk
565
  --! @param[in] i_nrst
566
  --! @param[in] i_e_valid Execution stage outputs are valid
567
  --! @param[in] i_e_pc Execution stage instruction pointer
568
  --! @param[in] i_e_instr Execution stage instruction value
569
  --! @param[in] i_res_addr Register address to be written (0=no writing)
570
  --! @param[in] i_res_data Register value to be written
571
  --! @param[in] i_memop_sign_ext Load data with sign extending (if less than 8 Bytes)
572
  --! @param[in] i_memop_load Load data from memory and write to i_res_addr
573
  --! @param[in] i_memop_store Store i_res_data value into memory
574
  --! @param[in] i_memop_size Encoded memory transaction size in bytes:
575
  --!                         0=1B; 1=2B; 2=4B; 3=8B
576
  --! @param[in] i_memop_addr Memory access address
577
  --! @param[out] o_wena Write enable signal
578
  --! @param[out] o_waddr Output register address (0 = x0 = no write)
579
  --! @param[out] o_wdata Register value
580
  --! @param[in] i_mem_req_read Memory request is acceptable
581
  --! @param[out] o_mem_valid Memory request is valid
582
  --! @param[out] o_mem_write Memory write request
583
  --! @param[out] o_mem_sz Encoded data size in bytes: 0=1B; 1=2B; 2=4B; 3=8B
584
  --! @param[out] o_mem_addr Data path requested address
585
  --! @param[out] o_mem_data Data path requested data (write transaction)
586
  --! @param[in] i_mem_data_valid Data path memory response is valid
587
  --! @param[in] i_mem_data_addr Data path memory response address
588
  --! @param[in] i_mem_data Data path memory response value
589
  --! @param[out] o_mem_resp_ready Data from DCache was accepted
590
  --! @param[out] o_hold Hold-on pipeline while memory operation not finished
591
  --! @param[out] o_valid Output is valid
592
  --! @param[out] o_pc Valid instruction pointer
593
  --! @param[out] o_instr Valid instruction value
594
  component MemAccess is
595
  port (
596
    i_clk  : in std_logic;
597
    i_nrst : in std_logic;
598
    i_e_valid : in std_logic;
599
    i_e_pc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
600
    i_e_instr : in std_logic_vector(31 downto 0);
601
    i_res_addr : in std_logic_vector(4 downto 0);
602
    i_res_data : in std_logic_vector(RISCV_ARCH-1 downto 0);
603
    i_memop_sign_ext : in std_logic;
604
    i_memop_load : in std_logic;
605
    i_memop_store : in std_logic;
606
    i_memop_size : in std_logic_vector(1 downto 0);
607
    i_memop_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
608
    o_wena : out std_logic;
609
    o_waddr : out std_logic_vector(4 downto 0);
610
    o_wdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
611
    i_mem_req_ready : in std_logic;
612
    o_mem_valid : out std_logic;
613
    o_mem_write : out std_logic;
614
    o_mem_sz : out std_logic_vector(1 downto 0);
615
    o_mem_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
616
    o_mem_data : out std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
617
    i_mem_data_valid : in std_logic;
618
    i_mem_data_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
619
    i_mem_data : in std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
620
    o_mem_resp_ready : out std_logic;
621
    o_hold : out std_logic;
622
    o_valid : out std_logic;
623
    o_pc : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
624
    o_instr : out std_logic_vector(31 downto 0)
625
  );
626
  end component;
627
 
628
  --! @param[in] i_clk CPU clock
629
  --! @param[in] i_nrst Reset. Active LOW.
630
  --! @param[in] i_radr1 Port 1 read address
631
  --! @param[out] o_rdata1 Port 1 read value
632
  --! @param[in] i_radr2 Port 2 read address
633
  --! @param[out] o_rdata2 Port 2 read value
634
  --! @param[in] i_waddr Writing value
635
  --! @param[in] i_wena Writing is enabled
636
  --! @param[in] i_wdata Writing value
637
  --! @param[in] i_dport_addr    Debug port address
638
  --! @param[in] i_dport_ena     Debug port is enabled
639
  --! @param[in] i_dport_write   Debug port write is enabled
640
  --! @param[in] i_dport_wdata   Debug port write value
641
  --! @param[out] o_dport_rdata  Debug port read value
642
  --! @param[out] o_ra           Return address for branch predictor
643
  component RegIntBank is
644
  port (
645
    i_clk : in std_logic;
646
    i_nrst : in std_logic;
647
    i_radr1 : in std_logic_vector(4 downto 0);
648
    o_rdata1 : out std_logic_vector(RISCV_ARCH-1 downto 0);
649
    i_radr2 : in std_logic_vector(4 downto 0);
650
    o_rdata2 : out std_logic_vector(RISCV_ARCH-1 downto 0);
651
    i_waddr : in std_logic_vector(4 downto 0);
652
    i_wena : in std_logic;
653
    i_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
654
    i_dport_addr : in std_logic_vector(4 downto 0);
655
    i_dport_ena : in std_logic;
656
    i_dport_write : in std_logic;
657
    i_dport_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
658
    o_dport_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
659
    o_ra : out std_logic_vector(RISCV_ARCH-1 downto 0)
660
  );
661
  end component;
662
 
663
  --! @param[in] i_clk            CPU clock
664
  --! @param[in] i_nrst           Reset. Active LOW.
665
  --! @param[in] i_dport_valid    Debug access from DSU is valid
666
  --! @param[in] i_dport_write    Write command flag
667
  --! @param[in] i_dport_region   Registers region ID: 0=CSR; 1=IREGS; 2=Control
668
  --! @param[in] i_dport_addr     Register idx
669
  --! @param[in] i_dport_wdata    Write value
670
  --! @param[out] o_dport_ready   Response is ready
671
  --! @param[out] o_dport_rdata   Response value
672
  --! @param[out] o_core_addr     Address of the sub-region register
673
  --! @param[out] o_core_wdata    Write data
674
  --! @param[out] o_csr_ena       Region 0: Access to CSR bank is enabled.
675
  --! @param[out] o_csr_write     Region 0: CSR write enable
676
  --! @param[in] i_csr_rdata      Region 0: CSR read value
677
  --! @param[out] o_ireg_ena      Region 1: Access to integer register bank is enabled
678
  --! @param[out] o_ireg_write    Region 1: Integer registers bank write pulse
679
  --! @param[out] o_npc_write     Region 1: npc write enable
680
  --! @param[in] i_ireg_rdata     Region 1: Integer register read value
681
  --! @param[in] i_pc             Region 1: Instruction pointer
682
  --! @param[in] i_npc            Region 1: Next Instruction pointer
683
  --! @param[in] i_e_valid        Stepping control signal
684
  --! @param[in] i_e_call         Pseudo-instruction CALL
685
  --! @param[in] i_e_ret          Pseudo-instruction RET
686
  --! @param[in] i_m_valid        To compute number of valid executed instruction
687
  --! @param[out] o_clock_cnt     Number of clocks excluding halt state
688
  --! @param[out] o_executed_cnt  Number of executed instructions
689
  --! @param[out] o_halt          Halt signal is equal to hold pipeline
690
  --! @param[in] i_ebreak            ebreak instruction decoded
691
  --! @param[out] o_break_mode       Behaviour on EBREAK instruction: 0 = halt; 1 = generate trap
692
  --! @param[out] o_br_fetch_valid   Fetch injection address/instr are valid
693
  --! @param[out] o_br_address_fetch Fetch injection address to skip ebreak instruciton only once
694
  --! @param[out] o_br_instr_fetch   Real instruction value that was replaced by ebreak
695
  --! @param[in] i_istate         ICache state machine value
696
  --! @param[in] i_dstate         DCache state machine value
697
  --! @param[in] i_instr_buf
698
  component DbgPort
699
  is port (
700
    i_clk : in std_logic;
701
    i_nrst : in std_logic;
702
    i_dport_valid : in std_logic;
703
    i_dport_write : in std_logic;
704
    i_dport_region : in std_logic_vector(1 downto 0);
705
    i_dport_addr : in std_logic_vector(11 downto 0);
706
    i_dport_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
707
    o_dport_ready : out std_logic;
708
    o_dport_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
709
    o_core_addr : out std_logic_vector(11 downto 0);
710
    o_core_wdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
711
    o_csr_ena : out std_logic;
712
    o_csr_write : out std_logic;
713
    i_csr_rdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
714
    o_ireg_ena : out std_logic;
715
    o_ireg_write : out std_logic;
716
    o_npc_write : out std_logic;
717
    i_ireg_rdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
718
    i_pc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
719
    i_npc : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
720
    i_e_valid : in std_logic;
721
    i_e_call : in std_logic;
722
    i_e_ret : in std_logic;
723
    i_m_valid : in std_logic;
724
    o_clock_cnt : out std_logic_vector(63 downto 0);
725
    o_executed_cnt : out std_logic_vector(63 downto 0);
726
    o_halt : out std_logic;
727
    i_ebreak : in std_logic;
728
    o_break_mode : out std_logic;
729
    o_br_fetch_valid : out std_logic;
730
    o_br_address_fetch : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
731
    o_br_instr_fetch : out std_logic_vector(31 downto 0);
732
    i_istate : in std_logic_vector(1 downto 0);
733
    i_dstate : in std_logic_vector(1 downto 0);
734
    i_cstate : in std_logic_vector(1 downto 0);
735
    i_instr_buf : in std_logic_vector(DBG_FETCH_TRACE_SIZE*64-1 downto 0)
736
  );
737
  end component;
738
 
739
  --! @brief CPU 5-stages pipeline top-level
740
  --! @param[in] i_clk             CPU clock
741
  --! @param[in] i_nrst            Reset. Active LOW.
742
  --! @param[in] i_req_ctrl_ready  ICache is ready to accept request
743
  --! @param[out] o_req_ctrl_valid Request to ICache is valid
744
  --! @param[out] o_req_ctrl_addr  Requesting address to ICache
745
  --! @param[in] i_resp_ctrl_valid ICache response is valid
746
  --! @param[in] i_resp_ctrl_addr  Response address must be equal to the latest request address
747
  --! @param[in] i_resp_ctrl_data  Read value
748
  --! @param[out] o_resp_ctrl_ready Response from ICache is accepted
749
  --! @param[in] i_req_data_ready  DCache is ready to accept request
750
  --! @param[out] o_req_data_valid Request to DCache is valid
751
  --! @param[out] o_req_data_write Read/Write transaction
752
  --! @param[out] o_req_data_size  Size [Bytes]: 0=1B; 1=2B; 2=4B; 3=8B
753
  --! @param[out] o_req_data_addr  Requesting address to DCache
754
  --! @param[out] o_req_data_data  Writing value
755
  --! @param[in] i_resp_data_valid DCache response is valid
756
  --! @param[in] i_resp_data_addr  DCache response address must be equal to the latest request address
757
  --! @param[in] i_resp_data_data  Read value
758
  --! @param[out] o_resp_data_ready Response drom DCache is accepted
759
  --! @param[in] i_ext_irq         PLIC interrupt accordingly with spec
760
  --! @param[out] o_time           Timer in clock except halt state
761
  --! @param[in] i_dport_valid     Debug access from DSU is valid
762
  --! @param[in] i_dport_write     Write command flag
763
  --! @param[in] i_dport_region    Registers region ID: 0=CSR; 1=IREGS; 2=Control
764
  --! @param[in] i_dport_addr      Register idx
765
  --! @param[in] i_dport_wdata     Write value
766
  --! @param[out] o_dport_ready    Response is ready
767
  --! @param[out] o_dport_rdata    Response value
768
  --! @param[in] i_istate          ICache state machine value
769
  --! @param[in] i_dstate          DCache state machine value
770
  --! @param[in] i_cstate          cachetop state machine value
771
  component Processor is
772
  port (
773
    i_clk : in std_logic;
774
    i_nrst : in std_logic;
775
    i_req_ctrl_ready : in std_logic;
776
    o_req_ctrl_valid : out std_logic;
777
    o_req_ctrl_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
778
    i_resp_ctrl_valid : in std_logic;
779
    i_resp_ctrl_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
780
    i_resp_ctrl_data : in std_logic_vector(31 downto 0);
781
    o_resp_ctrl_ready : out std_logic;
782
    i_req_data_ready : in std_logic;
783
    o_req_data_valid : out std_logic;
784
    o_req_data_write : out std_logic;
785
    o_req_data_size : out std_logic_vector(1 downto 0);
786
    o_req_data_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
787
    o_req_data_data : out std_logic_vector(RISCV_ARCH-1 downto 0);
788
    i_resp_data_valid : in std_logic;
789
    i_resp_data_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
790
    i_resp_data_data : in std_logic_vector(RISCV_ARCH-1 downto 0);
791
    o_resp_data_ready : out std_logic;
792
    i_ext_irq : in std_logic;
793
    o_time : out std_logic_vector(63 downto 0);
794
    i_dport_valid : in std_logic;
795
    i_dport_write : in std_logic;
796
    i_dport_region : in std_logic_vector(1 downto 0);
797
    i_dport_addr : in std_logic_vector(11 downto 0);
798
    i_dport_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
799
    o_dport_ready : out std_logic;
800
    o_dport_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0);
801
    i_istate : in std_logic_vector(1 downto 0);
802
    i_dstate : in std_logic_vector(1 downto 0);
803
    i_cstate : in std_logic_vector(1 downto 0)
804
  );
805
  end component;
806
 
807
  --! @brief CPU cache top level
808
  --! @param[in] i_clk
809
  --! @param[in] i_nrst
810
  --! @param[in] i_req_ctrl_valid
811
  --! @param[in] i_req_ctrl_addr
812
  --! @param[out] o_req_ctrl_ready
813
  --! @param[out] o_resp_ctrl_valid
814
  --! @param[out] o_resp_ctrl_addr
815
  --! @param[out] o_resp_ctrl_data
816
  --! @param[in] i_resp_ctrl_ready
817
  --! @param[out] o_req_data_ready
818
  --! @param[in] i_req_data_valid
819
  --! @param[in] i_req_data_write
820
  --! @param[in] i_req_data_sz
821
  --! @param[in] i_req_data_addr
822
  --! @param[in] i_req_data_data
823
  --! @param[out] o_resp_data_valid
824
  --! @param[out] o_resp_data_addr
825
  --! @param[out] o_resp_data_data
826
  --! @param[in] i_resp_data_ready
827
  --! @param[in] i_req_mem_ready      AXI request was accepted
828
  --! @param[out] o_req_mem_valid
829
  --! @param[out] o_req_mem_write
830
  --! @param[out] o_req_mem_addr
831
  --! @param[out] o_req_mem_strob
832
  --! @param[out] o_req_mem_data
833
  --! @param[in] i_resp_mem_data_valid
834
  --! @param[in] i_resp_mem_data
835
  --! @param[out] o_istate        ICache state machine value
836
  --! @param[out] o_dstate        DCache state machine value
837
  --! @param[out] o_cstate        cachetop state machine value
838
  component CacheTop is
839
  port (
840
    i_clk : in std_logic;
841
    i_nrst : in std_logic;
842
    i_req_ctrl_valid : in std_logic;
843
    i_req_ctrl_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
844
    o_req_ctrl_ready : out std_logic;
845
    o_resp_ctrl_valid : out std_logic;
846
    o_resp_ctrl_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
847
    o_resp_ctrl_data : out std_logic_vector(31 downto 0);
848
    i_resp_ctrl_ready : in std_logic;
849
    o_req_data_ready : out std_logic;
850
    i_req_data_valid : in std_logic;
851
    i_req_data_write : in std_logic;
852
    i_req_data_size : in std_logic_vector(1 downto 0);
853
    i_req_data_addr : in std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
854
    i_req_data_data : in std_logic_vector(RISCV_ARCH-1 downto 0);
855
    o_resp_data_valid : out std_logic;
856
    o_resp_data_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
857
    o_resp_data_data : out std_logic_vector(RISCV_ARCH-1 downto 0);
858
    i_resp_data_ready : in std_logic;
859
    i_req_mem_ready : in std_logic;
860
    o_req_mem_valid : out std_logic;
861
    o_req_mem_write : out std_logic;
862
    o_req_mem_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
863
    o_req_mem_strob : out std_logic_vector(BUS_DATA_BYTES-1 downto 0);
864
    o_req_mem_data : out std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
865
    i_resp_mem_data_valid : in std_logic;
866
    i_resp_mem_data : in std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
867
    o_istate : out std_logic_vector(1 downto 0);
868
    o_dstate : out std_logic_vector(1 downto 0);
869
    o_cstate : out std_logic_vector(1 downto 0)
870
  );
871
  end component;
872
 
873
 
874
  --! @brief "River" CPU Top level.
875
  --! @param[in] i_clk                 CPU clock
876
  --! @param[in] i_nrst                Reset. Active LOW.
877
  --! @param[in] i_req_mem_ready       AXI request was accepted
878
  --! @param[out] o_req_mem_valid      AXI memory request is valid
879
  --! @param[out] o_req_mem_write      AXI memory request is write type
880
  --! @param[out] o_req_mem_addr       AXI memory request address
881
  --! @param[out] o_req_mem_strob      Writing strob. 1 bit per Byte
882
  --! @param[out] o_req_mem_data       Writing data
883
  --! @param[in] i_resp_mem_data_valid AXI response is valid
884
  --! @param[in] i_resp_mem_data       Read data
885
  --! @param[in] i_ext_irq             Interrupt line from external interrupts controller (PLIC).
886
  --! @param[out] o_time               Timer. Clock counter except halt state.
887
  --! @param[in] i_dport_valid         Debug access from DSU is valid
888
  --! @param[in] i_dport_write         Write command flag
889
  --! @param[in] i_dport_region        Registers region ID: 0=CSR; 1=IREGS; 2=Control
890
  --! @param[in] i_dport_addr          Register idx
891
  --! @param[in] i_dport_wdata         Write value
892
  --! @param[out] o_dport_ready        Response is ready
893
  --! @param[out] o_dport_rdata        Response value
894
  component RiverTop is
895
  port (
896
    i_clk : in std_logic;
897
    i_nrst : in std_logic;
898
    i_req_mem_ready : in std_logic;
899
    o_req_mem_valid : out std_logic;
900
    o_req_mem_write : out std_logic;
901
    o_req_mem_addr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);
902
    o_req_mem_strob : out std_logic_vector(BUS_DATA_BYTES-1 downto 0);
903
    o_req_mem_data : out std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
904
    i_resp_mem_data_valid : in std_logic;
905
    i_resp_mem_data : in std_logic_vector(BUS_DATA_WIDTH-1 downto 0);
906
    i_ext_irq : in std_logic;
907
    o_time : out std_logic_vector(63 downto 0);
908
    i_dport_valid : in std_logic;
909
    i_dport_write : in std_logic;
910
    i_dport_region : in std_logic_vector(1 downto 0);
911
    i_dport_addr : in std_logic_vector(11 downto 0);
912
    i_dport_wdata : in std_logic_vector(RISCV_ARCH-1 downto 0);
913
    o_dport_ready : out std_logic;
914
    o_dport_rdata : out std_logic_vector(RISCV_ARCH-1 downto 0)
915
  );
916
  end component;
917
 
918
end; -- package body

powered by: WebSVN 2.1.0

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