URL
https://opencores.org/ocsvn/tv80/tv80/trunk
Subversion Repositories tv80
Compare Revisions
- This comparison shows the changes necessary to convert path
/tv80
- from Rev 90 to Rev 91
- ↔ Reverse comparison
Rev 90 → Rev 91
/trunk/scripts/sc_gen
0,0 → 1,6
#!/bin/bash |
|
verilator --sc rtl/core/tv80s.v rtl/core/tv80_alu.v \ |
rtl/core/tv80_mcode.v rtl/core/tv80_reg.v rtl/core/tv80_core.v |
|
|
trunk/scripts/sc_gen
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/sc_env/sc_env_top.cpp
===================================================================
--- trunk/sc_env/sc_env_top.cpp (nonexistent)
+++ trunk/sc_env/sc_env_top.cpp (revision 91)
@@ -0,0 +1,56 @@
+#include "systemc.h"
+#include "env_memory.h"
+#include "Vtv80s.h"
+
+int sc_main(int argc, char *argv[])
+{
+ sc_clock clk("clk125", 8, SC_NS, 0.5, 0.0, SC_NS);
+
+ sc_signal reset_n;
+ sc_signal wait_n;
+ sc_signal int_n;
+ sc_signal nmi_n;
+ sc_signal busrq_n;
+ sc_signal m1_n;
+ sc_signal mreq_n;
+ sc_signal iorq_n;
+ sc_signal rd_n;
+ sc_signal wr_n;
+ sc_signal rfsh_n;
+ sc_signal halt_n;
+ sc_signal busak_n;
+ sc_signal di;
+ sc_signal dout;
+ sc_signal addr;
+
+ Vtv80s tv80s ("tv80s");
+ tv80s.A (addr);
+ tv80s.reset_n (reset_n);
+ tv80s.clk (clk);
+ tv80s.wait_n (wait_n);
+ tv80s.int_n (int_n);
+ tv80s.nmi_n (nmi_n);
+ tv80s.busrq_n (busrq_n);
+ tv80s.m1_n (m1_n);
+ tv80s.mreq_n (mreq_n);
+ tv80s.iorq_n (iorq_n);
+ tv80s.rd_n (rd_n);
+ tv80s.wr_n (wr_n);
+ tv80s.rfsh_n (rfsh_n);
+ tv80s.halt_n (halt_n);
+ tv80s.busak_n (busak_n);
+ tv80s.di (di);
+ tv80s.dout (dout);
+
+ env_memory env_memory0("env_memory0");
+ env_memory0.clk (clk);
+ env_memory0.wr_data (dout);
+ env_memory0.rd_data (di);
+ env_memory0.mreq_n (mreq_n);
+ env_memory0.rd_n (rd_n);
+ env_memory0.wr_n (wr_n);
+ env_memory0.addr (addr);
+
+ sc_start(8000);
+ return 0;
+}
\ No newline at end of file
Index: trunk/sc_env/env_memory.cpp
===================================================================
--- trunk/sc_env/env_memory.cpp (nonexistent)
+++ trunk/sc_env/env_memory.cpp (revision 91)
@@ -0,0 +1,21 @@
+#include "env_memory.h"
+
+void env_memory::event()
+{
+ int lcl_cs;
+ int ad;
+
+ if (!mreq_n && !wr_n && (addr < AM_DEPTH)) {
+ ad = (int) addr;
+ memory[ad] = (unsigned char) wr_data.read();
+#ifdef DEBUG
+ printf ("Wrote %x to address %x\n", (int) wr_data.read(), ad);
+#endif
+ } else if (!mreq_n && !rd_n && (addr < AM_DEPTH)) {
+ ad = (int) addr;
+ rd_data.write ( (unsigned int) memory[ad] );
+#ifdef DEBUG
+ printf ("Read %x from address %x\n", memory[ad], ad);
+#endif
+ }
+}
Index: trunk/sc_env/env_memory.h
===================================================================
--- trunk/sc_env/env_memory.h (nonexistent)
+++ trunk/sc_env/env_memory.h (revision 91)
@@ -0,0 +1,29 @@
+#include "systemc.h"
+
+#ifndef ENV_MEMORY_H
+#define ENV_MEMORY_H
+#define AM_ASZ 16
+#define AM_DEPTH (1<<16)
+
+SC_MODULE(env_memory) {
+
+ sc_in clk;
+ sc_in wr_data;
+ sc_in mreq_n;
+ sc_in rd_n;
+ sc_in wr_n;
+ sc_in addr;
+ sc_out rd_data;
+
+ unsigned char *memory;
+
+ void event();
+
+ SC_CTOR(env_memory) {
+ memory = new unsigned char[AM_DEPTH];
+ SC_METHOD(event);
+ sensitive_pos << clk;
+ }
+};
+
+#endif
Index: trunk/sc_env/Makefile
===================================================================
--- trunk/sc_env/Makefile (nonexistent)
+++ trunk/sc_env/Makefile (revision 91)
@@ -0,0 +1,30 @@
+SYSTEMC=/opt/systemc
+VERILATOR_ROOT = /opt/verilator/share/verilator
+VERIDIR=../obj_dir
+INCLUDES=-I$(SYSTEMC)/include -I$(VERIDIR) -I$(VERILATOR_ROOT)/include
+LINKOPT=-L$(SYSTEMC)/lib-linux64 -lsystemc -lm
+DEFINES=-DDEBUG
+OBJFILES=sc_env_top.o env_memory.o $(VERIDIR)/Vtv80s.o $(VERIDIR)/Vtv80s__Syms.o verilated.o
+
+CXX=g++ -g $(INCLUDES) $(DEFINES)
+
+all: sc_env_top
+
+test: sc_env_top
+ ./sc_env_top
+
+sc_env_top: $(OBJFILES)
+ $(CXX) $^ -o $@ $(LINKOPT)
+
+verilated.o : $(VERILATOR_ROOT)/include/verilated.cpp
+ $(CXX) -c $^
+
+$(VERIDIR)/Vtv80s.o:
+ (cd $(VERIDIR); make -f Vtv80s.mk Vtv80s.o)
+
+$(VERIDIR)/Vtv80s__Syms.o:
+ (cd $(VERIDIR); make -f Vtv80s.mk Vtv80s__Syms.o)
+
+clean:
+ rm -f *.o
+