pugnator / openvsm Goto Github PK
View Code? Open in Web Editor NEWCreate your model for Proteus VSM CAD (7/8) in Lua!
License: Other
Create your model for Proteus VSM CAD (7/8) in Lua!
License: Other
At least at VS2015Pro
A lot of files were refactored and moved, so it needs to be fixed. Also Lua integration is broken in MSVC or never worked at all
Lua way is to accept extra argemunts in functions and just don't use them.
Errors should be only when there are not enough arguments passed
It is bad by design, should change it to autocomplete
Inverted pins must be surrounded with $ sign in order to be drawn correctly. It is impossible in Lua to create such a variable, so it should be transformed to something else.
I think the better is to use underscore, for example CS instead of
It should be transformed to
At the moment very few of the entire code is documented.
There is no manual, too few examples etc. It is not usable for people who don't want to dig into the code
It should be possible to create callback for pins, buses and in future to any virtual objects.
It is not a good idea to check some pins every time simulate function is called, better to set callback [if pin is high]. The same is for buses
Can you tell me what platform and gcc version were used to build the files in the example directory?
All 3 are different sizes even after stripping, indicating some source code change,
Files in github
-rwxr-xr-x 1 nm156 Administ 235549 Dec 2 13:44 addr.dll
-rwxr-xr-x 1 nm156 Administ 2301614 Dec 2 13:44 dbg.dll
-rwxr-xr-x 1 nm156 Administ 2300892 Dec 2 13:44 k573.dll
After debug strip
-rwxr-xr-x 1 nm156 Administ 235549 Feb 11 18:59 addr.dll
-rwxr-xr-x 1 nm156 Administ 237070 Feb 11 18:59 dbg.dll
-rwxr-xr-x 1 nm156 Administ 236558 Feb 11 18:59 k573.dll
I tried to compile the github sources on two platforms, both compile
cleanly but neither work properly. (No outputs from dbg or k573)
I used:
Linux: gcc-mingw32-4.4.2
-rwxr-xr-x 1 nm156 nm156 237597 2015-02-11 18:17 openvsm.dll
Windows (mingw) : gcc-4.8.1
-rwxr-xr-x 1 nm156 Administrators 251406 Feb 11 18:38 openvsm.dll
Each of the versions I built seem to ignore get_pin_bool()
I used my DLL for dbg.dll only and if I change the dbg.dll.lua to this:
function device_simulate()
for i = 0, 7 do
if 15 == get_pin_state(_G["D"..i]) then
-- if 1 == get_pin_bool(_G["D"..i]) then
DATA_BUS = set_bit(DATA_BUS, i)
else
DATA_BUS = clear_bit(DATA_BUS, i)
end
end
text = string.format("[%d] Fetched opcode %.2X\r\n", systime(), DATA_BUS)
out_log(text)
uart_send(text)
end
I can see the fetched opcode correctly, otherwise DATA_BUS is always 0
With the provided DLLs everything works fine.
It will be fine to support x86 emulation through QEMU, it will be possible to emulate x86 hardware/videoboards etc with nice speed
It is much more handy to work with data/address buses as with whole 4-8-16-32-64 bit object/variable, not with separate pins.
Also it will be useful to add callbacks to bus state
There are some commands in the current Makefile that failed if cygwin is not installed, for example release number generator in relgen.sh
The code in the repository for example dbg.dll.lua, function device_simulate() is empty:
function device_simulate()
end
It should be:
function device_simulate()
for i = 0, 7 do
if 1 == get_pin_bool(_G["D"..i]) then
DATA_BUS = set_bit(DATA_BUS, i)
else
DATA_BUS = clear_bit(DATA_BUS, i)
end
end
uart_send(string.format("[%d] Fetched opcode %.2X\r\n", systime(), DATA_BUS))
end
With that change (found by google-fu) everything is working great. Very impressed with the project!!
The sample script addr.lua works weird:
The timing seems to be 2 times slower I expect. But callback function is called just in time, so nothing wrong with callback itself.
Need to investigate the reason
It should be possible to emulate graphical devices like screens and VGA monitors
It must be interesting to add SystemC support while simulating devices in C. It is unclear at the moment if it make sense, but it worth to investigate it
Lua 5.3 provides new functions, like bitwise and number conversion which are custom implemented at the moment. And it greatly degrade performance. Also new Lua represent numbers as 64 bits by default.
Many old functions used by openvsm are now obsolete and need to be replaced. Compilation also fails.
See branch patch-1 testcases in my fork. It contains a V7 schematic and a simple multi-part device (7408) script.
Only 1 part of a multi-part device simulates at a time even across devices
Not sure if I did something wrong with the model script or there is an issue with openVSM.
Did not want to pull this if it is my fault.
Subj. In fact only arg number is checked at the moment
Ability to connect real device to as VSM model via SWIM interface
It is need for debug purposes
At the moment only individual pin can be handled. Should be fixed
If pin is floating - take pins' values for neighbourhood pins.
if 0 and 1 - take random
if 0 and 0 - 0
if 1 and 1 - 1
According to official manual, help and instructions about how to use VSM is sending personally.
VDM provides a lot of usefull functions to model CPU-like devices. In order not to reinvent the wheel it is better to reverse some existing DLL or maybe to find the manual (no go) or may be there is source code for some CPU model from electronics enthusiasts.
In current openvsm realization bus/pin states are set with specific functions like set_pin_bool or set_bus.
Much better to create metatables with custom functions using default metamethods like __add __call etc.
In order to make operation timing easier, there should be function that accept table of timings/operation flowchart and will automatically set callbacks and provide corresponding pin check
UART, I2C, SPI etc should be easy acceccible.
Also USB/ETH and other stacks should be added
There is no way to check for regression or simple bugs other then to check it manually.
At least simple checks should be added and written in Lua
engine should check if pin value is not 1/0 or if, for examplem 8bit value is assigned to 4bit one bus. As it is not clear how it should behave.
Hello,
Please be aware that you have no rights to distribute VSM SDK header files, especially under GPL licence.
Please remove this project, otherwise we will have to contact GitHub administration to take your account down under DMCA infringement policy:
https://help.github.com/articles/dmca-takedown-policy/
Best regards
While safe mode
static void SAFE_EXECUTE ( lua_State* L, void* curfunc )
provides easy debug, it degrades performance of entire model. Run mode should be customizable inside the script.
Great works! Would it be possible to include the source code for the example DLLs (Addr.dll, Dbg.dll and k573.dll)? This would be helpful to see how all the parts all fit together.
It should be possible to connect IDA Pro to memory or CPU for debug purposes.
At the moment the only way to extract model's this object is to call at after stack is flushed.
Need to fix it
Check possibility to add support of QBox
http://git.greensocs.com/qemu/qbox
It is greatly reduce performance for sure
In 0.1 TTL logic is hard-coded and can't be changed. It should be possible to change it to I2L or CMOS online
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.