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

Subversion Repositories zet86

[/] [zet86/] [trunk/] [sim/] [testbench.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 zeus
`timescale 10ns/100ps
2
 
3
module testbench;
4
 
5
  // Net declarations
6
  wire [15:0] rd_data;
7
  wire [15:0] wr_data, mem_data, io_data;
8
  wire [19:0] addr;
9
  wire        we;
10
  wire        m_io;
11
  wire        byte_m;
12
 
13
  reg         clk, rst;
14
  reg [15:0]  io_reg;
15
 
16
  // Module instantiations
17
  memory mem0 (clk, addr, wr_data, mem_data, we & ~m_io, byte_m);
18
  cpu    cpu0 (clk, rst, rd_data, wr_data, addr, we, m_io, byte_m,, 1'b1);
19
 
20
  // Assignments
21
  assign io_data = (addr[15:0]==16'hb7) ? io_reg : 16'd0;
22
  assign rd_data = m_io ? io_data : mem_data;
23
 
24
  // Behaviour
25
  // IO Stub
26
  always @(posedge clk)
27
    if (addr==20'hb7 & ~we & m_io)
28
      io_reg <= byte_m ? { io_reg[15:8], wr_data[7:0] } : wr_data;
29
 
30
  always #1 clk = ~clk;
31
 
32
  initial
33
    begin
34
         clk <= 1'b1;
35
         rst <= 1'b0;
36
      #5 rst <= 1'b1;
37
      #2 rst <= 1'b0;
38
    end
39
 
40
endmodule

powered by: WebSVN 2.1.0

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