<azzizi_>
21:17 <azzizi> I had a question .........can I create a script using matlab or any other language and create a modified RTLIL and can Yosys work with that ? I mean can I input the modified RTLIL ? 21:20 <daveshah> azzizi: yes, of course, but I personally wouldn't want to try and parse and generate RTLIL in Matlab 21:20 <daveshah> Probably be faster to learn C++ 21:23 <daveshah> The relevant command is read_ilang though 21:24 <da
<azzizi_>
21:24 <daveshah> The Json format is also worth looking into as a way of processing designs in another language
leviathan has joined #yosys
azzizi has quit [Ping timeout: 260 seconds]
<azzizi_>
<daveshah> thanks ...I am thinking about python ...but any idea how do input the newly created RTLIL to Yosys ..so it can work with the new RTLIL and get the backends work on it?
<daveshah>
azzizi: you can use read_ilang
<daveshah>
but ilang is not a stable or supported external format, its primarily for Yosys debugging
<daveshah>
I would really recommend looking at JSON instead
leviathan has quit [Client Quit]
leviathan has joined #yosys
<azzizi_>
<daveshah> For my work, I think I could work on RTLIL ...it's fine that it's not supported..could you elaborate on "not stable" ?
<daveshah>
azzizi_: there is a risk it could change in new Yosys versions
<azzizi_>
SO the rtlil needs to be transferred to JSON first and then worked on it ?
<azzizi_>
dang ..never thought of this
<daveshah>
you should use "read_json" and "write_json" in Yosys
<daveshah>
this is the current recommended interface for external tools working with Yosys
<azzizi_>
read_json converts a verilog source code into json ? and write_json converts json to verilog netlist?
<ZipCPU>
No.
<ZipCPU>
write_json converts the internal representation to a JSON output file.
<ZipCPU>
read_json reads the given JSON file and initializes the internal structures with the information found within it.
<ZipCPU>
Neither file translator works on Verilog. Verilog may however be ingested into yosys, and then converted to JSON.
<azzizi_>
<ZipCpu> By ingested, do you mean using read_verilog and then write_json
<ZipCPU>
Pretty much, plus any transformations that have taken place in between.
<azzizi_>
<ZipCpu> Can I go back from json to verilog netlist.... like read_json and then write_verilog?
<ZipCPU>
It'll be just like it was when you tried read_verilog followed by write_verilog. The result might look nothing like the input, although it should be logically equivalent
<azzizi_>
Basically I want to modify an intermediate representation ....add some stuffs an then input the modified representation into Yosys
<ZipCPU>
You are likely to find JSON useful for that purpose.
<azzizi_>
JavaScript Object Notation?
<ZipCPU>
Is that what JSON stands for?
<azzizi_>
yeah I googled
<azzizi_>
Am I right ? I wish the RTLIL were stable lol
<azzizi_>
Wouldn't have to look into JSON any more
<ZipCPU>
I just refactored yosys's JSON parser into another piece of software for another purpose. It wasn't really all that hard.
<azzizi_>
In the manual I dont see any read_json
<azzizi_>
read_json reads the given JSON file and initializes the internal structures with the information found within it.
<azzizi_>
so can I assume it transforms Json format to RTLIL?
<azzizi_>
Sorry for asking too many questions lol
<ZipCPU>
Yes, you may assume that.
promach_ has quit [Quit: WeeChat 2.1]
digshadow has joined #yosys
<azzizi_>
I have seen the JSON format, but it seems it doesn't have all the information flow there unless I am mistaken..netlist information is there ..but not the data flow
<azzizi_>
Anyone?
<awygle>
i'm not sure what you mean by data flow in this context
<tpb>
Title: Help please - Album on Imgur (at imgur.com)
<azzizi_>
For this source code, data flow would be the lines state<=1 and stuffs like that
<azzizi_>
I converted the RTLIL to json
<azzizi_>
But not being able to find the JSON lines representing the dataflows
<azzizi_>
Please help
<ZipCPU>
azzizi_: What do you mean by "data flow"? What specifically are you looking for?
<ZipCPU>
Oh, yeah, one more thing azzizi_: Look at the *last* main element in the JSON file to find your logic.
<ZipCPU>
With the JSON file's I've looked to date, the other items don't describe your logic, but often rather the capabilities of the elements in your system.
<azzizi_>
So are you saying not all the information will be there in Json file ?
<azzizi_>
I am pretty sure RTLIL has everything ...but if JSON doesnt have everything I have no other options but to work on RTLIL but as this is not stable I am in a dilemma
<ZipCPU>
No, the other way around: you may have more information in the JSON file than just your design.
<daveshah>
azzizi_: the JSON file contains an elaborated version of your design
<daveshah>
You might want to run proc or even prep before generating it
<daveshah>
Then the data flow should be included, albeit converted to a netlist
<azzizi_>
Please check this Json output ...no dataflow
<azzizi_>
the source code for the previous imgur
<daveshah>
azzizi_: run `proc` before generating the json
<daveshah>
you can already see the add and equals cells. Other cells for the registers etc will be created when you run `proc`
<azzizi_>
Thanks it worked now ...but sadly it is at the netlist level ..with the mux and registers added which I don't want ...I need to be able to edit the code at higher level than that ...changing the RTLIL would be perfect for me
<azzizi_>
But it may change in future and not stable so Ihave to rethink some stuff
<daveshah>
Yeah, in practice it sounds like RTLIL will be OK. I doubt there will be any breaking changes, but its also not really guaranteed
<azzizi_>
what is not guaranteed ?
<daveshah>
That RTLIL Ilang will be a stable interface forever
<daveshah>
But it's almost certainly fine. Officially though that kind of stuff should be done using the C++ interface directly
<azzizi_>
Thanks, May I know if you know of any ways to input the modified RTLIL (that I get from the script I will write) into the Yosys steps so I can work with it in the latter steps of yosys ....like with the new RTLIL in the Yosys ...if I write write_verilog then it will give me verilog netlist
<daveshah>
Yes, use read_ilang
<azzizi_>
Why not read_rtlil ?
<azzizi_>
Sorry just asking
<azzizi_>
I thought ilang was a textual representation of rtlil so they must be the same thing
<daveshah>
RTLIL is the name for the internal data structures representing RTL. "ilang" is the name when it is dumped in textual form
digshadow has quit [Quit: Leaving.]
sklv has joined #yosys
<azzizi_>
SO in the picture shown in the manual, it is depicted we can work on RTLIL ...by writing any pass not ILANG
<azzizi_>
So the modified RTLIL has to be in ilang form for me to be using the read_ilang command?
<daveshah>
I don't understand your question
<daveshah>
ilang is the only external direct form of RTLIL
<azzizi_>
The picture shows passes work on RTLIL ...so it has all the information...I know I can get the RTLIL form of any source code by read_verilog -dump rtlil ................but if I want to do the reverse ...my script will modify rtlil and input the modified RTLIL into yosys I can't use read_rtlil or something like that ?
<daveshah>
RTLIL is the name for the external data structures. If you want to work with RTLIL directly, use the C++ interface. Otherwise ilang is the text form of RTLIL for external use
<azzizi_>
May I ask the commands for the commands for getting Ilang representations of any verilog? and also Ilang to verilog netlist?
<azzizi_>
Thanks ...the last sentence explained a lot
AlexDaniel has quit [Read error: Connection reset by peer]
AlexDaniel has joined #yosys
<azzizi_>
Anyone has any verilog code for which Ilang and rtlil is different ? for me allof my example codes RTLIL and Ilang are same
<daveshah>
azzizi_: I am not sure if they will ever be different, ilang is the text representation of RTLIL, the only difference is in the naming of the command generating the output
<azzizi_>
Thanks again deveshah
SpaceCoaster has quit [Read error: Connection reset by peer]
SpaceCoaster has joined #yosys
SpaceCoaster_ has joined #yosys
SpaceCoaster has quit [Read error: Connection reset by peer]