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

Subversion Repositories nova

[/] [nova/] [tags/] [Start/] [src/] [ext_frame_RAM1_wrapper.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eexuke
//--------------------------------------------------------------------------------------------------
2
// Design    : nova
3
// Author(s) : Ke Xu
4
// Email           : eexuke@yahoo.com
5
// File      : ext_frame_RAM1_wrapper.v
6
// Generated : April 23,2006
7
// Copyright (C) 2008 Ke Xu                
8
//-------------------------------------------------------------------------------------------------
9
// Description 
10
// SRAM beha model for external RAM tween reconstruction and deblocking filter (9504x32bit)
11
// Sync Read,Sync Write
12
//-------------------------------------------------------------------------------------------------
13
// Revise log 
14
// 1.July 23,2006
15
// Change the ext_frame_RAM1 from async read to sync read.
16
//
17
//-------------------------------------------------------------------------------------------------
18
 
19
// synopsys translate_off
20
`include "timescale.v"
21
// synopsys translate_on
22
`include "nova_defines.v"
23
 
24
module ext_frame_RAM1_wrapper (clk,reset_n,ext_frame_RAM1_cs_n,ext_frame_RAM1_wr,ext_frame_RAM1_addr,dis_frame_RAM_din,ext_frame_RAM1_data,
25
        pic_num,slice_header_s6);
26
        input clk;
27
        input reset_n;
28
        input ext_frame_RAM1_cs_n;
29
        input ext_frame_RAM1_wr;
30
        input [13:0] ext_frame_RAM1_addr;
31
        input [31:0] dis_frame_RAM_din;
32
        input [5:0] pic_num;
33
        input slice_header_s6;
34
        output [31:0] ext_frame_RAM1_data;
35
 
36
        reg [31:0] ext_frame_RAM1 [0:9503];
37
        reg [31:0] ext_frame_RAM1_data;
38
 
39
        always @ (posedge clk)
40
                if (!ext_frame_RAM1_cs_n && ext_frame_RAM1_wr)
41
                        ext_frame_RAM1[ext_frame_RAM1_addr] <= dis_frame_RAM_din;
42
 
43
        //assign ext_frame_RAM1_data = (!ext_frame_RAM1_cs_n && !ext_frame_RAM1_wr)? ext_frame_RAM1[ext_frame_RAM1_addr]:32'bz;
44
 
45
        always @ (posedge clk)
46
                if (!ext_frame_RAM1_cs_n && !ext_frame_RAM1_wr)
47
                        ext_frame_RAM1_data <= ext_frame_RAM1[ext_frame_RAM1_addr];
48
 
49
        // synopsys translate_off
50
        integer tracefile_display;
51
        integer tracefile_verify;
52
        integer mb_num;
53
        integer j;
54
        reg [31:0] luma_out0,luma_out1,luma_out2,luma_out3;
55
        reg [31:0] Cb_out0,Cb_out1;
56
        reg [31:0] Cr_out0,Cr_out1;
57
        reg [8:0] pic_num_ext;
58
 
59
        parameter display = 1;
60
        parameter verify  = 1;
61
 
62
always @ (negedge reset_n or pic_num)
63
                if (reset_n == 1'b0)
64
                        pic_num_ext <= 0;
65
                else
66
                        pic_num_ext <= pic_num_ext + 1;
67
 
68
        always @ (posedge clk)
69
                if (slice_header_s6 == 1'b1 && pic_num[0] == 1'b0 && pic_num_ext != 0)
70
                        begin
71
                                if (display == 1'b1)    //display
72
                                        begin
73
                                                tracefile_display = $fopen("nova_display.log","a");
74
                                                for (j= 0; j < 9504; j= j + 1)
75
                                                        begin
76
                                                                $fdisplay (tracefile_display,"%h",ext_frame_RAM1[j]);
77
                                                        end
78
                                                $fclose(tracefile_display);
79
                                        end
80
                                if (verify == 1'b1)             //verify
81
                                        begin
82
                                                tracefile_verify = $fopen("nova_MB_output.log","a");
83
                                                for (mb_num = 0;mb_num < 99; mb_num = mb_num + 1)
84
                                                        begin
85
                                                                $fdisplay (tracefile_verify,"-------------------------------------------");
86
                                                                $fdisplay (tracefile_verify," Pic_num = %3d,MB_num = %3d",pic_num_ext - 1,mb_num);
87
                                                                $fdisplay (tracefile_verify,"-------------------------------------------");
88
                                                                $fdisplay (tracefile_verify," luma 16x16 block:");
89
                                                                for (j = 0; j < 16; j = j + 1)
90
                                                                        begin
91
                                                                                luma_out0 = ext_frame_RAM1[(mb_num/11)*704+(mb_num%11)*4+j*44];
92
                                                                                luma_out1 = ext_frame_RAM1[(mb_num/11)*704+(mb_num%11)*4+j*44+1];
93
                                                                                luma_out2 = ext_frame_RAM1[(mb_num/11)*704+(mb_num%11)*4+j*44+2];
94
                                                                                luma_out3 = ext_frame_RAM1[(mb_num/11)*704+(mb_num%11)*4+j*44+3];
95
 
96
                                                                                $fdisplay (tracefile_verify," %3H %3H %3H %3H | %3H %3H %3H %3H | %3H %3H %3H %3H | %3H %3H %3H %3H",
97
                                                                                luma_out0[7:0],luma_out0[15:8],luma_out0[23:16],luma_out0[31:24],
98
                                                                                luma_out1[7:0],luma_out1[15:8],luma_out1[23:16],luma_out1[31:24],
99
                                                                                luma_out2[7:0],luma_out2[15:8],luma_out2[23:16],luma_out2[31:24],
100
                                                                                luma_out3[7:0],luma_out3[15:8],luma_out3[23:16],luma_out3[31:24]);
101
 
102
                                                                                if (j == 3 || j == 7 || j == 11)
103
                                                                                        $fdisplay (tracefile_verify, "");
104
                                                                        end
105
                                                                $fdisplay (tracefile_verify," Chroma Cb 8x8 block:");
106
                                                                for (j = 0; j < 8; j = j + 1)
107
                                                                        begin
108
                                                                                Cb_out0 = ext_frame_RAM1[6336+(mb_num/11)*176+(mb_num%11)*2+j*22];
109
                                                                                Cb_out1 = ext_frame_RAM1[6336+(mb_num/11)*176+(mb_num%11)*2+j*22+1];
110
 
111
                                                                                $fdisplay (tracefile_verify, " %3H %3H %3H %3H | %3H %3H %3H %3H",
112
                                                                                Cb_out0[7:0],Cb_out0[15:8],Cb_out0[23:16],Cb_out0[31:24],
113
                                                                                Cb_out1[7:0],Cb_out1[15:8],Cb_out1[23:16],Cb_out1[31:24]);
114
                                                                                if (j == 3)
115
                                                                                        $fdisplay (tracefile_verify, "");
116
                                                                        end
117
                                                                $fdisplay (tracefile_verify," Chroma Cr 8x8 block:");
118
                                                                for (j = 0; j < 8; j = j + 1)
119
                                                                        begin
120
                                                                                Cr_out0 = ext_frame_RAM1[7920+(mb_num/11)*176+(mb_num%11)*2+j*22];
121
                                                                                Cr_out1 = ext_frame_RAM1[7920+(mb_num/11)*176+(mb_num%11)*2+j*22+1];
122
 
123
                                                                                $fdisplay (tracefile_verify, " %3H %3H %3H %3H | %3H %3H %3H %3H",
124
                                                                                Cr_out0[7:0],Cr_out0[15:8],Cr_out0[23:16],Cr_out0[31:24],
125
                                                                                Cr_out1[7:0],Cr_out1[15:8],Cr_out1[23:16],Cr_out1[31:24]);
126
                                                                                if (j == 3)
127
                                                                                        $fdisplay (tracefile_verify, "");
128
                                                                        end
129
                                                        end
130
                                                $fclose(tracefile_verify);
131
                                        end
132
                        end
133
        // synopsys translate_on
134
endmodule

powered by: WebSVN 2.1.0

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