mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			12 lines
		
	
	
		
			263 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			263 B
		
	
	
	
		
			C
		
	
	
	
	
	
// inline.c
 | 
						|
// David_Harris@hmc.edu 12 January 2022
 | 
						|
// Illustrates inline assembly language
 | 
						|
 | 
						|
#include <stdio.h>
 | 
						|
 | 
						|
int main(void) {
 | 
						|
    long cycles;
 | 
						|
    asm volatile("csrr %0, 0xB00" : "=r"(cycles)); // read mcycle register
 | 
						|
    printf ("mcycle = %ld\n", cycles);
 | 
						|
}
 |