Re: [Oberon] What is the status of Lola-2 and its use in the FPGAversion ofProject Oberon?
Dear Mr. Reed Thank you very much for your response.
I've used it in my own commercial work where it has had some nice advantages.
Could you please elaborate on this? How do you decide whether to use Lola-2 or Verilog? Are there projects/project sizes where you would not recommend to use Lola-2? Is it necessary to modify the generated Verilog code or can it directly be synthesized and placed/routed for an FPGA?
Thanks for the link. I didn't discover that yet. Very useful. I had a look at different Verilog alternatives but think that a HDL embedded in another programming language essentially suffers from the same disadvantages like Verilog, i.e. it's not obvious what is synthesized and how. Lola-2 seems to have advantages in that regard, but I can't assess its limitations right now. Actually I'm trying to find out if it's worth developing a QtCreator plugin for it, analogous to https://github.com/rochus-keller/VerilogCreator. Best R.K.
How do you decide whether to use Lola-2 or Verilog?
I prefer to use Lola wherever possible, it's clearer than either (System)Verilog or VHDL. If a feature requires special features not supported by Lola, I wrap it in Verilog. The main cause of this currently is library identifiers (e.g. "_" characters), but in fact it's really wrapping the nonportable pieces.
Are there projects/project sizes where you would not recommend to use Lola-2?
Sorry, this is a rather general question on which I cannot give any solid data. I have not compared projects with and without, in any meaningful way. I am really talking only about personal preferences. I suggest you could try it, and see if it works for you, that's all. YMMV.
Is it necessary to modify the generated Verilog code or can it directly be synthesized and placed/routed for an FPGA?
As Wirth describes, the Verilog generated by Lola-2 is used directly as input to synthesis. Verilog is used as a kind of intermediate language in order to get round the (often) proprietary nature of the FPGA bitstream. The original version of Lola compiled directly to a PAL fuse file or to an early FPGA bitstream, see http://www.cs.inf.ethz.ch/lola/ Wirth ended up using Verilog to define the TRM and RISC5 rather than VHDL, I think, because his colleagues Chuck Thacker and Ling Liu were using Verilog. But I know he's not impressed by either language. See https://www.inf.ethz.ch/personal/wirth/FPGA-relatedWork/index.html
... it's not obvious what is synthesized and how.
This is indeed part of the insanity of FPGAs. Like having a compiler which uses a different optimisation backend picked at random again and again, for each function, for each compile. With the original Lola, Wirth took a much more sensible approach (as always). Cheers, Paul
Paul:
I prefer to use Lola wherever possible, it's clearer than either (System)Verilog or VHDL.
Clearer is in the eyes of the beholder. I never liked Lola (sorry), because it only supports one particular coding style. Just looking at the VID.Lola I can see the RTL-style coding. I am seeing this style since the very first Lola book. In modern FPGA programming the code is more often expressed behaviorally. RTL style is used in low level modules, and not even always there. The high level constructs are coded as behavioral. VHDL is better (in my opinion) for behavioral coding than Verilog. However, both languages are exactly equivalent. They only feel different way, which is important for a programmer (myself), but fundamentally there are no restrictions to write the same code either in Verilog or in VHDL. For the laymen: Register Transfer Logic (RTL) is the style where you assign bits or vectors of bits directly by hand. Presumably this is how the flip flops and wires are connected in the FPGA. It is a low level style. Programming analogy: imagine you are coding a high level algorithm without using function calls, but rather assign many dozens of variables in one chunk of code. It gets very confusing very quickly. This is how RTL looks. (Look at VID.Lola or any other Lola module by Wirth.) An even larger reservation against RTL coding is that modern FPGAs simply are not collections of flip flops and wires. They contain many configurable blocks ("hardened logic") which can hardly be described by RTL assign statements. The "behavioral" style of coding leaves the compiler freedom to map functions "as intended" to these hardened logic blocks, using the internal compiler heuristic. You basically tell the compiler "here is what I intend, go and figure it out". Most FPGA coding is done this way these days. The RTL-style is neither capable nor intended for doing that.
If a feature requires special features not supported by Lola, I wrap it in Verilog. The main cause of this currently is library identifiers (e.g. "_" characters), but in fact it's really wrapping the nonportable pieces.
Is there any special reason to not change Lola such that the main cause is just eliminated? Thank you, Wojtek
Hi Wojciech,
In modern FPGA programming the code is more often expressed behaviorally [than] RTL style...
Yeah, you said this before, without backing it up and without giving a useful worked example. I've also had other similar dogmatic opinions from FPGA people without much edification. And their code [if any] is, well, let's just say... amazing. :)
tell the compiler "here is what I intend, go and figure it out". Most FPGA coding is done this way these days.
LOL. Good luck with that... Vendor sales pitch, surely? They have a vested interest in convincing you it's all too hard for meagre humans. But seriously, again, a working example would be nice showing pros and cons.
If a feature requires special features not supported by Lola, I wrap it in Verilog. The main cause of this currently is library identifiers (e.g. "_" characters), but in fact it's really wrapping the nonportable pieces.
Is there any special reason to not change Lola such that the main cause is just eliminated?
You mean the main cause of the subordinate cause? No. I sometimes add "_" to Prof. Wirth's scanners, but more often not, these days. It can be useful to have nicer-looking identifiers come from the Lola, and enforce that. C used this trick once upon a time. But knock yourself out, it's not a hard thing to add. Cheers, Paul
________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Paul Reed [paulreed@paddedcell.com] Sent: Friday, March 15, 2019 10:40 AM To: ETH Oberon and related systems Subject: Re: [Oberon] What is the status of Lola-2 and its use in the FPGAversion of Project Oberon? Hi Wojciech,
In modern FPGA programming the code is more often expressed behaviorally [than] RTL style...
[RTL versus behavioral] Yeah, you said this before, without backing it up and without giving a useful worked example. I've also had other similar dogmatic opinions from FPGA people without much edification.
I will provide an example over the weekend. Today and tomorrow and hopefully Sunday I will be very busy. Skiing.
And their code [if any] is, well, let's just say... amazing. :)
One can write good code and bad code in any language.
tell the compiler "here is what I intend, go and figure it out". Most FPGA coding is done this way these days.
LOL. Good luck with that... Vendor sales pitch, surely? They have a vested interest in convincing you it's all too hard for meagre humans.
No pitch. Just practice. I need to get my work done without getting into any flame wars. my company lives off firmware, so we just need to do it. If I saw advantages of Lola, I would have ordered my employees to use it. But right now I do not.
But seriously, again, a working example would be nice showing pros and cons.
Lacking time (lifts are already running) I attached an old text of mine. It is not exactly on topic, but it will help someone perhaps anyway. Thanks, Wojtek
I attached a file, and the e-mail did not get through. I am resending w/o the attachment. ________________________________________ From: Skulski, Wojciech Sent: Friday, March 15, 2019 11:27 AM To: ETH Oberon and related systems Subject: RE: [Oberon] What is the status of Lola-2 and its use in the FPGAversion of Project Oberon? ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Paul Reed [paulreed@paddedcell.com] Sent: Friday, March 15, 2019 10:40 AM To: ETH Oberon and related systems Subject: Re: [Oberon] What is the status of Lola-2 and its use in the FPGAversion of Project Oberon? Hi Wojciech,
In modern FPGA programming the code is more often expressed behaviorally [than] RTL style...
[RTL versus behavioral] Yeah, you said this before, without backing it up and without giving a useful worked example. I've also had other similar dogmatic opinions from FPGA people without much edification.
I will provide an example over the weekend. Today and tomorrow and hopefully Sunday I will be very busy. Skiing.
And their code [if any] is, well, let's just say... amazing. :)
One can write good code and bad code in any language.
tell the compiler "here is what I intend, go and figure it out". Most FPGA coding is done this way these days.
LOL. Good luck with that... Vendor sales pitch, surely? They have a vested interest in convincing you it's all too hard for meagre humans.
No pitch. Just practice. I need to get my work done without getting into any flame wars. my company lives off firmware, so we just need to do it. If I saw advantages of Lola, I would have ordered my employees to use it. But right now I do not.
But seriously, again, a working example would be nice showing pros and cons.
Lacking time (lifts are already running) I attached an old text of mine. It is not exactly on topic, but it will help someone perhaps anyway. Thanks, Wojtek
I tried to send a short tutorial text to this list (26 PDF pages) but it did not get through the list. There was an example of behavioral versus structural VHDL on page 19 and 20. So let me copy-paste in order to satisfy Paul's request. The formatting was lost while copy-paste. I will illustrate a shift register. A shift register is an example of a "hardened logic" provided in Xilinx FPGAs. It is not as simple as a flip flop, and not as complex as a clock manager or wizardry inside the Xilinx I/O pin. Let me start with the structural implementation using a "hardened" library component SRL32E. Note how many details you need to connect, initialize, etc. This implementation gives you a complete control over all the details. The compiler does not need to guess. So this is the "structural RTL" style of coding. I kind of believe that LOLA is meant this way, more or less. ENTITY Delay_Line_L32 IS GENERIC (PipeWdt: INTEGER := 14); -- default bit width of the stream PORT ( CLK : in STD_LOGIC; CE : in STD_LOGIC; -- clock enable prgm : in STD_LOGIC_VECTOR (4 downto 0); -- delay select between 0 to 31 din : in STD_LOGIC_VECTOR (PipeWdt-1 downto 0); dout : out STD_LOGIC_VECTOR (PipeWdt-1 downto 0) ); end Delay_Line_L32; -- end of the interface definition ARCHITECTURE SRL32 OF Delay_Line_L32 IS BEGIN pipe: FOR i IN 0 TO PipeWdt-1 GENERATE slice : SRLC32E GENERIC MAP (INIT => X"00000000") PORT MAP ( CLK => CLK, -- Clock input D => din(i), -- SRL data input Q31 => open, -- SRL cascade output pin (connect only to next SRL) A => prgm, -- 5-bit shift depth select input CE => CE, -- Clock enable can freeze the pipe Q => dout(i)); -- SRL data output END GENERATE pipe; END SRL32; Now the behavioral version (without the CE). Note that the code is really simple and self explanatory. The details will be inferred by the compiler. You describe what you want, and the compiler does the rest. You can check in the synthesis report what the compiler really guessed. TYPE Tpipe IS ARRAY(PipeLen-1 downto 0) OF STD_LOGIC_VECTOR (PipeWdt-1 downto 0); SIGNAL pipe: Tpipe; -- The "dynamic shift register" should be inferred by synthesis. process (CLK) begin if rising_edge (CLK) then pipe <= pipe(PipeLen-2 DOWNTO 0) & din; end if; end process; dout <= pipe(conv_integer(prgm)); -- select the dynamic length
Hi Wojtek I know my example is not directly comparable to your example but perhaps a little bit... structural Oberon . . . . . . . . . . . . . . . . PROCEDURE Copy(src, dst: ARRAY OF INTEGER); VAR i: INTEGER; BEGIN i:=0; WHILE i < LEN(dst) DO dst[i] := src[i]; INC(i) END END Copy; VAR a, b: ARRAY 30 OF INTEGER; Copy(a, b); You see you have to declare a procedure, state the types, declare variables and initialize a lot yourself. behavioral Oberon . . . . . . . . . . . . . . . . IMPORT S := SYSTEM; VAR a, b: ARRAY 30 OF INTEGER; S.COPY(S.ADR(a), S.ADR(b), 30); Here you say what you want to do (COPY) and the compiler generates itself the whole loop, and optimizes the code by finding a free register for the index i and holding it in a register iso memory. Another example that comes to my mind is the discussion we had lately in this forum around self programmed and initialzed jump tables (structural) vs using the CASE statement (behavioral) where the compiler itself initializes the jump table and does the housekeeping of calculating the index in the jump table and jumping indirectly... br Jörg
Am 16.03.2019 um 06:12 schrieb Skulski, Wojciech <skulski@pas.rochester.edu>:
I tried to send a short tutorial text to this list (26 PDF pages) but it did not get through the list. There was an example of behavioral versus structural VHDL on page 19 and 20. So let me copy-paste in order to satisfy Paul's request. The formatting was lost while copy-paste.
I will illustrate a shift register. A shift register is an example of a "hardened logic" provided in Xilinx FPGAs. It is not as simple as a flip flop, and not as complex as a clock manager or wizardry inside the Xilinx I/O pin.
Let me start with the structural implementation using a "hardened" library component SRL32E. Note how many details you need to connect, initialize, etc. This implementation gives you a complete control over all the details. The compiler does not need to guess. So this is the "structural RTL" style of coding. I kind of believe that LOLA is meant this way, more or less.
ENTITY Delay_Line_L32 IS GENERIC (PipeWdt: INTEGER := 14); -- default bit width of the stream PORT ( CLK : in STD_LOGIC; CE : in STD_LOGIC; -- clock enable prgm : in STD_LOGIC_VECTOR (4 downto 0); -- delay select between 0 to 31 din : in STD_LOGIC_VECTOR (PipeWdt-1 downto 0); dout : out STD_LOGIC_VECTOR (PipeWdt-1 downto 0) ); end Delay_Line_L32; -- end of the interface definition
ARCHITECTURE SRL32 OF Delay_Line_L32 IS BEGIN pipe: FOR i IN 0 TO PipeWdt-1 GENERATE slice : SRLC32E GENERIC MAP (INIT => X"00000000") PORT MAP ( CLK => CLK, -- Clock input D => din(i), -- SRL data input Q31 => open, -- SRL cascade output pin (connect only to next SRL) A => prgm, -- 5-bit shift depth select input CE => CE, -- Clock enable can freeze the pipe Q => dout(i)); -- SRL data output END GENERATE pipe; END SRL32;
Now the behavioral version (without the CE). Note that the code is really simple and self explanatory. The details will be inferred by the compiler. You describe what you want, and the compiler does the rest. You can check in the synthesis report what the compiler really guessed.
TYPE Tpipe IS ARRAY(PipeLen-1 downto 0) OF STD_LOGIC_VECTOR (PipeWdt-1 downto 0); SIGNAL pipe: Tpipe;
-- The "dynamic shift register" should be inferred by synthesis. process (CLK) begin if rising_edge (CLK) then pipe <= pipe(PipeLen-2 DOWNTO 0) & din; end if; end process; dout <= pipe(conv_integer(prgm)); -- select the dynamic length
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Even Prof. Wirth explores the behavioral description of circuits in the article "Hardware Compilation: Translating Programs into Circuits", originally published in IEEE Computer Magazine in 1998. I've started knowing and experimenting with Oberon, LoLa and FPGAs thanks to that amazing article. You could find it a version in the Tech Reports from ETHZ: ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/ Hardware Compilation: ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/2xx/286.abstract ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/2xx/286.ps And for LoLa: ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/2xx/215.abstract ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/2xx/236.abstract and many more amazing articles of all ETH, look at the Index.long in every folder: Hope you enjoy, Pablo Cayuela In case On Fri, Mar 15, 2019 at 11:20 AM Skulski, Wojciech < skulski@pas.rochester.edu> wrote:
Paul:
I prefer to use Lola wherever possible, it's clearer than either (System)Verilog or VHDL.
Clearer is in the eyes of the beholder. I never liked Lola (sorry), because it only supports one particular coding style. Just looking at the VID.Lola I can see the RTL-style coding. I am seeing this style since the very first Lola book. In modern FPGA programming the code is more often expressed behaviorally. RTL style is used in low level modules, and not even always there. The high level constructs are coded as behavioral. VHDL is better (in my opinion) for behavioral coding than Verilog. However, both languages are exactly equivalent. They only feel different way, which is important for a programmer (myself), but fundamentally there are no restrictions to write the same code either in Verilog or in VHDL.
For the laymen: Register Transfer Logic (RTL) is the style where you assign bits or vectors of bits directly by hand. Presumably this is how the flip flops and wires are connected in the FPGA. It is a low level style. Programming analogy: imagine you are coding a high level algorithm without using function calls, but rather assign many dozens of variables in one chunk of code. It gets very confusing very quickly. This is how RTL looks. (Look at VID.Lola or any other Lola module by Wirth.)
An even larger reservation against RTL coding is that modern FPGAs simply are not collections of flip flops and wires. They contain many configurable blocks ("hardened logic") which can hardly be described by RTL assign statements. The "behavioral" style of coding leaves the compiler freedom to map functions "as intended" to these hardened logic blocks, using the internal compiler heuristic. You basically tell the compiler "here is what I intend, go and figure it out". Most FPGA coding is done this way these days. The RTL-style is neither capable nor intended for doing that.
If a feature requires special features not supported by Lola, I wrap it in Verilog. The main cause of this currently is library identifiers (e.g. "_" characters), but in fact it's really wrapping the nonportable pieces.
Is there any special reason to not change Lola such that the main cause is just eliminated?
Thank you, Wojtek -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (5)
-
Jörg Straube -
Pablo Cayuela -
Paul Reed -
rochus.keller@bluewin.ch -
Skulski, Wojciech