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

Subversion Repositories 8051

[/] [8051/] [tags/] [rel_12/] [syn/] [src/] [verilog/] [oc8051_fpga_top.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 simont
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 fpga top module                                        ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   tpo module used for testing in xilinx fpga chip            ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@opencores.org                     ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// ver: 1
45
//
46
 
47
 
48
// synopsys translate_off
49
`include "oc8051_timescale.v"
50
// synopsys translate_on
51
 
52
module oc8051_fpga_top (clk, rst, int1, int2, int3, sw1, sw2, sw3, sw4, int_act, dispout, p0_out, p1_out, p2_out, p3_out, data_out, ext_addr);
53
 
54
input clk, rst, int1, int2, int3;
55
output sw1, sw2, sw3, sw4, int_act;
56
output [13:0] dispout;
57
output [7:0] p0_out, p1_out, p2_out, p3_out, data_out;
58
output [15:0] ext_addr;
59
 
60
 
61
reg int;
62
reg [7:0] int_v;
63
 
64
wire reti, write;
65
wire [7:0] data_out;
66
wire nrst;
67
 
68
reg int_act, ok;
69
 
70
assign nrst = ~rst;
71
 
72
assign sw1 = int1;
73
assign sw2 = int2;
74
assign sw3 = int3;
75
assign sw4 = nrst;
76
 
77
oc8051_top oc8051_top_1(.rst(nrst), .clk(clk), .int(int), .int_v(int_v), .reti(reti), .data_in(8'h00), .data_out(data_out),
78
         .ext_addr(ext_addr), .write(write), .p0_in(8'hb0), .p1_in(8'hb1), .p2_in(8'hb2), .p3_in(8'hb3), .p0_out(p0_out),
79
         .p1_out(p1_out), .p2_out(p2_out), .p3_out(p3_out));
80
 
81
 
82
  disp disp1(.in(p0_out), .out(dispout));
83
 
84
always @(posedge clk)
85
begin
86
  if (int_act) begin
87
    int <= #1 1'b0;
88
  end else if (ok==1'b0) begin
89
   if (int1==1'b0) begin
90
          int_v <= #1 8'h40;
91
          int <= #1 1'b1;
92
    end
93
   else if (int2==1'b0) begin
94
          int_v <= #1 8'h50;
95
          int <= #1 1'b1;
96
    end
97
   else if (int3==1'b0) begin
98
          int_v <= #1 8'h65;
99
          int <= #1 1'b1;
100
    end else int <= #1 1'b0;
101
  end
102
end
103
 
104
always @(posedge clk)
105
begin
106
  if (nrst)
107
    int_act <= #1 1'b0;
108
  else if (reti)
109
    int_act <= #1 1'b0;
110
  else if (int)
111
    int_act <= #1 1'b1;
112
end
113
 
114
always @(posedge clk)
115
begin
116
  case ({int1, int2, int3})
117
    3'b111: ok <= #1 1'b0;
118
    default: ok <= #1 1'b1;
119
  endcase
120
end
121
 
122
endmodule

powered by: WebSVN 2.1.0

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