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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [actel/] [ordb1a3pe1500/] [rtl/] [verilog/] [versatile_mem_ctrl/] [rtl/] [verilog/] [inc_adr.v] - Blame information for rev 517

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 408 julius
module inc_adr
2
  (
3
   input  [3:0] adr_i,
4
   input  [2:0] cti_i,
5
   input  [1:0] bte_i,
6
   input  init,
7
   input  inc,
8
   output reg [3:0] adr_o,
9
   output reg done,
10
   input clk,
11
   input rst
12
   );
13
 
14
   reg   init_i;
15
 
16
   reg [1:0] bte;
17
   reg [3:0] cnt;
18
 
19
   // delay init one clock cycle to be able to read from mem
20
   always @ (posedge clk or posedge rst)
21
     if (rst)
22
       init_i <= 1'b0;
23
     else
24
       init_i <= init;
25
 
26
   // bte
27
   always @ (posedge clk or posedge rst)
28
     if (rst)
29
       bte <= 2'b00;
30
     else
31
       if (init_i)
32
         bte <= bte_i;
33
 
34
   // adr_o
35
   always @ (posedge clk or posedge rst)
36
     if (rst)
37
       adr_o <= 4'd0;
38
     else
39
       if (init_i)
40
         adr_o <= adr_i;
41
       else
42
         if (inc)
43
           case (bte)
44
             2'b01: adr_o <= {adr_o[3:2], adr_o[1:0] + 2'd1};
45
             2'b10: adr_o <= {adr_o[3], adr_o[2:0] + 3'd1};
46
             default: adr_o <= adr_o + 4'd1;
47
           endcase // case (bte)
48
 
49
   // done
50
   always @ (posedge clk or posedge rst)
51
     if (rst)
52
       {done,cnt} <= {1'b0,4'd0};
53
     else
54
       if (init_i)
55
         begin
56
            done <= ({bte_i,cti_i} == {2'b00,3'b000});
57
            case (bte_i)
58
              2'b01: cnt <= 4'd12;
59
              2'b10: cnt <= 4'd8;
60
              2'b11: cnt <= 4'd0;
61
              default: cnt <= adr_i;
62
            endcase
63
         end
64
       else
65
         if (inc)
66
           {done,cnt} <= cnt + 4'd1;
67
 
68
endmodule // inc_adr
69
 
70
 

powered by: WebSVN 2.1.0

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