aboutsummaryrefslogtreecommitdiff
path: root/models/soc_with_peripherals.v
blob: 975c00263efb1e166c066b2a5d578b6d220e00c8 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
`default_nettype none

`include "messages.vh"

`ifndef SIMULATION
 `error_SIMULATION_not_defined
; /* Cause syntax error */
`endif

module soc_with_peripherals
  #(
    parameter FONT_FILE = "../design/font.mem",
    parameter EMBEDDED_ROM_FILE = "../design/rom.mem",
    parameter SPI_ROM_WORDS_COUNT = 0,
    parameter SPI_ROM_FILE = "/dev/zero"
    )
   (
    input wire 	      clock_100mhz,

    input wire 	      button1,
    input wire 	      button2,

    output wire       led1,
    output wire       led2,

    output wire [9:0] image_writes
    );

   wire [17:0] 	      sram_addr;
   wire [15:0] 	      sram_io;
   wire 	      sram_cs_n;
   wire 	      sram_oe_n;
   wire 	      sram_we_n;

   wire 	      vga_hs;
   wire 	      vga_vs;
   wire [2:0] 	      vga_red;
   wire [2:0] 	      vga_green;
   wire [2:0] 	      vga_blue;

   wire 	      spi_sdo;
   wire 	      spi_sdi;
   wire 	      spi_sck;
   wire 	      spi_ss_n;

   W25Q16BV_flash
     #(
       .BYTES_TO_INITIALIZE(SPI_ROM_WORDS_COUNT * 2),
       .INITIAL_CONTENTS_FILE(SPI_ROM_FILE)
       ) flash
       (
	.sdo(spi_sdo),
	.sdi(spi_sdi),
	.sck(spi_sck),
	.ss_n(spi_ss_n)
	);

   VGA_640_480_60Hz vga_display
     (
      .horizontal_sync(vga_hs),
      .vertical_sync(vga_vs),

      .red(vga_red),
      .green(vga_green),
      .blue(vga_blue),

      .image_writes(image_writes)
      );

   K6R4016V1D_TC10_sram sram
     (
      .sram_addr(sram_addr),
      .sram_io(sram_io),
      .sram_cs_not(sram_cs_n),
      .sram_oe_not(sram_oe_n),
      .sram_we_not(sram_we_n)
      );

   soc
     #(
       .FONT_FILE(FONT_FILE),
       .ROM_FILE(EMBEDDED_ROM_FILE)
       ) soc
       (
	.clock_100mhz(clock_100mhz),

	.sram_addr(sram_addr),
	.sram_io(sram_io),

	.sram_cs_n(sram_cs_n),
	.sram_oe_n(sram_oe_n),
	.sram_we_n(sram_we_n),

	.vga_hs(vga_hs),
	.vga_vs(vga_vs),
	.vga_red(vga_red),
	.vga_green(vga_green),
	.vga_blue(vga_blue),

	.spi_sdo(spi_sdo),
	.spi_sdi(spi_sdi),
	.spi_sck(spi_sck),
	.spi_ss_n(spi_ss_n),

	.button1(button1),
	.button2(button2),

	.led1(led1),
	.led2(led2)
	);
endmodule // soc_with_peripherals