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

Subversion Repositories blue

[/] [blue/] [trunk/] [blue8/] [misc.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wd5gnr
/*
2
    This file is part of Blue8.
3
 
4
    Foobar is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU Lesser General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    Foobar is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
13
 
14
    You should have received a copy of the GNU Lesser General Public License
15
    along with Blue8.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
    Blue8 by Al Williams alw@al-williams.com
18
 
19
*/
20
 
21
`default_nettype none
22
 
23
module constant #(parameter VALUE=0)(input wire send, output wire [15:0] dout);
24
  assign dout=send?VALUE:16'bz;
25
endmodule
26
 
27
module ffff(input wire send,output wire [15:0] dout);
28
   constant #(.VALUE(16'hffff)) xffff(send,dout);
29
endmodule // ffff
30
 
31
 
32
module zero(input wire send,output wire [15:0] dout);
33
   constant #(.VALUE(16'h0000)) xzero(send,dout);
34
endmodule // zero
35
 
36
 
37
module one(input wire send,output wire [15:0] dout);
38
    constant #(.VALUE(16'h0001)) xone(send,dout);
39
endmodule // one
40
 
41
 
42
 
43
module register #(parameter SIZE=16) (input wire clk,input wire [15:0] din,input wire write,
44
   output wire [15:0] dout,input wire send,output wire [SIZE-1:0] tap, input wire reset);
45
   reg [SIZE-1:0]         regvalue=0;
46
   assign        dout=send?regvalue:16'bz;
47
        assign tap=regvalue;
48
 
49
   always @(posedge clk, posedge reset) begin
50
         if (reset) regvalue<=0;
51
         else if (write) regvalue<=din;
52
         end
53
endmodule // register
54
 
55
 
56
module aregister(input wire clk,input wire [15:0] din, input wire write,
57
  output [15:0] dout, input wire send, output [11:0] tap, input reset);
58
register #(.SIZE(12)) areg(clk,din,write,dout,send,tap,reset);
59
endmodule // aregister
60
 

powered by: WebSVN 2.1.0

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