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

Subversion Repositories nova

[/] [nova/] [tags/] [Start/] [src/] [ext_frame_RAM0_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_RAM0_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_RAM0 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_RAM0_wrapper (clk,reset_n,ext_frame_RAM0_cs_n,ext_frame_RAM0_wr,ext_frame_RAM0_addr,dis_frame_RAM_din,ext_frame_RAM0_data,
25
        pic_num,slice_header_s6);
26
        input clk;
27
        input reset_n;
28
        input ext_frame_RAM0_cs_n;
29
        input ext_frame_RAM0_wr;
30
        input [13:0] ext_frame_RAM0_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_RAM0_data;
35
 
36
        reg [31:0] ext_frame_RAM0 [0:9503];
37
        reg [31:0] ext_frame_RAM0_data;
38
 
39
        always @ (posedge clk)
40
                if (!ext_frame_RAM0_cs_n && ext_frame_RAM0_wr)
41
                        ext_frame_RAM0[ext_frame_RAM0_addr] <= dis_frame_RAM_din;
42
 
43
        //assign ext_frame_RAM0_data = (!ext_frame_RAM0_cs_n && !ext_frame_RAM0_wr)? ext_frame_RAM0[ext_frame_RAM0_addr]:32'bz;
44
        always @ (posedge clk)
45
                if (!ext_frame_RAM0_cs_n && !ext_frame_RAM0_wr)
46
                        ext_frame_RAM0_data <= ext_frame_RAM0[ext_frame_RAM0_addr];
47
 
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
 
69
        always @ (posedge clk)
70
                if (slice_header_s6 == 1'b1 && pic_num[0] == 1'b1)
71
                        begin
72
                                if (display == 1'b1)    //display
73
                                        begin
74
                                                tracefile_display = $fopen("nova_display.log","a");
75
                                                for (j= 0; j < 9504; j= j + 1)
76
                                                        begin
77
                                                                $fdisplay (tracefile_display,"%h",ext_frame_RAM0[j]);
78
                                                        end
79
                                                $fclose(tracefile_display);
80
                                        end
81
                                if (verify == 1'b1)             //verify
82
                                        begin
83
                                                tracefile_verify = $fopen("nova_MB_output.log","a");
84
                                                for (mb_num = 0;mb_num < 99; mb_num = mb_num + 1)
85
                                                        begin
86
                                                                $fdisplay (tracefile_verify,"-------------------------------------------");
87
                                                                $fdisplay (tracefile_verify," Pic_num = %3d,MB_num = %3d",pic_num_ext - 1,mb_num);
88
                                                                $fdisplay (tracefile_verify,"-------------------------------------------");
89
                                                                $fdisplay (tracefile_verify," luma 16x16 block:");
90
                                                                for (j = 0; j < 16; j = j + 1)
91
                                                                        begin
92
                                                                                luma_out0 = ext_frame_RAM0[(mb_num/11)*704+(mb_num%11)*4+j*44];
93
                                                                                luma_out1 = ext_frame_RAM0[(mb_num/11)*704+(mb_num%11)*4+j*44+1];
94
                                                                                luma_out2 = ext_frame_RAM0[(mb_num/11)*704+(mb_num%11)*4+j*44+2];
95
                                                                                luma_out3 = ext_frame_RAM0[(mb_num/11)*704+(mb_num%11)*4+j*44+3];
96
 
97
                                                                                $fdisplay (tracefile_verify," %3H %3H %3H %3H | %3H %3H %3H %3H | %3H %3H %3H %3H | %3H %3H %3H %3H",
98
                                                                                luma_out0[7:0],luma_out0[15:8],luma_out0[23:16],luma_out0[31:24],
99
                                                                                luma_out1[7:0],luma_out1[15:8],luma_out1[23:16],luma_out1[31:24],
100
                                                                                luma_out2[7:0],luma_out2[15:8],luma_out2[23:16],luma_out2[31:24],
101
                                                                                luma_out3[7:0],luma_out3[15:8],luma_out3[23:16],luma_out3[31:24]);
102
 
103
                                                                                if (j == 3 || j == 7 || j == 11)
104
                                                                                        $fdisplay (tracefile_verify, "");
105
                                                                        end
106
                                                                $fdisplay (tracefile_verify," Chroma Cb 8x8 block:");
107
                                                                for (j = 0; j < 8; j = j + 1)
108
                                                                        begin
109
                                                                                Cb_out0 = ext_frame_RAM0[6336+(mb_num/11)*176+(mb_num%11)*2+j*22];
110
                                                                                Cb_out1 = ext_frame_RAM0[6336+(mb_num/11)*176+(mb_num%11)*2+j*22+1];
111
 
112
                                                                                $fdisplay (tracefile_verify, " %3H %3H %3H %3H | %3H %3H %3H %3H",
113
                                                                                Cb_out0[7:0],Cb_out0[15:8],Cb_out0[23:16],Cb_out0[31:24],
114
                                                                                Cb_out1[7:0],Cb_out1[15:8],Cb_out1[23:16],Cb_out1[31:24]);
115
                                                                                if (j == 3)
116
                                                                                        $fdisplay (tracefile_verify, "");
117
                                                                        end
118
                                                                $fdisplay (tracefile_verify," Chroma Cr 8x8 block:");
119
                                                                for (j = 0; j < 8; j = j + 1)
120
                                                                        begin
121
                                                                                Cr_out0 = ext_frame_RAM0[7920+(mb_num/11)*176+(mb_num%11)*2+j*22];
122
                                                                                Cr_out1 = ext_frame_RAM0[7920+(mb_num/11)*176+(mb_num%11)*2+j*22+1];
123
 
124
                                                                                $fdisplay (tracefile_verify, " %3H %3H %3H %3H | %3H %3H %3H %3H",
125
                                                                                Cr_out0[7:0],Cr_out0[15:8],Cr_out0[23:16],Cr_out0[31:24],
126
                                                                                Cr_out1[7:0],Cr_out1[15:8],Cr_out1[23:16],Cr_out1[31:24]);
127
                                                                                if (j == 3)
128
                                                                                        $fdisplay (tracefile_verify, "");
129
                                                                        end
130
                                                        end
131
                                                $fclose(tracefile_verify);
132
                                        end
133
                        end
134
        // synopsys translate_on
135
endmodule

powered by: WebSVN 2.1.0

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