mirror of
https://github.com/mist-devel/mist-board.git
synced 2026-01-28 04:37:12 +00:00
removing the caches project that I never started
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
TARGET=a23_fetch
|
||||
.PHONY: $(TARGET)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
include ../default.mk
|
||||
|
||||
$(TARGET): common
|
||||
verilator -DA23_DEBUG_CACHE -Wno-fatal -I$(AMBER) -I$(SUPPORT) --cc $(@).v --trace --exe ../$(@).cpp -Mdir $(@) -LDFLAGS "$(COMMON_LDFLAGS)" -CFLAGS "$(COMMON_CFLAGS)"
|
||||
make -C $(@) -f V$(TARGET).mk
|
||||
|
||||
clean::
|
||||
rm -rf *.o $(TARGET)
|
||||
distclean:: clean
|
||||
rm -rf *~ *.vcd *.txt *.orig
|
||||
@@ -1,208 +0,0 @@
|
||||
#include <verilated.h> // Defines common routines
|
||||
#include "Va23_fetch.h"
|
||||
#include "verilated_vcd_c.h"
|
||||
|
||||
#define TRACE
|
||||
|
||||
#include "edge.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
typedef uint32_t ARMword; /* must be 32 bits wide */
|
||||
|
||||
Va23_fetch *uut; // Instantiation of module
|
||||
unsigned char *main_memory = NULL;
|
||||
|
||||
vluint64_t main_time = 0; // Current simulation time
|
||||
// This is a 64-bit integer to reduce wrap over issues and
|
||||
// allow modulus. You can also use a double, if you wish.
|
||||
double sc_time_stamp () { // Called by $time in Verilog
|
||||
return main_time; // converts to double, to match
|
||||
// what SystemC does
|
||||
}
|
||||
|
||||
void dosetup(Va23_fetch *uut)
|
||||
{
|
||||
uut->i_system_rdy = 1;
|
||||
}
|
||||
|
||||
int dowrite(Va23_fetch *uut, VerilatedVcdC* tfp, ARMword address, ARMword data)
|
||||
{
|
||||
main_time = 0;
|
||||
|
||||
uut->eval(); // Evaluate model
|
||||
tfp->dump (main_time++);
|
||||
uut->eval(); // Evaluate model
|
||||
tfp->dump (main_time++);
|
||||
|
||||
uut->i_address = address;
|
||||
uut->i_address_valid = 1;
|
||||
uut->i_write_enable = 1;
|
||||
uut->i_data_access = 1;
|
||||
uut->i_write_data = data;
|
||||
Edge clk;
|
||||
int writes = 0;
|
||||
int wait = 2;
|
||||
|
||||
while (!Verilated::gotFinish())
|
||||
{
|
||||
if ((main_time % 2) == 0)
|
||||
{
|
||||
uut->i_clk = uut->i_clk ? 0 : 1; // Toggle clock
|
||||
}
|
||||
|
||||
clk.Update(uut->i_clk);
|
||||
|
||||
uut->eval(); // Evaluate model
|
||||
|
||||
#ifdef TRACE
|
||||
tfp->dump (main_time);
|
||||
#endif
|
||||
|
||||
if (uut->o_wb_stb && uut->o_wb_cyc && clk.PosEdge())
|
||||
{
|
||||
// wishbone cycle.
|
||||
if (uut->o_wb_we != 1)
|
||||
{
|
||||
throw std::runtime_error("Attempted read during write");
|
||||
}
|
||||
else
|
||||
{
|
||||
writes++;
|
||||
if (wait == 0)
|
||||
{
|
||||
uut->i_wb_ack = 1;
|
||||
uut->i_address_valid = 0;
|
||||
uut->i_write_enable = 0;
|
||||
}
|
||||
wait--;
|
||||
}
|
||||
}
|
||||
else if (clk.PosEdge())
|
||||
{
|
||||
uut->i_wb_ack = 0;
|
||||
}
|
||||
|
||||
main_time++; // Time passes...
|
||||
|
||||
if (main_time > 1000)
|
||||
{
|
||||
std::cerr << "Failed"<< std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return writes;
|
||||
}
|
||||
|
||||
|
||||
ARMword doread(Va23_fetch *uut, VerilatedVcdC* tfp, ARMword address)
|
||||
{
|
||||
main_time = 0;
|
||||
uut->i_address = address;
|
||||
uut->i_write_enable = 0;
|
||||
Edge clk;
|
||||
int writes = 0;
|
||||
|
||||
while (!Verilated::gotFinish())
|
||||
{
|
||||
if ((main_time % 2) == 0)
|
||||
{
|
||||
uut->i_clk = uut->i_clk ? 0 : 1; // Toggle clock
|
||||
}
|
||||
|
||||
clk.Update(uut->i_clk);
|
||||
|
||||
uut->eval(); // Evaluate model
|
||||
|
||||
#ifdef TRACE
|
||||
tfp->dump (main_time);
|
||||
#endif
|
||||
|
||||
if (uut->o_wb_stb && uut->o_wb_cyc && clk.PosEdge())
|
||||
{
|
||||
// wishbone cycle.
|
||||
if (uut->o_wb_we == 1)
|
||||
{
|
||||
throw std::runtime_error("Attempted read during write");
|
||||
}
|
||||
else
|
||||
{
|
||||
writes++;
|
||||
uut->i_wb_ack = 1;
|
||||
}
|
||||
}
|
||||
else if (clk.PosEdge())
|
||||
{
|
||||
uut->i_wb_ack = 0;
|
||||
uut->i_wb_dat = 0xDEADBEEF;
|
||||
}
|
||||
|
||||
|
||||
if (uut->o_fetch_stall == 0)
|
||||
{
|
||||
return uut->o_read_data;
|
||||
}
|
||||
main_time++; // Time passes...
|
||||
|
||||
if (main_time > 1000)
|
||||
{
|
||||
std::cerr << "Failed"<< std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
Edge clk;
|
||||
|
||||
Verilated::commandArgs(argc, argv); // Remember args
|
||||
VerilatedVcdC* tfp = NULL;
|
||||
uut = new Va23_fetch; // Create instance
|
||||
|
||||
// initialise random numbers
|
||||
std::srand(234234234);
|
||||
|
||||
#ifdef TRACE
|
||||
Verilated::traceEverOn(true);
|
||||
tfp = new VerilatedVcdC;
|
||||
uut->trace(tfp, 99);
|
||||
std::string exename = argv[0];
|
||||
std::string vcdname = exename + ".vcd";
|
||||
tfp->open(vcdname.c_str());
|
||||
std::cerr << vcdname << std::endl;
|
||||
#endif
|
||||
|
||||
dosetup(uut);
|
||||
|
||||
uut->i_cache_enable = 1;
|
||||
uut->i_cache_flush = 0;
|
||||
uut->i_cacheable_area = 0x0000FFFF;
|
||||
|
||||
if (dowrite(uut, tfp, 0x1234, 0x1234) != 1)
|
||||
{
|
||||
std::cerr << "Failed " << std::endl;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRACE
|
||||
tfp->close();
|
||||
#endif
|
||||
|
||||
uut->final(); // Done simulating
|
||||
|
||||
|
||||
delete uut;
|
||||
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Project Name="caches" InternalType="">
|
||||
<Plugins>
|
||||
<Plugin Name="qmake">
|
||||
<![CDATA[00010001N0005Debug000000000000]]>
|
||||
</Plugin>
|
||||
<Plugin Name="CMakePlugin">
|
||||
<![CDATA[[{
|
||||
"name": "Debug",
|
||||
"enabled": false,
|
||||
"buildDirectory": "build",
|
||||
"sourceDirectory": "$(ProjectPath)",
|
||||
"generator": "",
|
||||
"buildType": "",
|
||||
"arguments": [],
|
||||
"parentProject": ""
|
||||
}]]]>
|
||||
</Plugin>
|
||||
</Plugins>
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
<VirtualDirectory Name="caches">
|
||||
<File Name="a23_fetch.cpp"/>
|
||||
</VirtualDirectory>
|
||||
<Settings Type="Dynamic Library">
|
||||
<GlobalSettings>
|
||||
<Compiler Options="" C_Options="" Assembler="">
|
||||
<IncludePath Value="."/>
|
||||
</Compiler>
|
||||
<Linker Options="">
|
||||
<LibraryPath Value="."/>
|
||||
</Linker>
|
||||
<ResourceCompiler Options=""/>
|
||||
</GlobalSettings>
|
||||
<Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||
<Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||
<IncludePath Value="."/>
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="./a23_fetch/Va23_fetch" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(ProjectPath)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
|
||||
<DebuggerSearchPaths/>
|
||||
<PostConnectCommands/>
|
||||
<StartupCommands/>
|
||||
</Debugger>
|
||||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="yes">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
<ThirdPartyToolName>None</ThirdPartyToolName>
|
||||
<WorkingDirectory>$(ProjectPath)</WorkingDirectory>
|
||||
</CustomBuild>
|
||||
<AdditionalRules>
|
||||
<CustomPostBuild/>
|
||||
<CustomPreBuild/>
|
||||
</AdditionalRules>
|
||||
<Completion EnableCpp11="no">
|
||||
<ClangCmpFlagsC/>
|
||||
<ClangCmpFlags/>
|
||||
<ClangPP/>
|
||||
<SearchPaths/>
|
||||
</Completion>
|
||||
</Configuration>
|
||||
<Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
|
||||
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||
<IncludePath Value="."/>
|
||||
</Compiler>
|
||||
<Linker Options="-O2" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
|
||||
<DebuggerSearchPaths/>
|
||||
<PostConnectCommands/>
|
||||
<StartupCommands/>
|
||||
</Debugger>
|
||||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="yes">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
<ThirdPartyToolName>None</ThirdPartyToolName>
|
||||
<WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
|
||||
</CustomBuild>
|
||||
<AdditionalRules>
|
||||
<CustomPostBuild/>
|
||||
<CustomPreBuild/>
|
||||
</AdditionalRules>
|
||||
<Completion EnableCpp11="no">
|
||||
<ClangCmpFlagsC/>
|
||||
<ClangCmpFlags/>
|
||||
<ClangPP/>
|
||||
<SearchPaths/>
|
||||
</Completion>
|
||||
</Configuration>
|
||||
</Settings>
|
||||
<VirtualDirectory Name="amber">
|
||||
<File Name="amber/a23_alu.v"/>
|
||||
<File Name="amber/a23_barrel_shift.v"/>
|
||||
<File Name="amber/a23_barrel_shift_fpga.v"/>
|
||||
<File Name="amber/a23_cache.v"/>
|
||||
<File Name="amber/a23_config_defines.vh"/>
|
||||
<File Name="amber/a23_coprocessor.v"/>
|
||||
<File Name="amber/a23_core.v"/>
|
||||
<File Name="amber/a23_decode.v"/>
|
||||
<File Name="amber/a23_decompile.v"/>
|
||||
<File Name="amber/a23_execute.v"/>
|
||||
<File Name="amber/a23_fetch.v"/>
|
||||
<File Name="amber/a23_functions.vh"/>
|
||||
<File Name="amber/a23_localparams.vh"/>
|
||||
<File Name="amber/a23_multiply.v"/>
|
||||
<File Name="amber/a23_ram_register_bank.v"/>
|
||||
<File Name="amber/a23_register_bank.v"/>
|
||||
<File Name="amber/a23_wishbone.v"/>
|
||||
</VirtualDirectory>
|
||||
</CodeLite_Project>
|
||||
Reference in New Issue
Block a user