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

Subversion Repositories orsoc_graphics_accelerator

[/] [orsoc_graphics_accelerator/] [trunk/] [rtl/] [verilog/] [gfx/] [gfx_wbm_read.v] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 Orka
/*
2
ORSoC GFX accelerator core
3
Copyright 2012, ORSoC, Per Lenander, Anton Fosselius.
4
 
5
WBM reader
6
 
7
Loosely based on the vga lcds wishbone reader (LGPL) in orpsocv2 by Julius Baxter, julius@opencores.org
8
 
9
 This file is part of orgfx.
10
 
11
 orgfx is free software: you can redistribute it and/or modify
12
 it under the terms of the GNU Lesser General Public License as published by
13
 the Free Software Foundation, either version 3 of the License, or
14
 (at your option) any later version.
15
 
16
 orgfx is distributed in the hope that it will be useful,
17
 but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 GNU Lesser General Public License for more details.
20
 
21
 You should have received a copy of the GNU Lesser General Public License
22
 along with orgfx.  If not, see <http://www.gnu.org/licenses/>.
23
 
24
*/
25
 
26
//synopsys translate_off
27
`include "timescale.v"
28
//synopsys translate_on
29
 
30
module gfx_wbm_read (clk_i, rst_i,
31
  cyc_o, stb_o, cti_o, bte_o, we_o, adr_o, sel_o, ack_i, err_i, dat_i, sint_o,
32
  read_request_i,
33
  texture_addr_i, texture_sel_i, texture_dat_o, texture_data_ack);
34
 
35
  // inputs & outputs
36
 
37
  // wishbone signals
38
  input             clk_i;    // master clock input
39
  input             rst_i;    // asynchronous active high reset
40
  output reg        cyc_o;    // cycle output
41
  output            stb_o;    // strobe ouput
42
  output [ 2:0]     cti_o;    // cycle type id
43
  output [ 1:0]     bte_o;    // burst type extension
44
  output            we_o;     // write enable output
45
  output [31:0]     adr_o;    // address output
46
  output reg [ 3:0] sel_o;    // byte select outputs (only 32bits accesses are supported)
47
  input             ack_i;    // wishbone cycle acknowledge
48
  input             err_i;    // wishbone cycle error
49
  input [31:0]      dat_i;    // wishbone data in
50
 
51
  output        sint_o;     // non recoverable error, interrupt host
52
 
53
  // Request stuff
54
  input         read_request_i;
55
 
56
  input [31:2]  texture_addr_i;
57
  input [3:0]   texture_sel_i;
58
  output [31:0] texture_dat_o;
59
  output reg    texture_data_ack;
60
 
61
  //
62
  // variable declarations
63
  //
64
  reg busy;
65
 
66
  //
67
  // module body
68
  //
69
 
70
  assign adr_o  = {texture_addr_i, 2'b00};
71
  assign texture_dat_o = dat_i;
72
  // This interface is read only
73
  assign we_o   = 1'b0;
74
  assign stb_o  = 1'b1;
75
  assign sint_o = err_i;
76
  assign bte_o  = 2'b00;
77
  assign cti_o  = 3'b000;
78
 
79
  always @(posedge clk_i or posedge rst_i)
80
  if (rst_i) // Reset
81
    begin
82
      texture_data_ack <= 1'b0;
83
      cyc_o <= 1'b0;
84
      sel_o <= 4'b1111;
85
      busy  <= 1'b0;
86
    end
87
  else
88
  begin
89
    sel_o <= texture_sel_i;
90
 
91
    if(ack_i) // On ack, stop current read, send ack to arbiter
92
    begin
93
      cyc_o            <= 1'b0;
94
      texture_data_ack <= 1'b1;
95
      busy             <= 1'b0;
96
    end
97
    else if(read_request_i & !texture_data_ack) // Else, is there a pending request? Start a read
98
    begin
99
      cyc_o            <= 1'b1;
100
      texture_data_ack <= 1'b0;
101
      busy             <= 1'b1;
102
    end
103
    else if(!busy) // Else, are we done? Zero ack
104
      texture_data_ack <= 1'b0;
105
  end
106
 
107
endmodule

powered by: WebSVN 2.1.0

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