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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [verif/] [tb/] [tb_tasks.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 2 dinesha
 
2
initial
3
begin
4
   reg_cs  = 0;
5
   reg_be  = 4'h0;
6
end
7
 
8
task cpu_read;
9
  input  [2:0] block_id;
10
  input  [15:0] address;
11
  output [31:0] read_data;
12
  begin
13
      @(posedge app_clk);
14
      if(block_id == 1) reg_id  = `ADDR_SPACE_MAC;
15
      if(block_id == 2) reg_id  = `ADDR_SPACE_SPI;
16
      if(block_id == 3) reg_id  = `ADDR_SPACE_UART;
17
      if(block_id == 4) reg_id  = `ADDR_SPACE_RAM;
18
      reg_cs = 1;
19
      reg_wr = 0;
20
      reg_be = 4'hF;
21
      reg_addr = address;
22
      @(posedge reg_ack);
23
       #1 read_data = reg_rdata;
24
      @(posedge app_clk);
25
          reg_cs  = 0;
26
      //$display ("Config-Read: Id: %h Addr = %h, Data = %h", block_id,address, read_data);
27
  end
28
endtask
29
 
30
task cpu_write;
31
  input  [2:0] block_id; // 1/2/3 --> mac/spi/uart 
32
  input  [15:0] address;
33
  input  [31:0] write_data;
34
  begin
35
      $display ("Config-Write: Id: %h Addr = %h, Cfg. Data = %h", block_id,address, write_data);
36
      @(posedge app_clk);
37
      if(block_id == 1) reg_id  = `ADDR_SPACE_MAC;
38
      if(block_id == 2) reg_id  = `ADDR_SPACE_SPI;
39
      if(block_id == 3) reg_id  = `ADDR_SPACE_UART;
40
      reg_cs = 1;
41
      reg_wr = 1;
42
      reg_be = 4'hF;
43
      reg_addr = address;
44
      reg_wdata = write_data;
45
      @(posedge reg_ack);
46
      @(posedge app_clk);
47
      reg_cs  = 0;
48
      reg_wr = 0;
49
  end
50
endtask
51
 

powered by: WebSVN 2.1.0

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