Re: [quirks-uvm-devel] weekend questions
Status: Pre-Alpha
Brought to you by:
teodor
From: Sergei L. <sl...@is...> - 2002-04-08 10:26:18
|
Max wrote: > I promised you a lot of questions. Here it is. > > 1) Need more C function! > I prefer in Ada use C entities as atomic time or pointers. > I'm afraid to have not precision binding of complex C structures. > So could you add allocator/initializer/deallocator for > Selector, Cell, Cell_List. (see file my_func.c). OK. I will insert these functions (see my next letter). > > 2) Why dont asm_backend accept Name_Procedure? > It generate P1 instead of name I told. I will try resolve it. > > 3) When does mapping trigger. I thouth there were to situation to trigger > a) at act command > b) at if/loop command with au argument. > But now I see Fibonachi where no action with auSum. Please read this fragment of my answer to Bhavani carefully: ---------------------------------------------------------------------- The second moment is the use of act. I already wrote: >(When you invoke `act' the according map calls all defined AUs from >top to bottom. It is not on principle to which AU from this map you >point with act. Ideally we need only one map and an algorithm for >finding AUs which involved in operation ... > Well, I mean this fragment from your code: > exit @Loop when not lv[0]; > * auMul; > * auSum; > lv[5] <- lv[2]; > We don't need two acts. The *auMul will invoke all AUs declared in the same map to work. They will perform their action according to definition order: > declare map > -- Get access to two registers of >incrementer/decrementer > auInc is <int32/in int32/out stu>; > > -- Three ports of multiplier > auMul is <int32/in int32/in int32/out stu>; > au2Mul is <int32/out int32/in int32/in stu>; > auSum is <int32/in int32/in int32/out >stu>; > > map is > i.e.: auInc, then auMul, then au2Mul, then auSum. In this order each module will perform its action. So, the map is monolithic entity. You can't call separate modules from it. You can refer to all of its modules by pointing any of them, i.e: *auMul; or *auSum; All variants are equal. ---------------------------------------------------------------------------------------------- > > 4) Now my Ada test_uvm works! But only with Asm_Backend. > a) It does not support stdout as parameter of init_backend, does it? Why not support? : ---------------------------------------------------------------- void a_init_backend (void* ptr) { if (mellow_initialized) fatal_error (FERR_INTERNAL); out_file = (FILE *) ptr; <------ /* LOOK HERE. */ mellow_initialized = 1; StringDA_init (&proc_names, 10, 20); StringDA_zero_grow (&proc_names, 1); indent_level = 0; } ------------------------------------------------------------ What do you mean? > > b) When I tried Code Backend it crashed at function > UVM_EXPORT ErrorMark mark_error (void) on line > mark->next_mark = last_error->mark_rec_ptr; > because last_error is NULL. What had I forgot to call? > Ahh! Init_Errors! Ok! It's working now. I can't call init_errors from init_backend becouse one can use more then one backend in one's program. > > 5) Example of lexical context. > I dont see how to use fp for passing lexical context. > Can you help? > > procedure A is > X : Integer; > procedure B is > begin > X := 1; > end B; > begin > B; > end A; declare map dx1 is int32/out; map is (dx1, lv) end map; (but I should fix some errors in the VM to make it works. It will be ready in 1.1.d4). Now works another variant of the same: declare map dx1 is <int32/out stu>; map is (dx1[0], lv[0]) end map; > > > 6) When do you plan next release? The 15th of April is a deadline for 1.1d3 Now I am working on defining a set of problems will be solved in 1.1d4, so I don't know the date of 1.1d4. > > Will you wait for my code generator with current state of compiler? We will release the compiler as a different package. Its release dates can be not the same as for the VM releases. > > > 7) Example of discriminated descriptor usage. Try see on this version of Fibonacci (it really worked on 0.1.1p4 version (before CVS). Sorry, the syntax is archaic ... ----------------------------------------------------------------------------- :Main (fr1[0], fr1[1]) @: ; set <int32 <(int32 int32) int32 arr *1..*2> stu>, fr1 ; sub :Fib ; ret END :Main :Fib (fr1[1:1], fr1[1:2]) ; INPUT ; fr1 = <int32 <(int32 int32) int32 arr *1..*2> stu> ; fr1[0] - the counter; ; fr1[1] - the result vector. set static <(int32 int32) <int32/in arr *1..*2> <int32/in arr *1..*2> <int32/out arr *1..*2> stu>,auSum set static <int32/inout stu>,auDec set static <<(int32 int32) <int32 arr *1..*2> <int32 arr *1..*2> <int32 arr *1..*2> stu> int32 stu>,fr2 map static #1 < auSum[1],fr2[0:1] ; map the discriminants auSum[2],fr2[0:2] auSum[0:1],fr2[0:0:1] ; map the dynamic vectors auSum[0:2],fr2[0:0:2] auSum[0:3],fr2[0:0:3] auDec[0],fr2[1] > map static #2 < auDec[0],fr2[1] > @: mov fr1[0],fr2[1] ; init the counter ; act #2 ; jce @L2 @L1: act #1 jce @L2 mov fr2[0:0:1],fr2[0:0:0] mov fr2[0:0:2],fr2[0:0:1] jmp @L1 @L2: ; mov fr2[0:0:2],fr1[1] ret END :Fib ----------------------------------------------------------------------------- > > > 8) You promise me program for expression translation. > Done! Thanks. > > 9) You map lv, ct, fp to dx before procedure call. What for? > For restrict io mode ? It is for select which variables to pass as well as their io modes. > > Can I write "call :lv, Fact" if I need send all local variables as > procedure parameter? And don't send another parameters? I think it is an uncommon situation to be treated separately. > Can I map au to dx directly or I need an > intermediary local variable ? Mapping of au on dx is an ambiguity. I will not resolve this problem in 1.1d4. So, the answer is "no". > > 10) Dynamic memory (dn) example. How to allocate/deallocate memory. > Why dn is procedure scopped? Full schema is not ready now. I think for full support we need store descriptors of allocated values together with this values. It will be not present in the near future. I can give only this outline: Memory for dn can be allocated/deallocated only when enter/exit block. If you need have some dynamic structure accessible from underlaying procedures you need pass it with fp. We haven't null pointers, so if you would have allocate the memory later (not just after entering the block with this dn) you should use dynamic structure descriptor with variant record of two states: "empty" and the real state ("value"). But the variant record support is not realized now ... (and it will not be included in 1.1d4). dn selector is not for general-purpose dynamic memory. It is for variables which are expensive to store in stack. The general policy is using of container types and not direct using of pointers. But if there is such necessity that can be done very easely ever on a base of present release: - A general pointer is index in the structure <int8 arr *> (and more specific pointers are indexes in more specific structures). - Anybody can write au modules for access to such structure by adding necessary au modules. > > 11) Are there procedures to create environment file (efg)? No. > > 12) How to use mellow backend? Write me sequence of procedure calls. OK. I will work on it. -- Sergei P.S. My next letter will be with the time schedule of problems I promised solved. |