URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk
- from Rev 353 to Rev 354
- ↔ Reverse comparison
Rev 353 → Rev 354
/orpsocv2/bench/sysc/include/OrpsocMain.h
53,7 → 53,7
#define BENCH_RESET_TIME 10 |
|
//! CPU clock Half period in timescale units |
#define BENCH_CLK_HALFPERIOD 20 |
#define BENCH_CLK_HALFPERIOD 10 |
|
//! System's internal RAM size in byes - found in rtl/verilog/orpsoc_top.v, param for ram_wb module |
//! Currently is 32MB (8M words) |
72,7 → 72,7
#define FLASH_END 0xf01fffff |
|
//! Default port for RSP to listen on |
#define DEFAULT_RSP_PORT 51000 |
#define DEFAULT_RSP_PORT 50003 |
|
//! FIFO size for talking to the RSP connection |
#define RSP_FIFO_SIZE 8 |
/orpsocv2/bench/sysc/src/OrpsocMain.cpp
349,7 → 349,7
//printf("* Beginning test\n"); |
|
// Init the UART function |
uart->initUart(25000000, 115200); |
uart->initUart(50000000, 115200); |
|
if (do_program_file_load) // Did the user specify a file to load? |
{ |
/orpsocv2/bench/sysc/src/Or1200MonitorSC.cpp
188,6 → 188,7
} |
} |
} |
/* |
else if ((strcmp(argv[i], "-u")==0) || |
(strcmp(argv[i], "--bus-log")==0)) |
{ |
213,6 → 214,7
bus_trans_log_start_delay = log_start_time; |
} |
} |
*/ |
} |
} |
|
375,7 → 377,9
printf(" -q, --quiet\t\tDisable the performance summary at end of simulation\n"); |
printf(" -m, --memdump <file> <0xstartaddr> <0xendaddr>\n\t\t\tDump data between <0xstartaddr> and <0xendaddr> from\n\t\t\tthe system's RAM to <file> in binary format on exit\n"); |
printf(" -c, --crash-monitor\tDetect when the processor has crashed and exit\n"); |
/* |
printf(" -u, --bus-log <file> <val>\n\t\t\tLog the wishbone bus transactions to <file>, opt. start\n\t\t\tafter <val> ns\n\n"); |
*/ |
|
} |
|
/orpsocv2/bench/verilog/uart_decoder.v
39,34 → 39,16
//// //// |
////////////////////////////////////////////////////////////////////// |
|
// Decodes UART signals sent over the line defined by UART_TX_LINE |
|
// `include this file in the testbench and define UART_TX_LINE |
// Uses define CLOCK_RATE as the frequency of the clock in Hz |
|
// Receieves and decodes 8-bit, 1 stop bit, no parity UART signals. |
`timescale 1ns/1ns |
module uart_decoder(clk, uart_tx); |
|
// Requires definition of: |
// CLK_RATE - frequency of system clock in Hz |
// CLK_PERIOD - period of clock frequency in ns |
// UART_BAUDRATE - otherwise defaults to 115200 |
// UART_TX_LINE - name of the UART output signal (normally a wire) |
input clk; |
input uart_tx; |
|
// if it's not already defined, uses UART_BAUDRATE as baud to receive |
// bytes at |
`ifndef UART_BAUDRATE |
`define UART_BAUDRATE 115200 |
`endif |
// Default baud of 115200, period (ns) |
parameter uart_baudrate_period_ns = 8680; |
|
`ifndef CLOCK_RATE |
initial |
begin |
$display("* WARNING: uart_decoder included but CLOCK_RATE not defined."); |
end |
`else |
`ifdef UART_TX_LINE |
parameter UART_TX_WAIT = (`CLOCK_RATE / `UART_BAUDRATE) * `CLOCK_PERIOD; |
|
// Something to trigger the task |
always @(posedge clk) |
uart_decoder; |
74,50 → 56,38
task uart_decoder; |
reg [7:0] tx_byte; |
begin |
|
while (`UART_TX_LINE !== 1'b1) |
@(`UART_TX_LINE); |
while (uart_tx !== 1'b1) |
@(uart_tx); |
// Wait for start bit |
//while (`UART_TX_LINE == 1'b1) |
while (`UART_TX_LINE !== 1'b0) |
@(`UART_TX_LINE); |
#(UART_TX_WAIT+(UART_TX_WAIT/2)); |
tx_byte[0] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[1] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[2] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[3] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[4] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[5] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[6] = `UART_TX_LINE; |
#UART_TX_WAIT; |
tx_byte[7] = `UART_TX_LINE; |
#UART_TX_WAIT; |
while (uart_tx !== 1'b0) |
@(uart_tx); |
#(uart_baudrate_period_ns+(uart_baudrate_period_ns/2)); |
tx_byte[0] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[1] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[2] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[3] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[4] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[5] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[6] = uart_tx; |
#uart_baudrate_period_ns; |
tx_byte[7] = uart_tx; |
#uart_baudrate_period_ns; |
//Check for stop bit |
//if (`UART_TX_LINE == 1'b0) |
if (`UART_TX_LINE !== 1'b1) |
if (uart_tx !== 1'b1) |
begin |
//$display("* WARNING: user stop bit not received when expected at time %d__", $time); |
// Wait for return to idle |
//while (`UART_TX_LINE == 1'b0) |
while (`UART_TX_LINE !== 1'b1) |
@(`UART_TX_LINE); |
//$display("* USER UART returned to idle at time %d",$time); |
while (uart_tx !== 1'b1) |
@(uart_tx); |
end |
// display the char |
$write("%c", tx_byte); |
end |
endtask // user_uart_read_byte |
`else // !`ifdef UART_TX_LINE |
// If this file was included but not setup properly |
initial |
begin |
$display("* WARNING: uart_decoder included but UART_TX_LINE not defined."); |
end |
`endif // !`ifdef UART_TX_LINE |
`endif // !`ifndef CLOCK_RATE |
|
endmodule // uart_decoder |
/orpsocv2/bench/verilog/orpsoc_testbench_defines.v
39,15 → 39,12
//// //// |
////////////////////////////////////////////////////////////////////// |
|
// 25Mhz clock = 40ns period |
`define CLOCK_PERIOD 40 |
`define CLOCK_RATE 25000000 |
// 50Mhz clock = 20ns period |
`define CLOCK_PERIOD 20 |
|
// Period for 125MHz clock is 8ns |
`define ETH_CLK_PERIOD 8 |
|
|
|
// The ORPSoC tests makefile should generate the test_define.v file in |
// the sim/run directory. |
`ifdef TEST_DEFINE_FILE |
/orpsocv2/bench/verilog/orpsoc_testbench.v
329,10 → 329,15
// If we're using UART for printf output, include the |
// UART decoder |
`ifdef UART_PRINTF |
// Define the UART's txt line for it to listen to |
`define UART_TX_LINE uart0_stx_o |
`define UART_BAUDRATE 115200 |
`include "uart_decoder.v" |
uart_decoder |
#( |
.uart_baudrate_period_ns(8680) // 115200 baud = period 8.68uS |
) |
uart0_decoder |
( |
.clk(clk), |
.uart_tx(uart0_stx_o) |
); |
`endif |
|
endmodule // orpsoc_testbench |
/orpsocv2/sim/bin/Makefile
380,6 → 380,7
SIM_COMMANDRUN=$(SILOS) -b -w +width_mistmatches -f $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) -l $(SIM_RESULTS_DIR)/$$TEST-$(SILOS)-out.log $(EVENT_SIM_FLAGS) |
endif |
|
DIVIDE_LINE= |
|
# Names of memory files used in simulation |
SIM_FLASH_MEM_FILE="flash.in" |
777,8 → 778,8
prepare-vlt-profiled: $(SIM_VLT_DIR)/OrpsocMain.gcda clean vlt-restore-profileoutput prepare-rtl vlt-model-links $(SIM_VLT_DIR)/Vorpsoc_top |
|
$(SIM_VLT_DIR)/OrpsocMain.gcda: $(SIM_VLT_DIR)/Vorpsoc_top-for-profiling prepare-sw-uart-printf |
$(MAKE) -C $(SW_DIR)/dhry dhry-nocache-O2 NUM_RUNS=200 |
$(SIM_VLT_DIR)/Vorpsoc_top -f $(SW_DIR)/dhry/dhry-nocache-O2.or32 -v -l sim.log --crash-monitor |
$(MAKE) -C $(SW_DIR)/dhry dhry.elf NUM_RUNS=2000 |
$(SIM_VLT_DIR)/Vorpsoc_top -f $(SW_DIR)/dhry/dhry.elf -v -l sim.log --crash-monitor |
|
.PHONY: $(SIM_VLT_DIR)/Vorpsoc_top-for-profiling |
$(SIM_VLT_DIR)/Vorpsoc_top-for-profiling: |
795,7 → 796,6
# Architectural simulator test loop |
################################################################################ |
|
# Verilator defaults to internal memories |
sim-tests: prepare-sw |
@if [ ! -d $(SIM_RESULTS_DIR) ]; then mkdir -p $(SIM_RESULTS_DIR); fi |
@echo |
807,11 → 807,10
echo "\t#### Current test: $$TEST ####"; echo; \ |
echo "\t#### Compiling software ####"; echo; \ |
CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \ |
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST.vmem $(TEST_SW_MAKE_OPTS) UART_PRINTF=1; \ |
rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \ |
ln -s $$CURRENT_TEST_SW_DIR/$$TEST.or32 $(SIM_RUN_DIR)/.; \ |
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST.elf $(TEST_SW_MAKE_OPTS) UART_PRINTF=1; \ |
ln -s $$CURRENT_TEST_SW_DIR/$$TEST.elf $(SIM_RUN_DIR)/.; \ |
echo;echo "\t#### Launching architectural simulator ####"; \ |
time -p $(ARCH_SIM_EXE) --nosrv -f $(SIM_BIN_DIR)/$(ARCH_SIM_CFG_FILE) $$TEST.or32 > $(SIM_RESULTS_DIR)/$$TEST-or1ksim.log 2>&1; \ |
time -p $(ARCH_SIM_EXE) --nosrv -f $(SIM_BIN_DIR)/$(ARCH_SIM_CFG_FILE) $$TEST.elf > $(SIM_RESULTS_DIR)/$$TEST-or1ksim.log 2>&1; \ |
if [ $$? -gt 0 ]; then exit $$?; fi; \ |
if [ `tail -n 10 $(SIM_RESULTS_DIR)/$$TEST-or1ksim.log | grep -c $(SIM_SUCCESS_MESSAGE)` -gt 0 ]; then \ |
TEST_RESULT=1; \ |
823,7 → 822,7
fi; \ |
echo "\t####"; echo; \ |
TESTS_PERFORMED=`expr $$TESTS_PERFORMED + 1`;\ |
unlink $(SIM_RUN_DIR)/$$TEST.or32; \ |
unlink $(SIM_RUN_DIR)/$$TEST.elf; \ |
done; \ |
echo "Test results: "$$TESTS_PASSED" out of "$$TESTS_PERFORMED" tests passed"; echo |
|
/orpsocv2/sim/bin/or1ksim-orpsocv2.cfg
126,8 → 126,8
mc = 0 |
baseaddr = 0x00000000 |
size = 0x02000000 |
delayr = 2 |
delayw = 4 |
delayr = 1 |
delayw = 1 |
end |
|
section memory |
180,7 → 180,7
section immu |
|
enabled = 1 |
nsets = 32 |
nsets = 64 |
nways = 1 |
pagesize = 8192 |
|
220,7 → 220,7
|
section dmmu |
enabled = 1 |
nsets = 32 |
nsets = 64 |
nways = 1 |
pagesize = 8192 |
end |
385,7 → 385,7
/* exe_log_marker = 50 */ |
exe_log_fn = "executed.log" |
|
clkcycle = 40ns |
clkcycle = 20ns |
|
end |
|
/orpsocv2/sw/include/dhry.h
0,0 → 1,412
+ */
+ /* for strcpy, strcmp */
+
+#define Null 0
+ /* Value of a Null pointer */
+#define true 1
+#define false 0
+
+typedef int One_Thirty;
+typedef int One_Fifty;
+typedef char Capital_Letter;
+typedef int Boolean;
+typedef char Str_30 [31];
+typedef int Arr_1_Dim [50];
+typedef int Arr_2_Dim [50] [50];
+
+typedef struct record
+ {
+ struct record *Ptr_Comp;
+ Enumeration Discr;
+ union {
+ struct {
+ Enumeration Enum_Comp;
+ int Int_Comp;
+ char Str_Comp [31];
+ } var_1;
+ struct {
+ Enumeration E_Comp_2;
+ char Str_2_Comp [31];
+ } var_2;
+ struct {
+ char Ch_1_Comp;
+ char Ch_2_Comp;
+ } var_3;
+ } variant;
+ } Rec_Type, *Rec_Pointer;
+
+
/* |
**************************************************************************** |
* |
* "DHRYSTONE" Benchmark Program |
* ----------------------------- |
* |
* Version: C, Version 2.1 |
* |
* File: dhry.h (part 1 of 3) |
* |
* Date: May 25, 1988 |
* |
* Author: Reinhold P. Weicker |
* Siemens AG, AUT E 51 |
* Postfach 3220 |
* 8520 Erlangen |
* Germany (West) |
* Phone: [+49]-9131-7-20330 |
* (8-17 Central European Time) |
* Usenet: ..!mcsun!unido!estevax!weicker |
* |
* Original Version (in Ada) published in |
* "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), |
* pp. 1013 - 1030, together with the statistics |
* on which the distribution of statements etc. is based. |
* |
* In this C version, the following C library functions are used: |
* - strcpy, strcmp (inside the measurement loop) |
* - printf, scanf (outside the measurement loop) |
* In addition, Berkeley UNIX system calls "times ()" or "time ()" |
* are used for execution time measurement. For measurements |
* on other systems, these calls have to be changed. |
* |
* Updated January, 1997 Rick Cramer, Galileo(R) to work with |
* the i960jx and Galileo-5 Reference Design. |
* |
* |
* Collection of Results: |
* Reinhold Weicker (address see above) and |
* |
* Rick Richardson |
* PC Research. Inc. |
* 94 Apple Orchard Drive |
* Tinton Falls, NJ 07724 |
* Phone: (201) 389-8963 (9-17 EST) |
* Usenet: ...!uunet!pcrat!rick |
* |
* Please send results to Rick Richardson and/or Reinhold Weicker. |
* Complete information should be given on hardware and software used. |
* Hardware information includes: Machine type, CPU, type and size |
* of caches; for microprocessors: clock frequency, memory speed |
* (number of wait states). |
* Software information includes: Compiler (and runtime library) |
* manufacturer and version, compilation switches, OS version. |
* The Operating System version may give an indication about the |
* compiler; Dhrystone itself performs no OS calls in the measurement loop. |
* |
* The complete output generated by the program should be mailed |
* such that at least some checks for correctness can be made. |
* |
*************************************************************************** |
* |
* History: This version C/2.1 has been made for two reasons: |
* |
* 1) There is an obvious need for a common C version of |
* Dhrystone, since C is at present the most popular system |
* programming language for the class of processors |
* (microcomputers, minicomputers) where Dhrystone is used most. |
* There should be, as far as possible, only one C version of |
* Dhrystone such that results can be compared without |
* restrictions. In the past, the C versions distributed |
* by Rick Richardson (Version 1.1) and by Reinhold Weicker |
* had small (though not significant) differences. |
* |
* 2) As far as it is possible without changes to the Dhrystone |
* statistics, optimizing compilers should be prevented from |
* removing significant statements. |
* |
* This C version has been developed in cooperation with |
* Rick Richardson (Tinton Falls, NJ), it incorporates many |
* ideas from the "Version 1.1" distributed previously by |
* him over the UNIX network Usenet. |
* I also thank Chaim Benedelac (National Semiconductor), |
* David Ditzel (SUN), Earl Killian and John Mashey (MIPS), |
* Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) |
* for their help with comments on earlier versions of the |
* benchmark. |
* |
* Changes: In the initialization part, this version follows mostly |
* Rick Richardson's version distributed via Usenet, not the |
* version distributed earlier via floppy disk by Reinhold Weicker. |
* As a concession to older compilers, names have been made |
* unique within the first 8 characters. |
* Inside the measurement loop, this version follows the |
* version previously distributed by Reinhold Weicker. |
* |
* At several places in the benchmark, code has been added, |
* but within the measurement loop only in branches that |
* are not executed. The intention is that optimizing compilers |
* should be prevented from moving code out of the measurement |
* loop, or from removing code altogether. Since the statements |
* that are executed within the measurement loop have NOT been |
* changed, the numbers defining the "Dhrystone distribution" |
* (distribution of statements, operand types and locality) |
* still hold. Except for sophisticated optimizing compilers, |
* execution times for this version should be the same as |
* for previous versions. |
* |
* Since it has proven difficult to subtract the time for the |
* measurement loop overhead in a correct way, the loop check |
* has been made a part of the benchmark. This does have |
* an impact - though a very minor one - on the distribution |
* statistics which have been updated for this version. |
* |
* All changes within the measurement loop are described |
* and discussed in the companion paper "Rationale for |
* Dhrystone version 2". |
* |
* Because of the self-imposed limitation that the order and |
* distribution of the executed statements should not be |
* changed, there are still cases where optimizing compilers |
* may not generate code for some statements. To a certain |
* degree, this is unavoidable for small synthetic benchmarks. |
* Users of the benchmark are advised to check code listings |
* whether code is generated for all statements of Dhrystone. |
* |
* Version 2.1 is identical to version 2.0 distributed via |
* the UNIX network Usenet in March 1988 except that it corrects |
* some minor deficiencies that were found by users of version 2.0. |
* The only change within the measurement loop is that a |
* non-executed "else" part was added to the "if" statement in |
* Func_3, and a non-executed "else" part removed from Proc_3. |
* |
*************************************************************************** |
* |
* Defines: The following "Defines" are possible: |
* -DREG=register (default: Not defined) |
* As an approximation to what an average C programmer |
* might do, the "register" storage class is applied |
* (if enabled by -DREG=register) |
* - for local variables, if they are used (dynamically) |
* five or more times |
* - for parameters if they are used (dynamically) |
* six or more times |
* Note that an optimal "register" strategy is |
* compiler-dependent, and that "register" declarations |
* do not necessarily lead to faster execution. |
* -DNOSTRUCTASSIGN (default: Not defined) |
* Define if the C compiler does not support |
* assignment of structures. |
* -DNOENUMS (default: Not defined) |
* Define if the C compiler does not support |
* enumeration types. |
* -DICACHEON (default: Not defined) |
* Adjust performace by conditionally compiling |
* these i960jx CACHE paramaters. |
* -DICACHEOFF |
* -DDCACHEON (default: Not defined) |
* -DDCACHEOFF |
* |
* NOTE: Galileo-5 Board Frequency is set to 33Mhz in the |
* file jx-timer.c. If the operating frequency is |
* changed by replacing the crystal, then this #define |
* must also be changed. |
* |
*************************************************************************** |
* |
* Compilation model and measurement (IMPORTANT): |
* |
* This C version of Dhrystone consists of four files: |
* - dhry.h (this file, containing global definitions and comments) |
* - dhry_1.c (containing the code corresponding to Ada package Pack_1) |
* - dhry_2.c (containing the code corresponding to Ada package Pack_2) |
* - jx-timer.c (containing the code to access the i960jx timer) |
* |
* The following "ground rules" apply for measurements: |
* - No procedure merging |
* - Otherwise, compiler optimizations are allowed but should be indicated |
* - Default results are those without register declarations |
* See the companion paper "Rationale for Dhrystone Version 2" for a more |
* detailed discussion of these ground rules. |
* |
* For 16-Bit processors (e.g. 80186, 80286), times for all compilation |
* models ("small", "medium", "large" etc.) should be given if possible, |
* together with a definition of these models for the compiler system used. |
* |
* Example Intel 960jx compile syntax for Galileo-5. |
* |
* ic960 -AJA -Tgal5 -O2 -DREG=register dhry_1.c dhry_2.c jx-timer.c |
* |
************************************************************************** |
* |
* Dhrystone (C version) statistics: |
* |
* [Comment from the first distribution, updated for version 2. |
* Note that because of language differences, the numbers are slightly |
* different from the Ada version.] |
* |
* The following program contains statements of a high level programming |
* language (here: C) in a distribution considered representative: |
* |
* assignments 52 (51.0 %) |
* control statements 33 (32.4 %) |
* procedure, function calls 17 (16.7 %) |
* |
* 103 statements are dynamically executed. The program is balanced with |
* respect to the three aspects: |
* |
* - statement type |
* - operand type |
* - operand locality |
* operand global, local, parameter, or constant. |
* |
* The combination of these three aspects is balanced only approximately. |
* |
* 1. Statement Type: |
* ----------------- number |
* |
* V1 = V2 9 |
* (incl. V1 = F(..) |
* V = Constant 12 |
* Assignment, 7 |
* with array element |
* Assignment, 6 |
* with record component |
* -- |
* 34 34 |
* |
* X = Y +|-|"&&"|"|" Z 5 |
* X = Y +|-|"==" Constant 6 |
* X = X +|- 1 3 |
* X = Y *|/ Z 2 |
* X = Expression, 1 |
* two operators |
* X = Expression, 1 |
* three operators |
* -- |
* 18 18 |
* |
* if .... 14 |
* with "else" 7 |
* without "else" 7 |
* executed 3 |
* not executed 4 |
* for ... 7 | counted every time |
* while ... 4 | the loop condition |
* do ... while 1 | is evaluated |
* switch ... 1 |
* break 1 |
* declaration with 1 |
* initialization |
* -- |
* 34 34 |
* |
* P (...) procedure call 11 |
* user procedure 10 |
* library procedure 1 |
* X = F (...) |
* function call 6 |
* user function 5 |
* library function 1 |
* -- |
* 17 17 |
* --- |
* 103 |
* |
* The average number of parameters in procedure or function calls |
* is 1.82 (not counting the function values as implicit parameters). |
* |
* |
* 2. Operators |
* ------------ |
* number approximate |
* percentage |
* |
* Arithmetic 32 50.8 |
* |
* + 21 33.3 |
* - 7 11.1 |
* * 3 4.8 |
* / (int div) 1 1.6 |
* |
* Comparison 27 42.8 |
* |
* == 9 14.3 |
* /= 4 6.3 |
* > 1 1.6 |
* < 3 4.8 |
* >= 1 1.6 |
* <= 9 14.3 |
* |
* Logic 4 6.3 |
* |
* && (AND-THEN) 1 1.6 |
* | (OR) 1 1.6 |
* ! (NOT) 2 3.2 |
* |
* -- ----- |
* 63 100.1 |
* |
* |
* 3. Operand Type (counted once per operand reference): |
* --------------- |
* number approximate |
* percentage |
* |
* Integer 175 72.3 % |
* Character 45 18.6 % |
* Pointer 12 5.0 % |
* String30 6 2.5 % |
* Array 2 0.8 % |
* Record 2 0.8 % |
* --- ------- |
* 242 100.0 % |
* |
* When there is an access path leading to the final operand (e.g. a record |
* component), only the final data type on the access path is counted. |
* |
* |
* 4. Operand Locality: |
* ------------------- |
* number approximate |
* percentage |
* |
* local variable 114 47.1 % |
* global variable 22 9.1 % |
* parameter 45 18.6 % |
* value 23 9.5 % |
* reference 22 9.1 % |
* function result 6 2.5 % |
* constant 55 22.7 % |
* --- ------- |
* 242 100.0 % |
* |
* |
* The program does not compute anything meaningful, but it is syntactically |
* and semantically correct. All variables have a value assigned to them |
* before they are used as a source operand. |
* |
* There has been no explicit effort to account for the effects of a |
* cache, or to balance the use of long or short displacements for code or |
* data. |
* |
*************************************************************************** |
*/ |
|
/* Compiler and system dependent definitions: */ |
|
|
#define Mic_secs_Per_Second 1000000.0 |
/* Berkeley UNIX C returns process times in seconds/HZ */ |
|
#ifdef NOSTRUCTASSIGN |
#define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) |
#else |
#define structassign(d, s) d = s |
#endif |
|
#ifdef NOENUM |
#define Ident_1 0 |
#define Ident_2 1 |
#define Ident_3 2 |
#define Ident_4 3 |
#define Ident_5 4 |
typedef int Enumeration; |
#else |
typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} |
Enumeration; |
#endif |
/* for boolean and enumeration types in Ada, Pascal */ |
|
/* General definitions: */ |
|
orpsocv2/sw/include/dhry.h
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: orpsocv2/sw/include/board.h
===================================================================
--- orpsocv2/sw/include/board.h (revision 353)
+++ orpsocv2/sw/include/board.h (revision 354)
@@ -1,10 +1,10 @@
#ifndef _BOARD_H_
#define _BOARD_H_
-//#define IN_CLK 50000000 // Hz
+#define IN_CLK 50000000 // Hz
//#define IN_CLK 32000000 // Hz
//#define IN_CLK 30000000 // HZ
-#define IN_CLK 25000000 // HZ
+//#define IN_CLK 25000000 // HZ
//#define IN_CLK 24000000 // HZ
//#define IN_CLK 20000000 // HZ
//#define IN_CLK 18000000 // HZ
/orpsocv2/sw/or1200/or1200-simple.c
2,5 → 2,6
|
int main() |
{ |
exit(0x8000000d); |
report(0x8000000d); |
exit(0); |
} |
/orpsocv2/sw/dhry/dhry.h
File deleted
orpsocv2/sw/dhry/dhry.h
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: orpsocv2/sw/dhry/dhry.c
===================================================================
--- orpsocv2/sw/dhry/dhry.c (revision 353)
+++ orpsocv2/sw/dhry/dhry.c (revision 354)
@@ -14,32 +14,18 @@
*
****************************************************************************
*/
-#include "support.h"
-#include "time.h"
+
+#include "or32-utils.h"
+#include "board.h"
#include "dhry.h"
+#include "uart.h"
+#include "printf.h"
#ifndef NUM_RUNS
#define NUM_RUNS (1)
#endif
-#define DLX_FREQ 200 /* in MHz */
#define PROC_6 1
-// OR32 trap vector dummy functions
-void buserr_except(){}
-void dpf_except(){}
-void ipf_except(){}
-void lpint_except(){timer_interrupt();}
-void align_except(){}
-void illegal_except(){}
-void hpint_except(){}
-void dtlbmiss_except(){}
-void itlbmiss_except(){}
-void range_except(){}
-void syscall_except(){}
-void fpu_except(){}
-void trap_except(){}
-void res2_except(){}
-
#ifndef strcpy
char *strcpy (char *dst0, char *src0)
{
@@ -90,21 +76,7 @@
Boolean Reg = true;
#endif
-/* variables for time measurement: */
-#if DLX || OR1K
-#define Too_Small_Time DLX_FREQ
-#else
-#define Too_Small_Time 1
-#endif
-
-#define TIMER0 0
-#define TIMER1 1
-
-
-
-
-
unsigned int Begin_Time,
End_Time,
User_Time,
@@ -153,6 +125,8 @@
REG int Number_Of_Runs;
Rec_Type x, y;
+ uart_init(DEFAULT_UART);
+
/* Initializations */
test1(10, 20);
@@ -208,9 +182,11 @@
/***************/
/* printf("%d", my_test2(Number_Of_Runs));*/
- start_timer(TIMER0);
- Begin_Time = read_timer(TIMER0);
+ clear_timer_ticks(); // Clear tick timer counter
+ enable_timer(); // start OR1K tick timer
+ Begin_Time = get_timer_ticks();
+
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
{
@@ -297,7 +273,7 @@
/* Stop timer */
/**************/
- End_Time = read_timer(TIMER0);
+ End_Time = get_timer_ticks();
/* printf ("Execution ends\n");
printf ("\n");
@@ -359,9 +335,12 @@
printf("Begin Time = %d\n",Begin_Time);
printf("End Time = %d\n",End_Time);
-
- if (User_Time < Too_Small_Time)
+ // Run for at least 10 seconds to get a useful result
+#define MIN_SECS 10
+#define TOO_SMALL_TICKS (MIN_SECS*TICKS_PER_SEC)
+
+ if (User_Time < TOO_SMALL_TICKS)
{
printf ("Measured time too small to obtain meaningful results\n");
printf ("Please increase number of runs\n");
@@ -369,22 +348,12 @@
}
else
{
-#if DLX || OR1K
- User_Time /= DLX_FREQ;
-#if DLX
- printf("DLX ");
-#else
-#if OR1K
- printf("OR1K ");
-#else
- printf("Unknown CPU ");
-#endif
-#endif
- printf("at %u MHz ", DLX_FREQ);
+
+ printf("at %u MHz ", (IN_CLK/1000000));
if (PROC_6)
printf("(+PROC_6)");
printf("\n");
-#endif
+
Microseconds = User_Time / Number_Of_Runs;
Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
printf ("Microseconds for one run through Dhrystone: ");
/orpsocv2/sw/dhry/Makefile
1,36 → 1,17
include ../support/Makefile.inc |
#ADDED BY ME |
cases = dhry-nocache-O0 dhry-nocache-O2 dhry-icdc-O2 |
#common = ../support/libsupport.a |
common = ../support/except.o ../support/libsupport.a |
|
NUM_RUNS ?= 10 |
GCC_OPT += -g |
all: $(cases) |
|
dhry-nocache-O0: dhry-O0.o ../support/reset-nocache.o $(common) |
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T ../support/orp.ld $? -o $@.or32 |
$(OR32_TOOL_PREFIX)-objcopy -O binary $@.or32 $@.bin |
../utils/bin2hex $@.bin 1 -size_word > $@$(FLASH_MEM_HEX_FILE_SUFFIX).hex |
../utils/bin2vmem $@.bin > $@.vmem |
include ../Makefile.inc |
|
NUM_RUNS ?= 10 |
|
dhry-nocache-O2: dhry-O2.o ../support/reset-nocache.o $(common) |
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T ../support/orp.ld $? -o $@.or32 |
$(OR32_TOOL_PREFIX)-objcopy -O binary $@.or32 $@.bin |
../utils/bin2hex $@.bin 1 -size_word > $@$(FLASH_MEM_HEX_FILE_SUFFIX).hex |
../utils/bin2vmem $@.bin > $@.vmem |
OR32_CFLAGS += -DNUM_RUNS=$(NUM_RUNS) |
|
%.dis: %.elf |
$(Q)$(OR32_OBJDUMP) -d $< > $@ |
|
dhry-icdc-O2: dhry-O2.o ../support/reset-icdc.o $(common) |
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T ../support/orp.ld $? -o $@.or32 |
$(OR32_TOOL_PREFIX)-objcopy -O binary $@.or32 $@.bin |
../utils/bin2hex $@.bin 1 -size_word > $@$(FLASH_MEM_HEX_FILE_SUFFIX).hex |
../utils/bin2vmem $@.bin > $@.vmem |
%.bin: %.elf |
$(Q)$(OR32_OBJCOPY) -O binary $< $@ |
|
clean: |
$(Q)rm -f *.elf *.bin *.vmem *.flashin *.dis |
|
dhry-O0.o: dhry.c |
$(OR32_TOOL_PREFIX)-gcc -DNUM_RUNS=$(NUM_RUNS) -I../support -O0 $(GCC_OPT) $? -mhard-div -c -o $@ |
|
dhry-O2.o: dhry.c |
$(OR32_TOOL_PREFIX)-gcc -DNUM_RUNS=$(NUM_RUNS) -I../support -O2 $(GCC_OPT) $? -mhard-div -c -o $@ |
/orpsocv2/sw/support/crt0.S
64,9 → 64,28
.org 0x400 |
UNHANDLED_EXCEPTION |
|
|
/* ---[ 0x500: Timer exception ]----------------------------------------- */ |
.org 0x500 |
UNHANDLED_EXCEPTION |
#define TIMER_RELOAD_VALUE (SPR_TTMR_IE | SPR_TTMR_RT | ((IN_CLK/TICKS_PER_SEC) & SPR_TTMR_PERIOD)) |
//UNHANDLED_EXCEPTION |
/* Simply load timer_ticks variable and increment */ |
.extern _timer_ticks |
l.addi r1, r1, -8 |
l.sw 0(r1), r25 |
l.sw 4(r1), r26 |
l.movhi r25, hi(_timer_ticks) |
l.ori r25, r25, lo(_timer_ticks) |
l.lwz r26, 0(r25) /* Load variable addr.*/ |
l.addi r26, r26, 1 /* Increment variable */ |
l.sw 0(r25), r26 /* Store variable */ |
l.movhi r25, hi(TIMER_RELOAD_VALUE) /* Load timer value */ |
l.ori r25, r25, lo(TIMER_RELOAD_VALUE) |
l.mtspr r0, r25, SPR_TTMR /* Reset timer */ |
l.lwz r25, 0(r1) |
l.lwz r26, 4(r1) |
l.addi r1, r1, 8 |
l.rfe |
|
/* ---[ 0x600: Aligment exception ]-------------------------------------- */ |
.org 0x600 |