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

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [1942/] [1942.v] - Blame information for rev 8

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

Line No. Rev Author Line
1 3 gryzor
/*
2
        1942 simple board setup in order to test SQMUSIC.
3
 
4
        Requirements:
5
                  TV80, Z80 Verilog module
6
                        Dump of Z80 ROM from 1942 board
7
 
8
  (c) Jose Tejada Gomez, 9th May 2013
9
  You can use this file following the GNU GENERAL PUBLIC LICENSE version 3
10
  Read the details of the license in:
11
  http://www.gnu.org/licenses/gpl.txt
12
 
13
  Send comments to: jose.tejada@ieee.org
14
 
15
*/
16
 
17
`timescale 1ns / 1ps
18
 
19
module sound1942;
20
  // inputs to Z80
21 4 gryzor
  reg reset_n, clk, int_n, sound_clk;
22 6 gryzor
        parameter dump_text = 1; // set to 1 to dump data to use log2wav later
23 3 gryzor
 
24
  initial begin
25 5 gryzor
/*    $dumpfile("dump.lxt");
26
    $dumpvars(1,pwm0);
27
    $dumpvars(1,pwm1);*/
28 3 gryzor
//              $dumpvars();
29
//    $dumpon;
30
//              $shm_open("1942.shm");
31 6 gryzor
        //      $shm_probe( sound1942, "ACTFS" );
32 3 gryzor
    reset_n=0;
33
    #1500 reset_n=1;
34 6 gryzor
                $display("1942 START");
35 3 gryzor
                // change finish time depending on song
36 6 gryzor
                //#0.1e9 $finish;
37
    #7e9 $finish;
38 3 gryzor
  end
39
 
40
  always begin // main clock
41
    clk=0;
42
    forever clk = #167 ~clk;
43
  end
44
 
45
  always begin // sound clock
46
    sound_clk=0;
47
    forever sound_clk = #334 ~sound_clk;
48
  end
49
 
50
        parameter int_low_time=167*2*80;
51
 
52
  always begin // interrupt clock
53
    int_n=1;
54
    forever begin
55
                        #(4166667-int_low_time) int_n=0; // 240Hz
56
                        //$display("IRQ request @ %t us",$time/1e6);
57
                        #(int_low_time) int_n=1;
58
                end
59
  end
60
 
61 5 gryzor
 
62 4 gryzor
        wire [3:0] ay0_a, ay0_b, ay0_c, ay1_a, ay1_b, ay1_c;
63
  computer_1942 #(0) game( .clk(clk), .sound_clk(sound_clk),
64
    .int_n(int_n), .reset_n(reset_n),
65
    .ay0_a(ay0_a), .ay0_b(ay0_b), .ay0_c(ay0_c),
66
    .ay1_a(ay1_a), .ay1_b(ay1_b), .ay1_c(ay1_c) );
67
  // sound amplifier:
68 5 gryzor
  /*
69 4 gryzor
  wire [15:0] amp0_y, amp1_y;
70
        SQM_AMP amp0( .A(ay0_a), .B(ay0_b), .C(ay0_c), .Y( amp0_y ));
71 5 gryzor
        SQM_AMP amp1( .A(ay1_a), .B(ay1_b), .C(ay1_c), .Y( amp1_y ));
72
        always #22676 $display("%d", amp0_y+amp1_y ); // 44.1kHz sample
73
        */
74
        reg vhf_clk;
75
        always begin
76
          vhf_clk=0;
77
          forever begin
78 6 gryzor
            if( vhf_clk && dump_text ) begin
79 5 gryzor
              $display("%d, %d, %d, %d, %d, %d",
80
                pwm0_a, pwm0_b, pwm0_c, pwm1_a, pwm1_b, pwm1_c );
81
            end
82
            #10 vhf_clk <= ~vhf_clk; // 50MHz
83
          end
84
        end
85
 
86
  SQM_PWM_1 a0pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay0_a), .pwm(pwm0_a) );
87
  SQM_PWM_1 b0pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay0_b), .pwm(pwm0_b) );
88
  SQM_PWM_1 c0pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay0_c), .pwm(pwm0_c) );
89 3 gryzor
 
90 5 gryzor
  SQM_PWM_1 a1pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay1_a), .pwm(pwm1_a) );
91
  SQM_PWM_1 b1pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay1_b), .pwm(pwm1_b) );
92
  SQM_PWM_1 c1pwm( .clk(vhf_clk), .reset_n(reset_n), .din(ay1_c), .pwm(pwm1_c) );
93 3 gryzor
endmodule
94
 
95
 

powered by: WebSVN 2.1.0

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