mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	cxxrtl: Fix value::shl
This commit is contained in:
		
							parent
							
								
									1c8e58a736
								
							
						
					
					
						commit
						ff53f3d2b6
					
				
					 5 changed files with 30 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								tests/cxxrtl/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/cxxrtl/.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
cxxrtl-test-*
 | 
			
		||||
							
								
								
									
										12
									
								
								tests/cxxrtl/run-test.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								tests/cxxrtl/run-test.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -ex
 | 
			
		||||
 | 
			
		||||
run_subtest () {
 | 
			
		||||
    local subtest=$1; shift
 | 
			
		||||
 | 
			
		||||
    ${CC:-gcc} -std=c++11 -o cxxrtl-test-${subtest} -I../../backends/cxxrtl/runtime test_${subtest}.cc -lstdc++
 | 
			
		||||
    ./cxxrtl-test-${subtest}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
run_subtest value
 | 
			
		||||
							
								
								
									
										15
									
								
								tests/cxxrtl/test_value.cc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/cxxrtl/test_value.cc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
#include <cassert>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
#include "cxxrtl/cxxrtl.h"
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    {
 | 
			
		||||
        // shl exceeding Bits should be masked
 | 
			
		||||
        cxxrtl::value<6> a(1u);
 | 
			
		||||
        cxxrtl::value<6> b(8u);
 | 
			
		||||
        cxxrtl::value<6> c = a.shl(b);
 | 
			
		||||
        assert(c.get<uint64_t>() == 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue