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

Subversion Repositories yacc

[/] [yacc/] [trunk/] [doc/] [benchmark.htm] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tak.sugawa
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<HTML>
3
<HEAD>
4
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 9.0.2.0 for Windows">
6
<META http-equiv="Content-Style-Type" content="text/css">
7
<TITLE></TITLE>
8
</HEAD>
9
<BODY>
10
<P><B>4 Benchmark Test</B><BR>
11
<BR>
12
This test was using RTL simulation bench. When C program calls &nbsp;print(&quot;$time&quot;),
13
test bench in verilog prints $time.So call at start and finish of dhrystone
14
benchmark program. By using this technique you can measure exact clock
15
time for execution of benchmark program.<BR>
16
<BR>
17
</P>
18
<P>print &quot;C&quot; program</P>
19
<TABLE border="1">
20
  <TBODY>
21
    <TR>
22
      <TH align="left">
23
      <PRE>void print(unsigned char* ptr)//Verilog Test Bench Use
24
{
25
        #ifdef DOS
26
                        printf(&quot;%s &quot;,ptr);
27
        #else
28
 
29
        while (*ptr) {
30
 
31
                *(volatile unsigned char*)print_port=*(ptr++);
32
        }
33
 
34
        *(volatile unsigned char*)print_port=0x00;//Write Done
35
        #endif
36
}
37
</PRE>
38
      </TH>
39
    </TR>
40
  </TBODY>
41
</TABLE>
42
<P><BR>
43
Test bench in Verilog HDL</P>
44
<TABLE border="1">
45
  <TBODY>
46
    <TR>
47
      <TH align="left">
48
      <PRE>//YACC Test Bench
49
//Apr.5.2005 Tak.Sugawara
50
 
51
`include &quot;define.h&quot;
52
`timescale 1ns/1ps
53
 
54
module yacc_test;
55
        reg clock=0;
56
        reg Reset=0;
57
        reg int_req_usr=0;
58
        reg RXD=1'b1;
59
        wire TXD;
60
        wire [31:0] mem_data_w;
61
        wire mem_write;
62
        wire [15:0] mem_address;
63
        always #20 clock=~clock;
64
 
65
 
66
 
67
        initial begin
68
                Reset=0;
69
                #800 Reset=1;
70
        end
71
 
72
`ifdef RTL_SIMULATION
73
 yacc cpu(.clock(clock),.Async_Reset(Reset),.MemoryWData(mem_data_w),
74
                  .MWriteFF(mem_write),
75
                  .data_port_address(mem_address),.RXD(RXD),.TXD(TXD));
76
`else
77
        yacc cpu(.clock(clock),.Async_Reset(Reset),        .RXD(RXD),.TXD(TXD));
78
 
79
`endif
80
 
81
 
82
 
83
 
84
 
85
 
86
 
87
 
88
        task Cprint;// String OUT until the byte 00 or xx detected with least Byte first and justified.
89
                integer i;
90
                begin :Block
91
                        i=0;
92
                        while (1) begin
93
                                if (char_buffer[i*8 +:8] ===8'h00 || char_buffer[i*8 +:8]===8'hxx) begin
94
                                                disable Block;
95
                                end
96
                                $write(&quot;%c&quot;,char_buffer[i*8 +:8]);
97
                                i=i+1;
98
                        end
99
                end
100
        endtask
101
 
102
   reg [0:640*2-1] char_buffer;
103
   integer  counter=0;
104
   always @ (posedge clock ) begin
105
            if ((mem_write === 1'b1)) begin
106
                   if (mem_address==`Print_Port_Address) begin
107
                                if (mem_data_w[7:0]===8'h00) begin
108
                                        char_buffer[counter*8 +:8]=mem_data_w[7:0];
109
                                        if (char_buffer[0  +:8*7]===&quot;$finish&quot;) begin
110
                                                        $stop;
111
 
112
                                        end else if (char_buffer[0  +:8*5]===&quot;$time&quot;) begin
113
                                                        $display(&quot;Current Time on Simulation=%d&quot;,$time);
114
 
115
                                        end else  Cprint;//$write(&quot;%s&quot;,char_buffer);
116
 
117
                                        for (counter=0; counter&lt; 80*2; counter=counter+1) begin
118
                                                char_buffer[counter*8 +:8]=8'h00;
119
                                        end
120
                                        counter=0;
121
 
122
                                end else begin
123
                                        char_buffer[counter*8 +:8]=mem_data_w[7:0];
124
                                        counter=counter+1;
125
                                end
126
                   end
127
           else if (mem_address==`Print_CAHR_Port_Address) begin
128
                                $write(&quot;%h &quot;,mem_data_w[7:0]);
129
                   end else if (mem_address==`Print_INT_Port_Address) begin
130
                                $write(&quot;%h &quot;,mem_data_w[15:0]);//Little Endian
131
                   end else if (mem_address==`Print_LONG_Port_Address) begin
132
                                $write(&quot;%h &quot;,mem_data_w[31:0]);//Big Endian
133
                   end
134
        end //if
135
   end //always
136
 
137
 
138
//uart read port
139
  wire [7:0] buffer_reg;
140
  wire int_req;
141
  reg sync_reset;
142
 
143
  localparam LF=8'h0a;
144
        always @(posedge clock, negedge Reset) begin
145
                if (!Reset) sync_reset &lt;=1'b1;
146
                else sync_reset&lt;=1'b0;
147
        end
148
 
149
 
150
 
151
   uart_read   uart_read_port( .sync_reset(sync_reset), .clk(clock), .rxd(TXD),.buffer_reg(buffer_reg), .int_req(int_req));
152
 
153
        always @(posedge int_req) begin
154
                begin :local
155
 
156
                        reg [7:0] local_mem [0:1000];
157
                        integer i=0;
158
 
159
                        if (i&gt;=1000) $stop;//assert(0);
160
 
161
                        if (buffer_reg==LF) begin :local2 //pop stack
162
                                integer j;
163
                                j=0;
164
                                while( j &lt; i) begin
165
                                        $write( &quot;%c&quot;,local_mem[j]);
166
                                        j=j+1;
167
                                end
168
                                $write(&quot;     : time=%t\n&quot;,$time);
169
                                i=0;//clear stack
170
                        end else begin//push stack
171
 
172
                                local_mem[i]=buffer_reg;
173
                                i=i+1;
174
                         end
175
                end
176
 
177
        end
178
endmodule
179
 
180
</PRE>
181
      </TH>
182
    </TR>
183
  </TBODY>
184
</TABLE>
185
<P><BR>
186
</P>
187
<P>Figure below shows Spartan3 and Stratix2 result.<BR>
188
<BR>
189
Test Start :330310ns<BR>
190
Test Stop: 498050ns<BR>
191
<BR>
192
Since 10 cycles was done,<BR>
193
&nbsp;1 Cycle Time=(498050-330310)/10=167740ns<BR>
194
This means<BR>
195
&nbsp;596000Dhrystones/Sec<BR>
196
<BR>
197
VAX Computer is&nbsp;1757Dhrysones/Sec,this results 34DMIPS<BR>
198
<BR>
199
In this test bench System Clock is set at 50MHz,<BR>
200
Therefore Final Result is as follows.<BR>
201
<BR>
202
<B>17DMIPS for Spartan3</B> (allowable synthesized maximum frequency is 25MHz)<BR>
203
<B>110DMIPS for Stratix2</B>(allowable synthesized maximum frequency is 165MHz)<BR>
204
<BR>
205
</P>
206
<P><IMG src="dhrystone.png" width="783" height="715" border="0"></P>
207
<P>Note:<BR>
208
In Dhrystone benchmark, assembled &quot;strcmp&quot;&nbsp;was&nbsp;used&nbsp;instead&nbsp;of &quot;C strcmp &quot;.This is important for <B><I>fast</I></B> DMIPS.<BR>
209
<BR>
210
</P>
211
</BODY>
212
</HTML>

powered by: WebSVN 2.1.0

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