mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Update pmgen documentation
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									e8c5afcb84
								
							
						
					
					
						commit
						2b29aa5c86
					
				
					 1 changed files with 18 additions and 6 deletions
				
			
		|  | @ -29,19 +29,25 @@ up in any future matches: | |||
| 
 | ||||
|     pm.blacklist(some_cell); | ||||
| 
 | ||||
| The `.run(callback_function)` method searches for all matches and calls the | ||||
| callback function for each found match: | ||||
| The `.run_<pattern_name>(callback_function)` method searches for all matches | ||||
| for the pattern`<pattern_name>` and calls the callback function for each found | ||||
| match: | ||||
| 
 | ||||
|     pm.run([&](){ | ||||
|     pm.run_foobar([&](){ | ||||
|         log("found matching 'foo' cell: %s\n", log_id(pm.st.foo)); | ||||
|         log("          with 'bar' cell: %s\n", log_id(pm.st.bar)); | ||||
|     }); | ||||
| 
 | ||||
| The `.pmg` file declares matcher state variables that are accessible via the | ||||
| `.st.<state_name>` members. (The `.st` member is of type `foobar_pm::state_t`.) | ||||
| `.st_<pattern_name>.<state_name>` members. (The `.st_<pattern_name>` member is | ||||
| of type `foobar_pm::state_<pattern_name>_t`.) | ||||
| 
 | ||||
| Similarly the `.pmg` file declares user data variables that become members of | ||||
| `.ud`, a struct of type `foobar_pm::udata_t`. | ||||
| `.ud_<pattern_name>`, a struct of type `foobar_pm::udata_<pattern_name>_t`. | ||||
| 
 | ||||
| There are four versions of the `run_<pattern_name>()` method: Without callback, | ||||
| callback without arguments, callback with reference to `pm`, and callback with | ||||
| reference to `pm.st_<pattern_name>`. | ||||
| 
 | ||||
| 
 | ||||
| The .pmg File Format | ||||
|  | @ -52,6 +58,12 @@ lines consist of whitespace-separated tokens. | |||
| 
 | ||||
| Lines in `.pmg` files starting with `//` are comments. | ||||
| 
 | ||||
| Declaring a pattern | ||||
| ------------------- | ||||
| 
 | ||||
| A `.pmg` file contains one or more patterns. Each pattern starts with a line | ||||
| with the `pattern` keyword followed by the name of the pattern. | ||||
| 
 | ||||
| Declaring state variables | ||||
| ------------------------- | ||||
| 
 | ||||
|  | @ -66,7 +78,7 @@ State variables are automatically managed by the generated backtracking algorith | |||
| and saved and restored as needed. | ||||
| 
 | ||||
| They are automatically initialized to the default constructed value of their type | ||||
| when `.run(callback_function)` is called. | ||||
| when `.run_<pattern_name>(callback_function)` is called. | ||||
| 
 | ||||
| Declaring udata variables | ||||
| ------------------------- | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue