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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [support/] [dumpverilog.h] - Blame information for rev 532

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

Line No. Rev Author Line
1 55 lampret
#define DW 32   /* Data width of memory model generated by dumpverilog in bits */
2
#define DWQ (DW/8) /* Same as DW but units are bytes */
3 75 lampret
#define DISWIDTH 25 /* Width of disassembled message in bytes */
4 55 lampret
 
5 532 markom
#define OR1K_MEM_VERILOG_HEADER(MODNAME, FROMADDR, TOADDR, DISWIDTH) "\n"\
6
"include \"general.h\"\n\n"\
7
"`timescale 1ns/100ps\n\n"\
8
"// Simple dw-wide Sync SRAM with initial content generated by or1ksim.\n"\
9
"// All control, data in and addr signals are sampled at rising clock edge  \n"\
10
"// Data out is not registered. Address bits specify dw-word (narrowest \n"\
11
"// addressed data is not byte but dw-word !). \n"\
12
"// There are still some bugs in generated output (dump word aligned regions)\n\n"\
13
"module %s(clk, data, addr, ce, we, disout);\n\n"\
14
"parameter dw = 32;\n"\
15
"parameter amin = %d;\n\n"\
16
"parameter amax = %d;\n\n"\
17
"input clk;\n"\
18
"inout [dw-1:0] data;\n"\
19
"input [31:0] addr;\n"\
20
"input ce;\n"\
21
"input we;\n"\
22
"output [%d:0] disout;\n\n"\
23
"reg  [%d:0] disout;\n"\
24
"reg  [dw-1:0] mem [amax:amin];\n"\
25
"reg  [%d:0] dis [amax:amin];\n"\
26
"reg  [dw-1:0] dataout;\n"\
27
"tri  [dw-1:0] data = (ce && ~we) ? dataout : 'bz;\n\n"\
28
"initial begin\n", MODNAME, FROMADDR, TOADDR, DISWIDTH-1, DISWIDTH-1, DISWIDTH-1
29 55 lampret
 
30
#define OR1K_MEM_VERILOG_FOOTER "\n\
31
end\n\n\
32
always @(posedge clk) begin\n\
33
        if (ce && ~we) begin\n\
34 60 lampret
                dataout <= #1 mem[addr];\n\
35 75 lampret
                disout <= #1 dis[addr];\n\
36 55 lampret
                $display(\"or1k_mem: reading mem[%%0d]:%%h dis: %%0s\", addr, dataout, dis[addr]);\n\
37
        end else\n\
38
        if (ce && we) begin\n\
39 60 lampret
                mem[addr] <= #1 data;\n\
40
                dis[addr] <= #1 \"(data)\";\n\
41 55 lampret
                $display(\"or1k_mem: writing mem[%%0d]:%%h dis: %%0s\", addr, mem[addr], dis[addr]);\n\
42
        end\n\
43
end\n\n\
44
endmodule\n"
45
 

powered by: WebSVN 2.1.0

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