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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [logic/] [ip/] [disp_io/] [rtl/] [verilog/] [top.body] - Blame information for rev 131

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

Line No. Rev Author Line
1 131 jt_eaton
/**********************************************************************/
2
/*                                                                    */
3
/*             -------                                                */
4
/*            /   SOC  \                                              */
5
/*           /    GEN   \                                             */
6
/*          /  COMPONENT \                                            */
7
/*          ==============                                            */
8
/*          |            |                                            */
9
/*          |____________|                                            */
10
/*                                                                    */
11
/*                                                                    */
12
/*  Author(s):                                                        */
13
/*      - John Eaton, jt_eaton@opencores.org                          */
14
/*                                                                    */
15
/**********************************************************************/
16
/*                                                                    */
17
/*    Copyright (C) <2010>                     */
18
/*                                                                    */
19
/*  This source file may be used and distributed without              */
20
/*  restriction provided that this copyright statement is not         */
21
/*  removed from the file and that any derivative work contains       */
22
/*  the original copyright notice and the associated disclaimer.      */
23
/*                                                                    */
24
/*  This source file is free software; you can redistribute it        */
25
/*  and/or modify it under the terms of the GNU Lesser General        */
26
/*  Public License as published by the Free Software Foundation;      */
27
/*  either version 2.1 of the License, or (at your option) any        */
28
/*  later version.                                                    */
29
/*                                                                    */
30
/*  This source is distributed in the hope that it will be            */
31
/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
32
/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
33
/*  PURPOSE.  See the GNU Lesser General Public License for more      */
34
/*  details.                                                          */
35
/*                                                                    */
36
/*  You should have received a copy of the GNU Lesser General         */
37
/*  Public License along with this source; if not, download it        */
38
/*  from http://www.opencores.org/lgpl.shtml                          */
39
/*                                                                    */
40
/**********************************************************************/
41
 
42
 
43
// display io controller for digilent Basys fpga board
44
 
45
 
46
reg  [3:0]          divide;
47
reg  [3:0]          number;
48
wire                one_usec;
49
 
50
 
51
 
52
always@(posedge clk )  led_pad_out <= PosL;
53
always@(posedge clk )  PosS        <= sw_pad_in;
54
always@(posedge clk )  PosB        <= btn_pad_in;
55
 
56
 
57
cde_divider_def
58
  #(.SIZE(6))
59
cde_divider(
60
  .clk         (clk),
61
  .reset       (reset),
62
  .enable      (1'b1),
63
  .divider_in  (6'b100000),
64
  .divider_out (one_usec)
65
 
66
  );
67
 
68
 
69
 
70
 
71
 
72
always@(posedge clk)
73
  if(reset)      divide <= 4'b0000;
74
  else
75
  if(one_usec)   divide <= divide+4'b0001;
76
  else           divide <= divide;
77
 
78
always@(posedge clk)   dp_pad_out   <= 1'b1;
79
 
80
 
81
 
82
always@(posedge clk)
83
  if(reset)                   an_pad_out <= 4'b1111;
84
  else
85
  if(divide[3:0] == 4'b0010)  an_pad_out <= 4'b1110;
86
  else
87
  if(divide[3:0] == 4'b0110)  an_pad_out <= 4'b1101;
88
  else
89
  if(divide[3:0] == 4'b1010)  an_pad_out <= 4'b1011;
90
  else
91
  if(divide[3:0] == 4'b1110)  an_pad_out <= 4'b0111;
92
  else                        an_pad_out <= 4'b1111;
93
 
94
 
95
 
96
always@(posedge clk)
97
  if(divide[3:2] == 2'b00)  number <= PosD[3:0];
98
  else
99
  if(divide[3:2] == 2'b01)  number <= PosD[7:4];
100
  else
101
  if(divide[3:2] == 2'b10)  number <= PosD[11:8];
102
  else
103
  if(divide[3:2] == 2'b11)  number <= PosD[15:12];
104
  else                      number <= number;
105
 
106
 
107
 
108
always@(posedge clk)
109
  if(reset)                   seg_pad_out <= 7'b1111111;
110
  else
111
  if(number[3:0] == 4'b0000)  seg_pad_out <= 7'b1000000;
112
  else
113
  if(number[3:0] == 4'b0001)  seg_pad_out <= 7'b1111001;
114
  else
115
  if(number[3:0] == 4'b0010)  seg_pad_out <= 7'b0100100;
116
  else
117
  if(number[3:0] == 4'b0011)  seg_pad_out <= 7'b0110000;
118
  else
119
  if(number[3:0] == 4'b0100)  seg_pad_out <= 7'b0011001;
120
  else
121
  if(number[3:0] == 4'b0101)  seg_pad_out <= 7'b0010010;
122
  else
123
  if(number[3:0] == 4'b0110)  seg_pad_out <= 7'b0000010;
124
  else
125
  if(number[3:0] == 4'b0111)  seg_pad_out <= 7'b1111000;
126
  else
127
  if(number[3:0] == 4'b1000)  seg_pad_out <= 7'b0000000;
128
  else
129
  if(number[3:0] == 4'b1001)  seg_pad_out <= 7'b0011000;
130
  else
131
  if(number[3:0] == 4'b1010)  seg_pad_out <= 7'b0001000;
132
  else
133
  if(number[3:0] == 4'b1011)  seg_pad_out <= 7'b0000011;
134
  else
135
  if(number[3:0] == 4'b1100)  seg_pad_out <= 7'b1000110;
136
  else
137
  if(number[3:0] == 4'b1101)  seg_pad_out <= 7'b0100001;
138
  else
139
  if(number[3:0] == 4'b1110)  seg_pad_out <= 7'b0000110;
140
  else
141
  if(number[3:0] == 4'b1111)  seg_pad_out <= 7'b0001110;
142
  else                        seg_pad_out <= 7'b1111111;
143
 
144
 

powered by: WebSVN 2.1.0

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